Difference between revisions of "MediaWiki:Middleclick.js"
From Tycoon Gaming
m |
m |
||
Line 3: | Line 3: | ||
$(document).mousedown(function(e){ | $(document).mousedown(function(e){ | ||
if ( window.location !== window.parent.location ) { | if ( window.location !== window.parent.location ) { | ||
+ | console.log("window.location !== window.parent.location"); | ||
if(e.which === 2 ){ | if(e.which === 2 ){ | ||
console.log("Middleclick prevented"); | console.log("Middleclick prevented"); | ||
return false; // Or e.preventDefault() | return false; // Or e.preventDefault() | ||
} | } | ||
+ | } else { | ||
+ | console.log("window.location == window.parent.location"); | ||
} | } | ||
}); | }); | ||
} | } | ||
start(); | start(); |
Revision as of 01:58, 21 February 2021
function start(){ console.log("Middleclick prevention started"); $(document).mousedown(function(e){ if ( window.location !== window.parent.location ) { console.log("window.location !== window.parent.location"); if(e.which === 2 ){ console.log("Middleclick prevented"); return false; // Or e.preventDefault() } } else { console.log("window.location == window.parent.location"); } }); } start();