User:BranStark/monobook.js

From wikishia

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
importScript('User:BranStark/popupBookmarks.js'); //credit goes to User:Roux
importScript('User:Henrik/js/automod.js');
importScript('User:BranStark/script.js');
importScript('User:Voice_of_All/Specialadmin/monobook.js');
importScript('User:Voice of All/Addtabs/monobook.js');
importScript('User:Cameltrader/Advisor.js');
importScript('User:Mr.Z-man/closeAFD.js');
importScript ('User:Ais523/editcount.js');
importScript('User:AzaToth/twinkle.js');



TwinkleConfig = {
revertMaxRevisions              :       50,
userTalkPageMode                :       'window',
showSharedIPNotice              :       false,
openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
openTalkPageOnAutoRevert        :       false,
openAOLAnonTalkPage             :       false,
summaryAd                       :       " ",
deletionSummaryAd               :       " ",
protectionSummaryAd             :       " ",
watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
watchProdPages                  :       true,
openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
watchRevertedPages              :       [],
markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ],
deleteTalkPageOnDelete          :       false,
watchWarnings                   :       false,
markAIVReportAsMinor            :       true,
markSpeedyPagesAsMinor          :       true,
offerReasonOnNormalRevert       :       true,
orphanBacklinksOnSpeedyDelete   :       {orphan:true, exclude:['g6']}
};

importScript("User:Lupin/recent2.js");

// [[User:Lupin/popups.js]]

//importScript('User:Lupin/popups.js');


/*
// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');
*/



importScript('User:Alex Smotrov/wlunwatch.js');



/* Watchlist notifier ([[User:Ais523/watchlistnotifier.js]]); displays a message every time a watched page changes. */
//<pre><nowiki>
 
var wmwpajax;
// From [[WP:US]] mainpage (wpajax renamed to wmwpajax)
wmwpajax={
download:function(bundle) {
// mandatory: bundle.url
// optional:  bundle.onSuccess (xmlhttprequest, bundle)
// optional:  bundle.onFailure (xmlhttprequest, bundle)
// optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure
 
var x = window.XMLHttpRequest ? new XMLHttpRequest()
: window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
: false;
 
if (x) {
x.onreadystatechange=function() {
x.readyState==4 && wmwpajax.downloadComplete(x,bundle);
};
x.open("GET",bundle.url,true);
x.send(null); 
}
return x;
},
 
downloadComplete:function(x,bundle) {
x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
|| ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url));
}
};
 
// Example:
// function dlComplete(xmlreq, data) {
//      alert(data.message + xmlreq.responseText);
// }
//  wmwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw', 
//                   onSuccess: dlComplete, message: "Here's what we got:\n\n" });
 
// End of [[WP:US]] quote
 
function wmWatchEditFound(xmlreq, data) {
var watchrev, watchsum, watchrevold, watchpage, junk;
watchrev=xmlreq.responseText.split('timestamp="')[1].split('"')[0];
if(wgPageName == "Special:Watchlist")
document.cookie="ais523wmwatchrev="+watchrev+".; path=/";
else
{
watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0];
watchpage=xmlreq.responseText.split('title="')[1].split('"')[0];
try
{
watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0];
}
catch(junk) {watchrevold=0;}
watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;');
watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;');
if(watchrev!=watchrevold)
document.getElementById('contentSub').innerHTML+=
"<div class='watchlistnotify'>\""+watchpage+'" changed: "'+watchsum+'".</div>';
}
}
 
