Forked from johnelliott/gist:690905bb909347a56941
Last active
August 29, 2015 14:09
-
-
Save rektide/b4f6d6ce9b780ed59512 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 monkeybusiness-codeschool | |
// @namespace https://github.com/johnelliott/monkeybusiness | |
// @include http://*.codeschool.com/* | |
// ==/UserScript== | |
// this is not actually a UserScript. because `getEventListeners` only exists in the dev-consoles. | |
// so copy paste this content in rather than actually running it as a userscript | |
// the capability not actually in HTML. | |
// gee it sure would be great if the Document Object Model could tell you about itself but it's EventTargets cannot. | |
// seems a pretty basic part of what the DOM is supposed to be about- giving you an object model | |
// to tell you what you are dealing with, what you are looking at or hearing | |
var n = getEventListeners(document.body).keyup; | |
console.log("do we have an n?", n); | |
function guardedKeyupListener(e) { | |
if ((e.keyCode === 75 || e.keyCode === 74) && e.ctrlKey) { | |
console.log("return?"); | |
return; | |
} | |
console.log("listener call"); | |
n[0].listener.call(this, e); | |
} | |
// get rid of old event listener | |
document.body.removeEventListener("keyup", n[0].listener); | |
// put listener back and see if it the right key to pass through | |
document.body.addEventListener("keyup", guardedKeyupListener); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment