Skip to content

Instantly share code, notes, and snippets.

@dannvix
Last active August 29, 2015 14:01
Show Gist options
  • Save dannvix/085c9dd0f2626337ea07 to your computer and use it in GitHub Desktop.
Save dannvix/085c9dd0f2626337ea07 to your computer and use it in GitHub Desktop.
Bookmarklet which enables select, context menu, and so on.
(function() {
function Revive (evnt) {
onEvent = "on" + evnt;
if(window.addEventListener) {
window.addEventListener(onEvent, function (e) {
for (var node = e.originalTarget; node; node = node.parentNode) {
[node] = null;
}
}, true);
window[onEvent] = null;
document[onEvent] = null;
if (document.body) {
document.body[onEvent] = null;
}
}
};
var events = [
"contextmenu",
"click",
"mousedown",
"mouseup",
"selectstart"
];
for (e in events) {
Revive(e);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment