Utilisateur:Ayack/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.
//<pre><nowiki> 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("+ bandeau") titles.push("- image") titles.push("- lien ext") titles.push("corr lien int") titles.push("Blanchie") titles.push("Homon") titles.push("MeP") titles.push("ortho/gram") titles.push("retouches") titles.push("ajInfo") titles.push("rangmt") titles.push("recat") titles.push("revert vandalisme") titles.push("Evaluation") var inputs = new Array() inputs.push("+ {{ébauche}}") inputs.push("+ catégorie") inputs.push("+ image") inputs.push("+ liens interwiki") inputs.push("+ portail") inputs.push("+ bandeau") inputs.push("- image manquante") inputs.push("- lien externe") inputs.push("correction lien interne") inputs.push("Page blanchie : essai") inputs.push("Correction des [[Projet:Liens vers les pages d’homonymie|liens vers les pages d’homonymie]]") 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("changement catégorie") inputs.push("Revert vandalisme") inputs.push("Evaluation projet Ecosse") 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 googleOnglet() { 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"><font style="color: blue; font-weight: bold; padding-left: 0.5em">G</font>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikipedia.org+' + pageName + '&btnG=Search">' + 'wp-fr</a>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Awikipedia.org+' + pageName + '&btnG=Search">' + 'wp</a>' + '<a href="http://www.google.fr/search?num=20&hl=fr&safe=off&q=' + pageName + '&btnG=Search&meta=lr%3Dlang_fr">' + 'web-fr</a>' + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search">' + 'web</a>' + '</li>'; } } } addLoadEvent(googleOnglet); 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/vous" + "}}" + "~~" + "~~"; messages[2] = "{{subst:" + "Bienvenue vandale" + "}}" + "~~" + "~~"; messages[3] = "{{subst:" + "Vandalisme|page" + "}}" + "~~" + "~~"; messages[4] = "{{subst:" + "Bienvenue spammeur" + "}}" + "~~" + "~~"; messages[5] = "{{subst:" + "Utilisateur:Dake/Traité||~~" + "~~" + "}}"; messages[6] = "{{subst:" + "Utilisateur:Dake/TraitéConserver||~~" + "~~" + "}}"; messages[7] = "{{subst:" + "Utilisateur:Dake/TraitéSupprimer||~~" + "~~" + "}}"; 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}}"; messages[14] = "{{Portail Écosse}}"; 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://upload.wikimedia.org/wikipedia/fr/a/ad/Button_vandale2.png"; images[4] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png"; images[5] = "http://upload.wikimedia.org/wikipedia/fr/d/d9/Button_trait%C3%A9.png"; images[6] = "http://upload.wikimedia.org/wikipedia/fr/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" images[14] = "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" commentaires[14] = "+ Portail" //////////////////////////////// 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; } addLoadEvent(DeluxeBar); function addLoadEvent(func) { if (window.addEventListener) { window.addEventListener("load", func, false); } else if (window.attachEvent) { window.attachEvent("onload", func); } } function addLoadEvent(func) { if (window.addEventListener) { window.addEventListener("load", func, false); } else if (window.attachEvent) { window.attachEvent("onload", func); } } 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/Wikip%C3%A9dia:Demande_de_suppression_imm%C3%A9diate">Suppression immédiate</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/User:Ayack/monobook.js">Monobook.js</a></li>' + ' <li><a href="irc://irc.wikimedia.org/fr.wikipedia">#fr.wikipedia</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Portail:%C3%89cosse">Portail Écosse</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Projet:%C3%89cosse">Projet Écosse</a></li>' + ' <li><a href="http://fr.wikipedia.org/wiki/Cat%C3%A9gorie:Article_sur_l%27%C3%89cosse_d%27importance_inconnue">À évaluer</a></li>' + ' </ul>' + ' </div>' + '</div> '; } } addLoadEvent(nouvelleBoite); /* ========================================================================================= */ /* Aide au revert */ /* (src: en.wikipedia.org/wiki/Wikipedia_talk:WikiProject_User_scripts/Scripts/Revert_tools) */ /* ========================================================================================= */ //On diff pages this script replaces ''(Difference between revisions)''with //different tools for reverting the edit and warning the user that made the edit. //For instructions see talk page. // Revert tools by Lorian function getElementsByClass(searchClass,node,tag) { // Function from http://www.dustindiaz.com/getelementsbyclass/ var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } // _GET code from NoGray JS Library http://www.nogray.com/new_site/ var _GET = new Array(); var _uri = location.href; var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&"); var _temp_get_arr_1 = new Array(); for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){ _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("="); _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]); } delete _uri; delete _temp_get_arr; delete _temp_get_arr_1; function getMessage (where, user1, user2) { var message = prompt ('What message would you like to leave?', ''); window.location = 'http://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message; } addOnloadHook(function (){ if (location.href.match(/diff=/)) { // Get username of submitter var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML; var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[2].innerHTML; document.getElementById('contentSub').innerHTML = '(<a href="http://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">Revert</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">Message</a>) (<a href="http://fr.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&vandalism=1&user1='+user1+'&user2='+user2+'">Vandalisme</a> / <a href="javascript:var message = getMessage(\'vandalism\', \''+user1+'\', \''+user2+'\');">Message</a>) (Avertissement: <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=1">Coucou</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=2">Test 0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=3">Test 1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=4&article_name='+_GET['title']+'">Vandale IP</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=5&article_name='+_GET['title']+'">Spammeur</a>)'; } else if (location.href.match(/revert=1/)) { document.getElementById('wpSummary').value = 'Révocation des modifications de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] et retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]'; document.getElementById('editform').submit(); } else if (location.href.match(/revert=2/)) { document.getElementById('wpSummary').value = 'Révocation des modifications de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] et retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')'; document.getElementById('editform').submit(); } else if (location.href.match(/vandalism=1/)) { document.getElementById('wpSummary').value = 'Révocation du vandalisme de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']]. Retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]'; document.getElementById('editform').submit(); } else if (location.href.match(/vandalism=2/)) { document.getElementById('wpSummary').value = 'Révocation du vandalisme de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']]. Retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=1/)) { document.getElementById('wpSummary').value = 'Coucou'; document.getElementById('wpTextbox1').value = '{{sub'+'st:coucou}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=2/)) { document.getElementById('wpSummary').value = 'Avertissement Vandale'; document.getElementById('wpTextbox1').value = '{{sub'+'st:Test 0}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=3/)) { document.getElementById('wpSummary').value = 'Avertissement Vandale'; document.getElementById('wpTextbox1').value = '{{sub'+'st:Test 1}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=4/)) { document.getElementById('wpSummary').value = 'Avertissement Vandale'; document.getElementById('wpTextbox1').value = '{{sub'+'st:Vandalisme IP|' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=5/)) { document.getElementById('wpSummary').value = 'Avertissement Vandale'; document.getElementById('wpTextbox1').value = '{{sub'+'st:bienvenue spammeur|' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} ~~'+'~~'; document.getElementById('editform').submit(); } }); /* */ loadJs('Utilisateur:EDUCA33E/LiveRC.js'); //<pre><nowiki> /* * EvaluationDeluxe * * La fonction EvalProject ajoute un ou plusieurs boutons qui ouvrent un popup d'évaluation * sur un ou plusieurs projets donné. Le bouton n'est ajouté que sur les pages de discussion * des articles. * * Un modèle d'évaluation de projet sera mis à jour ou ajouté sur la page de * discussion concernée. * * Auteurs : Ugo14 * Date de dernière révision : */ //////////////////////ZONE PERSONNALISABLE////////////////////// var evalProjectButtons = new Array(); var evalProjectNames = new Array(); with (evalProjectButtons) { push("http://upload.wikimedia.org/wikipedia/commons/7/73/Button_iran.png"); //push(""); donne le bouton vide } with (evalProjectNames) { push("Écosse"); } /////////////////FIN DE LA ZONE PERSONNALISABLE///////////////// function popupEvalProject(project) { var pattern=new RegExp("\\{\\{Wikiprojet "+project+".*\\}\\}","i"); var found=document.editform.wpTextbox1.value.match(pattern); var aa="inconnu"; var ii="inconnue"; var chki=new Array(); var chka=new Array(); for (i=0;i<4;i++) {chki[i]="";} for (i=0;i<6;i++) {chka[i]="";} if (found) { if (found[0].match(/importance=faible/i)) { ii="faible"; chki[0]="checked"; } else if (found[0].match(/importance=moyenne/i)) { ii="moyenne"; chki[1]="checked"; } else if (found[0].match(/importance=élevée/i)) { ii="élevée"; chki[2]="checked"; } else if (found[0].match(/importance=maximum/i)) { ii="maximum"; chki[3]="checked"; } if (found[0].match(/avancement=ébauche/i)) { aa="ébauche"; chka[0]="checked"; } else if (found[0].match(/avancement=BD/i)) { aa="BD"; chka[1]="checked"; } else if (found[0].match(/avancement=BA/i)) { aa="BA"; chka[3]="checked"; } else if (found[0].match(/avancement=B/i)) { aa="B"; chka[2]="checked"; } else if (found[0].match(/avancement=AdQ/i)) { aa="AdQ"; chka[5]="checked"; } else if (found[0].match(/avancement=A/i)) { aa="A"; chka[4]="checked"; } } var popup = window.open('','name',''); javaCode = '<script type="text\/javascript">var a="'+aa+'"; var i="'+ii+'"; function insertCode(){'; javaCode += "var textarea=window.opener.document.editform.wpTextbox1.value; "; javaCode += 'var pattern=new RegExp("\\\\{\\\\{Wikiprojet '+project+'.*\\\\}\\\\}","i"); '; javaCode += 'if (textarea.match(pattern)) { '; javaCode += 'window.opener.document.editform.wpTextbox1.value='; javaCode += 'textarea.replace(pattern,"{{Wikiprojet '+project+'|importance="+i+"|avancement="+a+"}}"); '; javaCode += ' }else{ '; javaCode += 'window.opener.insertTags("","{{Wikiprojet '+project+'|importance="+i+"|avancement="+a+"}}",""); '; javaCode += ' } '; javaCode += 'window.opener.document.editform.wpSummary.value ="Évaluation wikiprojet '+project+' : importance="+i+", avancement="+a; '; javaCode += '} <\/script>'; popup.document.write('<html><head><title>Évaluation de '+wgTitle+' pour le projet '+project+'</title>'); popup.document.write('<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><!-- wikibits js --><\/script>'); popup.document.write('<style type="text\/css" media="screen projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>'); popup.document.write(javaCode); popup.document.write('</head><body>'); popup.document.write('<h1>Évaluation de <b>'+wgTitle+'</b> dans le cadre du projet <b>'+project+'</b></h1>'); popup.document.write('<p><center><form name="paramForm">'); popup.document.write('<table cellpading=1 cellspacing=0>'); popup.document.write('<tr><th colspan=2>Avancement</th><th colspan=2>Importance</th></tr>'); popup.document.write('<tr><td bgcolor="#6699ff"><input type="radio" name="avancement" onCLick="a=\'AdQ\'" '+chka[5]+'></td>'); popup.document.write('<td bgcolor="#6699ff">AdQ</td>'); popup.document.write('<td bgcolor="#ff00ff"><input type="radio" name="importance" onClick="i=\'maximum\'" '+chki[3]+'></td>'); popup.document.write('<td bgcolor="#ff00ff">maximum</td></tr>'); popup.document.write('<tr><td bgcolor="#66ffff"><input type="radio" name="avancement" onClick="a=\'A\'" '+chka[4]+'></td>'); popup.document.write('<td bgcolor="#66ffff">A</td>'); popup.document.write('<td bgcolor="#ff88ff"><input type="radio" name="importance" onClick="i=\'élevée\'" '+chki[2]+'></td>'); popup.document.write('<td bgcolor="#ff88ff">élevée</td></tr>'); popup.document.write('<tr><td bgcolor="#66ff66"><input type="radio" name="avancement" onClick="a=\'BA\'" '+chka[3]+'></td>'); popup.document.write('<td bgcolor="#66ff66">BA</td>'); popup.document.write('<td bgcolor="#ffccff"><input type="radio" name="importance" onClick="i=\'moyenne\'" '+chki[1]+'></td>'); popup.document.write('<td bgcolor="#ffccff">moyenne</td></tr>'); popup.document.write('<tr><td bgcolor="#ffff66"><input type="radio" name="avancement" onClick="a=\'B\'" '+chka[2]+'></td>'); popup.document.write('<td bgcolor="#ffff66">B</td>'); popup.document.write('<td bgcolor="#ffeeff"><input type="radio" name="importance" onClick="i=\'faible\'" '+chki[0]+'></td>'); popup.document.write('<td bgcolor="#ffeeff">faible</td></tr>'); popup.document.write('<tr><td bgcolor="#ffaa66"><input type="radio" name="avancement" onClick="a=\'BD\'" '+chka[1]+'></td>'); popup.document.write('<td bgcolor="#ffaa66">BD</td>'); popup.document.write('<td></td>'); popup.document.write('<td></td></tr>'); popup.document.write('<tr><td bgcolor="#ff6666"><input type="radio" name="avancement" onClick="a=\'ébauche\'" '+chka[0]+'></td>'); popup.document.write('<td bgcolor="#ff6666">ébauche</td>'); popup.document.write('<td></td>'); popup.document.write('<td></td></tr>'); popup.document.write('</table>'); popup.document.write('<p>'); popup.document.write('<input type="submit" value="Évaluer" onClick="javascript:insertCode();javascript:self.close()">'); popup.document.write('<input type="submit" value="Annuler" onClick="javascript:self.close()">'); popup.document.write('</form></center>'); popup.document.write('<iframe id="article" src="http://fr.wikipedia.org/wiki/'+wgTitle+'" width="100%" height="75%" align="bottom"></iframe>'); popup.document.write('</body></html>'); popup.document.close(); } function EvalProject () { if ((wgAction != "edit") || (wgCanonicalNamespace != "Talk")) return false; if (document.createTextNode) { var toolbar = document.getElementById("toolbar"); if (!toolbar) return; for(var i = 0; i < evalProjectNames.length; i ++) { var img = document.createElement("img"); if (evalProjectButtons[i]==undefined || evalProjectButtons[i]=="") { img.setAttribute("src","http://upload.wikimedia.org/wikipedia/fr/8/84/Button_vide.png"); } else { img.setAttribute("src", evalProjectButtons[i]); } var ref = document.createElement("a"); ref.setAttribute("href", "javascript:popupEvalProject('"+evalProjectNames[i]+"');"); ref.setAttribute("title", "Évaluation projet "+evalProjectNames[i]); ref.appendChild(img); toolbar.appendChild(ref); } } } addLoadEvent(EvalProject); //</nowiki></pre>[[Catégorie:MediaWiki:Fonction Monobook en JavaScript]] function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); } function OptimizedSuivi() { if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Liste_de_suivi")==0 || document.URL.indexOf("http://fr.wikipedia.org/w/index.php?title=Special:Liste_de_suivi")==0 ){ var admin = (wgUserGroups.indexOf("sysop") != -1); 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 ma = articleName.match(/^Special:Log\/(.*)$/); if(ma) { var lien; if(ma[1] == "newusers") lien = aTag[1]; else if(admin) lien = aTag[5]; // lien supplémentaire (bloquer) else lien = aTag[4]; if(lien.className == "new") articleName = lien.title.replace(/ \(page inexistante\)$/, ""); else articleName = lien.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); } } } } } addLoadEvent(OptimizedSuivi);