Utilisateur:Zzyzx11/monobook.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.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;
}
addOnloadHook(function () { // add onload handler using code from wikibits.js
addLink('p-tb', 'http://www.google.com/translate_t',
'Google translate', 't-googletranslate', 'Google Translate', 'G', null);
});
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 = addLink('p-cactions', url+"§ion=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';
}
}
});