Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// // LockRollback ver 0.1// https://commons.wikimedia.org/wiki/User:Whym/lockrollback.js//// Warning: this script is nowhere close to finished. Use it at your own risk.//// How to use://// Add below to [[Special:MyPage/common.js]].// importScript("User:Whym/lockrollback.js");//// This script disables rollback links.// They can be reactivated when you click a portlet link "unlock rollback" in the side bar.// (function($,mw,undefined){"use strict";varlrb=mw.libs.LockRollback={targets:$('.mw-rollback-link a'),init:function(lang){// exit if there is no rollback linksif(!lrb.targets.length)return;// set up messagesmw.messages.set({'lrb-portlettext-unlock':'Unlock rollbacks','lrb-portlettext-lock':'Lock rollbacks'});// set up CSS classesmw.util.addCSS('.lockrollback-locked, .lockrollback-locked:hover { text-decoration: line-through; }');mw.util.addCSS('.lockrollback-unlocked, .lockrollback-unlocked:hover { text-decoration: underline; }');// set the default state to lockedlrb.lock();// set up a portlet link to toggle locked/unlocked$(mw.util.addPortletLink('p-tb','#',mw.msg('lrb-portlettext-unlock'),'t-lockrollback-trigger')).on('click',function(e){e.preventDefault();if(lrb.locked()){lrb.unlock();}else{lrb.lock();}});},locked:function(){returnlrb.targets.hasClass('lockrollback-locked');},unlock:function(){$('#t-lockrollback-trigger a').html(mw.msg('lrb-portlettext-lock'));lrb.targets.removeClass('lockrollback-locked').addClass('lockrollback-unlocked');lrb.targets.off('click').on('click',function(e){e.preventDefault();document.location.replace($(e.target).attr('href'));});},lock:function(){$('#t-lockrollback-trigger a').html(mw.msg('lrb-portlettext-unlock'));lrb.targets.addClass('lockrollback-locked').removeClass('lockrollback-unlocked');lrb.targets.off('click').on('click',function(e){e.preventDefault();});},};// LockRollback// executed from here when loadedmw.loader.using(['mediawiki.util'],function(){lrb.init();});})(jQuery,mediaWiki);