-
-
Save jameswritescode/997295 to your computer and use it in GitHub Desktop.
How to be an asshole
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
//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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment