Utilisateur:Fabienkhan/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.
obtenir("BistroDuJour"); obtenir("FusionContribs"); <!-- Outils revert--> 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 ('Quel message faut-il laisser ?', ''); if (message) { 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; if (user2 == "défaire"){ user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[3].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+'">Annuler</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>) (Avertir : <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=1">Test0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=2">Test1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=3">Test2</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit§ion=new&warn=4">Test3</a>)'; } else if (location.href.match(/revert=1/)) { document.getElementById('wpSummary').value = 'Révocation des modifications par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version 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 par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version 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 de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]'; document.getElementById('editform').submit(); } else if (location.href.match(/vandalism=2/)) { document.getElementById('wpSummary').value = 'Révocation de vandalisme par [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] ; retour à la version de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=1/)) { document.getElementById('wpSummary').value = 'Avertissement'; document.getElementById('wpTextbox1').value = '{{sub'+'st:test0}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=2/)) { document.getElementById('wpSummary').value = 'Avertissement'; document.getElementById('wpTextbox1').value = '{{sub'+'st:test1}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=3/)) { document.getElementById('wpSummary').value = 'Avertissement'; document.getElementById('wpTextbox1').value = '{{sub'+'st:test2}} ~~'+'~~'; document.getElementById('editform').submit(); } else if (location.href.match(/warn=4/)) { document.getElementById('wpSummary').value = 'Avertissement'; document.getElementById('wpTextbox1').value = '{{sub'+'st:test3}} ~~'+'~~'; document.getElementById('editform').submit(); } }); // <!-- Pop ups--> document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=User:Leag/popups-strings-fr.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); <!-- ONGLETS --> function addLoadEvent(func) { if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); } 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/Utilisateur:Fabienkhan/bac a sable">' + 'bac à sable</a></li>' + '<li id="ca-nstab-user">' + '<a href="/wiki/Utilisateur:Fabienkhan/Pense bête">' + 'Pense bête</a></li>'; } } } addLoadEvent(nouvelOnglet); <!-- Liste de suivi --> 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=-1; 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[a] = "^.*"; interfaceMsg[++a] = "Utilisateurs"; regexpList[a] = "^Utilisateur:"; interfaceMsg[++a] = "Wikipédia:*"; regexpList[a] = "^Wikipédia:"; interfaceMsg[++a] = "Sous-pages de PàS"; regexpList[a] = "^Wikipédia:Pages à supprimer\/"; interfaceMsg[++a] = "Sous-pages de PàV"; regexpList[a] = "^Wikipédia:Pages à vérifier\/"; interfaceMsg[++a] = "Pages du bistro"; regexpList[a] = "^Wikipédia:Le Bistro\/"; interfaceMsg[++a] = "Images"; regexpList[a] = "^Image:"; interfaceMsg[++a] = "Modèles"; regexpList[a] = "^Modèle:"; interfaceMsg[++a] = "Aide"; regexpList[a] = "^Aide:"; interfaceMsg[++a] = "Catégories"; regexpList[a] = "^Catégorie:"; interfaceMsg[++a] = "Portails"; regexpList[a] = "^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); <!-- Navigation optimisée --> function OptimizedNavig() { 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] = 'WP:BOT' urls[4] = 'Special:Newimages' urls[5] = 'Special:Newpages' urls[6] = 'Commons:Special:Upload' urls[7] = 'Projet:Iran/Chaykhaneh' urls[8] = 'Portail:Iran' urls[9] = 'Projet:Iran' var labels = new Array() labels[0] = 'Bistro' labels[1] = 'PàS' labels[2] = 'pAdQ' labels[3] = 'Bots' labels[4] = 'nImgs' labels[5] = 'nPage' labels[6] = 'Upload Commons' labels[7] = 'Chaykhaneh' labels[8] = 'Portail:Iran' labels[9] = 'Projet:Iran' 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 } } } } addLoadEvent(OptimizedNavig); /* Lien Editcount */ 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); <!-- Commentaire modif --> 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("+ réf") 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("Portail Iran") titles.push("recat") titles.push("Wikiprojet Iran") var inputs = new Array() inputs.push("+ {{ébauche}}") inputs.push("+ catégorie") inputs.push("+ image") inputs.push("+ liens interwiki") inputs.push("+ réf") 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("{{portail Iran}}") inputs.push("changement catégorie") inputs.push("{{Wikiprojet Iran}}") 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)