Jump to content

User:MacGyverMagic/monobook.js

From Wikipedia, the free encyclopedia
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.
//-------------------BASIC SCRIPTS ---------------------------------
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-script***********

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;
}

// ***********addlimenu***********

function addlimenu(tabs, name, id)
{
    var na = document.createElement('a');
    na.href = '';
    var mn = document.createElement('ul');
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.className = 'tabmenu';
    li.appendChild(na);
    li.appendChild(mn);
    tabs.appendChild(li);
    return li;
}

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

// ***********addToolboxLink script***********
function addToolboxLink(url, name, id){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
//    addlilink(tb, url, name, id);
      addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
      addlilink(tb, '/wiki/Special:Log', 'Logs', '');   
}

//***********Replace function***********

function replace()
{
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

//-------------------BASIC SCRIPTS END HERE---------------------------------

importScript('User:Ais523/highlightmyname2.js'); //[[User:Ais523/highlightmyname2.js]]
importScript('User:Ais523/catwatch.js'); //[[User:Ais523/catwatch.js]]
importScript('User:Ais523/stubtagtab2.js'); // [[User:Ais523/stubtagtab2.js]]

importScript('User:Tra/sidebartranslate.js'); // Translates sidebar languages.
importScript('User:Spang/autowatch.js'); // Skips confirmation page for watchlist feature.
importScript('User:MacGyverMagic/watchlistsorter.js'); //sorts watchlist by namespace.

importScript('User:Lifebaka/closedrv.js '); // automates DRV closures

importScript('Wikipedia:WikiProject_User_scripts/Scripts/TimeTraveller.js');
importScript('User:Mr.Z-man/closeAFD.js');
importScript('User:Mr.Z-man/patrollinks.js');
importScript('User:Mr.Z-man/delLog.js')

importScript('User:MacGyverMagic/nssearch.js'); //namspace searching
//importScript('User:Scott.wheeler/relatedarticles.js'); //Adds Directed Edge Related Results
importScript('Wikipedia:WikiProject User scripts/Scripts/Search links'); //AFD search help

importScript('User:Henrik/js/automod.js'); //Script needed for status box
importScript('User:Henrik/js/afc-helper.js'); //automated AFC declines

importScript('User:TheDJ/Gadget-HotCat.js'); //automated categorization script

//Own copies of scripts.
//importScript('wikipath'); //comment

importScript('User:MacGyverMagic/block.js'); // own block tabs
importScript('User:MacGyverMagic/purge.js'); //adds purge tab to the top.
importScript('User:MacGyverMagic/autoafd.js'); //AutoAFD script.
importScript('User:MacGyverMagic/time.js'); //displays time (UTC) and date in top bar.
importScript('User:MacGyverMagic/extrabuttons.js'); //adds buttons to edit interface.
importScript('User:MacGyverMagic/section0.js'); //section 0 tab instead of link.
importScript('User:MacGyverMagic/tabnames.js'); //changes the names of tabs.

importScript('User:Twinzor/wikimark.js'); //Wikimarks script
importScript('User:Dr_pda/prosesize.js'); //[[User:Dr_pda/prosesize.js]]

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
dateFormat = "american";
hookLengthYellow = 195;
hookLengthRed = 200;
fixedSidebar = "onttdyk";
check5xNoms = "ifnom5x";
unlock = false;


 // [[User:Jsimlo/shortcuts.js]]
 mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Jsimlo/shortcuts.js' 
             + '&action=raw&ctype=text/javascript');
 
 function shortcutsInit ()
 {
 
  shortcutsAddLink ('Navigation shortcuts', 'Wikipedia:Tools/Navigation shortcuts');
  shortcutsAddLink ('Search box info', 'Wikipedia:Wikipedia_Signpost/2008-11-10/Search_engine');
  shortcutsAddLink ('Citation templates', 'Wikipedia:Citation templates');
  shortcutsAddLink ('Newbie log', 'http://en.wikipedia.org/w/index.php?title=Special:Contributions&contribs=newbie');
  shortcutsAddLink ('Proposal - IRE', 'WP:IRE');
  shortcutsAddLink ('WikiBits.js', 'http://en.wikipedia.org/skins-1.5/common/wikibits.js');
 
 }

// [[User:Dschwen/wikiminiatlas2.js]] - please include this line 
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Dschwen/wikiminiatlas2.js' 
     + '&action=raw&ctype=text/javascript');

//Script that highlights links to redirect pages green
// [[User:Dschwen/highlightredirects.js]] - please include this line 
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Dschwen/highlightredirects.js' 
             + '&action=raw&ctype=text/javascript');

//Quick Preview button
importScript('User:Alex_Smotrov/qpreview.js'); //[[User talk:Alex Smotrov/qpreview.js]]
qPreviewKey = '`'; // accesskey for QPreview button ('~' by default)
qPreviewName = 'QPreview'; // name on the button

//Lupin's Popup navigation script - [[Wikipedia:Tools/Navigation_popups]]
// [[User:Lupin/popups.js]] - please include this line 
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

popupAdminLinks=true;
popupStructure='fancy2';
popupFixRedirs=true;
popupFixDabs=true;

//End of popup navigational script.

//*****************************************************************************************
//***************************** Special Loading Section ***********************************
//*****************************************************************************************

window.onload = Main;

function Main()
{
 addToolboxLink();
}