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.
// <nowiki>/*- Displays whether or not a mainspace page is marked as reviewed. This info is placed on the right of the page title using a small icon.- Without a script like this, you need to be a new page reviewer or admin and look at the Page Curation toolbar. Or you need to use Special:Log -> Page Curation Log. And there is also some complex logic. For example, the absence of a log entry means the page is marked as reviewed.*/// TODO: display whether the page is indexed or not. can do this by using JS to look for "noindex", or can do this by checking the first revision date.// TODO: display in all namespaces// TODO: do I need to use different code to check if marked as patrolled? I think that uses recentchanges table... maybe?classReviewStatus{asyncexecute(){if(!this.shouldRunOnThisPage()){return;}constpageID=mw.config.get('wgArticleId');constboolIsReviewed=awaitthis.isReviewed(pageID);lethtmlToInsert='';// modules/ext.pageTriage.views.toolbar/images/icons/if(boolIsReviewed){htmlToInsert=' <img src="https://en.wikipedia.org/w/extensions/PageTriage/modules/ext.pageTriage.toolbar/images/pageInfo/icon_reviewed.png" title="Reviewed" />';}else{htmlToInsert=' <img src="https://en.wikipedia.org/w/extensions/PageTriage/modules/ext.pageTriage.toolbar/images/pageInfo/icon_not_reviewed.png" title="Not reviewed" />';}if(this.pageHasSections()){$('#firstHeading .mw-editsection').before(htmlToInsert);}else{$('#firstHeading').append(htmlToInsert);}}/** * @param {number} pageID The page ID number. A positive number with no commas. */asyncisReviewed(pageID){constapi=newmw.Api();constresponse=awaitapi.get({action:'query',format:'json',formatversion:'2',prop:'isreviewed',pageids:pageID});returnresponse.query.pages[0].isreviewed;}shouldRunOnThisPage(){// don't run when not viewing articlesconstaction=mw.config.get('wgAction');if(action!=='view'){returnfalse;}// don't run when viewing diffsconstisDiff=mw.config.get('wgDiffNewId');if(isDiff){returnfalse;}constisDeletedPage=(!mw.config.get('wgCurRevisionId'));if(isDeletedPage){returnfalse;}// Only run in mainspaceconstnamespace=mw.config.get('wgNamespaceNumber');constisMainspaceOrDraftspace=([0].includes(namespace));if(!isMainspaceOrDraftspace){returnfalse;}returntrue;}pageHasSections(){return$('#firstHeading .mw-editsection').length;}}$(asyncfunction(){awaitmw.loader.using(['mediawiki.api'],asyncfunction(){await(newReviewStatus()).execute();});});// </nowiki>