Last active
September 8, 2021 14:29
-
-
Save sharpicx/7faa9713740aaabdd6cb082b9e0b0b8b to your computer and use it in GitHub Desktop.
rightclick.js
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
var _NS = (navigator.appName == "Netscape") ? 1 : 0; | |
var EnableRightClick = 0; | |
if(_NS) | |
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP); | |
function mischandler() | |
{ | |
if(EnableRightClick==1) | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
function mousehandler(e) | |
{ | |
if(EnableRightClick==1) | |
{ | |
return true; | |
} | |
var myevent = (_NS) ? e : event; | |
var eventbutton = (_NS) ? myevent.which : myevent.button; | |
if((eventbutton==2)||(eventbutton==3)) return false; | |
} | |
function keyhandler(e) | |
{ | |
var myevent = (_NS) ? e : window.event; | |
if (myevent.keyCode==96) | |
EnableRightClick = 1; | |
return; | |
} | |
document.oncontextmenu = mischandler; | |
document.onkeypress = keyhandler; | |
document.onmousedown = mousehandler; | |
document.onmouseup = mousehandler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment