Skip to content

Instantly share code, notes, and snippets.

@advait
Created August 15, 2017 20:25
Show Gist options
  • Save advait/089334c95f1b92695edd7270327c1dea to your computer and use it in GitHub Desktop.
Save advait/089334c95f1b92695edd7270327c1dea to your computer and use it in GitHub Desktop.
Userscript for brain.fm: Press spacebar to play or pause
// ==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