HOW TO: Adding keyboard support to the default web remote

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
xbmccbmx Offline
Junior Member
Posts: 1
Joined: Feb 2014
Reputation: 0
Post: #1
I wanted keyboard support (that is, using a keyboard to send basic navigation commands to xbmc) on the default web interface remote so I put this together quickly:

Code:
--- MediaLibrary.js    2014-02-24 05:34:07.711798612 -0700
+++ MediaLibrary.js.orig    2014-01-04 08:39:06.000000000 -0700
@@ -46,7 +46,6 @@ MediaLibrary.prototype = {
     $('#remoteControl').removeClass('selected');
     $('#pictureLibrary').removeClass('selected');
     this.hideOverlay();
-    $(document).off('keypress');
   },
   replaceAll: function(haystack, needle, thread) {
     return (haystack || '').split(needle || '').join(thread || '');
@@ -112,45 +111,12 @@ MediaLibrary.prototype = {
           .css('left',keys[akey]['left'])
           .bind('click',{key: keys[akey]['name']},jQuery.proxy(this.pressRemoteKey,this));
           libraryContainer.append(aremotekey);
-      }    
+      }
     } else {
       libraryContainer.show();
       libraryContainer.trigger('scroll');
     }
-    $(document).keypress( function(e){
-var keynum = (window.event) ? e.which : e.keyCode;
-switch(keynum)
-{
-    case 13: //enter
-    case 32: //space
-        $('#ok').click();
-    break;
-    case 39: //rarr
-        $('#right').click();
-    break;
-    case 37: //larr
-        $('#left').click();
-    break;
-    case 33: //pageup
-    case 8: //backspace
-        $('#back').click();
-    break;
-    case 36: //home
-        $('#home').click();
-    break;
-    case 38: //uarr
-        $('#up').click();
-    break;
-    case 40: //darr
-        $('#down').click();
-    break;
-    default:
-        return;
-}
-    if (e.preventDefault)
-           e.preventDefault();
-        else e.returnValue = false;
-});
+
     $('#spinner').hide();
   },
   pressRemoteKey: function(event) {

Works.
(This post was last modified: 2014-02-24 14:40 by xbmccbmx.)
find quote