Created
August 15, 2017 20:25
-
-
Save advait/089334c95f1b92695edd7270327c1dea to your computer and use it in GitHub Desktop.
Userscript for brain.fm: Press spacebar to play or pause
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
// ==UserScript== | |
// @name Brain.fm (play/pause spacebar) | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Press spacebar to play/pause brain.fm | |
// @author advait | |
// @match https://www.brain.fm/app* | |
// @grant | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.body.onkeyup = function(e) { | |
// space=32, k=107 | |
if (e.keyCode == 32 || e.keyCode == 107) { | |
var ps = document.getElementById('player_circle'); | |
if (ps) { | |
ps.click(); | |
} | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment