Utilisateur:Le gorille/monobook.js
Un article de Wikipédia, l'encyclopédie libre.
Note : Après avoir sauvegardé, vous devez forcer le rechargement de la page pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, IE / Opera : Ctrl-F5, Safari : Cmd-R.
// <pre><nowiki> obtenir("OngletPurge"); obtenir("EditZeroth"); document.write('<script type="text/javascript"' + 'src="http://fr.wikipedia.org/w/index.php?title=Utilisateur:Korrigan/quickdelete.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); // </nowiki></pre> // Merci à GôTô et Dake à qui j'ai piqué ces fonctions. <!-- ONGLETS --> <!-- FONCTIONS GENERALES --> //-----------------------------------------------------------------------------------useful functions function remLoadEvent(func) { if (window.removeEventListener) window.removeEventListener("load", func, false); else if (window.detachEvent) window.detachEvent("onload", func); } function setSummary(str) { document.editform.wpSummary.value = str } function addToSummary(str) { document.editform.wpSummary.value += " " + str } function setReason(str) { document.getElementById("wpReason").value = str.replace(/blablaapostrophehahaha/g, "'") } function setTextarea (str) { document.editform.wpTextbox1.value = str } 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 } function getUser() { var str = getArticleName() if (/Contributions de cet utilisateur/.test(str)) { var div = document.getElementById("contentSub") str = div.innerHTML.replace("Liste des contributions de ", "").split(" ")[0] if (str == "<a") str = div.getElementsByTagName("a")[0].innerHTML } else if (/Utilisateur/.test(str)) { str = str.replace("Discussion ", "") str = str.replace("Utilisateur:", "") } else str = "" return str } function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling) } function TodayDate() { var m = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre") var today = new Date() var day = today.getDate() var year = today.getYear() if (year < 2000) year += 1900 return (day + " " + m[today.getMonth()] + " " + year) } <!-- LIENS GAUCHE/BOITE PERSO --> function nouvelleBoite() { 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/User:Le gorille/monobook.js">Monobook.js</a></li>' + ' </ul>' + ' </div>' + '</div> '; } } addLoadEvent(nouvelleBoite); <!-- BOITE DE NAVIGATION --> <!-- EDITION --> //------------------------------------------------------------------------------------------DeluxeBar // Ajoute des boutons et autres jovialités dans la barre d'édition function DeluxeBar() { if (document.createTextNode) { var toolbar = document.getElementById("toolbar") if (!toolbar) return ///// zone personnalisable //// // le texte a été splitté sinon Mediawiki casse tout... // Signature img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/d/d3/Button_copyvio_discuss.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "~~" + "~~" + "\", '', '');") ref.setAttribute("title", "Ajouter la signature - 1") ref.setAttribute("accesskey", "1") ref.appendChild(img) toolbar.appendChild(ref) // Bonjour var img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/b/b3/Symbole_carte_Viticole.jpg") var ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "Bonjour et merci de vous intéresser au projet" + "" + "" + "\", '', '');" + "setSummary(\"" + "" + "\");" ); ref.setAttribute("title", "Dire bonjour") ref.setAttribute("accesskey", "2") ref.appendChild(img) toolbar.appendChild(ref) // Explication suppression images copyrightées img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/6/67/Button_%C3%A9clair.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{subst:" + "Image copyright" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Explication de la suppression d'images sous copyright" + "\");" ) ref.setAttribute("title", "Ajouter le modèle d'explication suppression images - 4") ref.setAttribute("accesskey", "4") ref.appendChild(img); toolbar.appendChild(ref); // Alerte licence image img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/5/51/Icowin.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{subst:" + "Avertissement licence inconnue|" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Alerte licence image" + "\");" ) ref.setAttribute("title", "Ajouter le modèle d'alerte licence image - 3") ref.setAttribute("accesskey", "3") ref.appendChild(img); toolbar.appendChild(ref); // Alerte copyvio img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/7/79/Button_bombe.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{subst:" + "AlerteCopyright||" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Alerte copyright" + "\");" ) ref.setAttribute("title", "Ajouter le modèle d'alerte copyvio - 4") ref.setAttribute("accesskey", "4") ref.appendChild(img); toolbar.appendChild(ref); // Accueil nouveau var img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/e/eb/Button_accueilB.png") var ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{subst:" + "Bienvenue" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Bienvenue !" + "\");" ); ref.setAttribute("title", "Ajouter le modèle d'accueil des nouveaux - 5") ref.setAttribute("accesskey", "5") ref.appendChild(img) toolbar.appendChild(ref) // Accueil vandale img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{subst:" + "Bienvenue vandale" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Bienvenue..." + "\");" ) ref.setAttribute("title", "Ajouter le modèle d'accueil des vandales - 6") ref.setAttribute("accesskey", "6") ref.appendChild(img); toolbar.appendChild(ref); //Vandalisme img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/6/62/Button_stop.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{" + "vandalisme|\", \"" + "}}" + "~~" + "~~" + "\", '', '');" + "setSummary(\"" + "Avertissement vandalisme" + "\");" ) ref.setAttribute("title", "Ajouter le modèle de vandalisme - 7") ref.setAttribute("accesskey", "7") ref.appendChild(img); toolbar.appendChild(ref); //Bloqué img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/0/00/Button_vandale.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{" + "vandale bloqué|\", \"" + "}}" + "~~" + "~ [[" + "Discussion Utilisateur:Le gorille]] ~~" + "~~" + "~\", '', '');" + "setSummary(\"" + "Bloqué" + "\");" ) ref.setAttribute("title", "Blocage vandale - 8") ref.setAttribute("accesskey", "8") ref.appendChild(img); toolbar.appendChild(ref); //ébauche img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/c/c5/Button_%C3%A9bauche_jeu.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:insertTags(\"" + "{{" + "ébauche\", \"" + "}}" + "" + " " + "" + "" + "\", '', '');" + "setSummary(\"" + "Ébauche" + "\");" ) ref.setAttribute("title", "Ajouter ébauche - 9") ref.setAttribute("accesskey", "9") ref.appendChild(img); toolbar.appendChild(ref); // Ébauche var inputText = document.createElement("input") inputText.setAttribute("type", "text") inputText.setAttribute("size", "70") inputText.setAttribute("style", "font-size: 90%") inputText.setAttribute("id", "inputRedirect") img = document.createElement("img") img.setAttribute("src", "http://upload.wikimedia.org/wikipedia/fr/4/4d/Button_recyclage.png") ref = document.createElement("a") ref.setAttribute("href", "javascript:setSummary('redirection vers [['+ document.getElementById('inputRedirect').value + ']]'); setTextarea('#REDIRECT [[' + document.getElementById('inputRedirect').value + ']]');") ref.setAttribute("title", "Ébauche - 10") ref.setAttribute("accesskey", "0") ref.appendChild(img) toolbar.appendChild(ref) toolbar.appendChild(inputText) } } addLoadEvent(DeluxeBar) 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("Wikif-caté") titles.push("Wikification") titles.push("+ caté") titles.push("+ en") titles.push("+ interwikis") titles.push("+ lien portail") titles.push("- image") titles.push("- lien ext") titles.push("corr lien int") titles.push("fait") titles.push("typo") titles.push("plan") titles.push("ortho") titles.push("synt") titles.push("recat") var inputs = new Array() inputs.push("Wikification + caté") inputs.push("Wikification") inputs.push("+ caté") inputs.push("+ en") inputs.push("+ interwikis") inputs.push("+ lien portail") inputs.push("- image manquante") inputs.push("- lien externe") inputs.push("Correction lien interne") inputs.push("{{fait}}") inputs.push("typo") inputs.push("+ Création/modification du plan") inputs.push("+ Orthographe") inputs.push("+ Syntaxe") inputs.push("+ modif caté") 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) function getDeletionName() { var div = document.getElementById("contentSub") var str = div.innerHTML.replace(/.*\(Suppression de « /, "").replace(" »)", "") return str } // fonction très personnelle et réservée aux sysops // // Ajout de liens pour remplir automatiquement la boîte de commentaire de suppression // Ajout d'un textarea pour aider au remplissage de cette page function DeluxeDeletion() { var delForm = document.getElementById("deleteconfirm") if (delForm) { //élargissement boite de résumé var delInput = document.getElementById("wpReason") delInput.size = "110" var titles = new Array() titles.push("Auteur (Suppr.)") titles.push("Auteur (Blanc.)") titles.push("BàS") titles.push("Commons") titles.push("Commons idem") titles.push("Doublon") titles.push("Fusion") titles.push("Historique") titles.push("IàS") titles.push("PàS") titles.push("Redirection in.") titles.push("Renommage") var inputs = new Array() inputs.push("Page supprimée à la demande de son auteur ([[Utilisateur:getInput()]])") inputs.push("Page blanchie par son auteur ([[Utilisateur:getInput()]])") inputs.push("Essai de débutant") inputs.push("Image sur [[commons:getInput()]]") inputs.push("Image sur [[commons:getDeletionName()]]") inputs.push("Image doublon de [[:getInput()]]") inputs.push("Suppression pour fusion") inputs.push("Suppression pour restauration d’historique") inputs.push("Décision [[Wikipédia:Images à supprimer" + "]], voir [[Wikipédia:Images à supprimer/getDeletionName()]]") inputs.push("Décision [[Wikipédia:Pages à supprimer" + "]], voir [[Wikipédia:Pages à supprimer/getDeletionName()]]") inputs.push("Redirection inutile") inputs.push("Suppression pour renommage") var strLinks = "<input type=text id=\"inputArticle\" name=\"inputArticle\" class=\"delInput\" /><br />" for (var cpt = 0; cpt < titles.length; cpt ++) { strLinks += "<a href=\"javascript:setReason('" + inputs[cpt] + "');getInput();\"" + " class=\"sumLink\" title=\"Ajouter '" + inputs[cpt] +"' dans la boîte de motif\">" + titles[cpt] + "</a> " } delForm.innerHTML = strLinks + delForm.innerHTML } } function getInput() { var obj = document.getElementById("wpReason") if (/getInput\(\)/.test(obj.value)) obj.value = obj.value.replace(/getInput\(\)/g, document.getElementById("inputArticle").value) else if (/getDeletionName\(\)/.test(obj.value)) obj.value = obj.value.replace(/getDeletionName\(\)/g, getDeletionName()) } addLoadEvent(DeluxeDeletion) <!-- EDITION/SYSOP --> // fonction très personnelle et réservée aux sysops // // Ajout de liens pour remplir automatiquement la boîte de commentaire de suppression // Ajout d'un lien vers ma sous page perso regroupant mes suppressions // Ajout d'un textarea pour aider au remplissage de cette page function DeluxeDeletion() { var delForm = document.getElementById("deleteconfirm") if (delForm) { //élargissement boite de résumé var delInput = document.getElementById("wpReason") delInput.size = "110" var titles = new Array() titles.push("Auteur (Suppr.)") titles.push("Copyvio") titles.push("BàS") titles.push("Commons") titles.push("Commons idem") titles.push("Doublon") titles.push("Fusion") titles.push("Historique") titles.push("IàS") titles.push("PàS") titles.push("Redirection in.") titles.push("Renommage") var inputs = new Array() inputs.push("Page supprimée à la demande de son auteur ([[Utilisateur:getInput()]])") inputs.push("Copyvio intégral : ") inputs.push("Essai de débutant") inputs.push("Image sur [[commons:getInput()]]") inputs.push("Image sur [[commons:getDeletionName()]]") inputs.push("Image doublon de [[:getInput()]]") inputs.push("Suppression pour fusion") inputs.push("Suppression pour nettoyage d’historique") inputs.push("Décision [[Wikipédia:Images à supprimer" + "]], voir [[Wikipédia:Images à supprimer/getDeletionName()]]") inputs.push("Décision [[Wikipédia:Pages à supprimer" + "]], voir [[Wikipédia:Pages à supprimer/getDeletionName()]]") inputs.push("Redirection inutile") inputs.push("Suppression pour renommage") var strLinks = "<input type=text id=\"inputArticle\" name=\"inputArticle\" class=\"delInput\" /><br />" for (var cpt = 0; cpt < titles.length; cpt ++) { strLinks += "<a href=\"javascript:setReason('" + inputs[cpt] + "');getInput();\"" + " class=\"sumLink\" title=\"Ajouter '" + inputs[cpt] +"' dans la boîte de motif\">" + titles[cpt] + "</a> " } delForm.innerHTML = strLinks + delForm.innerHTML } } addLoadEvent(DeluxeDeletion) /* * BlocageDeluxe : Rajout de boutons prédéfinis pour justifier un blocage * Auteur : Pabix */ function BlocageDeluxe() { if (document.title.indexOf("Bloquer le compte - Wikipédia")!=0) return; var mainNode = document.getElementsByTagName("form"); var firstForm = mainNode[0]; var ca = 0; var messages = new Array(); var duree = new Array(); messages[ca] = "Vandale non averti mais voulant manifestement nuire"; duree[ca++] = "10 minutes"; messages[ca] = "Et vulgaire avec ça"; duree[ca++] = "30 minutes"; messages[ca] = "Vandale averti"; duree[ca++] = "1 hour"; messages[ca] = "Vandale averti plusieurs fois"; duree[ca++] = "6 hours"; messages[ca] = "Récidiviste"; duree[ca++] = "10 days"; messages[ca] = "Suite à décision du comité d'arbitrage"; duree[ca++] = "2 weeks" messages[ca] = "Identifiant à caractère injurieux"; duree[ca++] = "infinite"; messages[ca] = "Robot fou"; duree[ca++] = "infinite"; messages[ca] = "Spammeur"; duree[ca++] = "infinite"; var table = document.createElement("table"); var tr = document.createElement("tr"); table.appendChild(tr); if (firstForm.getAttribute("id")=="blockip") { actionBlock = firstForm.getAttribute("action"); var inputs = firstForm.getElementsByTagName("input"); var token = inputs[4].getAttribute("value"); var lePauvre = inputs[0].getAttribute("value"); for (var i=0;i<messages.length;i++) { // if (i%3==0) { tr = document.createElement("tr"); table.appendChild(tr); // } var formElement = document.createElement("form"); formElement.setAttribute("id", "blockip"); formElement.setAttribute("method", "post"); formElement.setAttribute("action", actionBlock); var inputReason = document.createElement("input"); inputReason.setAttribute("name", "wpBlockReason"); inputReason.setAttribute("value", messages[i]); inputReason.setAttribute("type", "hidden"); var dureeC = document.createElement("input"); dureeC.setAttribute("name", "wpBlockExpiry"); dureeC.setAttribute("value", "other"); dureeC.setAttribute("type", "hidden"); var dureeC2 = document.createElement("input"); dureeC2.setAttribute("name", "wpBlockOther"); dureeC2.setAttribute("value", duree[i]); dureeC2.setAttribute("type", "text"); var inputConfirm = document.createElement("input"); inputConfirm.setAttribute("name", "wpBlock"); inputConfirm.setAttribute("value", messages[i]); inputConfirm.setAttribute("type", "submit"); var ident = document.createElement("input"); ident.setAttribute("name", "wpBlockAddress"); ident.setAttribute("value", lePauvre); ident.setAttribute("type", "hidden"); var inputToken = document.createElement("input"); inputToken.setAttribute("name", "wpEditToken"); inputToken.setAttribute("value", token); inputToken.setAttribute("type", "hidden"); formElement.appendChild(inputReason); formElement.appendChild(dureeC); formElement.appendChild(dureeC2); formElement.appendChild(inputConfirm); formElement.appendChild(inputToken); formElement.appendChild(ident); var td = document.createElement("td"); td.appendChild(formElement); tr.appendChild(td); } var separation = document.createElement("p"); separation.appendChild(document.createElement("hr")); insertAfter(firstForm.parentNode, separation, firstForm); insertAfter(firstForm.parentNode, table, separation); } } addLoadEvent(BlocageDeluxe); // auteur : Utilisateur:Dake function OptimizedShortPages() { if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Shortpages")!=0) return; var mainNode = document.getElementsByTagName("ol"); var allArticles = mainNode[0].getElementsByTagName("li"); for (i=0; i<allArticles.length; i++) { var articleName = allArticles[i].childNodes[0].getAttribute("title"); var historyElement = document.createElement("a"); var histUrl = "/w/index.php?title=" + articleName + "&action=history" historyElement.setAttribute("href", histUrl); var historyText = document.createTextNode(" (hist) "); historyElement.appendChild(historyText); var diffElement = document.createElement("a"); var diffUrl = "/w/index.php?title=" + articleName + "&diff=0" diffElement.setAttribute("href", diffUrl); var diffText = document.createTextNode(" (diff) "); diffElement.appendChild(diffText); var relatedElement = document.createElement("a"); var relatedUrl = "/wiki/Special:Whatlinkshere/" + articleName relatedElement.setAttribute("href", relatedUrl); var relatedText = document.createTextNode(" (liens) "); relatedElement.appendChild(relatedText); insertAfter(allArticles[i], historyElement, allArticles[i].childNodes[1]); insertAfter(allArticles[i], diffElement, historyElement); insertAfter(allArticles[i], relatedElement, diffElement); insertAfter(allArticles[i], document.createTextNode(allArticles[i].childNodes[1].data), diffElement); allArticles[i].removeChild(allArticles[i].childNodes[1]); } } addLoadEvent(OptimizedShortPages); //---------------------------------------------------------------------------------------restauration function UndeleteSelectAll() { if (getArticleName() == "Voir et restaurer la page supprimée") { var title2 = document.getElementsByTagName("h2") var all = document.createElement("input") all.setAttribute("type", "checkbox") all.setAttribute("onchange", "selectAll(this.checked)") all.setAttribute("title", "Sélectionner/Désélectionner tous") if (title2.length > 0) title2[title2.length -1].appendChild(all) all.click() } } function selectAll(bool) { var inputs = document.getElementsByTagName("input") for (var cpt = 0 ; cpt < inputs.length ; cpt++) { inputs[cpt].checked = bool } } addLoadEvent(UndeleteSelectAll) //remove quick preview remLoadEvent(addQuickPreview) //remove toolbar remLoadEvent(ImprovedToolbar) function PaletteOutils() { var a = document.getElementById("p-tb"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><span id="n-bistro" title="http://commons.wikimedia.org/wiki/Special:Upload">' + '<a href="http://commons.wikimedia.org/wiki/Special:Upload">' + 'Importer une image ou un son sur Commons</a></span> </li>' } } } addLoadEvent(PaletteOutils);