Difference between revisions of "MediaWiki:Middleclick.js"

From Tycoon Gaming
m
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
$(document).mousedown(function(e){
+
function start(){
if ( window.location !== window.parent.location ) {  
+
console.log("Middleclick prevention started");
if(e.which === 2 ){
+
$(document).mousedown(function(e){
return false; // Or e.preventDefault()
+
if ( window.location !== window.parent.location ) {  
 +
if(e.which === 2 ){
 +
console.log("Middleclick prevented");
 +
return false; // Or e.preventDefault()
 +
}
 
}
 
}
}
+
});
});
+
}
 +
start();

Latest revision as of 02:02, 21 February 2021

function start(){
console.log("Middleclick prevention started");
	$(document).mousedown(function(e){
		if ( window.location !== window.parent.location ) { 
			if(e.which === 2 ){
				console.log("Middleclick prevented");
				return false; // Or e.preventDefault()
			}
		}
	});
}
start();