User:Phoe/confirmwatchlistrollback.js

/*
 * Will pop-up a confirmation dialog when rollback link is clicked from Watchlist.
 * Hit the "cancel" button if you had clicked Rollback accidentally and the edit will not be reverted.

function confirmWatchlistRollback {	if(wgCanonicalSpecialPageName=='Watchlist') {		var rollbackNodes; if(!document.getElementsByClassName) {			rollbackNodes=getElementsByClassName(document.getElementById("bodyContent"),"span","mw-rollback-link"); }		else {			rollbackNodes=document.getElementsByClassName('mw-rollback-link'); }

function rollbackclicked(e) {			if(!e) {				var e=window.event; }			if(!confirm("Are you sure you want to rollback this edit?")) {		        	if(e.stopPropagation) {					e.stopPropagation; e.preventDefault; }				else {					e.cancelBubble=true; e.returnValue=false; }			}                 }

for (var i=0;i<rollbackNodes.length;i++) {	             rollbackNodes[i].childNodes[1].onclick=rollbackclicked; }   }

}

$(confirmWatchlistRollback);