User:Shardsofmetal/monobook.js/Status switcher.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Shardsofmetal/monobook.js/Status switcher. |
// <pre> This is a slightly modified version of [[User:Misza13]]'s Status switcher
// found at [[User:Misza13/Status switcher]]
$(function (){
var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
var subpage = "/Status";
var linkprefix = "http://en.wikipedia.org/w/index.php?title=User:";
var contribs = document.getElementById( 'pt-mycontris' );
//Add the links
addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=Online", "Online", "pt-status-in", "Online", "");
addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=Busy", "Busy", "pt-status-busy", "Busy", "");
addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=Offline", "Offline", "pt-status-out", "Offline", "");
if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
//Get new status
statusRegExp = /&action=edit&newstatus=(.*)/;
status = statusRegExp.exec(location.href)[1];
//Modify the form
document.getElementById('wpTextbox1').value = status;
document.getElementById('wpSummary').value = "Status: "+status;
document.getElementById('wpMinoredit').checked = 'checked';
//Submit it!
document.getElementById('editform').submit();
});
// </pre>