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.
functiongetLabel(itemnumbers){varlangCode=mw.config.get('wgUserLanguage');$.ajax({url:'//www.wikidata.org/w/api.php',data:{'format':'json','action':'wbgetentities','ids':itemnumbers.join('|'),'props':'labels','languages':langCode,'maxage':30,'smaxage':30},dataType:'jsonp',headers:{'Api-User-Agent':'WikidataWatchlistLabels ( https://en.wikipedia.org/wiki/User:Evad37/WikidataWatchlistLabels.js )'},cache:true}).done(function(data){if(data.success){for(varitemindata.entities){// Get labelvarlabel='[?]';if(data.entities[item].labels&&data.entities[item].labels[langCode]&&data.entities[item].labels[langCode].value){label=data.entities[item].labels[langCode].value;}// Add labels to items$("span."+item+" > a").empty().append($('<span>').addClass('labelFromWikidata').text(label+' '),$('<span>').addClass('wikidataItemParenthesis').css('font-size','85%').text('('),$('<span>').css('font-size','85%').text(item),$('<span>').addClass('wikidataItemParenthesis').css('font-size','85%').text(')'));}// Hide any labels that duplicate local page titles$("a.wb-entity-link > span.labelFromWikidata").each(function(){var$pageTitle=$(this).parent().parent().siblings('.mw-title');if($pageTitle.length&&$pageTitle.text()===$(this).text().trim()){$(this).hide();$(this).siblings(".wikidataItemParenthesis").hide();}});}});}$(function($){if(mw.config.get('wgNamespaceNumber')!=-1){// only operate in Special: namespacereturn;}// Hook on to changes in page content - initial load, 'New filters for edit review' changes, etcmw.hook('wikipage.content').add(function($content){varitems=[];// Find item and property links in comments$content.find(// Standard watchlist/rc"li.mw-changeslist-src-mw-wikibase > span.comment > a.external, "+// "Group changes by page" watchlist/rc, single edit"table.mw-changeslist-src-mw-wikibase td.mw-changeslist-line-inner span.comment > a.external, "+// "Group changes by page" watchlist/rc, multiple edits"table.mw-changeslist-line.mw-collapsible tr.mw-changeslist-src-mw-wikibase td.mw-enhanced-rc-nested span.comment > a.external").each(function(){if($(this).attr('href').indexOf('//www.wikidata.org/wiki/')!==-1){varpq=$(this).text();varpqnumber=pq.replace("Property:","");// Test for validityif(!/^(p|q)\d+$/i.test(pqnumber)){return;}$(this).wrap("<span class='"+pqnumber+"'></span>");if(items.indexOf(pqnumber)===-1){items.push(pqnumber);}}});// Find items following page titles$content.find(// Standard watchlist/rc"li.mw-changeslist-src-mw-wikibase > a.wb-entity-link, "+// "Group changes by page" watchlist/rc, single edit"table.mw-changeslist-src-mw-wikibase td.mw-changeslist-line-inner a.wb-entity-link, "+// "Group changes by page" watchlist/rc, multiple edits"table.mw-changeslist-line.mw-collapsible tr.mw-changeslist-src-mw-wikibase td.mw-enhanced-rc-nested > a.wb-entity-link").each(function(){varqnum=$(this).text();$(this).wrap("<span class='"+qnum+"'></span>");if(items.indexOf(qnum)===-1){items.push(qnum);}});// Get labels in batches of 50 (max for Wikidata api)for(vari=0;i<items.length;i+=50){getLabel(items.slice(i,i+49));}});});