Utilisateur:Chmilblick/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.// <pre> <nowiki> auteur : Utilisateur:Dake
function DeluxeBar() {
if (document.createTextNode) {
var toolbar = document.getElementById("toolbar");
if (!toolbar) return;
var messages = new Array()
// le texte a été splitté sinon Mediawiki casse tout...
messages[0] = "{{subst:" + "Bienvenue sur ta page" + "}}" + "~~" + "~~";
messages[1] = "{{subst:" + "Bienvenue" + "}}" + "--" + "~~" + "~~";
messages[2] = "{{subst:" + "Bienvenue vandale" + "}}" + "--" + "~~" + "~~";
messages[3] = "{{subst:" + "Bienvenue débutant" + "}}" + "~~" + "~~";
messages[4] = "{{subst:" + "test1" + "}}" + "~~" + "~~";
messages[5] = "{{subst:" + "test2" + "}}" + "~~" + "~~";
messages[6] = "{{subst:" + "test3" + "}}" + "~~" + "~~";
messages[7] = "{{subst:" + "Bienvenue spammeur" + "}}" + "~~" + "~~";
var images = new Array()
images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png";
images[1] = "http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png";
images[2] = "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png";
images[3] = "http://fr.wikipedia.org/wiki/Image:Button_bombe.png";
images[4] = "http://upload.wikimedia.org/wikipedia/commons/1/1d/Bouton_Vandale1.png";
images[5] = "http://upload.wikimedia.org/wikipedia/commons/c/cc/Bouton_Vandale2.png";
images[6] = "http://upload.wikimedia.org/wikipedia/commons/e/e4/Bouton_Vandale3.png";
images[7] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png";
var commentaires = new Array()
commentaires[0] = "Bienvenue sur ta page !"
commentaires[1] = "Bienvenue !"
commentaires[2] = "Avertissement vandalisme 0"
commentaires[3] = "Bienvenue débutant";
commentaires[4] = "Avertissement vandalisme 1" ;
commentaires[5] = "Avertissement vandalisme 2"
commentaires[6] = "Avertissement vandalisme 3"
commentaires[7] = "Avertissement spam"
////////////////////////////////
for (var i=0;i<messages.length;i++) {
var img = document.createElement("img");
img.setAttribute("src", images[i]);
var ref = document.createElement("a");
ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" +
"javascript:changeSummary(\"" + commentaires[i] + "\");" );
ref.appendChild(img);
toolbar.appendChild(ref);
}
}
}
function changeSummary(sampleText) {
document.editform.wpSummary.value = sampleText;
}
$(DeluxeBar);
$(DeluxeBar);
function addToSummary(str)
{
document.editform.wpSummary.value += " " + str
}
function DeluxeSummary()
{
var sumLbl = document.getElementById("wpSummaryLabel")
if (sumLbl)
{
//élargissement boite de résumé
var sumInput = document.getElementById("wpSummary")
sumInput.style.width = "90%"
var titles = new Array()
titles.push("ébauche")
titles.push("+ cat ")
titles.push("+ wiki ")
titles.push("+ interwiki")
titles.push("+ portail ")
titles.push("vandalisme ")
titles.push("spam")
titles.push("Cor leins int")
titles.push("Blanchit")
titles.push("MeP")
titles.push("ortho/gram")
titles.push("retouches")
titles.push("ajInfo")
titles.push("recat")
var inputs = new Array()
inputs.push("+ {{ébauche}}")
inputs.push("+ catégorie")
inputs.push("+ wikification")
inputs.push("+ liens interwiki")
inputs.push("+ bandeau portail")
inputs.push("Revert:vandalisme")
inputs.push("Revert:Lien externe non pertinent")
inputs.push("correction lien interne")
inputs.push("Blanchit:bac à sable")
inputs.push("mise en page")
inputs.push("correction orthographe/grammaire")
inputs.push("diverses retouches")
inputs.push("ajout d’infos")
inputs.push("changement catégorie")
inputs.push("bac à sable")
var str = ""
for (var cpt = 0; cpt < titles.length; cpt ++)
{
str += "<a href=\"javascript:addToSummary('" + inputs[cpt] + "')\""
+ " class=\"sumLink\" title=\"Ajouter '" + inputs[cpt] +"' dans la boîte de résumé\">"
+ titles[cpt]
+ " ·</a> "
}
sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML
}
}
$(DeluxeSummary);
// Onglet Purge
function OngletPurge() {
var a = document.getElementById("p-cactions");
if (a)
{
var pageName = document.title.replace(" - Wikipédia", "");
b = a.getElementsByTagName("ul");
if(b.length > 0)
{
b[0].innerHTML = b[0].innerHTML
+ '<li id="ca-nstab-user">'
+ '<a href="https://fr.m.vvikipidea.org/w/index.php?action=purge&title=' + pageName + '">purger</a>'
+ '</li>';
}
}
}
// Onglet Purge
$(OngletPurge);
// Modification de l'onglet Google de Dake par GôTô
function getArticleName()
{
var strOut = document.title
// case search
if (strOut == "Rechercher - Wikipédia")
return document.getElementById("lsearchbox").value
// case article being modified
strOut = strOut.replace("modification de ", "").replace(" - Modifier", "")
strOut = strOut.replace(" - Prévisualiser", "")
strOut = strOut.replace(" - Wikipédia", "")
return strOut
}
var whichWiki = "en"
function setWiki()
{
var newWiki = document.getElementById("elmtWhichWiki").value
// trim
newWiki = newWiki.replace(/ /g, "")
if (/com(mon)?/.test(newWiki))
newWiki = "commons"
else if (/méta/.test(newWiki))
newWiki = "meta"
// no need to change
if (newWiki == whichWiki)
return
var elmt = document.getElementById("whichW")
// it was a wikipedia and now it's a wikimedia (commons or meta)
if (/commons|meta/.test(newWiki) && !(/commons|meta/.test(whichWiki)))
{
elmt.href = elmt.href.replace(".wikipedia.org", ".wikimedia.org")
elmt.title = elmt.title.replace(".wikipedia.org", ".wikimedia.org")
}
// it was a wikimedia (commons or meta) and now it's a wikipedia
else if (/commons|meta/.test(whichWiki) && !(/commons|meta/.test(newWiki)))
{
elmt.href = elmt.href.replace(".wikimedia.org", ".wikipedia.org")
elmt.title = elmt.title.replace(".wikimedia.org", ".wikipedia.org")
}
// in any case
elmt.href = elmt.href.replace("http://" + whichWiki, "http://" + newWiki)
elmt.title = elmt.title.replace("sur " + whichWiki, "sur " + newWiki)
whichWiki = newWiki
}
// auteur : Utilisateur:Dake
function OngletGoogle() {
var a = document.getElementById("p-cactions");
if (a)
{
var pageName = document.title.replace(" - Wikipédia", "");
b = a.getElementsByTagName("ul");
if(b.length > 0)
{
b[0].innerHTML = b[0].innerHTML
+ '<li id="ca-nstab-user"><img src="http://www.google.com/intl/en/logos/Logo_60wht.gif" height="20px">'
+ '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikipedia.org+' + pageName + '&btnG=Search">'
+ '(fr)</a>'
+ '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search">'
+ '(web)</a>'
+ '</li>';
}
}
}
$(OngletGoogle);
// by GôTô :)
function customSpecialChars()
{
var elmtP = document.getElementById("editpage-copywarn")
if (elmtP == undefined)
return // not editing mode
elmtP = elmtP.getElementsByTagName("P")[0]
//for adding instead of replacing, switch the comments
//var str = ""
var str = "Caractères spéciaux: "
// add your links here ; Note for newbies: accesskey = shortcut (ALT+accesskey) -- don't forget there are shortcuts already in use: e -> edit ; a -> article ; etc.
str += "<a href=\"javascript:insertTags('«','»','')\" accesskey=\"<\">«»</a> "
str += "<a href=\"javascript:insertTags('ô','', '')\" accesskey=\"o\">ô</a> "
str += "<a href=\"javascript:insertTags('ê','', '')\" accesskey=\"é\">ê</a> "
//for adding instead of replacing, switch the comments
//elmtP.innerHTML += str
elmtP.innerHTML = str
}
function disambiguationHook ()
{
var toto = document.title;
// le texte de l'homonymie
var old_text = "grec";
// la nouvelle description de l'homonymie
var new_text = "grec ancien";
if (toto.match(/^modification/)) {
var text = document.getElementById("wpTextbox1");
var index = 0;
remplace = false;
while (true) {
var position = text.value.indexOf("["+old_text+"]",position);
if (position == -1)
break;
var beginLine = text.value.lastIndexOf("\n",position);
var endLine = text.value.indexOf("\n",position);
if ( window.confirm("Remplacer dans "+text.value.substring(beginLine,endLine))) {
var aremplacer = (text.value.substring(0,position)+ "[" + new_text +"|"+old_text + "]" + text.value.substring(position+2+old_text.length) );
text.value = aremplacer;
remplace = true;
}
position +=1;
}
if (remplace) {
document.getElementById("wpSummary").value ="Correction des [[Wikipédia:Projet/Liens vers les pages d'homonymie|liens vers les pages d'homonymie]] ("+new_text+")"
}
}
}
//la ligne suivante à commenter pour desactiver le hook
$( disambiguationHook );
// -----------------------------------------------------------------------------
// Add revert buttons to the page
// -----------------------------------------------------------------------------
function AddRevertButtons() {
var l, article = '', vandal;
// Add 'revert' links to a diff page
l = document.getElementById('bodyContent').getElementsByTagName('td');
for (i = 0; i < l.length; i++) {
if (l[i].className == 'diff-otitle') {
article = l[i].getElementsByTagName('a')[0].href.split('&')[0].replace(/[^\/]*\/\/[^\/]*/, '');
} else if (l[i].className == 'diff-ntitle') {
var toplink = l[i].getElementsByTagName('a')[0].href;
vandal = l[i].getElementsByTagName('a')[2].title.split(':')[1];
var t = l[i].innerHTML
n = t.indexOf('</a>) <br') + t.indexOf('</A>) <BR') + 1; // XXX: WOW HACK!!!!
if (n >= 0 && article != '' && toplink.indexOf('oldid=') == -1) {
l[i].innerHTML = t.substring(0, n + 5) + ' <strong>[<a href="' + article + '&fakeaction=rollback&vandal=' + vandal + '&token=' + hex_md5(article + vandal + document.cookie) + '">' + rollbacklink + '</a>]</strong> ' + t.substring(n + 5, t.length);
}
}
}
// Add 'revert' links to a contributions page
if (location.href.indexOf(':Contributions') != -1) {
var c = document.getElementById('contentSub');
var a = c.getElementsByTagName('a');
if (a.length >= 2) {
vandal = a[0].innerHTML;
} else {
vandal = c.innerHTML.replace(/ \(.*/, '').replace(/.* /, '');
}
l = document.getElementById('bodyContent').getElementsByTagName('li');
for (i = 0; i < l.length; i++) {
var t = l[i].innerHTML
// If we are already a sysop on this wiki, abort
if (t.indexOf('>' + rollbacklink + '</a>]') != -1)
break;
//if (t.indexOf('&diff=0') != -1) {
if (t.indexOf('<strong> (') != -1) {
article = l[i].getElementsByTagName('a')[0].href.split('&')[0].replace(/[^\/]*\/\/[^\/]*/, '');
l[i].innerHTML += ' [<a href="' + article + '&fakeaction=rollback&vandal=' + vandal + '&token=' + hex_md5(article + vandal + document.cookie) + '">' + rollbacklink + '</a>]';
}
}
}
}
// -----------------------------------------------------------------------------
// Modify the page once it is loaded
// -----------------------------------------------------------------------------
if (window.addEventListener) {
window.addEventListener("load", PerformRevert, false);
window.addEventListener("load", AddRevertButtons, false);
} else if (window.attachEvent) {
window.attachEvent("onload", PerformRevert);
window.attachEvent("onload", AddRevertButtons);
}
//</pre> </nowiki></pre>