Skip to content

Instantly share code, notes, and snippets.

@roc
Created March 7, 2012 09:58
Show Gist options
  • Save roc/1992322 to your computer and use it in GitHub Desktop.
Save roc/1992322 to your computer and use it in GitHub Desktop.
Bookmarklet for http://thisismyjam.com player controls
<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>
@roc
Copy link
Author

roc commented Mar 7, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment