Aller au contenu

Utilisateur:PamMiks/common.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.
************************************************************************************************************************************************ */
if (typeof(LiveRC_AddHook)==="function" ) { // DÉBUT IF
 
/* ************************************************************************************************************************************************ */
 
lrcParams["DiffExtensionShowConfigPanel"] = true;
lrcParamDesc["DescDiffExtensionShowConfigPanel"] = "[Diff] Ajoute un bouton pour ouvrir le menu de configuration";
 
 
function LiveRC_DiffExtension_Init(){
    if(!mw.config.get('wgUserName') || !mw.config.get('wgUserGroups') || (mw.config.get('wgUserGroups').indexOf("autopatrolled")==-1 && LiveRC_Config["LimitationsWhitelist"].indexOf(mw.config.get('wgUserName'))==-1) ) return
    if(mw.config.get('wgNamespaceNumber')<0 && mw.config.get('wgAction')!="view" && mw.config.get('wgAction') != "purge") return; 
    if(mw.config.get('wgPageName') == lrcMakeParam("PageTitle")) return;
    var Functions = new Array(LiveRC_DiffExtension_setDefaultLang, LiveRC_DiffExtension_getLangTranslations, LiveRC_CheckIfTranslationsLoaded, LiveRC_InitTextTranslations, LiveRC_DiffExtension_Build);
    for(var a=0,l=Functions.length;a<l;a++){
        LiveRC_Config["LaunchProcess"].push({functions:Functions[a]});
    }
}
LiveRC_AddHook("AfterInitActivationProcess", LiveRC_DiffExtension_Init);
 
function LiveRC_DiffExtension_setDefaultLang(){
  LiveRC_getMediawikiDefaultLanguage();
  LiveRC_LaunchProcessNextStep();
}
 
function LiveRC_DiffExtension_getLangTranslations(){
    var Support = "not supported (yet)";
    var Lang = lrcMakeParam("Language");
    var LangName = LiveRC_Config["MediawikiLanguages"][Lang];
    if(LiveRC_Config["SupportedLanguages"].indexOf(Lang)==-1){
      lrcDisplayDebug("Set Mediawiki interface language : " + Lang + (LangName ? " ("+LangName+")" : "") +" : "+Support);
      Lang = "en";
    }else{
      Support = "supported";
      lrcDisplayDebug("Set Mediawiki interface language : " + Lang + (LangName ? " ("+LangName+")" : "") +" : "+Support);
    }
    LiveRC_Config["AvailableLanguages"].push(Lang);
    LoadLaunched = true;
    lrcDisplayDebug("Load translations: " + Lang );
    mw.loader.load('//fr.wikipedia.org/w/index.php?title='
                 + 'MediaWiki:Gadget-LiveRC.js/i18n/'+Lang+'.js'
                 + '&action=raw&ctype=text/javascript');
    LiveRC_LaunchProcessNextStep();
}
 
function LiveRC_DiffExtension_Build(){
    var TableDiff = $('table.diff')[0];
    if(!TableDiff) return; 
    buildReportCreateReasons();
    var Control = document.createElement('table');
    Control.id = "livePreviewFoot";
    lrcaddCustomizableClasses(Control, "livePreviewFoot");
    lrcaddCustomizableClasses(Control, "LiveRC_MenuAnchor");
    Control.style.width = "100%";
    Control.style.fontSize = "12px";
    Control.style.display = "block";
    Control.appendChild(document.createElement('tr'));
    TableDiff.parentNode.insertBefore(Control, TableDiff);
    Control.onmouseover = function(){ lrcSetControlBarPosition(true); };
    Control.onmouseout = function(){ lrcSetControlBarPosition(false); };
    var ShowConfig = lrcMakeParam("DiffExtensionShowConfigPanel");
    if(ShowConfig){
        var ConfigTarget = document.createElement('div');
        ConfigTarget.id = "LiveRCContainer";
        ConfigTarget.innerHTML = '<div id="OutFixedBottomPanel"></div>';
        document.body.appendChild(ConfigTarget);
        var ConfigPanelLink = ''
         + '<div id="LiveRCButtons">'
           + '<span id="LiveRCConfigButtonOn" >'
             + '<span class="OnButton"><a href="#">'+lrcMakeIcon("ConfigButtonIcon")+'</a></span>'
           + '</span>'
           + ' '
           + '<span id="LiveRCConfigButtonOff" >'
             + '<span class="OffButton"><a href="#">'+lrcMakeIcon("ConfigButtonIcon")+'</a></span>'
           + '</span>'
          + '</div>';
        AddButtonToControlBar(ConfigPanelLink);
        lrcUpdateButton("LiveRCConfigButtonOff", false, function(){ LiveRC_ManageParams_OpenMenu(); return false; });
        lrcUpdateButton("LiveRCConfigButtonOn", false, function(){ LiveRC_ManageParams_OpenMenu(); return false; });
        lrcaddCustomizableClasses(document.getElementById("LiveRCButtons"), "LiveRCButtons");
    }
    var Page = mw.config.get('wgPageName').replace(/_/g, " ");
    var User1 = document.getElementById('mw-diff-otitle2');
    if (User1 != null) {
      User1 = User1.getElementsByTagName('a')[0].innerHTML;
    }
    var User2 = document.getElementById('mw-diff-ntitle2');
    if (User2 != null) {
      User2 = User2.getElementsByTagName('a')[0].innerHTML;
    }
    var Oldid = document.getElementById('mw-diff-otitle1');
    if (Oldid != null) {
      Oldid = Oldid.getElementsByTagName('a')[0].href;
      try{Oldid = decodeURIComponent(Oldid); }catch(e){ };
      Oldid = lrcGetArgFromURL(Oldid, "oldid");
    }
    var User = User2;
    var NextModifLink = document.getElementById("differences-nextlink");
    var AllForms = new Array();
    AllForms.push( buildLiveTag(Page) );
    AllForms.push( buildLiveBlank(Page) );
    if(!NextModifLink) AllForms.push( buildLiveUndo(Page, Oldid, User1, User2) );
    AllForms.push( buildLiveAverto(Page, User, true) );
    AllForms.push( buildReport(Page, User) );
    for(var a=0,l=AllForms.length;a<l;a++){
        var Sep = (a!==0 || ShowConfig);
        AddButtonToControlBar(AllForms[a], Sep);
    }
    LiveRC_RevertMessagesExtension_Init();
}
 
/* ************************************************************************************************************************************************ */
} // FIN IF