Utilisateur:Yves-Laurent/monobook.js
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5./* ========================================================================================= */
/* ========================================================================================= */
/* Boite à outils perso */
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 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/w/index.php?title=Special:Recentchangeslinked&target=' + 'Portail:%C3%89lectricit%C3%A9_et_%C3%A9lectronique/Liste_des_articles&days=10&limit=200" >RC Portail élec</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'Projet:Électricité et Électronique">Projet élec</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'Utilisateur:Yves-Laurent/monobook.js">monobook.js</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'Wikipédia:Le Bistro/' + TodayDate() + '">Le Bistrot J!</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'WP:LB">Le Bistrot !</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'Utilisateur:Yves-Laurent/Brouillon">Brouillon</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/wiki/' + 'Aide:Exploration des espaces">Explo des espaces</a></li>'
+ ' <li><a href="http://fr.wikipedia.org/w/' + 'index.php?title=Special:Watchlist&hideMinor=1&hideOwn=1&hideBots=1">Liste de suivi light</a></li>'
+ ' </ul>'
+ ' </div>'
+ '</div> ';
}
}
$(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;
}
$(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;
// Get real oldid due to possible problems on the url oldid ..
var temp = getElementsByClass('diff-otitle',null,'td');
temp = temp[0].getElementsByTagName('a')[0].href;
_GET['oldid'] = temp.substring(temp.indexOf('oldid=')+6, temp.length);
delete temp;
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+'">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>) (<a href="http://fr.wikipedia.org/wiki/Wikipédia:Modèles/Espace Discussion Utilisateur">Avertissement:</a> <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> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit§ion=new&warn=6&article_name=' + _GET['title'] + '">Inf Boite résumé</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 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 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']+']] et 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 du vandalisme de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] et 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 = '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();
} else if (location.href.match(/warn=6/)) {
document.getElementById('wpSummary').value = 'Information IP';
document.getElementById('wpTextbox1').value = '{{sub'+'st:Motivation modif|Page=' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} ~~'+'~~';
document.getElementById('editform').submit();
}
});
/* </nowiki></pre> */