User:WillSWC/monobook.js: Difference between revisions
Appearance
Content deleted Content added
m Maintenance: Fixing deprecated call to addPortletLink (mw:ResourceLoader/Migration_guide_(users)#addPortletLink) |
m Maintenance: Replacing document.write with mw.loader.load (mw:ResourceLoader/Migration_guide_(users)#Avoid_document.write() - phab:T130879) |
||
Line 2: | Line 2: | ||
// install [[User:Cacycle/diff]] text diff code |
// install [[User:Cacycle/diff]] text diff code |
||
⚫ | |||
document.write('<script type="text/javascript" src="' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
// install [[User:Pilaf/Live_Preview]] page preview tool |
// install [[User:Pilaf/Live_Preview]] page preview tool |
||
⚫ | |||
document.write('<script type="text/javascript" src="' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
// install [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer |
// install [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer |
||
⚫ | |||
document.write('<script type="text/javascript" src="' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
// install [[User:Cacycle/wikEd international]] translation here |
// install [[User:Cacycle/wikEd international]] translation here |
||
// install [[User:Cacycle/wikEd]] editing page extension |
// install [[User:Cacycle/wikEd]] editing page extension |
||
⚫ | |||
document.write('<script type="text/javascript" src="' |
|||
⚫ | |||
⚫ | |||
⚫ | |||
// [[User:Lupin/popups.js]] |
// [[User:Lupin/popups.js]] |
Latest revision as of 23:47, 20 May 2022
// installation of the wikEd editing page extension
// install [[User:Cacycle/diff]] text diff code
mw.loader.load('https://en.wikipedia.org/enwiki/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/enwiki/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/enwiki/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/enwiki/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript');
// [[User:Lupin/popups.js]]
//From http://en.wikipedia.org/enwiki/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", "/enwiki/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 + "/enwiki/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');