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.
/* This script adds new tabs to What Links Here pages. To use this script, put the following in your [[Special:Mypage/monobook.js]] (or <skin>.js) file: importScript('User:Barticus88/WhatLinksHere.js'); // [[User:Barticus88/WhatLinksHere.js]]This script has not been tested with Vector skins. Let me know if you have problems.Wow. Has it really been five years since I did major work on this?==Randall Bart's WhatLinksHere select script== by Randall Bart [[User:Barticus88]] version 1.2 GPL GFDL February 2007 fork of [[User:Barticus88/dpl.js]] version 1.1 GPL GFDL February 2007 version 1.0 GPL GFDL January 2007 May contain meaty chunks of [[User:Agentsoo/dpl.js]]. On What links here pages, this script adds these tabs: Mode: # All DPL T PTCI R W U 5000 All-Redirect Each selection mode filters the list of pages Hover over each letter to get a description When selection mode is activated, a yellow banner appears at the top and bottom of the page, with the mode description and counts, eg Select Mode: Redirect (11 shown/687 hidden)== module scoping ==*/(function($,mw){/* == Selection funcs == */functionsel_mode_DPL(linkHTML){return!(linkHTML.toLowerCase().indexOf('</a> (redirect page')==-1&&(linkHTML.indexOf('href="/wiki/Talk:')!=-1||linkHTML.indexOf('href="/wiki/Category_talk:')!=-1||linkHTML.indexOf('href="/wiki/Template_talk:')!=-1||linkHTML.indexOf('href="/wiki/Help_talk:')!=-1||linkHTML.indexOf('href="/wiki/Image:')!=-1||linkHTML.indexOf('href="/wiki/Image_talk:')!=-1||linkHTML.indexOf('href="/wiki/Portal:')!=-1||linkHTML.indexOf('href="/wiki/Portal_talk:')!=-1||linkHTML.indexOf('href="/wiki/Wikipedia:')!=-1||linkHTML.indexOf('href="/wiki/Wikipedia_talk:')!=-1||linkHTML.indexOf('href="/wiki/User:')!=-1||linkHTML.indexOf('href="/wiki/User_talk:')!=-1||linkHTML.indexOf('href="/wiki/MediaWiki:')!=-1||linkHTML.indexOf('href="/wiki/MediaWiki_talk:')!=-1||linkHTML.indexOf('href="/wiki/Book:')!=-1||linkHTML.indexOf('href="/wiki/Book_talk:')!=-1));}functionsel_mode_Template(linkHTML){returnlinkHTML.indexOf('href="/wiki/Template:')!=-1;}functionsel_mode_Portal(linkHTML){returnlinkHTML.indexOf('href="/wiki/Portal:')!=-1||linkHTML.indexOf('href="/wiki/Template:')!=-1||linkHTML.indexOf('href="/wiki/Category:')!=-1||linkHTML.indexOf('href="/wiki/Image:')!=-1;}functionsel_mode_User(linkHTML){returnlinkHTML.indexOf('href="/wiki/User:')!=-1||linkHTML.indexOf('href="/wiki/User_talk:')!=-1;}functionsel_mode_Wiki(linkHTML){returnlinkHTML.indexOf('href="/wiki/Wikipedia:')!=-1||linkHTML.indexOf('href="/wiki/Wikipedia_talk:')!=-1;}functionsel_mode_Redir(linkHTML){returnlinkHTML.toLowerCase().indexOf('</a> (redirect page')!=-1;}functionsel_mode_All(linkHTML){returntrue;}/*==Da Main func==*/functionselect_pages(select_this,mode_name){varbody=document.getElementById('bodyContent');if(!body){return;}varbanner=document.getElementById('dpl_banner');if(banner&&banner.innerHTML.indexOf(mode_name)!=-1){open(document.URL,"_self");//refresh the pagereturn;}varlists=body.getElementsByTagName("ul");for(j=0;j<lists.length;j++){lists[j].style.listStyleType='decimal';}varlinks=body.getElementsByTagName("li");vardpl_in=0;vardpl_ex=0;for(vari=0;i<links.length;i++){if(select_this(links[i].innerHTML)){links[i].style.display='';// clear prior styledpl_in++;}else{links[i].style.display='none';// hidedpl_ex++;}}window.wlhCt=window.wlhCt||0;window.wlhCt++;varbanner_text="Select Mode: "+mode_name+" ("+dpl_in.toFixed()+" shown/"+dpl_ex.toFixed()+" hidden)";if(banner){banner.innerHTML=banner_text;banner=document.getElementById('dpl_footer');banner.innerHTML=banner_text;}else{banner=document.createElement("div");banner.id="dpl_banner";banner.style.backgroundColor="yellow";banner.style.fontSize='larger';banner.innerHTML=banner_text;body.insertBefore(banner,body.childNodes[0]);body=document.getElementById('footer');if(!body){return;}banner=document.createElement("div");banner.id="dpl_footer";banner.style.backgroundColor="yellow";banner.style.fontSize='larger';banner.innerHTML=banner_text;body.insertBefore(banner,body.childNodes[0]);}}/* end function select_pages==Da tabbar fiddler==*/$.when(mw.loader.using(['mediawiki.util']),$.ready).done(function(){if(mw.config.get('wgPageName').slice(0,21).toLowerCase()!='special:whatlinkshere'){return;}// only add toolbox link on 'whatlinkshere' pagesvartarget=document.getElementById('p-cactions').getElementsByTagName("ul");if(target.length===0){return;}//no action bar to hook intovarwlhCmd=mw.util.getParamValue('wlhCmd');if(wlhCmd=='r')select_pages(sel_mode_Redir,"Redirect (auto)");target=target[0];newTool=document.createElement("li");target.appendChild(newTool);functionptool(btn,func,desc){return'<a href="" onclick="select_pages(sel_mode_'+func+',\''+desc+'\');return false;" title="'+desc+'">'+btn+'</a>';}newTool.innerHTML='Filter mode:'+ptool('All','All','Show all')+ptool('DPL','DPL','Main Space and Template')+ptool('T','Template','Template Only')+ptool('PTCI','Portal','Portal, Template, Category, Image')+ptool('R','Redir','Redirect')+ptool('W','Wiki','Wikipedia')+ptool('U','User','User and User Talk');document.getElementById('bodyContent').innerHTML.match(/href="([^"]*)&limit=500/);varurl500=RegExp.$1;mw.util.addPortletLink('p-cactions',url500+'&limit=5000','5000',null,'Show up to 5000 links');mw.util.addPortletLink('p-cactions',url500+'&limit=5000&wlhCmd=r','All Redirects',null,'Show ALL Redirects (up to 5000 links)');// i'm too lazy to rewrite the onclick to use eventhandlers -- [[User:TheDJ]window.select_pages=select_pages;});})(jQuery,mediaWiki);