Created
March 7, 2012 09:58
-
-
Save roc/1992322 to your computer and use it in GitHub Desktop.
Bookmarklet for http://thisismyjam.com player controls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:(function(){window.playerKeyControls=window.playerKeyControls||function(){var keys={left:37,up:38,right:39,down:40,enter:13,escape:27,space:32,L:76},elements={playerBar:$("#player-bar"),back:$("#backwards"),forward:$("#forwards"),playPause:$("#playPause"),like:$("#controlLike"),linker:$("#playerJamLink")}; $(document).on("keydown",function(e){var keyCode=e.keyCode||e.which;if(!elements.playerBar.is(":visible"))return;if(e.metaKey){console.log("got meta key");return true;}switch(keyCode){case keys.up:case keys.down:return true;case keys.left:elements.back.click();break;case keys.right:elements.forward.click();break;case keys.L:elements.like.click();break;case keys.enter:elements.linker.click();break;case keys.space:elements.playPause.click();break;}return false;});}();})();">Keyboard Controls</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Controls:
Right = Forward
Left = Back
L = Like
Space = Play/Pause
Enter = Go to Jam page
Uncompressed (totally improvable) code here: https://gist.github.com/1992319