Utilisateur:JoKerozen/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> /* * Outils pour réverter * * Fournit des liens dans les pages de diff * * Auteur : Lorian (en) * Dernière révision : 3 novembre 2006 */ 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=/)) { if ( getElementsByClass('firstrevisionheader',null,'div')[0] ) { return } else { // 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(); } }); /*************************** *Historique en couleur avec icones (voir monobook.css aussi) ***************************/ document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/objects.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.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /*************************** * ajout du lien bistro et oracle ***************************/ function TodayDate() { 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()] + " " + year); } function Bistro_Oracle() { var a = document.getElementById("p-navigation"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><a style="display: inline" id="n-bistro" title="Wikipédia:Le Bistro" href="/wiki/Wikipédia:Le_Bistro/' + TodayDate() + '">Bistro <small>du jour</small></a>, <a style="display: inline" id="n-bistro" title="Oracle" href="/wiki/Wikipédia:Oracle">Oracle</a></li>' } } } addLoadEvent(Bistro_Oracle); /*************************** * editer l'en-tete seul ***************************/ obtenir("EditZeroth"); /*************************** * Répéter les onglets en bas de page ***************************/ 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); /*************************** * boite perso code déplacé dans http://fr.wikipedia.org/w/index.php?title=Utilisateur:JoKerozen/boiteperso.js ************************** /* * Onglet ajouter a la Boite Perso (voir juste au dessus) * Déplacé : http://fr.wikipedia.org/w/index.php?title=Utilisateur:JoKerozen/boiteperso.js */ document.write('<SCRIPT SRC="http://fr.wikipedia.org/w/index.php?title=Utilisateur:JoKerozen/projet_boiteperso.js&action=raw&ctype=text/javascript"><\/SCRIPT>'); 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 SRC="http://fr.wikipedia.org/w/index.php?title=Utilisateur:JoKerozen/popup.js&action=raw&ctype=text/javascript"><\/SCRIPT>'); //document.write('<SCRIPT SRC="http://fr.wikipedia.org/w/index.php?title=Utilisateur:JoKerozen/ajax.js&action=raw&ctype=text/javascript"><\/SCRIPT>'); //obtenir("PapierAjax"); loadJs('Wikipédia:Brouillons/interface ajax/js'); //</nowiki></pre>