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.

//<pre><nowiki>

 

document.write('<link rel="stylesheet" type="text/css" href="' +

               'http://en.wikipedia.org/?title=User:MarkS/XEB/live.css' +

               '&action=raw&ctype=text/css&dontcountme=s">');

 

//fills the variable mwCustomEditButtons (s. function in /wikibits.js), with buttons for the Toolbar  

function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText){

mwCustomEditButtons.push({

  "imageFile": imageFile,

  "speedTip": speedTip,

  "tagOpen": tagOpen,

  "tagClose": tagClose,

  "sampleText": sampleText});

}

 

var Isrc='http://upload.wikimedia.org/wikipedia/';

 

// English Wikipedia creates 11 extra buttons which are stored in mwCustomEditButtons

//  rather than mwEditButtons. However, there is no guarantee it will always be 11

//  so we count them here. 

var enExtraButtons=mwCustomEditButtons.length;

 

var BDict={

'A':'commons/f/f0/Bouton_Vandale0.png','Vandal Warning 01','{{subst:uw-vandal1|','}} ~~~~','Article'],

'B':'commons/1/1d/Bouton_Vandale1.png','Vandal Warning 02','{{subst:uw-vandal2|','}} ~~~~','Article'],

'C':'commons/c/cc/Bouton_Vandale2.png','Vandal Warning 03','{{subst:uw-vandal3|','}} ~~~~','Article'],

'D':'commons/e/e4/Bouton_Vandale3.png','Vandal Warning 04','{{subst:uw-vandal4|','}} ~~~~','Article'],

'E':'commons/7/7e/Bouton_Vandale4.png','Only Warning','{{subst:uw-vandalism4im|','}} ~~~~','Article'],

'F':'commons/b/bf/WP-icon.png','Welcome a New User to Wikipedia','{{subst:User:Hersfold/Welcome|','}}','Username'],

'G':'en/b/b9/CFD_Ready_button.png',' CFD Tag ','{{User:Hersfold/CFD ready|ready=','}}','no'],

'H':'en/7/78/Toolbar_Help_New.png',' NP Help ','{{subst:User:Hersfold/New page help}} ~~~~','',''],

};

 

var XEBOrder2=[];

if (typeof XEBOrder!='string') // can be modified

    XEBOrder2="A,B,C,D,E,F,G,H".split(",");

else if (XEBOrder.toLowerCase()=='all') 

    for (b in BDict) XEBOrder2.push(b);

else XEBOrder2=XEBOrder.toUpperCase().split(",");

 

 

 

addOnloadHook(initButtons);

if(!wgIsArticle)// only if edit

{ 

 

    if(XEBPopups)hookEvent("load", extendButtons);

}

 

function initButtons(){

 

    var bc,d;

    for (b in BDict) BDictb][0 = Isrc+BDictb][0]; // // Add the start of the URL (Isrc) to the XEB buttons

    // If the user has defined any buttons then add them into the available button lists 

 

    if (typeof myButtons=='object')

      for (b in myButtons) BDictb = myButtonsb];    // custom user buttons

    // Add the media wiki standard buttons into the available buttons 

 

    for (b in mwEditButtons) { // add standard buttons for full XEB order changing

 

    //    BDict[b]=[];

BDictb=mwEditButtonsb].imageFile,mwEditButtonsb].speedTip,mwEditButtonsb].tagOpen,mwEditButtonsb].tagClose,mwEditButtonsb].sampleText];

 

//        for (d in mwEditButtons[b]) BDict[b].push(mwEditButtons[b][d]);

    }

 

    // Build the new buttons 

 

    for (i=0;i<XEBOrder2.length;i++) {

        bc = BDictXEBOrder2i]];

 

        //Check if bc is an object 

        // - protects if user specified a non-existant buttons

        // - IE causes a javascript error when viewing a page

        if(typeof bc=='object')

        {

 

            //Call addCustomButton in wikibits

            addCustomButton(bc0],bc1],bc2],bc3],bc4]);

        }

    }

 

    // Remove the default buttons (if requested by the user)

    eraseButtons();

}

 

 

/** en: Removes arbitrary standard buttons from the toolbar

* @author: [[:de:User:Olliminatore]]

* @version: 0.1 (01.10.2006) **/

 

function eraseButtons(){

 

    //Remove the buttons the user doesn't want

 

    if(typeof rmEditButtons!='object') return;

 

    if (typeof rmEditButtons0 == 'string' && rmEditButtons0].toLowerCase() == 'all') 

    {

        mwEditButtons=[];

        for(i=0;i<enExtraButtons;i++){mwCustomEditButtons.shift();}

    }

    //Sort the user's requests so we remove the button with the highest index first

    //- This ensures we remove the buttons the user expects whatever order he requested the buttons in

    rmEditButtons.sort(sortit);

 

    //Remove individual buttons the user doesn't want 

 

    for(i=0;i<rmEditButtons.length;i++){

        var n=rmEditButtonsi];

        //Standard Wikimedia buttons

        if(n>=0 && n<mwEditButtons.length){

            if(n<mwEditButtons.length){

                var x = -1;

                while((++x)<mwEditButtons.length)

                    if(x>=n)

                        mwEditButtonsx = mwEditButtonsx+1];

            }

        mwEditButtons.pop();

        }

        //Extra buttons in English Wikipedia

        n=n-mwEditButtons.length;

        if(n>0 && n<mwCustomEditButtons.length){

        if(n<mwCustomEditButtons.length){

                var x = -1;

                while((++x)<mwCustomEditButtons.length)

                    if(x>=n)

                        mwCustomEditButtonsx = mwCustomEditButtonsx+1];

            }

        mwCustomEditButtons.pop();

        }

    }

};

 

//Function:

//    sortit

//Purpose:

//    Used to sort the rmEditButtons array into descending order

function sortit(a,b){

    return(b-a)

}

 

 

 

// Adds extended onclick-function to some buttons 

function extendButtons(){

 

    if(!(allEditButtons = document.getElementById('toolbar'))) return false;

    if(typeof editform != 'undefined')

        if(!(window.editform = document.forms'editform'])) return false;

 

    //  table

extendAButton(Isrc+"0/04/Button_array.png",XEBPopupTable)

extendAButton(Isrc+"7/79/Button_reflink.png",XEBPopupRef)

extendAButton(Isrc+"b/b8/Button_Globe.png",XEBPopupGeoLink)

extendAButton(Isrc+"4/49/Button_talk.png",XEBPopupTalk)

extendAButton(Isrc+"1/1c/Button_advanced_image.png",XEBPopupImage)

//extendAButton(Isrc+"6/6a/Button_sup_letter.png",XEBPopupFormattedText)

 

    // redirect

    c=XEBOrder2.getIndex('V');

    if(c != -1)

        allEditButtonsbu_len+c].onclick=function(){

        var a='#REDIRECT \[\['+prompt("Which page do you want to redirect to\?")+'\]\]';

        document.editform.elements'wpTextbox1'].value=a;

        document.editform.elements'wpSummary'].value=a;

        document.editform.elements'wpWatchthis'].checked=false

  };

};

 

//</nowiki></pre>