User:Cuckooman4/statustabs.js: Difference between revisions

Content deleted Content added
Cuckooman4 (talk | contribs)
Changing status: on
m Maintenance: Replacing addPortletLink() with mw.util.addPortletLink() (mw:ResourceLoader/Migration_guide_(users)#addPortletLink)
 
(5 intermediate revisions by 2 users not shown)
Line 1:
//Made by cuckooman4.
{{User:Cuckooman4/StatusTemplate|s=on}}
//
//See /doc
//<pre><nowiki>
 
if(!statuspageurl) var statuspageurl = "Status"
if(!statustemplateurl) var statustemplateurl = "StatusTemplate"
if(!statussyntax) var statussyntax = "{{User:" + wgUserName + "/" + statustemplateurl + "|%STATUSPARAMS%}}"
if(!statustabs) var statustabs = ["on","off"]
 
addOnloadHook(
function() {
var i = 0
while(i < statustabs.length) {
mw.util.addPortletLink('p-cactions', mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=User:" + wgUserName + "/" + statuspageurl + "&action=edit&autostatus=" + encodeURIComponent(statustabs[i]), statustabs[i], 'ca-status' + i)
i++
}
 
if(___location.href.indexOf("&autostatus=") != -1) {
var statusurlvar = ___location.href.split("&autostatus=")[1]
document.getElementById("wpTextbox1").innerText = statussyntax.split("%STATUSPARAMS%")[0] + statusurlvar + statussyntax.split("%STATUSPARAMS%")[1]
document.getElementById("wpSummary").value = "Changing status: " + statusurlvar
document.getElementById("wpMinoredit").checked = false
document.getElementById("editform").submit()
}
}
)
 
//</nowiki></pre>