Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*!
- * Font Awesome Free 5.9.0 by @fontawesome - https://fontawesome.com
- * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
- */
- (function () {
- /*
- https://www.computerhope.com/javascript/disable-right-click.htm
- */
- var isNS = (navigator.appName == "Netscape") ? 1 : 0;
- if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
- function mischandler(){
- return false;
- }
- function mousehandler(e){
- var myevent = (isNS) ? e : event;
- var eventbutton = (isNS) ? myevent.which : myevent.button;
- if((eventbutton==2)||(eventbutton==3)) return false;
- }
- document.oncontextmenu = mischandler;
- document.onmousedown = mousehandler;
- document.onmouseup = mousehandler;
- /*
- https://mycyberuniverse.com/developing/disabling-right-clicking-by-using-javascript.html
- */
- /**
- * Disable right-click of mouse, F12 key, and save key combinations on page
- * By Arthur Gareginyan (https://www.arthurgareginyan.com)
- * For full source code, visit https://mycyberuniverse.com
- */
- window.onload = function() {
- document.addEventListener("contextmenu", function(e){
- e.preventDefault();
- }, false);
- document.addEventListener("keydown", function(e) {
- //document.onkeydown = function(e) {
- // "I" key
- if (e.ctrlKey && e.shiftKey && e.keyCode == 73) {
- disabledEvent(e);
- }
- // "J" key
- if (e.ctrlKey && e.shiftKey && e.keyCode == 74) {
- disabledEvent(e);
- }
- // "S" key + macOS
- if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
- disabledEvent(e);
- }
- // "U" key
- if (e.ctrlKey && e.keyCode == 85) {
- disabledEvent(e);
- }
- // "F12" key
- if (event.keyCode == 123) {
- disabledEvent(e);
- }
- }, false);
- function disabledEvent(e){
- if (e.stopPropagation){
- e.stopPropagation();
- } else if (window.event){
- window.event.cancelBubble = true;
- }
- e.preventDefault();
- return false;
- }
- };
- /*
- https://www.howtogeek.com/251807/how-to-enable-pasting-text-on-sites-that-block-it/
- */
- var allowPaste = function(e){
- e.stopImmediatePropagation();
- return false;
- };
- document.addEventListener('paste', allowPaste, false);
- /*
- https://www.itzgeek.com/web/disable-right-click-html-script.html
- */
- //Disable right mouse click Script
- //By Geek Site.in
- function clickIE4(){
- if (event.button==2){
- return false;
- }
- }
- function clickNS4(e){
- if (document.layers||document.getElementById&&!document.all){
- if (e.which==2||e.which==3){
- return false;
- }
- }
- }
- if (document.layers){
- document.captureEvents(Event.MOUSEDOWN);
- document.onmousedown=clickNS4;
- }
- else if (document.all&&!document.getElementById){
- document.onmousedown=clickIE4;
- }
- document.oncontextmenu=new Function("return false")
- }());
- raw
- formatted
- ==================
- simpan file ini dalam dot js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement