Jump to content
Wikimedia Meta-Wiki

User:Mike.lifeguard/addTools.js

From Meta, a Wikimedia project coordination wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
 //addtabs.js
 //getqueryvalue.js
 functionlastdiff(){
 mw.util.addPortletLink("p-cactions",mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+"&diff=cur&oldid=prev","last","ca-last","Show most recent diff");
 }
 functionuserlogs(){
 mw.util.addPortletLink("p-cactions",mw.config.get('wgServer')+mw.config.get('wgScript')+"?title=Special:Log/block&page=User:"+encodeURIComponent(mw.config.get('wgTitle')),"blocklog","ca-blocklog","block log");
 }
 functionaddtoolboxlinks(){
 mw.util.addPortletLink("p-tb",'/wiki/Special:NewPages','NewPages','pt-newpages','New pages',null,'pt-logs');
 mw.util.addPortletLink("p-tb",'/wiki/Special:Log/newusers','NewUsers','pt-newusers','New users',null,'pt-newpages');
 if(mw.config.get('wgIsArticle')&&mw.config.get('wgNamespaceNumber')!=6&&mw.config.get('wgNamespaceNumber')!=7)
 mw.util.addPortletLink("p-tb",'/wiki/Special:PrefixIndex/'+mw.config.get('wgPageName'),'PrefixIndex','pt-prefixindex','PrefixIndex',null,'pt-newusers');
 if(mw.config.get('wgIsArticle'))
 mw.util.addPortletLink("p-tb",mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:Log&page='+encodeURIComponent(mw.config.get('wgPageName')),"PageLogs","pt-logs","Logs for this page",null);
 }
 functioncontribstools(){
 vartarget=document.getElementsByName('target')[0];
 if(!target)return;
 varuser=encodeURIComponent(target.value);
 mw.util.addPortletLink("p-tb","http://toolserver.org/~luxo/contributions/contributions.php?user="+user+"&blocks=true&lang=","Luxo's",'t-luxos',"Luxo's global contribs",null);
 //mw.util.addPortletLink("p-tb", "http://tools.wmflabs.org/meta/crossblock/?target=" + user + "&hide_unblocked=on", "Crossblock", "t-crossblock", "Pathoschild's cross-wiki block tool", null, "t-luxos");
 if(!/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(user)){
 mw.util.addPortletLink("p-tb","http://toolserver.org/~vvv/sulutil.php?user="+user,"VVV's","t-vvv","VVV's SUL tool",null,"t-crossblock");
 mw.util.addPortletLink("p-tb","https://secure.wikimedia.org/wikipedia/meta/wiki/Special:CentralAuth/"+user,"CentralAuth","t-centralauth","Special:CentralAuth",null,"t-vvv");
 }
 if(/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(user)){
 mw.util.addPortletLink("p-tb","http://www.robtex.com/rbls/"+user+".html","RBL check","t-rblcheck","Multi-RBL check",null,"t-crossblock");
 mw.util.addPortletLink("p-tb","http://toolserver.org/~chm/whois.php?ip="+user,"WHOIS","t-whois","Toolserver WHOIS",null,"t-rblcheck");
 mw.util.addPortletLink("p-tb","http://toolserver.org/~krimpet/torcheck.php?ip="+user,"TOR?","t-tor","TOR check",null,"t-whois");
 mw.util.addPortletLink("p-tb","http://meta.wikimedia.org/wiki/Special:GlobalBlock/"+user,"GlobalBlock","t-globalblock","Special:GlobalBlock",null,"t-tor");
 }
 }
 functionpurge(){
 varhist;varurl;
 if(!(hist=document.getElementById('ca-history')))return;
 if(!(url=hist.getElementsByTagName('a')[0]))return;
 if(!(url=url.href))return;
 mw.util.addPortletLink('p-cactions',url.replace(/([?&]action=)history([&#]|$)/,'1ドルpurge2ドル'),'purge','ca-purge','Purge server cache for this page','0');
 }
 functionedittop(){
 // This will add an [edit] link at the top of all pages except preview pages and the main page
 if(mw.config.get('wgNamespaceNumber')<0)
 return;
 if(mw.config.get('wgAction')=="edit"){
 varsection=mw.util.getParamValue('section');
 if(section=="0")
 document.getElementById("wpSummary").value="/* Intro */ ";
 }
 else{
 //un-hide siteSub if it's hidden
 mw.util.addCSS('#siteSub {display:inline !important; font-weight:normal !important; font-size:1.2em !important;}');
 // create span and set innerHTML to link
 varsectionZero=document.createElement('span');
 sectionZero.setAttribute('class','editsection');
 vara=document.createElement("a");
 a.href=mw.config.get('wgScript')+'?title='+encodeURIComponent(mw.config.get('wgPageName'))+'&action=edit&section=0';
 a.title='Edit section: Intro';
 a.appendChild(document.createTextNode("edit"));
 sectionZero.appendChild(document.createTextNode("["));
 sectionZero.appendChild(a);
 sectionZero.appendChild(document.createTextNode("]"));
 // insert sectionZero into the DOM before the first level 1 heading
 varsiteSub=document.getElementById('siteSub')
 if(siteSub)siteSub.insertBefore(sectionZero,siteSub.firstChild);
 }
 }
 functionblockhist(){
 varul=document.getElementById('bodyContent').getElementsByTagName('ul')[0];
 if(!ul||!ul.getElementsByTagName('li')[0])
 return;//nothing to do
 varl=ul.getElementsByTagName('li');
 if(l[0].innerHTML.indexOf('">block</a>)')==-1)
 return;//non-admin; somehow get the user and create links as for the admin section below
 //use unblock links
 if(location.href.search(/&page=[^&]/)==-1){
 //		alert("add stuff");
 for(vari=0;i<l.length;i++){
 if(l[i].getElementsByTagName('a')[4]){
 varname=l[i].getElementsByTagName('a')[4].innerHTML;
 l[i].innerHTML='(<a href="/w/index.php?title=Special%3ALog&type=block&page=User:'+name+'">hist</a>) (<a href="/w/index.php?title=Special%3AIpblocklist&action=search&limit=&ip='+name+'">status</a>) '+l[i].innerHTML;
 }
 }
 }
 else{
 varname=l[0].getElementsByTagName('a')[4].innerHTML;
 l[0].innerHTML='(<a href="/w/index.php?title=Special%3AIpblocklist&action=search&limit=&ip='+name+'">status</a>) '+l[0].innerHTML;
 }
 }

 if(mw.config.get('wgCanonicalNamespace')!="Special")
 $(purge);
 if(mw.config.get('wgCanonicalSpecialPageName')=="Contributions")
 $(contribstools);
 if(mw.config.get('wgCanonicalSpecialPageName')=='IPBlockList'||mw.config.get('wgCanonicalSpecialPageName')=='Log'&&(location.href.search(/\/block|type=block/)!=-1))
 $(blockhist);
 if(mw.config.get('wgIsArticle')&&mw.config.get('wgCanonicalNamespace')!='Special')
 $(lastdiff);
 if(mw.config.get('wgIsArticle')&&(mw.config.get('wgNamespaceNumber')==2||mw.config.get('wgNamespaceNumber')==3)&&mw.config.get('wgPageName').indexOf("/")==-1)
 $(userlogs);
 $(addtoolboxlinks);
 if(mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge"||mw.config.get('wgAction')=="edit")
 $(edittop);

AltStyle によって変換されたページ (->オリジナル) /