This is an old revision of this page, as edited by SD0001(talk | contribs) at 19:10, 27 June 2019(begin script for hiding reverted edits from page histories). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 19:10, 27 June 2019 by SD0001(talk | contribs)(begin script for hiding reverted edits from page histories)
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.
// TODO: handle reverts of reverts$.when(mw.loader.using('mediawiki.util'),$.ready).then(function(){if(mw.config.get('wgAction')!=='history')return;$('#pagehistory li.mw-tag-mw-undo').each(function(){vareditcomment=$(this).find('.comment').text();// Plain mediawiki undo with untampered edit summaryif(editcomment.startsWith('Undid revision ')){varreverted_rev=parseInt(editcomment.slice('Undid revision '.length));if(isNaN(reverted_rev))returntrue;$(this).hide();$('[data-mw-revid='+reverted_rev+']').hide();// Twinkle reverts}elseif(editcomment.startsWith('Reverted ')){// rollbackif(/^Reverted (?:good faith|\d+) edits? by/.test(editcomment)){varreverted_user=/^Reverted (?:good faith|\d+) edits? by (.*?) \(talk\)/.exec(editcomment)[1];// IPv6 addresses are in lowercase in history page, but in uppercase in rollback edit summaryif(mw.util.isIPv6Address(reverted_user)){reverted_user=reverted_user.toLowerCase();}$(this).hide();varrev=$(this).next();while(rev.find('.mw-userlink bdi').text()===reverted_user){rev.hide();rev=rev.next();if(rev.length===0){break;// end of page history (in current view)}}// Restore this version edits}elseif(/^Reverted to revision \d+ by /.test(editcomment)){varlast_good_revision=/^Reverted to revision (\d+) by /.exec(editcomment)[1];$(this).hide();varrev=$(this).next();while(rev.attr('data-mw-revid')!==last_good_revision){rev.hide();rev=rev.next();if(rev.length===0){break;// end of page history (in current view)}}// not a twinkle rollback?}else{returntrue;}}});// Mediawiki rollback$('#pagehistory li.mw-tag-mw-rollback').each(function(){vareditcomment=$(this).find('.comment').text();// sanity checkif(!editcomment.startsWith('Reverted edits by '))returntrue;varreverted_user=editcomment.slice('Reverted edits by '.length,editcomment.indexOf(' (talk)'));// IPv6 addresses are in lowercase in history page, but in uppercase in rollback edit summaryif(mw.util.isIPv6Address(reverted_user)){reverted_user=reverted_user.toLowerCase();}$(this).hide();varrev=$(this).next();while(rev.find('.mw-userlink bdi').text()===reverted_user){rev.hide();rev=rev.next();if(rev.length===0){break;// end of page history (in current view)}}});});