Jump to content

User:WillSWC/monobook.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.
// installation of the wikEd editing page extension

// install [[User:Cacycle/diff]] text diff code
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript');

// install [[User:Pilaf/Live_Preview]] page preview tool
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript');

// install [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/RegExTypoFix.js'
+ '&action=raw&ctype=text/javascript');

// install [[User:Cacycle/wikEd international]] translation here

// install [[User:Cacycle/wikEd]] editing page extension
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript');

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

//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510
function addSinceTab() {
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
       do_since_I_last_edited()
    }
    else if (wgCanonicalNamespace != "Special") {
       mw.util.addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true", 'since', '', "since");
    }
}
function do_since_I_last_edited() {
        var csub=document.getElementById("contentSub");
        var msg=document.createElement("p");
        msg.appendChild(document.createTextNode
                        ("Parsing history... please wait..."));
        msg.className="error";
        csub.insertBefore(msg, csub.firstChild)

        var username=document.getElementById("pt-userpage").textContent;
        var hists=document.getElementById("pagehistory").getElementsByTagName('li');
        for (n=0;n<hists.length;n++) {
            if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) {
                document.location=hists[n].childNodes[1].href; 
                return;
            }
        }

        msg.replaceChild(document.createTextNode
                         ("You have not edited this page! (recently)"),
                         msg.firstChild);
}

$(addSinceTab);

//

// Script from [[User:Haza-w/cactions.js]]
importScript('User:Haza-w/cactions.js'); //[[User:Haza-w/cactions.js]]



// STATUS CHANGER
$(function (){
var subpage = "/Status";
var scheme = "/StatusTemplate";
var subpagelink = wgServer + "/w/index.php?title=User:" + encodeURIComponent(wgUserName + subpage);
var logout = document.getElementById( 'pt-logout' );
//Add the links
mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "", logout);
mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "", logout);
mw.util.addPortletLink("p-personal", subpagelink + "&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "", logout);
if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
//Get new status
var statusRegExp = /&action=edit&newstatus=(.*)/;
var status = statusRegExp.exec(location.href)[1];
//Modify the form
document.getElementById('wpTextbox1').value = "{{User:"+wgUserName+scheme+"|"+status+"}}";
document.getElementById('wpSummary').value = "Status: "+status;
document.getElementById('wpMinoredit').checked = 'checked';
//Submit it!
document.getElementById('editform').submit();
});



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

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

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