public
Last active — forked from Kilian/annoying.js

How to be an asshole

  • Download Gist
asshole.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
//no context menu
document.oncontextmenu = function(){return false}
 
 
//no loading in iframes
if (parent.frames.length > 0) top.location.replace(document.location);
 
//no dragging
document.ondragstart = function(){return false}
 
//no text selection, in IE
document.onselectstart=function(){
if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") {
return false
} else {
return true;
}
};
 
//no text selection, in Firefox
document.onmousedown=function(e){
var obj=e.target;
if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") {
return true;
} else {
return false;
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.