Utilisateur:Hexasoft/monobook.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

/*
 * AddExtEdit
 *
 * Permet d'éditer en mode éditeur externe
 *
 * Dérivé de [[MediaWiki:JSScripts/EditZeroth]]
 *   Contributeur : Pabix, Zelda
 *   Dernière révision : 12 novembre 2006
 *
 * Modifié le 19 avril 2007 par [[User:Hexasoft|Hexasoft]]
 */
 
function addExtEdit() {
        ta['ca-extedit'] = ['', 'Edit using external editor'];
        if (!document.getElementById) {
                return;
        }
        x = document.getElementById('ca-edit');
        if(!x) {
                return;
        }
        y = document.createElement('LI');
        y.id = 'ca-edit-0';
        if (x.className == 'selected') {
                if (/&action=edit&externaledit=true$/.test(window.location.href)) {
                        x.className = 'istalk';
                        y.className = 'selected';
                } else {
                        x.className = 'selected istalk';
                }
        } else if (x.className == 'selected istalk') {
                if (/&action=edit&externaledit=true$/.test(window.location.href)) {
                        x.className = 'istalk';
                        y.className = 'selected istalk';
                } else {
                        y.className = 'istalk';
                }
        } else {
                y.className = x.className;
                x.className = 'istalk';
        }
        z = document.createElement('A');
        if (x.children) {
                z.href = x.children[0].href + '&externaledit=true';
                z.appendChild(document.createTextNode('extedit'));
                y.appendChild(z);
                x.parentNode.insertBefore(y,x.nextSibling);
        } else {
                z.href = x.childNodes[0].href + '&externaledit=true';
                z.appendChild(document.createTextNode('extedit'));
                y.appendChild(z);
                x.parentNode.insertBefore(y,x.nextSibling);
        }
}
if (document.title.indexOf("modification ") == -1) {
        addLoadEvent(addExtEdit);
}
//