Jump to content

User:TreasuryTag/vector.js

From Wikipedia, the free encyclopedia
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.
// [[User:Lupin/popups.js]] - please include this line 

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');



importScript('User:AzaToth/twinkle.js');

TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'blank',
        showSharedIPNotice              :       false,
        openTalkPage                    :       ['norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       true,
        summaryAd                       :       " ",
        deletionSummaryAd               :       " ",
        protectionSummaryAd             :       " ",
        watchSpeedyPages                :       [ ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ ],
        watchRevertedPages              :       [ ],
        markRevertedPagesAsMinor        :       ['agf' ],
        watchWarnings                   :       false,
        markAIVReportAsMinor            :       false,
        markSpeedyPagesAsMinor          :       false,
        markProdPagesAsMinor            :       false,
        confirmUsernameToAIV            :       true,
        toolboxButtons                  :       ['tw-prod', 'tw-rpp', 'tw-since', 'tw-sincemine'  ]
};


/* 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');




/* <pre><nowiki> */

//Please adjust the following variables according to when you want to end your break:
var year = 2009; //YYYY
var month = 05; //MM
var day = 11; //DD
var hour = 15; //HH
var minute = 00; //MM
var second = 00; //SS 

function EnforceWikiBreak() {
    var currentdate = new Date();
    var enforced_break_end = new Date(year,changemonth(),day,hour,minute,second);
    if (currentdate > enforced_break_end) {
      // alert ("Welcome back from your enforced wikibreak!");
    } else {
      alert ("No way!! You're on an Enforced Wikibreak until " + enforced_break_end.toLocaleString() + " (currently " + currentdate.toLocaleString() + "). Bye!");
      window.location.href = ("http://"+document.location.host+"/w/index.php?title=Special:Userlogout&returnto=Main_Page");
    }
}

function changemonth() {
//thing to subtract 1 from the month. you can't use month-1 because it removes the '0' from the front
if(month==01) return 00;
if(month==02) return 01;
if(month==03) return 02;
if(month==04) return 03;
if(month==05) return 04;
if(month==06) return 05;
if(month==07) return 06;
if(month==08) return 07;
if(month==09) return 08;
if(month==10) return 09;
if(month==11) return 10;
if(month==12) return 11;
return 00;
}

addOnloadHook(function() { EnforceWikiBreak(); });

/* </nowiki></pre> */


importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Misza13/statusChanger.js');



importScript('User:Ioeth/friendly.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlywelcome.js');
importScript('User:AzaToth/morebits.js');
importScript('User:Ioeth/friendlytag.js');

FriendlyConfig = {
        summaryAd                       :       " ",
        topWelcomes                     :       false,
        watchWelcomes                   :       false,
        markWelcomesAsMinor             :       false,
        insertHeadings                  :       true,
        welcomeHeading                  :       "== Welcome ==",
        insertUsername                  :       false,
        insertSignature                 :       true,
        quickWelcomeMode                :       "semiauto",
        quickWelcomeTemplate            :       "Welcome",
        groupByDefault                  :       true,
        watchTaggedPages                :       false,
        enableClock                     :       false,
        markTaggedPagesAsMinor          :       false,
        idsToRename : []
};



// [[User:Animum/reset.js]] by Animum
importScript('User:Animum/urlparameters.js');
importScript('User:Voice of All/Addtabs/monobook.js');
 
function resetSandbox() {
  if(UrlParameters["sandboxreset"] == 'reset' && wgPageName == "Wikipedia:Sandbox" && wgAction == "edit") {
    document.forms["editform"].wpTextbox1.value = "\{\{Please leave this line alone (sandbox heading)\}\}\n" + 
"<!-- Hello! Feel free to try your formatting and editing skills below this line\. As this page is for editing experiments, this page will automatically be cleaned every 12 hours. -->"; //Add the base text for the sandbox
    document.forms["editform"].wpSummary.value = "[[User:Animum/reset.js|JS EDIT]]: Reset the Sandbox"; //Make a descriptive edit summary
    document.forms["editform"].wpMinoredit.checked = true; //Make it a minor edit
    if(UrlParameters["indirect"] == '1' && wgPageName == "Wikipedia:Sandbox" && wgAction == "edit") { //If you've clicked on the toolbox link
      window.setTimeout(function() { document.forms["editform"].wpDiff.click(); }, 200); //Load the diff if you are resetting it per the toolbox link
      var save = confirm("Save? (click \"OK\" to save; \"cancel\" to abort)") // Do you want to make these changes?
      if(save == true) { 
        window.setTimeout(function() { document.forms["editform"].wpSave.click(); }, 500); //Submit it!
      } else { location.href = "http://en.wikipedia.org/wiki/Wikipedia:Sandbox"; } // Go back two pages if you don't want to save it
    } else {
    window.setTimeout(function() { document.forms["editform"].wpSave.click(); }, 200); //Submit it! 
    }
  }
}
 
addOnloadHook(function () {
    if(wgPageName == "Wikipedia:Sandbox") // If the page you are viewing is the sandbox
      { mw.util.addPortletLink('p-cactions', 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&sandboxreset=reset', 'reset', 'ca-reset', "Reset the Sandbox"); }
    if(wgPageName != "Wikipedia:Sandbox") // If the page you are viewing is NOT the sandbox 
      { addToolboxLink("http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&sandboxreset=reset&indirect=1", 'Reset the Sandbox', '', '', ''); }
});
 
addOnloadHook(resetSandbox);

importScript('User:Gracenotes/rollback.js');




// [[User:Ais523/hidetopcontrib.js]]
// By a suggestion by [[User:Discospinster]]
// 090325 MEH Fixed where it is not hiding all (top)s, starting with redirects
//            and continuing after any regex mismatch.
// 090615 MEH Cater for new <span class="mw-uctop">
//            Add userHideAllSubsequent user setting.
//            Fix issue reported by [[User talk:Markhurd/hidetopcontrib.js#Bug Lenore]].
 
// This script hides lines according to who has the top contribution for a page.
// If userHideAllSubsequent=true, all subsequent contributions are hidden too, more like watchlists.
 
//<pre><nowiki>
 
if (typeof userHideAllSubsequent=='undefined')
 userHideAllSubsequent=false;
 
function hidetopcontrib()
{
   var i,li,a;
   li=document.getElementById("bodyContent");
   li=li.getElementsByTagName("li");
   i=-1;
   a=new Array();
   while(++i<li.length)
   {
     var s,t,links;
     links=li[i].getElementsByTagName("a");
 
      if (typeof links=='undefined' || links.length<4)
           continue;
 
     t=links[3].innerHTML;
 
     if(li[i].getElementsByTagName("strong").length>0||li[i].innerHTML.match(/\<span +class\="mw\-uctop"\>/)!=undefined)
       s="none";
     else
       s="";
 
     if(a[t]!=undefined)
       s=userHideAllSubsequent?"none":a[t];
     else
       a[t]=s;
 
     if(s!="")
       // li[i].innerHTML=li[i].innerHTML + ":'" + 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))
     mw.util.addPortletLink('p-cactions', 'javascript:hidetopcontrib()', 'show/hide top', 'ca-hidetop',
                    "Show/hide pages for which you're the top contributor", '');
 });
 
//</nowiki></pre>
//[[Category:Wikipedia scripts]]