User:Pseudomoi/monobook.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
/* <pre><nowiki> */ /**************************************************************/ /* Ajoute deux liens sur les liens rouges en prévisualisation */ /* Auteur : Seb35 */ /* Modifications pour IE/Firefox : Dake */ /**************************************************************/ function liensRouges_main() { if(/Spe[cz]ial(?::|%3A)Watchlist/i.test(window.location) || /edit/i.test(window.location)) return; var allLinks = document.getElementById('bodyContent').getElementsByTagName('a'); for(i=0; i<allLinks.length; i++) { if(allLinks[i].getAttribute('class') == 'new') { titre = allLinks[i].getAttribute('title'); var newElement = document.createElement("a"); newElement.setAttribute("title",'Rechercher \'' + titre + '\''); newElement.setAttribute("href", 'http://www.google.com/search?num=100&q=' + titre + '+site:en.wikipedia.org'); newElement.appendChild(document.createTextNode(" (google -")); var newElement2 = document.createElement("a"); newElement2.setAttribute("title",'Pages liées à \'' + titre + '\''); newElement2.setAttribute("href", '/wiki/Special:Whatlinkshere/' + titre + '+site:en.wikipedia.org'); newElement2.appendChild(document.createTextNode(" liées)")); insertAfter( allLinks[i].parentNode, newElement, allLinks[i]); insertAfter( allLinks[i].parentNode, newElement2, newElement); } } } addOnloadHook(liensRouges_main); var suiviManagerAllPages = new Array(); function SuiviManagerRegexp(regexp) { var match = new RegExp(regexp); for (var i=0;i<suiviManagerAllPages.length;i++) { var pageName = suiviManagerAllPages[i].childNodes[0].getAttribute("value"); if (match.test(pageName)) { suiviManagerAllPages[i].childNodes[0].checked=true; } } } function SuiviManagerLiensRouges() { for (var i=0;i<suiviManagerAllPages.length;i++) { var pageClass = suiviManagerAllPages[i].childNodes[1].getAttribute("class"); if (pageClass && pageClass=="new") { suiviManagerAllPages[i].childNodes[0].checked=true; } } } function SuiviManagerDeselect() { for (var i=0;i<suiviManagerAllPages.length;i++) { suiviManagerAllPages[i].childNodes[0].checked=false; } } function SuiviManager() { if (document.URL.indexOf("http://en.wikipedia.org/wiki/Special:Watchlist/edit")!=0) return; var a=0; var b=0; var interfaceMsg = new Array(); var regexpList = new Array(); ////////////////////////////////////////////////// // Expressions régulières et liens de l'interface // // besoin d'aide pour les regexp ? // http://www.commentcamarche.net/javascript/jsregexp.php3 ////////////////////////////////////////////////// interfaceMsg[a++] = "<b>Tout cocher</b>"; regexpList[b++] = "^.*"; interfaceMsg[a++] = "Utilisateurs"; regexpList[b++] = "^User:"; interfaceMsg[a++] = "Wikipédia:*"; regexpList[b++] = "^Wikipedia:"; interfaceMsg[a++] = "Sous-pages de PàS"; regexpList[b++] = "^Wikipédia:Pages à supprimer\/"; interfaceMsg[a++] = "Sous-pages de PàV"; regexpList[b++] = "^Wikipédia:Pages à vérifier\/"; interfaceMsg[a++] = "Propositions AdQ"; regexpList[b++] = "^Wikipédia:Proposition articles de qualité\/"; interfaceMsg[a++] = "Lumière sur"; regexpList[b++] = "^Wikipédia:AccueilLumièreSur\/"; interfaceMsg[a++] = "Pages du bistro"; regexpList[b++] = "^Wikipédia:Le Bistro\/"; interfaceMsg[a++] = "Images"; regexpList[b++] = "^Image:"; interfaceMsg[a++] = "Modèles"; regexpList[b++] = "^Template:"; interfaceMsg[a++] = "Aide"; regexpList[b++] = "^Help:"; interfaceMsg[a++] = "Catégories"; regexpList[b++] = "^Catégorie:"; interfaceMsg[a++] = "Portails"; regexpList[b++] = "^Portal:"; ////////////////////////////////////////////////// var topTag = document.getElementById("contentSub") // récupère toutes les pages var watchlist = document.getElementsByTagName("ul"); for (u=0;u<watchlist.length;u++) { var entries = watchlist[u].getElementsByTagName("li"); for (i=0;i<entries.length;i++) { suiviManagerAllPages.push(entries[i]); } } // prépare la mini-interface var str = "<div style=\"background-color:#8ecfe4;font-size:1px;height:8px;border:1px solid #AAAAAA;-moz-border-radius-topright:0.5em;-moz-border-radius-topleft:0.5em;\"></div>" + "<div style=\"border:1px solid #6ac1de;border-top:0px solid white;padding:5px 5px 0 5px;margin-bottom:3ex;\"><p>" + "<div style=\"float: left; text-align: left; white-space: nowrap;\"></div>" for (var cpt = 0; cpt < interfaceMsg.length; cpt ++) { str += "<a href=\"javascript:SuiviManagerRegexp('" + regexpList[cpt] + "')\">" + interfaceMsg[cpt] + " ·</a> " } str += "<a href=\"javascript:SuiviManagerLiensRouges()\">" + "Retirer les liens rouges" + " ·</a> " str += "<a href=\"javascript:SuiviManagerDeselect()\">" + "<b>Enlever toutes les coches</b>" + " ·</a> " topTag.innerHTML = topTag.innerHTML + "<br clear=all />" + str + "<p></div>" } addOnloadHook(SuiviManager); function TodayDate2() { 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()]); } function MenuPàS() { var tDate2 = TodayDate2(); var a = document.getElementById("p-navigation"); if (a) { b = a.getElementsByTagName("ul"); if (b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><span title="Section du jour de PàS">' + '<a href="/wiki/Wikipédia:Pages_à_supprimer#'+ tDate2 +'">Section du jour de PàS</a></span></li>' } } } addOnloadHook(MenuPàS); ///////////////////////////////////////// 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("+ image") titles.push("+ interwiki") titles.push("+ portail") titles.push("- image") titles.push("- lien ext") titles.push("corr lien int") titles.push("lien ext -> lien int") titles.push("MeP") titles.push("ortho/gram") titles.push("retouches") titles.push("ajInfo") titles.push("rangmt") titles.push("recat") titles.push("PàS conservé") var inputs = new Array() inputs.push("+ {{Stub}}") inputs.push("+ category") inputs.push("+ image") inputs.push("+ liens interwiki") inputs.push("+ Portal") inputs.push("- image manquante") inputs.push("- lien externe") inputs.push("correction lien interne") inputs.push("conversion lien externe en lien interne") inputs.push("mise en page") inputs.push("correction orthographe/grammaire") inputs.push("diverses retouches") inputs.push("ajout d’infos") inputs.push("rangement interwikis/catégories") inputs.push("categorization") inputs.push("article listé sur PàS - retrait du bandeau (conservé)") 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 } } addOnloadHook(DeluxeSummary) // Released into the public domain by [[User:Func]] // function NUPatrol() { if ( window.location.href.indexOf( 'Special:Log/newusers') < 0 && window.location.href.indexOf( '&type=newusers' ) < 0 ) return; var items, item, i, links, user, name, talk, contribs, insertLoc, link; items = document.getElementById( 'bodyContent' ).getElementsByTagName( 'ul' )[ 0 ].getElementsByTagName( 'li' ); function NewLink( txt, url, plainlinks, linkColor ) { var a = document.createElement( 'a' ); a.appendChild( document.createTextNode( txt ) ); a.href = url; if ( plainlinks ) a.className = 'plainlinks'; if ( linkColor ) { if ( typeof linkColor == "string" ) a.style.color = linkColor; else a.style.color = '#FF0000'; // old default behavior } return a; } for ( i = 0; i < items.length; i++ ) { item = items[ i ]; links = item.getElementsByTagName( 'a' ); user = links[ 0 ]; name = user.firstChild.nodeValue; talk = links[ 2 ]; talk.firstChild.nodeValue = 'discussion'; // lowercase 'Talk' for consistency contribs = links[ 3 ]; insertLoc = user.nextSibling; // ' newusers ' item.insertBefore( document.createTextNode( ' ( ' ), insertLoc ); item.insertBefore( talk, insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( contribs, insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'actions', '/w/index.php?title=Special%3ALog&user=' + name, true, '#000088' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'blocages', '/w/index.php?title=Special%3ALog&type=block&page=User%3A' + name, true, '#008800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'est bloqué ?', '/wiki/Special:Ipblocklist?action=search&ip=' + name, true, '#888800' ), insertLoc ); item.insertBefore( document.createTextNode( ', ' ), insertLoc ); item.insertBefore( NewLink( 'bloquer', '/w/index.php?title=Special:Blockip&ip=' + name, true, '#880000' ), insertLoc ); item.insertBefore( document.createTextNode( ' )' ), insertLoc ); item.removeChild( insertLoc.nextSibling ); // should remove the span item.removeChild( insertLoc ); // should remove ' newusers ' text } } if ( window.addEventListener ) window.addEventListener( 'load', NUPatrol, false ); else if ( window.attachEvent ) window.attachEvent( 'onload', NUPatrol ); /* ~~~~ <-- test */ var tabAction = "p-cactions"; function addPurgeButton() { // condition à améliorer var s = window.location.search; if (s.indexOf("?") == -1) { var l = document.getElementById(tabAction); t = l.innerHTML; ind = t.toLowerCase().indexOf("</ul>"); before = t.substring(0,ind); after = t.substring(ind); pitem = "<li><a href='javascript:purgePage();'>"+ "<div id='purgeTab' style='display:inline;'>" + "Purger" + "</div></a></li>"; l.innerHTML = before + pitem + after ; } } function purgePage() { window.location.search = '?action=purge'; } addOnloadHook(addPurgeButton); function OptimizedSuivi() { if (document.title=="Supprimée de la liste de suivi - Ne plus suivre - Wikipédia") { history.go(-1) } // remplacement de la watchlist "normal" par une version avec ses modifs masquées + 1 jour var watch = document.getElementById("pt-watchlist"); if (!watch) return; watch.childNodes[0].setAttribute("href", "http://fr.wikipedia.org/w/index.php?title=Special:Watchlist&days=1&hideOwn=1") if (document.URL.indexOf("http://en.wikipedia.org/wiki/Special:Watchlist")==0 || document.URL.indexOf("http://en.wikipedia.org/w/index.php?title=Special:Watchlist")==0 ){ var allDays = document.getElementsByTagName("ul"); for (i=0; i<allDays.length; i++) { if (allDays[i].getAttribute("class") == "special") { var artList = allDays[i].getElementsByTagName("li"); for (j=0; j<artList.length; j++) { var elem = artList[j]; var aTag = elem.getElementsByTagName("a"); var articleName = aTag[0].getAttribute("title"); var stopWatch = "/w/index.php?title=" + articleName + "&action=unwatch" var newElement = document.createElement("a"); newElement.setAttribute("href",stopWatch); var newText = document.createTextNode("stop"); newElement.appendChild(newText); var newPar = document.createTextNode(") (") // séparation des cas (nouvel article, ou déjà existant) if (aTag[0].childNodes[0].data == "diff") { insertAfter(elem, newPar, aTag[1]); } else { insertAfter(elem, newPar, aTag[0]); } insertAfter(elem, newElement, newPar); } } } } } addOnloadHook(OptimizedSuivi); function Bistro_PaS_PaF() { var a = document.getElementById("p-navigation"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { var startUrl = '/w/index.php?title=' var endUrl = '&action=purge' // liste des URLs var urls = new Array() urls[0] = 'Wikipédia:Le Bistro' urls[1] = 'Wikipédia:Pages à supprimer' urls[2] = 'Wikipédia:Proposition articles de qualité' urls[3] = 'Utilisateur:Pseudomoi/tests' urls[4] = 'Catégorie:Désormais sur Commons' urls[5] = 'Special:Newpages' urls[6] = 'Special:Blockip' urls[7] = 'Special:Log/delete' urls[8] = 'Special:Unusedcategories' urls[9] = 'Wikipédia:Images à supprimer' var labels = new Array() labels[0] = 'Bistro' labels[1] = 'PàS' labels[2] = 'pAdQ' labels[3] = 'tests' labels[4] = 'Sur Commons' labels[5] = 'nPage' labels[6] = 'Block' labels[7] = 'Log/Del' labels[8] = 'Cat vide' labels[9] = 'IàS' for (var i=0;i<urls.length;i+=2) { tableHTML = '<table valign="top" cellspacing="0" cellpadding="0">' tableHTML += '<tr>' tableHTML += '<li><td><a href="' + startUrl + urls[i] + endUrl + '">' + labels[i] + ' | </a></td>' tableHTML += '<td><a href="' + startUrl + urls[i+1] + endUrl + '">' + labels[i+1] + '</a></td></li>' tableHTML += '</tr>' tableHTML += '</table>' b[0].innerHTML = b[0].innerHTML + tableHTML } } } } addOnloadHook(Bistro_PaS_PaF); // merci à Eskimo pour les autres icônes function DeluxeBar() { if (document.createTextNode) { var toolbar = document.getElementById("toolbar"); if (!toolbar) return; ///// zone personnalisable //// 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] = "{{Recherche IP}}\n{{subst:" + "Bienvenue vandale" + "}}" + "~~" + "~~"; messages[3] = "{{Recherche IP}}\n{{subst:" + "Vandalisme|page" + "}}" + "~~" + "~~"; messages[4] = "{{Recherche IP}}\n{{subst:" + "Bienvenue spammeur" + "}}" + "~~" + "~~"; messages[5] = "{{subst:" + "Utilisateur:Dake/Traité||2=~~" + "~~" + "}}"; messages[6] = "{{subst:" + "Utilisateur:Dake/TraitéConserver||2=~~" + "~~" + "}}"; messages[7] = "{{subst:" + "Utilisateur:Dake/TraitéSupprimer||2=~~" + "~~" + "}}"; messages[8] = "{{subst:" + "Utilisateur:Eskimo/Copyvio|page|URL|titre" + "}} " + "~~" + "~~"; messages[9] = "{{" + "copie de site|URL|Titre" + "}}"; messages[10] = "{{" + "suppression" + "}}"; messages[11] = "{{subst:" + "Utilisateur:Meanos/Modèles/PAdQ rejetée|premier/second tour|0|0|0|-|~~" + "~~}}"; messages[12] = "{{subst:" + "Utilisateur:Meanos/Modèles/PAdQ validée|premier/second tour|0|0|0|-|~~" + "~~}}"; messages[13] = "{{subst:" + "Utilisateur:Dake/Toolbox/LicenceInconnue|test.jpg}}"; var images = new Array() images[0] = "http://upload.wikimedia.org/wikipedia/en/1/12/Button_accueilA.png"; images[1] = "http://upload.wikimedia.org/wikipedia/en/e/eb/Button_accueilB.png"; images[2] = "http://upload.wikimedia.org/wikipedia/en/0/00/Button_vandale.png"; images[3] = "http://upload.wikimedia.org/wikipedia/en/a/ad/Button_vandale2.png"; images[4] = "http://upload.wikimedia.org/wikipedia/en/f/fb/Button_spam2.png"; images[5] = "http://upload.wikimedia.org/wikipedia/en/d/d9/Button_trait%C3%A9.png"; images[6] = "http://upload.wikimedia.org/wikipedia/en/a/ae/Button_trait%C3%A9conserver.png"; images[7] = "http://upload.wikimedia.org/wikipedia/fr/9/96/Button_trait%C3%A9supprimer.png"; images[8] = "http://upload.wikimedia.org/wikipedia/fr/e/e5/Button_copyvio.png"; images[9] = "http://upload.wikimedia.org/wikipedia/fr/e/e5/Button_copyvio.png"; images[10] = "http://upload.wikimedia.org/wikipedia/fr/f/f8/Button_suppr.png"; images[11] = "http://upload.wikimedia.org/wikipedia/fr/c/cf/Button_PAdQ_rejet.png"; images[12] = "http://upload.wikimedia.org/wikipedia/fr/2/29/Button_PAdQ_validation.png"; images[13] = "http://upload.wikimedia.org/wikipedia/fr/6/67/Button_%C3%A9clair.png" var commentaires = new Array() commentaires[0] = "Bienvenue sur ta page !" commentaires[1] = "Bienvenue !" commentaires[2] = "Avertissement vandalisme" commentaires[3] = "Avertissement vandalisme"; commentaires[4] = "Avertissement spam" ; commentaires[5] = "Traité" commentaires[6] = "Traité : article conservé" commentaires[7] = "Traité : article supprimé" commentaires[8] = "Violation de copyright" commentaires[9] = "Violation de copyright"; commentaires[10] = "Proposé à la suppression"; commentaires[11] = "Notification de rejet de la proposition" commentaires[12] = "Notification de validation de la proposition" commentaires[13] = "Image - licence inconnue ou imprécise" //////////////////////////////// for (var i=0;i<messages.length;i++) { var img = document.createElement("img"); img.setAttribute("src", images[i]); img.setAttribute("alt", commentaires[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; } addOnloadHook(DeluxeBar); function SuppressionDeluxe() { if (document.title.indexOf("Confirmer la suppression")!=0) return; var mainNode = document.getElementsByTagName("form"); var firstForm = mainNode[0]; // vous pouvez ajouter vos messages ci-dessous var messages = new Array() var idx = 0; messages[idx++] = "Bac à sable"; messages[idx++] = "©"; messages[idx++] = "Publicité, autopromotion ou spam"; messages[idx++] = "Vandalisme ou vulgarités"; messages[idx++] = "Redirect orphelin"; messages[idx++] = "Supprimé à la demande de son auteur"; messages[idx++] = "Traduction automatique ou charabia"; messages[idx++] = "Contrevient aux règles de nommage"; messages[idx++] = "Article listé sur [[WP:PàS|Pages à supprimer]] - traité : supprimer"; messages[idx++] = "Transféré sur Wiktionnaire"; messages[idx++] = "Gag qui ne fait rire que son auteur"; messages[idx++] = "Image orpheline, sans licence"; messages[idx++] = "Image sans licence"; messages[idx++] = "Ne respecte pas les critères d'admissibilité"; var table = document.createElement("table"); var tr = document.createElement("tr"); table.appendChild(tr); // normalement, pas besoin de toucher à partir d'ici if (firstForm.getAttribute("id")=="deleteconfirm") { actionDelete = firstForm.getAttribute("action"); var inputs = firstForm.getElementsByTagName("input"); var token = inputs[2].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", "deleteconfirm"); formElement.setAttribute("method", "post"); formElement.setAttribute("action", actionDelete); var inputReason = document.createElement("input"); inputReason.setAttribute("name", "wpReason"); inputReason.setAttribute("value", messages[i]); inputReason.setAttribute("type", "hidden"); var inputConfirm = document.createElement("input"); inputConfirm.setAttribute("name", "wpConfirmB"); inputConfirm.setAttribute("value", messages[i]); inputConfirm.setAttribute("type", "submit"); var inputToken = document.createElement("input"); inputToken.setAttribute("name", "wpEditToken"); inputToken.setAttribute("value", token); inputToken.setAttribute("type", "hidden"); formElement.appendChild(inputReason); formElement.appendChild(inputConfirm); formElement.appendChild(inputToken); 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); } } addOnloadHook(SuppressionDeluxe); function nouvelOnglet() { var a = document.getElementById("p-cactions"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li id="ca-nstab-user">' + '<a href="/wiki/Special:Shortpages">' + 'shortpages</a></li>'; } } } addOnloadHook(nouvelOnglet); function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); } function OptimizedShortPages() { if (document.URL.indexOf("http://en.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); insertAfter(allArticles[i], historyElement, allArticles[i].childNodes[1]); var relatedElement = document.createElement("a"); var relatedUrl = "/wiki/Special:Whatlinkshere/" + articleName relatedElement.setAttribute("href", relatedUrl); var relatedText = document.createTextNode(" (liens) "); relatedElement.appendChild(relatedText); 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); insertAfter(allArticles[i], relatedElement, historyElement); insertAfter(allArticles[i], diffElement, relatedElement); insertAfter(allArticles[i], document.createTextNode(allArticles[i].childNodes[1].data), diffElement); allArticles[i].removeChild(allArticles[i].childNodes[1]); } } addOnloadHook(OptimizedShortPages); 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 sur Commons</a></span> </li>' } } } addOnloadHook(PaletteOutils); //////////////////////////////////////// // truc spécial en cours de test //////////////////////////////////////// // rippé depuis le God-Mode de Sam, avec mes remerciements var xmlhttp; var licenceInconnueEraserTemp; if (document.implementation.createDocument) { var xmlparser = new DOMParser(); } function HTTPClient() { var http; if(window.XMLHttpRequest) { http = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { http = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { http = false; } } } return http; } function XMLParse(string) { if (document.implementation.createDocument) { return xmlparser.parseFromString(string, "text/xml"); } else if (window.ActiveXObject) { var xmldoc = new ActiveXObject("Microsoft.XMLDOM"); xmldoc.async = "false"; ret = xmldoc.loadXML(string); if (!ret) return null; return xmldoc.documentElement; } return null; } // LicenceInconnueEraserHandler() - dake function LicenceInconnueEraserHandler() { if (xmlhttp.readyState != 4) return; doc = XMLParse(xmlhttp.responseText); var mainNode = doc.getElementsByTagName("form"); if (!mainNode) return; var firstForm = mainNode[0]; if (firstForm.getAttribute("id")=="deleteconfirm") { actionDelete = firstForm.getAttribute("action"); var inputs = firstForm.getElementsByTagName("input"); var token = inputs[2].getAttribute("value"); var formElement = document.createElement("form"); formElement.setAttribute("id", "deleteconfirm"); formElement.setAttribute("method", "post"); formElement.setAttribute("action", actionDelete); var inputToken = document.createElement("input"); inputToken.setAttribute("name", "wpEditToken"); inputToken.setAttribute("value", token); inputToken.setAttribute("type", "hidden"); var inputReason = document.createElement("input"); inputReason.setAttribute("name", "wpReason"); inputReason.setAttribute("value", "Image sans licence"); inputReason.setAttribute("type", "hidden"); var inputConfirm = document.createElement("input"); inputConfirm.setAttribute("name", "wpConfirmB"); inputConfirm.setAttribute("value", "suppression rapide"); inputConfirm.setAttribute("type", "submit"); formElement.appendChild(inputReason); formElement.appendChild(inputConfirm); formElement.appendChild(inputToken); licenceInconnueEraserTemp.appendChild(formElement); } } // LicenceInconnueEraser() - dake function LicenceInconnueEraser() { var allDiv = document.getElementsByTagName("div"); if (!allDiv) return; var titreImage = document.title.replace(" - Wikipédia", ""); for (var i=0;i<allDiv.length;i++) { if (allDiv[i].getAttribute("class")=="alerte") { licenceInconnueEraserTemp = allDiv[i]; if(allDiv[i].innerHTML.indexOf("La licence de cette image n'est pas définie")!=-1) { xmlhttp = HTTPClient(); if (!xmlhttp) return; xmlhttp.open("GET", 'http://en.wikipedia.org/w/index.php?title=' + titreImage + '&action=delete', true); xmlhttp.onreadystatechange = LicenceInconnueEraserHandler; xmlhttp.send(null); } } } } addOnloadHook(LicenceInconnueEraser); /*----------------------------------------------------------------------*/ /* </nowiki></pre> */