Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if(mw.config.get('wgAction')=='history'){// Don't do anything unless we're on a History page.// Grab the Compare buttons, create an empty link after each, and grab the empty linksvarsubmitButton=$('.historysubmit:submit');submitButton.after("<a class='diffURL' style='border:#999 1px dashed; padding:2px 4px 2px 4px;'></a>");vardisplayDiffField=$('.diffURL');// Grab the initial revision selectionsvardisplayDiffNew=$('[name="diff"]:checked').slice(0,1).attr('value');vardisplayDiffOld=$('[name="oldid"]:checked').slice(0,1).attr('value');// Set the initial main diff link URL, text, & tooltip, add arrow between Compare button and linkdisplayDiffField.text("http://en.wikipedia.org/w/index.php?title="+mw.config.get('wgPageName')+"&diff="+displayDiffNew+"&oldid="+displayDiffOld);displayDiffField.attr("href","http://en.wikipedia.org/w/index.php?title="+mw.config.get('wgPageName')+"&diff="+displayDiffNew+"&oldid="+displayDiffOld);displayDiffField.attr('title','http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld);displayDiffField.before("<b> → </b>");// Grab initial revision size fieldsvardisplayDiffSizeNew=$('[name="diff"]:checked').slice(0,1).parent('li').find('.history-size');vardisplayDiffSizeOld=$('[name="oldid"]:checked').slice(0,1).parent('li').find('.history-size');// Add diff link before initial revision sizes. Using a link contained in a <span> allows us to refer back to the entire added text using its class.vardisplayDiffMobileNew=displayDiffSizeNew.before('<span class="historyDiffLink">(<a href="http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld+'">DIFF</a>) . . </span>');vardisplayDiffMobileOld=displayDiffSizeOld.before('<span class="historyDiffLink">(<a href="http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld+'">DIFF</a>) . . </span>');// Set tooltip for the size diff link$('.historyDiffLink').find('a').attr('title','http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld);// Set the Click event function for radio buttons$(":radio").click(function(){// Clear existing revision size links$('.historyDiffLink').remove();// Grab the revision selection, place in appropriate varif($(this).attr('name')=='oldid')displayDiffOld=$(this).attr('value');if($(this).attr('name')=='diff')displayDiffNew=$(this).attr('value');// Update the main diff link URL, text, & tooltipdisplayDiffField.attr("href","http://en.wikipedia.org/w/index.php?title="+mw.config.get('wgPageName')+"&diff="+displayDiffNew+"&oldid="+displayDiffOld);displayDiffField.text("http://en.wikipedia.org/w/index.php?title="+mw.config.get('wgPageName')+"&diff="+displayDiffNew+"&oldid="+displayDiffOld);displayDiffField.attr('title','http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld);// Grab new revision size fieldsdisplayDiffSizeNew=$('[name="diff"]:checked').slice(0,1).parent('li').find('.history-size');displayDiffSizeOld=$('[name="oldid"]:checked').slice(0,1).parent('li').find('.history-size');// Add diff link before revision sizesvardisplayDiffMobileNew=displayDiffSizeNew.before('<span class="historyDiffLink">(<a href="http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld+'">DIFF</a>) . . </span>');vardisplayDiffMobileOld=displayDiffSizeOld.before('<span class="historyDiffLink">(<a href="http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld+'">DIFF</a>) . . </span>');// Set tooltip for the size diff link$('.historyDiffLink').find('a').attr('title','http://en.wikipedia.org/w/index.php?title='+mw.config.get('wgPageName')+'&diff='+displayDiffNew+'&oldid='+displayDiffOld);});}