User:Voyagerfan5761/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

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 of whether the code is safe, you can ask at the help desk.
/* AddLink Helper Function */

//A helper function to add a button to one of the toolbars in the interface.
//An improved(I hope) version of [[Wikipedia:WikiProject User scripts/Scripts/Add LI link|addlilink]].
//[[User:JesseW/sig|JesseW, the juggling janitor]] 05:33, 8 November *2005 (UTC)

function addLink(where, url, name, id, title, key, after){
    //* where is the id of the toolbar where the button should be added;
    //   i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
    //
    //* url is the URL which will be called when the button is clicked.
    //   javascript: urls can be used to do more complex things.
    //
    //* name is what will appear as the name of the button.
    //
    //* id is the id of the button; it's best to define one.  
    //   Use a prefix to make sure its unique. Optional.
    //
    //* title is the tooltip title that gives a longer description 
    //   of the button; if you define a accesskey, mention it here. Optional.
    //
    //* key is the char you want for the accesskey. Optional.
    //
    //* after is the id of the button you want to follow this one. Optional.
    //
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li,document.getElementById(after));
    } else {
        tabs.appendChild(li);
    }
    if(id) {
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];} 
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

/* Add LI Link Helper Function */

function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

/* AddTab Helper Function */

function addTab(url, name, id, title, key){
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    return addlilink(tabs, url, name, id, title, key)
};

/* Addtabs from VoiceOfAll */

importScript('User:Voice_of_All/Addtabs/monobook.js');

/* Twinkle from WP:TWINKLE ([[Wikipedia:WikiProject User scripts/Scripts/Twinkle]]) */

importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
importScript('User:AzaToth/twinklediff.js');

/* Twinkle configuration */

TwinkleConfig = {
markRevertedPagesAsMinor        :       [  ],
overrideMarkRevertedPagesAsMinor:       [  ],
markWarningsAsMinor             :       false,
markAIVReportAsMinor            :       false,
watchRevertedPages              :       [  ],
};

/* wikEd by Cacycle */

/* Configuration and extra options for wikEd */
wikEdLoadRegExTypoFix = true;

// install [[User:Cacycle/wikEd]] in-browser text editor
importScript("User:Cacycle/wikEd.js");

/* Lupin's Anti-Vandal Tool, Modified by Gzkn */

importScript("User:Gzkn/recent2.js");

/* Jnothman's afd helper */

importScript("User:Jnothman/afd_helper/script.js");

/* Formatter Script */

importScript("Wikipedia:WikiProject_User_scripts/Scripts/Formatter");

/* Interiot's RealTitle Script */

importScript("User:Interiot/js/RealTitle.js");

/* Misza13's Status Switcher Script */

addOnloadHook(function (){
  var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
  var subpage = "/Status";
  var scheme = "/StatusText";
  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=in", "In", "pt-status-in", "I'm in!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "");
  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 = "{{User:"+user+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status: "+status;
  //Submit it!
  document.getElementById('editform').submit();
});

/* Popup Navigation Script */

// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');

/* Begin Configuration for Popup Navigation Script */
popupStructure='menus';
popupShortcutKeys=true;
popupRedlinkRemoval=true;
popupFixDabs=true;
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';
popupRevertSummaryPrompt=true;
popupQueriedRevertSummary="Revert to revision $1 dated $2 by [[Special:Contributions/$3|$3]] using [[:en:Wikipedia:Tools/Navigation_popups|popups]]";
popupQueriedRevertToPreviousSummary="Revert to the revision prior to revision $1 dated $2 by [[Special:Contributions/$3|$3]] using [[:en:Wikipedia:Tools/Navigation_popups|popups]]";
popupRedlinkSummary="Removed unnecessary redlink (%s)";
popupFixDabsSummary="Disambiguating link to disambiguation page %s with a link to %s";
popupLazyDownloads=false;
popupLazyPreviews=false;
popupDragHandle="navpopup_maindiv0";
/* End configuration for Popup Navigation Script */

/* Lupin's Editcounter JS */

// Script from [[User:Lupin/editcount.js]]
importScript("User:Lupin/editcount.js");

/* Interiot's JavaScript Edit Counter */

importScript("User:Interiot/Tool2/code.js");

/* Add Purge Tab Script */

// addPurge
addOnloadHook( function (){
    var x = document.getElementById('ca-history');
    if(!x) return;
    if(x.children) x = x.children[0].href;
    else x = x.childNodes[0].href;
    addLink("p-cactions", x.replace(/=history/, "=purge"), 'Purge', 'ca-purge', 'Purge the internal cache for this page', 0);
});

/* Zocky's Picture Popups Script */

// [[User:Zocky/PicturePopups.js]]
importScript("User:Zocky/PicturePopups.js");

/* Zocky's Search Box Script */
/* Incompatible with wikEd, and not needed anyway, since the functionality
   is incorporated into wikEd

// [[User:Zocky/SearchBox.js]]
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

*/
/* Add Intro Edit Link Script */

// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades


// Add an [edit] link to pages
addOnloadHook(function () {
// if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a revision history, stop
  if(document.getElementById("histlegend?") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a diff page, stop
  if(document.getElementById("difference?") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is a watchlist, stop
  if(document.getElementById("watchdetails") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // if this is the main page, stop
  if(document.getElementById("mainpage") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_");

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:0px;margin-top:47px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit</a>]</div>';

  // insert divContainer into the DOM below the h1
  if(window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
});