User:Deyyaz/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* This function is used to include scripts from other Wikipedia pages in mine.  I got it from [[User:Quarl/monobook.js]]. */
 
function winc(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
    document.write('<scr' + 'ipt type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></scr' 
             + 'ipt>');
}
 
// Include scripts from the [[de:]]
 
function dinc(s) {
    s = s.replace(/^\[\[/, '').replace(/\]\]$/, '');
    document.write('<scr' + 'ipt type="text/javascript" src="' 
             + 'http://de.wikipedia.org/w/index.php?title=' + s
             + '&action=raw&ctype=text/javascript&dontcountme=s"></scr' 
             + 'ipt>');
}
winc('User:Lupin/popups.js');
winc('[[Wikipedia:WikiProject User scripts/Scripts/addLink]]');
winc('[[Wikipedia:WikiProject User scripts/Scripts/Add LI link]]');
winc('[[WikiProject User scripts/Scripts/Fix diff width]]');
winc('[[User:Ais523/editcount.js]]'); // Count a user's edits
// STATUS CHANGER
addOnloadHook(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();
});
 
//
 
winc('User:Lupin/recent2.js');
dinc('Benutzer:ASM/quickedit.js');