addOnloadHook(function() {
/* Find the top item in the watchlist, and its edit summary. We only need one item, so
set the limit to 1 to ease the load on the server. */
//if(location.href.indexOf("/wiki/")!=-1)
wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+
'wldir=older&format=xml&wlprop=comment|timestamp|title', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// [[Category:Wikipedia scripts]]



importScript('User:TheJosh/Scripts/NewPagePatrol.js');



/**** welcome new user ****/
document.write('<script type="text/javascript"' +
'src="http://en.wikipedia.org/w/index.php?title=User:Nmajdan/welcome_newuser.js' +
'&action=raw&ctype=text/javascript&dontcountme=s"></script>');


// adds a 'logs for this page' link to the toolbox bar
// if the page is a user's page, talk page or subpage, the link will go to logs for the user instead
// if the page is a special page, then no link is displayed

addOnloadHook(function () {

// if this is a user, show the logs for the user rather than the page
if ( wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk" ) {
url = wgServer + "/w/index.php?title=Special:Log&user=" + wgTitle.split("/")[0];
} else if ( wgCanonicalNamespace == "Special" ) {
// don't display link for special pages
return;
} else {
url = wgServer + "/w/index.php?title=Special:Log&page=" + wgPageName;
}

addPortletLink("p-tb", url, "Logs", "pt-logs");

});

//

// Stub tag tab. Original version by [[User:ais523]], on a request by [[User:thesublime514]].
// Enhancements made on requests by [[User:Alai]] and [[User:jj137]].
// ([[User:ais523/stubtagtab2.js]])
// <source lang="javascript">
addOnloadHook(function(){
  if(wgNamespaceNumber==0&&wgAction=="view")
  {
    if(document.getElementById("ca-edit"))
      addPortletLink('p-cactions', 'javascript:stubtagtab()', 'stub', 'ca-stubtag',
                                   'Add a stub tag to this page', '');
  }
  if(location.href.indexOf("&autoaddstubtag=")!=-1&&document.getElementById('wpTextbox1')!=null)
  {
    var x=decodeURIComponent(location.href.split("&autoaddstubtag=")[1]);
    if(x.indexOf("-stub")==-1) x+="-stub";
    document.getElementById('wpTextbox1').value+="\n{"+"{"+x+"}}"; //add to the end of the article
    document.getElementById('wpSummary').value=
      "Tagging with {"+"{"+x+"}}";
    document.getElementById('wpPreview').click();
  }
});
 
function stubtagtab()
{
  var h;
  // A list of subpages of WikiProject Stub sorting/Stub types/ that are relevant to this
  var a=['Commerce','Culture','Education','Geography','Government, law, and politics','History',
         'Leisure','Military and weaponry','Miscellaneous','Organizations','People',
         'Religion, mythology, faiths, and beliefs','Science','Sports','Technology','Transport'];
  var i=0;
  h="<div style='color:#000000; background-color:#fff8f8;'>&bull; ";
  while(i<a.length)
  {
    h+="<a href='javascript:stubtagmenu(\""+a[i]+"\");'>"+a[i]+"</a> &bull; ";
    i++;
  }
  h+="</div><div id='stubtagmenudiv' style='color:#000000; background-color:#fffff8;'></div>";
  document.getElementById("contentSub").innerHTML=h;
}
 
function stubtagmenurender(a)
{
  if(a.responseText.indexOf("<text>")==-1)
  {
    document.getElementById('stubtagmenudiv').innerHTML=
      "<i>Loading, please wait...</i>";
    return;
  }
  var s=a.responseText.split("<text>")[1].split("</text>")[0];
  s=s.split("&lt;").join("<").split("&gt;").join(">");
  s=s.split("&quot;").join('"').split("&amp;").join('&');
  s=s.split('<a href="/wiki/Template:');
  var i=s.length;
  while(--i) s[i]=s[i].split('" title').join('\');" title');
  s=s.join('<a temphref="javascript:stubtagwith(\'');
  s=s.split('<a href=').join('<a style="color:#000000;" notanhref=');
  s=s.split('<a temphref=').join('<a href=');
  document.getElementById('stubtagmenudiv').innerHTML=s;
}
 
function stubtagmenu(x)
{
  //Fetch the relevant subpage of the WikiProject
  var a = sajax_init_object();
  a.open('GET', wgServer+wgScriptPath+'/api.php?action=parse&prop=text&text='+
    encodeURIComponent('__NOTOC____NOEDITSECTION__{{Wikipedia:WikiProject Stub sorting/Stub types/'+
                       x+'}}')+'&format=xml');
  a.onreadystatechange = function(){stubtagmenurender(a)};
  a.send('');
}
 
function stubtagwith(x)
{
  if(x==null||x=="") return;
  location.href=wgServer+wgScript+"?title="+encodeURIComponent(wgPageName)+                                  
                "&action=edit&autoaddstubtag="+encodeURIComponent(x);
}
 
// </source> <!--[[Category:Wikipedia scripts]]-->



importScript('User:Ioeth/friendly.js');

FriendlyConfig = {
summaryAd                       :       " ",
topWelcomes                     :       false,
watchWelcomes                   :       false,
markWelcomesAsMinor             :       true,
insertHeadings                  :       true,
welcomeHeading                  :       "== Welcome ==",
insertUsername                  :       true,
insertSignature                 :       true,
quickWelcomeMode                :       "auto",
quickWelcomeTemplate            :       "Welcome",
maskTemplateInSummary           :       true,
markSharedAsMinor               :       true,
groupByDefault                  :       true,
watchTaggedPages                :       false,
markTaggedPagesAsMinor          :       true
};

// [[User:Outriggr/metadatatest.js]]      
 importScript('User:Outriggr/metadatatest.js');
 assessmentMyTemplateCode = ["{"+"{WPBiography|class=|priority=|needs-infobox =|needs-photo =|listas=}}", "{"+"{WikiProject Kent|class=|importance=}}"];
 assessmentDefaultProject = "WPBiography";

importScript('User:AWeenieMan/furme.js');
importScript('User:TheDJ/qui.js');
importScript('User:AndyZ/peerreviewer.js');

// addPurge
addOnloadHook(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', '0');
});

//


//This script ([[User:ais523/highlightmyname2.js]]) highlights all instances of the
//logged-in user's username on pages by giving them a bright red background. It only
//checks bodyContent, not titles or sidebars, and doesn't change edit windows or
//Special:Preferences.
 
//<nowiki><pre>
function highlightmyname(n,p) //node, parent node
{
  while(n!=null)
  {
    if(n.nodeType==3) //text node
    {
      if(n.data.toLowerCase().indexOf(wgUserName.toLowerCase())!=-1)
      {
        var ix=n.data.toLowerCase().indexOf(wgUserName.toLowerCase());
        var t1=ix?document.createTextNode(n.data.substr(0,ix)):null;
        var t2=document.createTextNode(n.data.substr(ix,wgUserName.length));
        var t3=ix+wgUserName.length==n.data.length?null:
          document.createTextNode(n.data.substr(ix+wgUserName.length));
        var s1=document.createElement("SPAN");
        s1.style.backgroundColor="#FF0000";
        s1.appendChild(t2);
        var s2=document.createElement("SPAN");
        if(t1!=null) s2.appendChild(t1);
        s2.appendChild(s1);
        if(t3!=null) s2.appendChild(t3);
        p.replaceChild(s2,n);
        if(t3!=null) highlightmyname(t3,s2); //find remaining occurences in the new nodes
        n=s2.nextSibling;
      }
      else
        n=n.nextSibling;
    }
    else
    {
      if(n.firstChild!=null) highlightmyname(n.firstChild,n);
      n=n.nextSibling;
    }
  }
}
 
addOnloadHook(function() {
  if(location.href.indexOf("?ais523")==-1&&location.href.indexOf("&ais523")==-1&&
     location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&&
     location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&&
     location.href.indexOf("&action=raw")==-1&&wgPageName!="Special:Preferences")
    highlightmyname(document.getElementById('bodyContent').firstChild,
                    document.getElementById('bodyContent'));
});
//</pre></nowiki>
//[[Category:Wikipedia scripts]]


//Hide Huggle edits
function hidehugcontrib()
{
  var i,li,a;
  li=document.getElementById("bodyContent");
  li=li.getElementsByTagName("li");
  i=-1;
  a=new Array();
  while(++i<li.length)
  {
    var s,t;
    t=li[i].innerHTML.match(/"\/wiki\/([^"]*)"/)[1];
    if(li[i].innerHTML.match(/\(\<a href=\"\/wiki\/Wikipedia:HG\" class=\"mw\-redirect\" title=\"Wikipedia:HG\"\>HG\<\/a\>/))
      s="none";
    else
      s="";
    if(a[t]!=undefined) s=a[t]; else a[t]=s;
    if(s!="") li[i].style.display=(li[i].style.display=="none"?"list-item":"none");
  }
}
 
addOnloadHook(function () {
  if((location.href.indexOf("Special:Contributions")!=-1||
      location.href.indexOf("Special%3AContributions")!=-1)
     &&location.href.indexOf("&ais523")==-1&&location.href.indexOf("?ais523")==-1)
    addPortletLink('p-cactions', 'javascript:hidehugcontrib()', 'show/hide huggle edits', 'ca-hidehug',
                   "Show/hide pages made using Huggle", '');
});
//</nowiki></pre>
//[[Category:Wikipedia scripts]]