Aller au contenu

Utilisateur:Zedh/monobook.js

Une page de Wikipédia, l'encyclopédie libre.
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.
/* <pre><nowiki> */

/* ========================================================================================= */
/* Fonctions de Projet:Javascript */
/* ========================================================================================= */

obtenir("HotCats");
obtenir("FusionContribs");
obtenir("QPreview");

/* ========================================================================================= */
/* 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="//fr.wikipedia.org/w/index.php?title=Special:Suivi_des_liens&target=' + 'Portail:%C3%89lectricit%C3%A9_et_%C3%A9lectronique/Liste_des_articles&days=10&limit=200" >RC Portail élec</a></li>'
          + '     <li><a href="//fr.wikipedia.org/w/index.php?title=Special:Suivi_des_liens&target=' + 'Projet:T%C3%A9l%C3%A9communications/Liste_des_articles&hideminor=0&showlinkedto=0&days=3&limit=250" >RC Telecom</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'Projet:Électricité et Électronique">Projet élec</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'Utilisateur:Zedh/monobook.js">monobook.js</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'Wikipédia:Le Bistro/' + TodayDate() + '">Le Bistrot J!</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'WP:LB">Le Bistrot !</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'Utilisateur:Zedh/Brouillon">Brouillon</a></li>'
          + '     <li><a href="//fr.wikipedia.org/wiki/' + 'Aide:Exploration des espaces">Explo des espaces</a></li>'
          + '     <li><a href="//fr.wikipedia.org/w/' + 'index.php?title=Special:Watchlist&hideMinor=1&hideOwn=1&hideBots=1">Liste de suivi light</a></li>'
          + '     <li><a href="//fr.wikipedia.org/w/' + 'index.php?title=Special:Linksearch">Tracking url externes</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 = '//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="//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="//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="//fr.wikipedia.org/wiki/Wikipédia:Modèles/Espace Discussion Utilisateur">Avertissement:</a> '
       + '<a href="//fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=1">Coucou</a> / '
       + '<a href="//fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=2">Test 0</a> / '
       + '<a href="//fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=3">Test 1</a> / '
       + '<a href="//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="//fr.wikipedia.org/w/index.php?title=User_talk:' + user2 + '&action=edit&section=new&warn=5&article_name=' + _GET['title'] + '">Spammeur</a> / '
       + '<a href="//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}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'Révocation';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test 0}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'Révocation';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test 1}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = 'Avertissement';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Vandalisme IP|' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=5/)) {
    document.getElementById('wpSummary').value = 'Annulation de vos modifications';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:bienvenue spammeur|' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=6/)) {
    document.getElementById('wpSummary').value = 'Information';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Motivation modif|Page=' + location.href.replace(/^.*article_name=([^&]*).*$/, '$1') + '}} <br>~~'+'~~';
    document.getElementById('editform').submit();
  }
});


/* ========================================================================================= */
/* LiveRC */
/* ========================================================================================= */

importScript('User:EDUCA33E/LiveRC.js');

/* ========================================================================================= */
/* Wikipédia:Historiques en couleur */
/* ========================================================================================= */

document.write('<script type="text/javascript" src="' 
             + '//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="' 
            + '//fr.wikipedia.org/w/index.php?title=Utilisateur:Dake/monobook.js/deluxehistory.js' 
            + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


/* ========================================================================================= */
/* 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">');

//<!-- ======================================================================================== -->

*/

/* ========================================================================================= */
/* Boutons d'édition perso */
/* ========================================================================================= */

var ModèleOuvrage = '<ref>{{Ouvrage\n'
+  '|titre=\n'
+  '|éditeur=\n'
+  '|auteur=\n'
+  '|langue=\n'
+  '|année=\n'
+  '|isbn=\n'
+  '|commentaire=\n'
+  '}}</ref>';

addCustomButton('//upload.wikimedia.org/wikipedia/commons/4/4b/Books-aj.svg_aj_ashton_01.svg','Ouvrage',ModèleOuvrage,'','','mw-editbutton-Ouvrage');


/* </nowiki></pre> */