Last active
April 23, 2018 11:50
-
-
Save fsuuaas/b704169588e0743703f57fe457d78e1f 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
document.onkeypress = function(e) { | |
if (123 == (e = e || window.event).keyCode) return !1 | |
}, document.onmousedown = function(e) { | |
if (123 == (e = e || window.event).keyCode) return !1 | |
}, document.onkeydown = function(e) { | |
if (123 == (e = e || window.event).keyCode) return !1 | |
}; | |
var message = "Sorry, right-click has been disabled"; | |
function clickIE() { | |
if (document.all) return !1 | |
} | |
function clickNS(e) { | |
if ((document.layers || document.getElementById && !document.all) && (2 == e.which || 3 == e.which)) return !1 | |
} | |
function disableCtrlKeyCombination(e) { | |
var n, o, t = new Array("a", "n", "c", "x", "v", "j", "w", "s", "p", "u"); | |
if (window.event ? (n = window.event.keyCode, o = !!window.event.ctrlKey) : (n = e.which, o = !!e.ctrlKey), o) | |
for (i = 0; i < t.length; i++) | |
if (t[i].toLowerCase() == String.fromCharCode(n).toLowerCase()) return alert("Key combination CTRL + " + String.fromCharCode(n) + " has been disabled."), !1; | |
return !0 | |
} | |
document.layers ? (document.captureEvents(Event.MOUSEDOWN), document.onmousedown = clickNS) : (document.onmouseup = clickNS, document.oncontextmenu = clickIE), document.oncontextmenu = new Function("return false"); | |
function copyToClipboard() { | |
// Create a "hidden" input | |
var aux = document.createElement("input"); | |
// Assign it the value of the specified element | |
aux.setAttribute("value", "Please do not try to take screenshot."); | |
// Append it to the body | |
document.body.appendChild(aux); | |
// Highlight its content | |
aux.select(); | |
// Copy the highlighted text | |
document.execCommand("copy"); | |
// Remove it from the body | |
document.body.removeChild(aux); | |
alert("Why you need to take screenshot? Contact at [email protected]."); | |
} | |
$(window).keyup(function(e){ | |
if(e.keyCode == 44){ | |
copyToClipboard(); | |
} | |
}); | |
$(window).focus(function() { | |
$("body").show(); | |
}).blur(function() { | |
$("body").hide(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment