Utilisateur:K!roman/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.
// Modification de l'onglet Google de Dake par GôTô function getArticleName() { var strOut = document.title // case article being modified strOut = strOut.replace("modification de ", "").replace(" - Modifier", "") strOut = strOut.replace(" - Wikipédia", "") return strOut } var whichWiki = "en" function setWiki() { var newWiki = document.getElementById("elmtWhichWiki").value // trim newWiki = newWiki.replace(/ /g, "") // 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?|m(e|é){1}ta/.test(newWiki) && !(/commons?|m(e|é){1}ta/.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?|m(e|é){1}ta/.test(whichWiki) && !(/commons?|m(e|é){1}ta/.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 } function searchLinks() { var site = (/commons?|m(e|é){1}ta/.test(whichWiki) ? 'wikimedia' : 'wikipedia') var a = document.getElementById("p-cactions") if (a) { var pageName = getArticleName() var ulElmt = a.getElementsByTagName("ul") if(ulElmt.length > 0) { ulElmt[0].innerHTML += '<li><a id="whichW" onmousedown="setWiki()" onkeydown="setWiki()" href="http://' + whichWiki + '.' + site + '.org/wiki/Special:Search?search=' + pageName + '" title="Rechercher ' + pageName + '" target="_blank">' + 'Rch wp</a>' + '<input type=text id="elmtWhichWiki" style="color : #002bb8; font: normal 8pt Arial; text-align: top; border: 0px; background: none; width: 50px" maxlength="7" value="' + whichWiki + '">' + '<span style="color: #002bb8; font-weight: bold; padding-left: 0.5em; background: none">G:</span>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikipedia.org+' + pageName + '&btnG=Search" title="Rechercher sur Google dans fr.wikipédia.org" target="_blank">' + 'wp-fr</a>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Awikipedia.org+' + pageName + '&btnG=Search" title="Rechercher sur Google dans wikipédia.org" target="_blank">' + 'wp</a>' + '<a href="http://www.google.fr/search?num=20&hl=fr&safe=off&q=' + pageName + '&btnG=Search&meta=lr%3Dlang_fr" title="Rechercher sur Google dans tout le web en français" target="_blank">' + 'web-fr</a>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search" title="Rechercher sur Google dans tout le web" target="_blank">' + 'web</a>' + '</li>' } } } addLoadEvent(searchLinks) function addLoadEvent(func) { if(window.addEventListener) { window.addEventListener("load", func, false); } else if(window.attachEvent) { window.attachEvent("onload", func); } } function setSummary(str) { document.editform.wpSummary.value = str; } function addToSummary(str) { var resum = document.editform.wpSummary.value if(resum != 0 && resum.indexOf("*/") < resum.length - 3) { document.editform.wpSummary.value += " - "; } document.editform.wpSummary.value += str; checksWithSummary(str, "Projet", 8); checksWithSummary(str, "revert", 8); } function checksWithSummary(str, text, num) { if(str.indexOf(text, num) > 0) { document.editform.wpWatchthis.checked = false; document.editform.wpMinoredit.checked = true; } } function TodayDate() { m = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"); today = new Date(); day = today.getDate(); year = today.getYear(); if(year < 2000) { year = year + 1900; } return(day + " " + m[today.getMonth()] + " " + year); } // Ajouter une boîte perso dans le menu de gauche. function nouvelleBoite() { var tDate = TodayDate(); var l = document.getElementById("column-one"); if(l) { l.innerHTML = l.innerHTML + '<div class="portlet" id="p-nbx">' + ' <h5>boîte perso</h5>' + ' <div class="pBody">' + ' <ul>' + ' <li><a href="http://fr.wikipedia.org/wiki/Wikipédia:Annonces" target="_blank">Annonces</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Wikipédia:Le_Bistro" target="_blank">Bistro</a> - <a href="http://fr.wikipedia.org/wiki/Wikipédia:Le_Bistro/' + tDate + '" target="_blank">aujourd\'hui</a> - <a href="http://fr.wikipedia.org/wiki/Utilisateur:Escalabot/Liste_des_messages_du_bistro_tri%C3%A9s_par_date" target="_blank">trié</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Special:Newpages" target="_blank">Nouvelles pages</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Catégorie:Wikipédia:ébauche" target="_blank">Ébauches</a> - <a href="http://fr.wikipedia.org/wiki/Wikipédia:Catégories d\'ébauches" target="_blank">catégories</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Aide:Formules TeX" target="_blank">Formules TeX</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Wikipédia:Modèles" target="_blank">Modèles</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Utilisateur:K!roman/ensablage" target="_blank">Sable</a></li>' + ' <li><a href="http://en.wikipedia.org/wiki/Main_Page" target="_blank">Wiki-en</a> - <a href="http://es.wikipedia.org/wiki/Portada" target="_blank">es</a> - <a href="http://de.wikipedia.org/wiki/Hauptseite" target="_blank">de</a> - <a href="http://it.wikipedia.org/wiki/Pagina_principale" target="_blank">it</a></li>' + ' <li><a href="http://meta.wikimedia.org/wiki/Main_Page" target="_blank">Meta</a> - <a href="http://wikizine.org/ " target="_blank">Zine</a> - <a href="http://fr.wiktionary.org/wiki/ " target="_blank">Wikt</a> - <a href="http://fr.wikibooks.org/wiki/Accueil" target="_blank">B</a> - <a href="http://fr.wikisource.org/wiki/Accueil" target="_blank">S</a> - <a href="http://fr.wikiversity.org/wiki/Accueil" target="_blank">V</a> - <a href="http://commons.wikimedia.org/wiki/Accueil" target="_blank">C</a> - <a href="http://fr.wikiquote.org/wiki/Accueil" target="_blank">Q</a> - <a href="http://meta.wikimedia.org/wiki/LSS" target="_blank">LSS</a></li>' + ' </ul>' + ' </div>' + '</div> '; } } addLoadEvent(nouvelleBoite); // Ajouter des commentaires prédéfinis dans la barre de résumé. function DeluxeSummary() { var sumLbl = document.getElementById("wpSummaryLabel"); if(sumLbl) { var sumInput = document.getElementById("wpSummary"); sumInput.style.width = "95%"; var titles = new Array() titles.push("ortho") titles.push("typo") titles.push("cat") titles.push("inter") titles.push("wikif") titles.push("redir") titles.push("revert") titles.push("rouge") titles.push("homon") var inputs = new Array() inputs.push("ortho") inputs.push("typo") inputs.push("cat") inputs.push("interwiki") inputs.push("ouikif") inputs.push("redirect") inputs.push("revert") inputs.push("[[Wikipédia:Projet/Restauration lien rouge|restauration liens rouges]]") inputs.push("lien homonymie") 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 } } addLoadEvent(DeluxeSummary) document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/objects.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dake/monobook.js/deluxehistory.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');