Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created December 9, 2012 22:30
Show Gist options
  • Save Velrok/4247293 to your computer and use it in GitHub Desktop.
Save Velrok/4247293 to your computer and use it in GitHub Desktop.
add this javascript to your browser as a link and click it to enable keyinput throu the web ui remote. Use wasd, enter and q to navigate
$(document).keypress(function(e) {
var element;
switch (e.keyCode) {
case 119: // W
element = $('#up');
break;
case 97: // A
element = $('#left');
break;
case 115: // S
element = $('#down');
break;
case 100: // D
element = $('#right');
break;
case 13: // enter
element = $('#ok');
break;
case 113: // Q
element = $('#back');
break;
case 49: // 1
element = $('#volumedown');
break;
case 50: // 2
element = $('#volumeup');
break;
default:
console.log("No function for key " + e.keyCode);
}
if(element) {
element.click();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment