User:Dreamafter/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
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.
importScript('User:AzaToth/twinkle.js');
 
addOnloadHook(function () {
    var x;
    if (!(x = document.getElementById('ca-edit') )) return;
    var url;
    if (!(url = x.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    var y = addPortletLink('p-cactions', url+"&section=0", '0', 'ca-edit-0',
                           'Edit the lead section of this page', '0', x.nextSibling);
 
    y.className = x.className;  // steal classes from the the edit tab...
    x.className = 'istalk';     // ...and make the edit tab have no right margin
 
    // exception: don't steal the "selected" class unless actually editing section 0:
    if (/(^| )selected( |$)/.test(y.className)) {
        if (!document.editform || !document.editform.wpSection
            || document.editform.wpSection.value != "0") {
            y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
            x.className += ' selected';
        }
    }
});
 
//
 
//Please leave the following line
//[[user:Where/easy db]], maintained by [[User:MER-C]]
//Start db script
 
addOnloadHook(function()
{
  //check if called from deletion request
  if (document.title.indexOf("Editing ") != -1)
  {
    if (document.URL.lastIndexOf("&fakeaction=huff") == -1)
      return;
    // does the page exist?
    if (wgCurRevisionId == false)
    {
      alert("The page has already been deleted.");
      return;
    }
    if (document.URL.lastIndexOf("&reason=off") != -1)
    {
      var type = prompt("Enter criteria for speedy deletion, e.g. A1, G3");
      if (type == null)
        return;
      var f = document.editform, t = f.wpTextbox1;
      t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;
      f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type.toUpperCase() + "]])";
      f.wpSave.click();
      return;
    }
    else if (document.URL.lastIndexOf("&reason=on") != -1)
    {
      var type = prompt("Enter reason for speedy deletion");
      if (type == null)
        return;
      var f = document.editform, t = f.wpTextbox1;
      t.value = "{{" + "db|" + type + "}}\n" + t.value;
      f.wpSummary.value = "JS: Requesting speedy deletion";
      f.wpSave.click();
      return;
    }
  }
  if (wgCanonicalNamespace == "Special")
    return;
 
  addPortletLink("p-cactions", "javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");
  addPortletLink("p-cactions", "javascript:easyDb(1)", "db (reason)", "ca-db1", "Request speedy deletion with reason", "");
});
 
function easyDb(n)
{
  var title = wgPageName.replace("&", "%26").replace("+", "%21");
  if (n == 0)
    location.assign("/w/index.php?&action=edit&fakeaction=huff&reason=off&title=" + title);
 
  if (n == 1)
    location.assign("/w/index.php?&action=edit&fakeaction=huff&reason=on&title=" + title);
}
 
 
//End db script
//
 
/**** welcome new user ****/
document.write('<script type="text/javascript"' +
  'src="http://en.wikipedia.org/w/index.php?title=User:Nmajdan/welcome_newuser.js' +
  '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
if (wgNamespaceNumber >= 0)
addOnloadHook(function(){
var pCactions = document.getElementById('p-cactions');
if (!pCactions) return;
var caMain = pCactions.getElementsByTagName('li')[0];
var caTalk = document.getElementById('ca-talk');
var caEdit = document.getElementById('ca-edit');
if (!caEdit) caEdit = document.getElementById('ca-viewsource');
var caHistory = document.getElementById('ca-history');
if (!caMain || !caTalk || !caEdit || !caHistory) return;
var el_move, el_create, id2;
if (wgNamespaceNumber % 2) { //talk space
   el_move = caTalk; el_create = caMain; id2 = '';
} else {
   el_move = caMain; el_create = caTalk; id2 = 'discussion';
}
caEdit.firstChild.innerHTML = 'edit';
caHistory.firstChild.innerHTML = 'hist';
el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
var href = el_create.firstChild.getAttribute('href', 2);
if (el_create.className.indexOf('new') < 0){
   addPortletLink('p-cactions', href + '?action=history', 'hist',
     'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
   addPortletLink('p-cactions', href + '?action=edit', 'edit',
     'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
} 
  caMain.style.marginRight = '0.3em'; 
  caTalk.style.marginRight = '0.3em'; 
  caTalk.style.marginLeft  = '1.6em'; 
})
//
 
// <nowiki>If you are editing a page, click the wikify button on your tab bar to add "{{Wikify|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked for wikification." as the edit summary, mark it as a minor edit, and submit.</nowiki>
 
function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|date=' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification.';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}
 
addOnloadHook(function() {
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     // wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?
     return;
  }
  if (document.editform) {
     addPortletLink("p-cactions", "javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
  }
});
 
// by [[User:Raylu|raylu]]
 
//<pre><nowiki>
importScript('User:Voice of All/addtabs/monobook.js');
 
function addcountedit() { 
  if( wgNamespaceNumber == '2' || wgNamespaceNumber == '3' || ( wgNamespaceNumber == '-1' && wgTitle == 'Contributions' ) ) { 
    var countuser = wgTitle.split( '/' )[0];
    if( wgNamespaceNumber == '-1' && wgTitle == 'Contributions' ) countuser = document.getElementById( 'contentSub' ).getElementsByTagName( 'a' )[0].getAttribute('title').split(':')[1]; 
    addToolboxLink("http://tools.wikimedia.de/~interiot/cgi-bin/Tool1/wannabe_kate?username=" + countuser.replace('/\ /', '+') + "&site=en.wikipedia.org", "Edit count", '', '', ''); } 
}
 
addOnloadHook(addcountedit);
 
importScript('User:Ioeth/friendlytag.js');
 
importScript('User:Ioeth/friendlyshared.js');
 
importScript('User:Ioeth/fixtabs.js');
 
importScript('User:Ioeth/friendlywelcome.js');
 
importScript('User:Dreamafter/fix.js');
 
importScript('User:Dreamafter/editcount.js');
 
importScript('User:Dreamafter/purge.js');
 
importScript('User:MarkS/extraeditbuttons.js');
 
importScript('User:Dreamafter/georgemoney.js');
 
importScript('User:Voice of All/History/monobook.js');
 
//<nowiki> History tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/History/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 
//</nowiki>[[Category:Wikipedians who use VoA script|{{PAGENAME}}]]
 
// BAG
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Approvals.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
 
// [[User:Henrik/live-edit-counter]]
importScript('User:Henrik/js/live-edit-counter.js');
 
/* Force preview */
/* by Marc Mongenet, 2006, fr.wikipedia. Modified to work for non-anons by Soxred93 */
/* [[User:Soxred93/forcepreview.js]] */
function forcePreview() {
  if (wgAction == "edit")
{
  document.getElementById("wpSave").disabled=true;
  document.getElementById("wpSave").value = "Save (preview first)";
  document.getElementById("wpSave").style.fontWeight = "normal";
  document.getElementById("wpPreview").style.fontWeight = "bold";
}
}
 
addOnloadHook(forcePreview);