Utilisateur:Wart Dark/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.
// En cas de problèmes consultez l'aide du modèle le programmeur concerné //----------------------------------------------------------------------------------Useful functions document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/ufunctions.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_noajax.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //---------------------------------------------------------------------------------- document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Modèle:Ligne Wikipompiers/code.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:WartDark/spy.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); //---------------------------------------------------------------------------------- obtenir("EditZeroth"); //---------------------------------------------------------------------------------- document.write('<SCRIPT SRC="http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupFixDabs='true'; popupFixRedirs='true'; popupLoadImagesSequentially='true'; popupStructure='original'; popupAdminLinks=true; //---------------------------------------------------------------------------------- document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Leag/popups-strings-fr.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /***********************************************************/ /* Variables pour activer/desactiver les fonctionnalitées */ var deactivateAll = false; var activateSuiviManager = true; var activateImageUse = true; var activateCategoryUse = true; var activateGlobalSearch = false; var activateOptimizedSuivi = false; var activateDeluxeBar = true; var activateResumeDeluxe = true; // Tout désactiver if (deactivateAll) { activateImageUse = false; activateCategoryUse = false; activateGlobalSearch = false; activateOptimizedSuivi = false; activateDeluxeBar = false; activateResumeDeluxe = true; } /**************************************************************/ /* Ajoute deux liens sur les liens rouges en prévisualisation */ /* Ne marche que sur Opera, voir texte */ /* Auteur : Seb35 */ /**************************************************************/ function liensRouges_main() { if(!/\=submit/i.test(window.location)) return; //Retirer cette ligne pour afficher ces liens tout le temps, non uniquement en prévisualisation 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'); allLinks[i].insertAdjacentHTML('afterEnd', ' (' + '<a title="Rechercher \'' + titre + '\'" href="http://www.google.com/search?num=100&q=' + titre + '+site:fr.wikipedia.org">google</a>; ' + '<a title="Pages liées à \'' + titre + '\'" href="/wiki/Special:Whatlinkshere/' + titre + '">liées</a>)'); } } } addLoadEvent(liensRouges_main); /***********************************************************/ // Auteur : Verdy P. (inspiré d'une protoversion de Wart Dark) var articleAccueilPerso = "Special:Mypage/Accueil"; // Votre page d'accueil // Convertit le nom d’article en chemin absolu var cheminAccueilPerso = "/wiki/" + articleAccueilPerso; // Redirection immédiate vers votre accueil personnel en cas de chargement de la page d’accueil par défaut if (window.location.pathname != cheminAccueilPerso && window.location.pathname == "/wiki/Accueil" && window.location.search == "") window.location.pathname = cheminAccueilPerso; // Modifie les liens affichés dans la barre de navigation de toutes les pages une fois chargées function liensAccueilPerso() { var element = document.getElementById("p-logo").getElementsByTagName("a")[0]; element.setAttribute("href", cheminAccueilPerso); element.setAttribute("title", articleAccueilPerso); element = document.getElementById("n-mainpage").getElementsByTagName("a")[0]; element.setAttribute("href", "/wiki/Accueil?1"); } addLoadEvent(liensAccueilPerso); /***********************************************************/ /* Lien Editcount */ // Auteur : Educa33e var tabAction = "p-cactions"; function addECButton() { if ( window.location.href.indexOf('Contributions') < 0) return; var c = document.getElementById('contentSub'); var a = c.getElementsByTagName('a'); name = a[0].innerHTML; 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='http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?user="+escape(name)+"&dbname=frwiki_p'>"+ "<div id='EditCount' style='display:inline;'>" + "Editcount" + "</div></a></li>"; l.innerHTML = before + pitem + after ; } addLoadEvent(addECButton); /*********************************/ // restauration avec boîte cochée d'office // Auteur : Gôtô obtenir("RestaurationDeluxe"); /*********************************/ /* Recherche avancée multilingue */ /* Auteur : Seb35 */ /*********************************/ function advancedResearch_main() { //document.getElementById('searchform').style.display = 'none'; a = document.getElementById('p-search').getElementsByTagName('div')[0]; a.innerHTML = a.innerHTML + '<form id="ad-search" name="adsearch">' + '<input type="textbox" id="ad-input" name="adinput" value="" style="font-size:95%;" />' + '<br />' + '<input type="radio" id="ad-all" name="adlang" />all' + '<input type="radio" id="ad-fr" name="adlang" checked />fr' + '<input type="radio" id="ad-en" name="adlang" />en' + '<input type="radio" id="ad-de" name="adlang" />de' + '<span id="ad-other">' + '<input type="radio" name="adlang" onFocus="if(document.adsearch.adotherlang.value == \'\') document.adsearch.adotherlang.focus();" style="vertical-align:top;" />' + '<input type="textbox" name="adotherlang" value="" size="2" maxlength="12" onBlur="if(document.adsearch[5].checked && document.adsearch.adotherlang.value == \'\') document.adsearch[2].checked = true;" style="font-size:95%;" />' + '</span>' + '<input type="checkbox" name="mode" id="ad-mode" style="vertical-align:top;" />' + '<br />' + '<input type="button" id="ad-lire" value="l" onClick="go(1)" style="font-size:95%;" />' + '<input type="button" id="ad-wiki" value="w" onClick="go(2)" style="font-size:95%;" />' + '<input type="button" id="ad-google" value="g" onClick="go(3)" style="font-size:95%;" />' + '<input type="button" id="ad-reset" value="r" onClick="if(document.adsearch.adinput.value == \'\') { if(document.adsearch[2].checked == true) document.adsearch.adotherlang.value = \'\'; document.adsearch[2].checked = true; } document.adsearch.adinput.value=\'\'; document.adsearch.adinput.focus();" style="font-size:95%;" />' + '<input type="button" id="ad-cpr" value="c" onClick="go(4)" style="font-size:95%;" />' + '</form>'; } /************************************/ /* Fonction auxiliaire de recherche */ /* Auteur : Seb35 */ /************************************/ function go(motor) { var nbresultats = 100; //Nombre de résultats sur Google var raccourcis = new Array( //Attention à l'ordre, le tableau est parcouru dans l'ordre donc il faut mettre /css avec /c :O /(.*)\/js$/i, 'User:$1/monobook.js', 'Utilisateur:$1/monobook.js', /(.*)\/css$/i, 'User:$1/monobook.css', 'Utilisateur:$1/monobook.css', /(.*)\/c$/i, 'Special:Contributions/$1', 'Special:Contributions/$1', /(.*)\/i[aà]s/i, '$1', 'Wikipédia:Images_à_supprimer/$1', /(.*)\/lann/i, '$1', 'Wikipédia:Liste_des_articles_non_neutres/$1', /(.*)\/p[aà]s/i, '$1', 'Wikipédia:Pages_à_supprimer/$1', /(.*)\/p[aà]v/i, '$1', 'Wikipédia:Pages_à_vérifier/$1', /^d:(.*)/i, 'Talk:$1', 'Discuter:$1', /^dc(?:at)?:(.*)/i, 'Category_talk:$1', 'Discussion_Catégorie:$1', /^dm:(.*)/i, 'Template_talk:$1', 'Discussion_Modèle:$1', /^dp:(.*)/i, 'Portal_talk:$1', 'Discussion_Portail:$1', /^du:(.*)/i, 'User_talk:$1', 'Discussion_Utilisateur:$1', /^dw:(.*)/i, 'Project_talk:$1', 'Discussion_Wikipédia:$1', /^c(?:at)?:(.*)/i, 'Category:$1', 'Catégorie:$1', /^m:(.*)/i, 'Template:$1', 'Modèle:$1', /^mw:(.*)/i, 'MediaWiki:$1', 'MediaWiki:$1', /^p:(.*)/i, 'Portal:$1', 'Portail:$1', /^u:(.*)/i, 'User:$1', 'Utilisateur:$1', /^w:(.*)/i, 'Project:$1', 'Wikipédia:$1', /(.*)--$/i, 'Special:Recentchangeslinked/$1', 'Special:Recentchangeslinked/$1', /(.*)-$/i, 'Special:Whatlinkshere/$1', 'Special:Whatlinkshere/$1' ); var serveurs = new Array( //Les noms de raccourcis doivent être disjoints dans leur ensemble, y compris avec les noms de langue ISO /^c(?:ommons)?\.$/i, '', 'commons.wikimedia.org', /^f(?:ou?ndation)?\.$/i, '', 'wikimediafoundation.org', /^m(?:eta)?\.$/i, '', 'meta.wikimedia.org', /^s(?:pecies)?\.$/i, '', 'species.wikipedia.org', /^(.*)\.b\.$/i, '$1' + '.', 'wikibooks.org', /^(.*)\.n\.$/i, '$1' + '.', 'wikinews.org', /^(.*)\.q\.$/i, '$1' + '.', 'wikiquote.org', /^(.*)\.s\.$/i, '$1' + '.', 'wikisource.org', /^(.*)\.wikt\.$/i, '$1' + '.', 'wiktionary.org' ); //Déclaration des variables nom = new String(); urllanguage = new String(); urlserver = new String(); urlmotor = new String(); //Récupération de la requête nom = document.adsearch.adinput.value; //Pseudo-raccourcis var pseudoraccourcis = new Array( //Ne pas modifier /^h:(.*)/i, 6, /^e:(.*)/i, 7, /^g:(.*)/i, 3, /^go:(.*)/i, 5, /^h:(.*)/i, 6, /^e:(.*)/i, 7 ); for(i = 0; i<(pseudoraccourcis.length)/2; i++) { if(pseudoraccourcis[2*i].test(nom)) { nom = nom.replace(pseudoraccourcis[2*i], '$1'); motor = pseudoraccourcis[2*i+1]; if(motor == 6 || motor == 7) break; } } //Page au hasard if(nom == '#' && motor < 6) { nom = 'Special:Random'; motor = 1; } //Vérifie les incompatibilités if(document.adsearch[1].checked && (motor == 1 || motor == 2 || motor == 6 || motor == 7)) return; //Raccourcis de recherche nom_simple = nom; for(i = 0; i<(raccourcis.length)/3; i++) { if(raccourcis[3*i].test(nom)) { nom_simple = nom_simple.replace(raccourcis[3*i], '$1'); if(document.adsearch[2].checked) nom = nom.replace(raccourcis[3*i], raccourcis[3*i+2]); else nom = nom.replace(raccourcis[3*i], raccourcis[3*i+1]); } } if(!/Spe[cz]ial(?::|%3A)/i.test(window.location)) TitreDePage = document.title.replace(/^(?:modification de )?(.+) -(?:.*)/i, '$1').replace(/^(.*) -(?:.*)/i, '$1').replace(/^(.*) \((?:.*)\)/i, '$1'); else TitreDePage = 'Special:' + window.location.toString().replace(/(?:.*)Spe[cz]ial(?::|%3A)(.+)/i, '$1').replace(/(.+)&(?:.*)/i, '$1').replace(/(.+)&(?:.*)/i, '$1').replace(/(.+)&(?:.*)/i, '$1').replace(/(.+)&(?:.*)/i, '$1').replace(/(.+)\/(?:.*)/i, '$1'); //Pseudo-raccourci '_' pour le nom de la page courante if(nom_simple == '_') { tmp = TitreDePage; if(!document.adsearch[2].checked) { for(i = 0; i<(raccourcis.length)/3; i++) { tmp2 = new RegExp(raccourcis[3*i+2].replace('$1', '(.*)'), 'i'); if(tmp2.test(tmp)) tmp = tmp.replace(tmp2, raccourcis[3*i+1]); } } nom = nom.replace(/_/i, tmp); } //Pseudo-raccourci '__' pour le nom de la page courante sans le namespace if(nom_simple == '__') nom = nom.replace(/__/i, TitreDePage.replace(/^(?:(?:Media|Discuter|Utilisateur|Discussion Utilisateur|Wikipédia|Discussion Wikipédia|Image|Discussion Image|MediaWiki|Discussion MediaWiki|Modèle|Discussion Modèle|Aide|Discussion Aide|Catégorie|Discussion Catégorie|Portail|Discussion Portail|Référence|Discussion Référence):)?(.+)/i, '$1')); //Aller à la page principale de google ou quitter s'il n'y a pas de recherche if(!nom) { if(motor >= 3 && motor <= 5) open('http://www.google.com', '_blank', 'location=yes'); if(motor != 1) return; } //Récupération de la langue urlserver = 'wikipedia.org'; urllanguage = 'fr.'; if(document.adsearch[1].checked) urllanguage = 'all'; else if(document.adsearch[3].checked) urllanguage = 'en.'; else if(document.adsearch[4].checked) urllanguage = 'de.'; else if(document.adsearch[5].checked) { urllanguage = document.adsearch.adotherlang.value + '.'; if(urllanguage == '.' && (motor == 1 || motor == 2 || motor == 6 || motor ==7)) return; if(urllanguage == '639.') { open('http://fr.wikipedia.org/wiki/Utilisateur:Hégésippe_Cormier/préfixes_et_noms_de_langues', '_blank', 'location=yes'); return; } if(urllanguage == 'liste.') { open('/wiki/Special:SiteMatrix', '_blank', 'location=yes'); return; } for(i = 0; i<(serveurs.length)/3; i++) { if(serveurs[3*i].test(urllanguage)) { urllanguage = urllanguage.replace(serveurs[3*i], serveurs[3*i+1]); urlserver = serveurs[3*i+2]; break; } } } //Entrée de l'url if(motor == 1) urlmotor = 'http://' + urllanguage + urlserver + '/wiki/' + nom; else if(motor == 2) urlmotor = 'http://' + urllanguage + urlserver + '/w/index.php?title=Special%3ASearch&search=' + nom + '&fulltext=Recherche'; else if(motor == 3 && urllanguage == 'all') urlmotor = 'http://www.google.com/search?num=' + nbresultats + '&q=' + nom + '+site:' + urlserver; else if(motor == 3) urlmotor = 'http://www.google.com/search?num=' + nbresultats + '&q=' + nom + '+site:' + urllanguage + urlserver; else if(motor == 4) urlmotor = 'http://www.google.com/search?num=' + nbresultats + '&q=%22' + nom + '%22'; else if(motor == 5) urlmotor = 'http://www.google.com/search?num=' + nbresultats + '&q=' + nom; else if(motor == 6) urlmotor = 'http://' + urllanguage + urlserver + '/w/index.php?title=' + nom + '&action=history'; else if(motor == 7) urlmotor = 'http://' + urllanguage + urlserver + '/w/index.php?title=' + nom + '&action=edit'; //Ouverture if(document.adsearch[7].checked) window.location = urlmotor; else open(urlmotor, '_blank', 'location=yes'); } addLoadEvent(advancedResearch_main); /***********************************************************/ // Auteur : Anakin // Dernière mise à jour : 11 décembre 2005 function ImageUse() { var element = document.getElementById('ca-nstab-image'); if (element) { var imagename = element.firstChild.href; var indexofname; if (imagename.indexOf("http://") != -1) indexofname = imagename.indexOf(":", 6); else indexofname = imagename.indexOf(":"); imagename = imagename.substring(indexofname + 1); var indexofampersand = imagename.indexOf("&"); if (indexofampersand != -1) imagename = imagename.substring(0, indexofampersand); var li = document.createElement('li'); li.id = 'ca-imageuse'; var a = document.createElement('a'); a.appendChild(document.createTextNode("Voir l'utilisation")); a.href = 'http://www.juelich.de/avatar/check-usage/check-usage.php?filename=' + imagename + '&template'; li.appendChild(a); document.getElementById('ca-nstab-image').parentNode.appendChild(li); } } addLoadEvent(ImageUse); /***********************************************************/ // Auteur : Anakin // Dernière mise à jour : 11 décembre 2005 function CategoryTree() { var element = document.getElementById('ca-nstab-category'); if (element) { var categoryname = element.firstChild.href; categoryname = categoryname.substring(7); var wikiname = categoryname.substring(0, categoryname.indexOf('.')); var indexofname = categoryname.indexOf(":") + 1; categoryname = categoryname.substring(indexofname); var indexofampersand = categoryname.indexOf("&"); if (indexofampersand != -1) categoryname = categoryname.substring(0, indexofampersand); var li = document.createElement('li'); li.id = 'ca-categorytree'; var a = document.createElement('a'); a.appendChild(document.createTextNode("Arborescence")); a.href = 'http://tools.wikimedia.de/~daniel/WikiSense/CategoryTree.php?wiki=' + wikiname + '&art=on&cat=' + categoryname; li.appendChild(a); document.getElementById('ca-nstab-category').parentNode.appendChild(li); } } addLoadEvent(CategoryTree); /***********************************************************/ function fill_empty_vfd() { var url_name = 'http://fr.wikipedia.org/w/index.php?title=' var vfd_name = 'Wikip%C3%A9dia:Pages_%C3%A0_supprimer/' var page_name = document.URL; var index = page_name.indexOf(url_name + vfd_name); var text_area = document.editform.wpTextbox1; if (index != -1 && text_area.value.length == 0) { page_name = page_name.slice((url_name + vfd_name).length); page_name = page_name.split('&')[0]; page_name = decodeURI(page_name); page_name = page_name.replace(/_/g, ' ') var comment = "<!-- Sauver la page pour l'initialiser puis suivre les instructions -->"; var template = '{{subst:' + 'Initialiser PàS|' + page_name + '|~~' + '~}}'; text_area.value = comment + '\n' + template; } } addLoadEvent(fill_empty_vfd); 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:" + "Utilisateur:Wart Dark/Bienvenue sur ta page" + "}}" + "~~" + "~~"; messages[1] = "{{subst:" + "Bienvenue" + "}}" + "~~" + "~~"; messages[2] = "{{subst:" + "Vandalisme IP|page" + "}}" + "~~" + "~~"; messages[3] = "{{subst:" + "Bienvenue spammeur" + "}}" + "~~" + "~~"; messages[4] = "{{subst:" + "Utilisateur:Dake/Traité||~~" + "~~" + "}}"; messages[5] = "{{subst:" + "Utilisateur:Dake/TraitéConserver||~~" + "~~" + "}}"; messages[6] = "{{subst:" + "Utilisateur:Dake/TraitéSupprimer||~~" + "~~" + "}}"; messages[7] = "{{" + "À recycler" + "}}"; 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|-|~~" + "~~}}"; 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/a/ad/Button_vandale2.png"; images[3] = "http://upload.wikimedia.org/wikipedia/fr/f/fb/Button_spam2.png"; images[4] = "http://upload.wikimedia.org/wikipedia/fr/d/d9/Button_trait%C3%A9.png"; images[5] = "http://upload.wikimedia.org/wikipedia/fr/a/ae/Button_trait%C3%A9conserver.png"; images[6] = "http://upload.wikimedia.org/wikipedia/fr/9/96/Button_trait%C3%A9supprimer.png"; images[7] = "http://upload.wikimedia.org/wikipedia/fr/4/4d/Button_recyclage.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"; var commentaires = new Array() commentaires[0] = "Bienvenue sur ta page !" commentaires[1] = "Bienvenue !" commentaires[2] = "Avertissement vandalisme"; commentaires[3] = "Avertissement spam" ; commentaires[4] = "Traité" commentaires[5] = "Traité : page conservée" commentaires[6] = "Traité : page supprimée" commentaires[7] = "À recycler"; 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" //////////////////////////////// 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 changeSummary(sampleText) { var txtarea = document.editform.wpSummary; // IE if(document.selection && !is_gecko) { var theSelection = document.selection.createRange().text; if(!theSelection) { theSelection=sampleText;} txtarea.focus(); if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any theSelection = theSelection.substring(0, theSelection.length - 1); document.selection.createRange().text = theSelection + " "; } else { document.selection.createRange().text = theSelection ; } // Mozilla } else if(txtarea.selectionStart || txtarea.selectionStart == '0') { var replaced = false; var startPos = txtarea.selectionStart; var endPos = txtarea.selectionEnd; if(endPos-startPos) replaced=true; var scrollTop=txtarea.scrollTop; var myText = (txtarea.value).substring(startPos, endPos); if(!myText) { myText=sampleText;} if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any subst = myText.substring(0, (myText.length - 1)) + " "; } else { subst = myText ; } txtarea.value = txtarea.value.substring(0, startPos) + subst + txtarea.value.substring(endPos, txtarea.value.length); txtarea.focus(); //set new selection if(replaced){ var cPos=startPos+(myText.length); txtarea.selectionStart=cPos; txtarea.selectionEnd=cPos; }else{ txtarea.selectionStart=startPos; txtarea.selectionEnd=startPos+myText.length; } txtarea.scrollTop=scrollTop; // All other browsers get no toolbar. // There was previously support for a crippled "help" // bar, but that caused more problems than it solved. } // reposition cursor if possible if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate(); } /***********************************************************/ 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>'; } } } addLoadEvent(nouvelOnglet); function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); } /***********************************************************/ obtenir("OptimizedSuivi"); /***********************************************************/ obtenir("OptimizedShort"); /***********************************************************/ function Supernavigation() { var a = document.getElementById("p-navigation"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><span id="n-bistro" title="Wikipédia:Le Bistro">' + '<a href="/w/index.php?title=Wikip%C3%A9dia:Le_Bistro&action=purge">' + 'Bistro</a></span>' + '<li>' + '<span id="n-pas" title="Wikipédia:Bot/Requêtes">' + '<a href="/w/index.php?title=Wikipédia:Bot/Requêtes&action=purge">' + 'Bots</a></span>' + '<li>' + '<span id="n-paf" title="Boîte à outils">' + '<a href="/w/index.php?title=Utilisateur:Wart Dark/Boîte à outils">' + 'Outils</a></span></li>' + '<li>' + '<span id="n-bistro" title="Requêtes aux administrateurs">' + '<a href="/w/index.php?title=Wikipédia:Requête aux administrateurs">' + 'WP:RA</a></span>' + '<li>' + '<span id="n-bistro" title="Coordination de la maintenance ">' + '<a href="/w/index.php?title=Wikipédia:Coordination des pages de maintenance">' + ' WP:CM </a></span>' } } } addLoadEvent(Supernavigation); /***********************************************************/ 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>' } } } addLoadEvent(PaletteOutils); //////////////////////////////////////// function morelinks() { var tabs = document.getElementById('p-cactions').cloneNode(true); tabs.id = 'mytabs'; var listitems = tabs.getElementsByTagName('LI'); for (i=0;i<listitems.length;i++) { if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id; } document.getElementById('column-content').appendChild(tabs); } if (window.addEventListener) window.addEventListener("load",morelinks,false); else if (window.attachEvent) window.attachEvent("onload",morelinks); //////////////////////////////////////// // Résumé Deluxe // Fonction ResumeDeluxeModif // // Code : Dake & Modifications de GôTô function addToSummary(str) { if (document.editform.wpSummary.value != 0) { document.editform.wpSummary.value+=' - '; } 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 = "100%" var titles = new Array() titles.push("Ortho") titles.push("Wiki") titles.push("style") titles.push("+ Ébauche") titles.push("+ Cat") titles.push("Commons") titles.push("- Lien rouge") var inputs = new Array() inputs.push("Orthographe") inputs.push("Wikification") inputs.push("style") inputs.push("ébauchage") inputs.push("catégorisation") inputs.push("Remplacement image par version de Commons") inputs.push("Correction lien rouge") 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) //////////////////////////////////////// // [[User:Lupin/popups.js]] document.write('<SCRIPT SRC="http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js&action=raw&ctype=text/javascript&dontcountme=s"></script>'); popupFixDabs='true'; popupFixRedirs='true'; popupLoadImagesSequentially='true'; popupStructure='original'; function PerformBlock() { var l, target = ''; // Look for '&faketarget=XXX' in URL url = location.pathname; l = location.search.substring(1).split('&'); for (i = 0; i < l.length; i++) { var n = l[i].indexOf('='); if (l[i].substring(0, n) == 'faketarget') { target = l[i].substring(n + 1); } } if (!target) return; form = document.getElementById('blockip'); if (!form) return; input = form.getElementsByTagName('input')[0]; input.value = target; } function AddBlockButtons() { var l, article = '', vandal; // Add 'block' links to a diff page l = document.getElementById('t-emailuser'); if (l) { clone = l.cloneNode(true); l.id = 't-blockuser'; a = clone.getElementsByTagName('a')[0]; a.href = a.href.replace(/Special:Emailuser/, 'Special:Blockip'); a.href = a.href.replace(/target=/, 'faketarget='); a.innerHTML = blocklink; l.parentNode.insertBefore(clone, l.nextSibling); } } if (window.addEventListener) { window.addEventListener("load", PerformBlock, false); window.addEventListener("load", AddBlockButtons, false); } else if (window.attachEvent) { window.attachEvent("onload", PerformBlock); window.attachEvent("onload", AddBlockButtons); } /****************************************************/ /* boutons prédéfinis pour justifier une suppression*/ /* Auteur : GôTô, personnalisé par Wart Dark*/ /****************************************************/ function SuppressionDeluxe() { 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("Redirect orphelin") titles.push("Bac à sable") titles.push("Commons") titles.push("Commons idem") titles.push("Copyvio") titles.push("Fusion") titles.push("Purge d’historique") titles.push("IàS") titles.push("PàS") titles.push("Renommage") var inputs = new Array() inputs.push("Page supprimée à la demande de son auteur ([[Utilisateur:getInput()]])") inputs.push("Redirection cassée") inputs.push("Essai de débutant") inputs.push("Image sur [[commons:getInput()]]") inputs.push("Image sur [[commons:getDeletionName()]]") inputs.push("Violation de copyright") 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("Suppression pour inversion de redirection") 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> " } strLinks += "<br /> <center><a href=\"javascript:saveHist('" + getDeletionName() + "')\" class=\"sumlink\" title=\"Obtenir l'historique\">Lire historique</a> <span id=histSpan></span></center>" 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(SuppressionDeluxe); /************************************************/ /* 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 messages = new Array() messages[0] = "Vandalismes divers"; messages[1] = "Suite à décision du comité d'arbitrage"; messages[2] = "Malgré plusieurs avertissements"; messages[3] = "Récidiviste"; messages[4] = "Identifiant à caractère injurieux"; messages[5] = "Robot fou"; messages[6] = "Spammeur"; var duree = new Array() duree[0] = "6 hours"; duree[1] = "1 month"; duree[2] = "3 days"; duree[3] = "10 days"; duree[4] = "infinite"; duree[5] = "infinite"; duree[6] = "2 hours"; 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) //////////////////////////////////////// // 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://fr.wikipedia.org/w/index.php?title=' + titreImage + '&action=delete', true); xmlhttp.onreadystatechange = LicenceInconnueEraserHandler; xmlhttp.send(null); } } } } addLoadEvent(LicenceInconnueEraser); //////////////////////////////////////// // Cacher la colonne de gauche // FoeNyx (c) 2005 var portletVisible = true, tabAction = "p-cactions", minStr = "←", maxStr = "→"; function addFullWideButton() { var l = document.getElementById(tabAction); l.style.width="100%"; t = l.innerHTML; ind = t.toLowerCase().indexOf("</ul>"); before = t.substring(0,ind); after = t.substring(ind); pitem = "<li><a href='javascript:showOrHidePortlets();'>"+ "<div id='wideTab' style='display:inline;'>" + minStr + "</div></a></li>"; l.innerHTML = before + pitem + after ; } function showOrHidePortlets() { var elmts = ["p-logo", "p-personal", "p-navigation", "p-search", "p-tb", "p-lang", "p-nbx"], leftTabAction = "138px" , leftContentLayer = "155px"; if (portletVisible) { var elmt; for (var i = 0; i < elmts.length; i++) { elmt = document.getElementById(elmts[i]); if (elmt) elmt.style.display = "none"; } elmt = document.getElementById(tabAction); elmt.style.left = "0px"; elmt = document.getElementById("content"); elmt.style.marginLeft = "0px"; elmt = document.getElementById("wideTab"); elmt.innerHTML = maxStr; portletVisible = false; } else { var elmt; elmt = document.getElementById("wideTab"); elmt.innerHTML = minStr; elmt = document.getElementById(tabAction); elmt.style.left = leftTabAction; elmt = document.getElementById("content"); elmt.style.marginLeft = leftContentLayer; for (var i = 0; i < elmts.length; i++) { elmt = document.getElementById(elmts[i]); if (elmt) elmt.style.display = "block"; } portletVisible = true; } } addLoadEvent(addFullWideButton); /***********************************************************/ 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://fr.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++] = "^Utilisateur:"; interfaceMsg[a++] = "Wikipédia:*"; regexpList[b++] = "^Wikipédia:"; 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++] = "^Modèle:"; interfaceMsg[a++] = "Aide"; regexpList[b++] = "^Aide:"; interfaceMsg[a++] = "Catégories"; regexpList[b++] = "^Catégorie:"; interfaceMsg[a++] = "Portails"; regexpList[b++] = "^Portail:"; ////////////////////////////////////////////////// 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>" } addLoadEvent(SuiviManager);