Utilisateur:Fmaunier/monobook.js

Une page de Wikiquote, le recueil des citations libres.

Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  • Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
  • Opera : appuyez sur Ctrl + F5.
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>');

mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

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=0;
        var b=0;                        
        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[b++]         = "^.*"; 
        
        interfaceMsg[a++]       = "Utilisateurs";
        regexpList[b++]         = "^Utilisateur:";
        
        interfaceMsg[a++]       = "Wikipédia:*"; 
        regexpList[b++]         = "^Wikipédia:";
        
        interfaceMsg[a++]       = "Sous-pages de PàS"; 
        regexpList[b++]         = "^Wikipédia:Pages à supprimer\/";

        interfaceMsg[a++]       = "Sous-pages de PàV"; 
        regexpList[b++]         = "^Wikipédia:Pages à vérifier\/";
        
        interfaceMsg[a++]       = "Pages du bistro"; 
        regexpList[b++]         = "^Wikipédia:Le Bistro\/";
        
        interfaceMsg[a++]       = "Images"; 
        regexpList[b++]         = "^Image:";
        
        interfaceMsg[a++]       = "Modèles"; 
        regexpList[b++]         = "^Modèle:"; 
        
        interfaceMsg[a++]       = "Aide"; 
        regexpList[b++]         = "^Aide:"; 
        
        interfaceMsg[a++]       = "Catégories"; 
        regexpList[b++]         = "^Catégorie:";      
        
        interfaceMsg[a++]       = "Portails"; 
        regexpList[b++]         = "^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);

function googleOnglet() {
  var a = document.getElementById("p-cactions");
        if (a) 
        {
          var pageName = document.title.replace(" - Wikipédia", ""); 
          b = a.getElementsByTagName("ul");
                  
          if(b.length > 0)
          {
            b[0].innerHTML = b[0].innerHTML
            + '<li id="ca-nstab-user"><font style="color: blue; font-weight: bold; padding-left: 0.5em">G</font>'
            + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Afr.wikiquote.org+' + pageName + '&btnG=Search">'
            + 'wq-fr</a>'
            + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=site%3Awikiquote.org+' + pageName + '&btnG=Search">'
            + 'wq</a>'
            + '<a href="http://www.google.fr/search?num=20&hl=fr&safe=off&q=' + pageName + '&btnG=Search&meta=lr%3Dlang_fr">'
            + 'web-fr</a>'
            + '<a href="http://www.google.fr/search?num=20&hl=en&safe=off&q=' + pageName + '&btnG=Search">'
            + 'web</a>'
            + '</li>';
          }
        }
      } 
addLoadEvent(googleOnglet);

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.wikiquote.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;
    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.wikiquote.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.wikiquote.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.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=1">Test0</a> / <a href="http://fr.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">Test1</a> / <a href="http://fr.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">Test2</a> / <a href="http://fr.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=4">Test3</a> / <a href="http://fr.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=5">Bienvenue spammeur</a> / <a href="http://fr.wikiquote.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=6">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();
  } 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();
  } 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();
  } 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();
  } 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 Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test2}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = 'Récidive Vandalisme';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Test3}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=5/)) {
    document.getElementById('wpSummary').value = 'Avertissement Spam';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:Bienvenue spammeur}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=6/)) {
    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:Bienvenue copyright|' + page_copyvio + '}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
});

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