Utilisateur:Evpok/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> */
 
//Liens Utilisateur
 
//LiveRC
function addLoadEvent(func) 
      {
         if (window.addEventListener) 
             window.addEventListener("load", func, false);
         else if (window.attachEvent) 
             window.attachEvent("onload", func);
      }
 
      function nouveauLien1() 
      {
        var a = document.getElementById("p-personal");
        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:EDUCA33E/LiveRC">'
            + 'LiveRC</a></li>'
            + ' '
            + '<li id="ca-nstab-user">'
            + '<a href="/wiki/Wikipédia:Patrouille RC">'
            + 'Pat</a></li>';
          }
        }
      }
      addLoadEvent(nouveauLien1);
 
 
loadJs('User:EDUCA33E/LiveRC.js');
 
 
obtenir('CopyScape');
 
obtenir('BlockLogById');
 
obtenir('AncreTitres');
 
obtenir('BistroOracle');
 
function OptimizedNavig() 
{
  var a = document.getElementById("p-navigation");
  if (a) 
  {
    b = a.getElementsByTagName("ul");
    if(b.length > 0)
    {
      b[0].innerHTML = b[0].innerHTML
      + '<br>'
      + '<li><span id="n-bistro" title="Wikipédia:Le Bistro">'
      + '<a href="/wiki/Wikipédia:Le_Bistro/' + TodayDate() + '">Le Bistro</a>'
      + '</span></li>'
      + '<li><span id="n-pas" title="Wikipédia:Pages à supprimer">'
      + '<a href="/wiki/Wikipédia:Pages à supprimer">Pages à supprimer</a>'
      + '</span></li>'
      + '<li><span id="n-ias" title="Wikipédia:Images à supprimer">'
      + '<a href="/wiki/Wikipédia:Images à supprimer">Images à supprimer</a>'
      + '</span></li>'
      + '<br>'
      + '<li><span id="n-radmin" title="Wikipédia:Requête aux administrateurs">'
      + '<a href="/wiki/Wikipédia:Requête aux administrateurs">Requêtes</a>'
      + '</span></li>'
      + '<li><span id="n-npages" title="Special:Newpages">'
      + '<a href="/wiki/Special:Newpages">Nouvelles pages</a>'
      + '</span></li>'
    }
  }
}
 
addLoadEvent(OptimizedNavig);
 
 
/* ========================================================================================= */
/* 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;
    // 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&section=new&warn=1">Coucou</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=2">Test 0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=3">Test 1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=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&section=new&warn=5&article_name=' + _GET['title'] + '">Spammeur</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=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();
  }
});
 
// Alexandria
 
//<!-- ======================================================================================== -->
//<!-- Alexandria IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. -->
//<!-- YOU USE AT YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF -->
//<!-- PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE. -->
//<!-- ======================================================================================== -->
 
//<!-- **************************************************************************************** -->
//<!-- Alexandria's parameters for Webmasters -->
//<!-- Download and place on your site the "alexandria.wm.js" to update your special terms. -->
//<!-- Customization is only possible for registered customers. -->
//<!-- **************************************************************************************** -->
document.write('<script type="text/javascript" language="JavaScript1.2" src="/alexandria-memodata/alexandria.wm.fr.js"></script>');
 
//<!-- **************************************************************************************** -->
//<!-- Alexandria's engine -->
//<!-- Copy the lines below in each page you want Alexandria's functionalities to be available. -->
//<!-- **************************************************************************************** -->
document.write('<script type="text/javascript" language="JavaScript1.2" src="http://www.sensagent.com/alexandria/scripts/alexandria.main.js"></script>');
document.write('<link rel=StyleSheet href="http://www.sensagent.com/alexandria/css/alexandria.window.css" type="text/css">');
 
//<!-- ======================================================================================== -->
 
// Revert tools by Lorian
// French translation and fr.wikipedia modification by Fmaunier
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 voulez-vous laisser ?', '');
  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+'">Révoquer</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&section=new&warn=1">Test0</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">Test1</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">Bienvenue spammeur</a> / <a href="http://fr.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=4">Bienvenue copyvio</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'Révocation des modifications de [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] (retour à la version ' + _GET['oldid']+' de [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']])';
    document.getElementById('editform').submit();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'Révocation des modifications 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();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } 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();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } 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();
    //Décommenter la ligne suivante si utilisation de PatTrack
    //patTrackPing(2);
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'Avertissement Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test0}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'Récidive Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test1}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'Avertissement Spam';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Bienvenue spammeur}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    var page_copyvio = prompt ('Quel est le nom de la page où a eu lieu le copyvio ? (Ne pas mettre les "[[]]")', '');
    document.getElementById('wpSummary').value = 'Avertissement Copyvio';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Copieur|' + page_copyvio + '}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
});
 
/* </nowiki></pre> */