123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <html>
- <head><title>VGS</title>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script></head>
- <body>
- <p>Just start typing! Try "VGS"</p>
- <div id="display"></div>
- <br />
- <div id="suggest"></div>
- <script type="text/javascript">
- var commands = ['VAA',
- 'VAB',
- 'VAC',
- 'VAD',
- 'VAF',
- 'VAR',
- 'VAW',
- 'VBC',
- 'VBE',
- 'VBR',
- 'VBS',
- 'VCA',
- 'VCC',
- 'VCD',
- 'VCW',
- 'VDB',
- 'VDC',
- 'VDE',
- 'VDF',
- 'VDM',
- 'VDR',
- 'VED',
- 'VFD',
- 'VFF',
- 'VFG',
- 'VFR',
- 'VFS',
- 'VFT',
- 'VGB',
- 'VGCA',
- 'VGCG',
- 'VGCN',
- 'VGCS',
- 'VGCY',
- 'VGH',
- 'VGN',
- 'VGO',
- 'VGQ',
- 'VGRA',
- 'VGRD',
- 'VGRT',
- 'VGRW',
- 'VGS',
- 'VGTA',
- 'VGTB',
- 'VGTG',
- 'VGTT',
- 'VGTW',
- 'VGW',
- 'VGY',
- 'VNC',
- 'VNE',
- 'VNS',
- 'VNW',
- 'VSAA',
- 'VSAB',
- 'VSAF',
- 'VSDB',
- 'VSDD',
- 'VSDF',
- 'VSRB',
- 'VSTC',
- 'VSTD',
- 'VSTO',
- 'VTA',
- 'VTB',
- 'VTD',
- 'VTF',
- 'VTM',
- 'VTN',
- 'VTW',
- 'VVA',
- 'VVB',
- 'VVC',
- 'VVD',
- 'VVH',
- 'VVM',
- 'VVN',
- 'VVS',
- 'VVT',
- 'VVW',
- 'VVY',
- ];
- $(document).ready(function(){
- document.addEventListener("keydown", keyDown, true);
- buildCommands();
- });
- var buildCommands = function() {
- commands.forEach(command => {
- var audioNode = document.createElement("audio");
- audioNode.id = command;
- let mp3Source = document.createElement("source");
- mp3Source.src = `${command}.mp3`;
- mp3Source.type = "audio/mpeg";
- audioNode.appendChild(mp3Source);
- let oggSource = document.createElement("source");
- oggSource.src = `${command}.ogg`;
- oggSource.type = "audio/ogg";
- audioNode.appendChild(mp3Source);
- document.body.appendChild(audioNode);
- });
- };
- var keyDown = function(event){
- var display = $("#display");
- var suggestion = $("#suggest");
- if (event.keyCode == 27) {
- display.text("");
- } else {
- display.append(String.fromCharCode(event.keyCode));
- var displayContents = display.text();
- if(isValid(displayContents)) {
- suggestion.html("<ul>" + suggestNextCommand(displayContents) + "</ul>");
- }
- if(inCommandsList(displayContents)) {
- $("#" + displayContents).get(0).play();
- display.text("");
- suggestion.html("");
- }
- if(!isValid(displayContents)) {
- display.text("");
- suggestion.html("");
- }
- }
- };
- var inCommandsList = function(input) {
- for(var i = 0; i < commands.length; i++) {
- if(input == commands[i]) {return true;}
- };
- return false;
- };
- var isValid = function(input) {
- if(input.charAt(0) == "V" && input.length < 5) {
- return true;
- }
- return false;
- };
- var suggestNextCommand = function(input) {
- var filteredCommands = [];
- var displayFilteredCommands = "";
- for(var i = 0; i < commands.length; i++) {
- if (commands[i].indexOf(input) == 0) {
- filteredCommands.push(commands[i]);
- displayFilteredCommands += "<li>"+ commands[i] +"</li>";
- }
- }
- return displayFilteredCommands;
- };
- console.log("Mornin' Jeramie! Try these!");
- console.log(commands);
- </script>
- <div id="footer">
- <p>Contact: <a href="mailto:eyeofmidas@gmail.com">eyeofmidas@gmail.com</a></p>
- <script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-50800317-1', 'eyeofmidas.com');
- ga('send', 'pageview');
- </script>
- </div>
- </body>
- </html>
|