User:Cuckooman4/statustabs.js

This is an old revision of this page, as edited by Cuckooman4 (talk | contribs) at 00:50, 9 January 2008 (Made script). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
//Made by cuckooman4.
//
//See /doc
//<pre><nowiki>

var statuspageurl = "Status"
var statustemplateurl = "StatusTemplate"
var statussyntax = "{{User:" + wgUserName + "/" + statustemplateurl + "|%STATUSPARAMS%}}"
var statustabs = ["on","off"]

addOnloadHook(
  function() {
    var i = 0
    while(i < statustabs.length) {
      addPortletLink('p-cactions', wgServer + wgScript + "?title=" + encodeURIComponent(wgPageName) + "&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
    }
  }
)

//</nowiki></pre>