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.
//Forked, with thanks, from [[User:Writ Keeper/Scripts/commonHistory.js]]//so that I can do some fussy formatting//changes: 14/08/16 - hardcode labels, remove bold font, remove leading/trailing spaces//updated: 13/12/17 - updated source re-merged with local changes //updated: 19/01/18 - updated source re-merged with local changes //updated: 27/02/18 - updated source re-merged with local changes if(typeofinspectText=="undefined"){inspectText="+";}if(typeofshowText=="undefined"){showText="+";}if(typeofhideText=="undefined"){hideText="–";//en-dash for consistent width with '+'}if(mw.config.get("wgCanonicalSpecialPageName")=="Watchlist"||mw.config.get("wgCanonicalSpecialPageName")=="Recentchanges"||mw.config.get("wgCanonicalSpecialPageName")=="Contributions"||mw.config.get("wgAction")=="history"){functioninspectionEachHelper(index,element){varfindString;if(mw.config.get("wgAction")=="history"||$(element).hasClass("mw-enhanced-rc-nested")){findString='a:contains("prev")';}else{findString='a:contains("diff")';}varregex;if(mw.config.get("wgCanonicalSpecialPageName")=="Contributions"){regex=/&oldid=(\d+)$/;}else{regex=/&diff=(\d+)&oldid=/;}vardiffLink=$(element).find(findString);if(diffLink.length>0){varregexResult=regex.exec(diffLink[0].href);if(regexResult!=null&®exResult.length>=2){vardiffID=regexResult[1];//don't re-add if it already existsif($("#"+diffID).length>0){return;}varinlineDiffButton;if(typeofinlineDiffBigUI==="undefined"){inlineDiffButton=document.createElement("a");inlineDiffButton.href="#";inlineDiffButton.innerHTML='<span style="color:black;">[</span><span style="color:#339900;">'+inspectText+'</span><span style="color:black;">]</span>';}else{inlineDiffButton=document.createElement("input");inlineDiffButton.type="button";inlineDiffButton.value="Inspect edit";}inlineDiffButton.id=diffID;$(inlineDiffButton).addClass("inspectDiffButton");$(inlineDiffButton).click(function(){returninspectWatchlistDiff(this);});if($(element).find("tr:first").length==0){$(inlineDiffButton).insertAfter($(element).find(".mw-changeslist-separator:first"));}else{$(inlineDiffButton).insertBefore($(element).find(".mw-title"));$(inlineDiffButton).addClass("mw-enhanced-rc-diff");/* $(element).find("tr:first").append("<td></td>"); $(element).find("tr:first>td:last").append(inlineDiffButton); */}}}}functionaddWatchlistInspectionBoxes(){mw.loader.using("mediawiki.diff.styles").done(function(){varentries=$("#mw-content-text table.mw-enhanced-rc");if(entries.length==0){$("#mw-content-text ul").each(function(ind,el){$(el).children("li").each(inspectionEachHelper);});}else{entries.each(inspectionEachHelper);$("td.mw-enhanced-rc-nested").each(inspectionEachHelper);}});}functioninspectWatchlistDiff(button){mw.loader.using(['mediawiki.api']).done(function(){varmwApi=newmw.Api();mwApi.get({action:"query",prop:"revisions",format:"json",rvprop:"timestamp",rvdiffto:"prev",revids:button.id}).done(function(response){if(response==null){alert("Request failed!");returnfalse;}vardiffString=response.query.pages[Object.keys(response.query.pages)[0]].revisions[0].diff["*"];if(diffString==null){alert("Request failed!");returnfalse;}varnewTable=document.createElement("table");newTable.className="diff";$(newTable).html('<colgroup><col class="diff-marker"><col class="diff-content"><col class="diff-marker"><col class="diff-content"></colgroup>');$(newTable).append(diffString);diffParent=null;if($("#"+button.id).hasClass("mw-enhanced-rc-diff")){$("#"+button.id).parents("table").after(newTable);}else{diffParent=$("#"+button.id).parent();diffParent.append(newTable);}newTable.id=button.id+"display";$(button).unbind("click");if(typeofinlineDiffBigUI==="undefined"){$(button).html('<span style="color:black;">[</span><span style="color:#339900;">'+hideText+'</span><span style="color:black;">]</span>');$(button).click(function(){returnhideSmallEditInspection(this);});}else{$(button).attr("value","Hide edit");$(button).click(function(){returnhideEditInspection(this);});}if(typeofmarkAsViewed!="undefined"&&markAsViewed){mwApi.postWithToken('csrf',{action:"setnotificationtimestamp",revids:button.id}).done(function(data){if(diffParent!=null){diffParent.removeClass("mw-changeslist-line-watched");diffParent.addClass("mw-changeslist-line-not-watched");}});}});});returnfalse;}functionshowEditInspection(button){$("#"+button.id+"display").css("display","");$(button).attr("value","Hide edit");$(button).unbind("click");$(button).click(function(){returnhideEditInspection(this);});returnfalse;}functionhideEditInspection(button){$("#"+button.id+"display").css("display","none");$(button).attr("value","Show edit");$(button).unbind("click");$(button).click(function(){returnshowEditInspection(this);});returnfalse;}functionshowSmallEditInspection(button){$("#"+button.id+"display").css("display","");$(button).html('<span style="color:black;">[</span><span style="color:#339900;">'+hideText+'</span><span style="color:black;">]</span>');$(button).unbind("click");$(button).click(function(){returnhideSmallEditInspection(this);});returnfalse;}functionhideSmallEditInspection(button){$("#"+button.id+"display").css("display","none");$(button).html('<span style="color:black;">[</span><span style="color:#339900;">'+showText+'</span><span style="color:black;">]</span>');$(button).unbind("click");$(button).click(function(){returnshowSmallEditInspection(this);});returnfalse;}mw.hook('wikipage.content').add(addWatchlistInspectionBoxes);}