Aller au contenu

Utilisateur:Dr Brains/GlobalManager.js/Old.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.
/* 
Gestionnaire de scripts .js

Documentation : [[Discussion utilisateur:Dr Brains/GlobalManager.js]]


{{Projet:JavaScript/Script}}
*/

// <pre><nowiki>
/////////////////////////////////////////////////////////////// PARTIE PERSONNALISABLE : DÉFINITION DES SCRIPTS

window.GlobalManager_ScriptType = [];
window.GlobalManager_ScriptText = [];
window.GlobalManager_ScriptPage = [];
window.GlobalManager_ScriptId  =  [];

 /*******************************************************************************************************************
 * Les scripts personnalisés sont à définir au sein d'une fonction appelée GlobalManager_GetUserScripts()           *         
 * GlobalManager_ScriptType : 1 => script ; 2 à 6 => titre de section                                               *
 * GlobalManager_ScriptText : type 1 => description du script ; autre type => texte du titre                        *
 * GlobalManager_ScriptPage : type 1 => Page à importer ; autre type => inutilisé                                   *
 * GlobalManager_ScriptId : type 1 => ID du script (titre de la sous-page sans le ".js") ; autre type => inutilisé  *
 ********************************************************************************************************************/

window.GlobalManager_GetDefaultScripts = function(){ ///// SCRIPTS PAR DÉFAUT



GlobalManager_ScriptType.push(5);  ///////////////////////////////////////
GlobalManager_ScriptText.push('Liste des gadgets par défaut');
GlobalManager_ScriptId.push(''); 
GlobalManager_ScriptPage.push(''); 

GlobalManager_ScriptType.push(1); 
GlobalManager_ScriptText.push('<a href="//fr.wikipedia.org/wiki/Utilisateur:'+ mw.config.get('wgUserName') +'/BacASable.js">Bac à Sable</a>'); 
GlobalManager_ScriptId.push('BacASable'); 
GlobalManager_ScriptPage.push('Utilisateur:'+ mw.config.get('wgUserName') +'/BacASable.js');


} /// FIN DES SCRIPTS PAR DÉFAUT

// //////////////////////////////////////////////////////////// PARTIE PERSONNALISABLE : PARAMÈTRES

// Liste des mw.config.get('skin')s disponibles
window.GlobalManager_RunningSkins = [ 
  'common',
  'monobook',
  'modern',
  'vector',
  'cologneblue'
];

// Langue du wiki d'origine
window.GlobalManager_LangFrom = 'fr';

// Adresses du wiki d'origine
window.GlobalManager_URLFrom = '//fr.wikipedia.org/wiki/';
window.GlobalManager_URLBisFrom = '//fr.wikipedia.org/w/index.php?title=';

// Pages du GlobalManager
window.GlobalManager_HomePage = 'User:Dr_Brains/GlobalManager.js/Old.js';
window.GlobalManager_UserScriptPage = 'User:Dr_Brains/GlobalManager.js/PersonalScripts.js';

// Résumé de modification
window.GlobalManager_Resume = 'Mise à jour avec [[:'+GlobalManager_LangFrom+':'+GlobalManager_HomePage+']]';

// Commentaires d'édition
window.GlobalManager_CommStart = '//DebutSectionAuto'
window.GlobalManager_CommPlus = ' : Cette section est produite par le script [[:'+GlobalManager_LangFrom+':'+GlobalManager_HomePage+']]';
window.GlobalManager_CommConfig = '//ConfigSectionAuto';
window.GlobalManager_CommEnd = '//FinSectionAuto';

// //////////////////////////////////////////////////////////// PARTIE PERSONNALISABLE : TEXTES

window.GlobalManager_Text = {
  SelectScripts : "Sélectionner les scripts à ajouter à la page : ",
  Help          : "Documentation",
  InputOK       : "Générer le script",
  InputPersonal : "Sauvegarder les gadgets",
  Hide          : "[Masquer]",
  Show          : "[Afficher]",
  Import        : "Importation des scripts : ",
  Edit          : "Édition de la page : ",
  Save          : "Sauvegarde de la page : ",
  OK            : "OK",
  SelectAll     : "Tous",
  SelectNone    : "Aucun",
  EditLink      : "Modifier"
}

// //////////////////////////////////////////////////////////// FIN DE LA PARTIE PERSONNALISABLE

////////////////////////// VARIABLES GLOBALES NON PERSONNALISABLES

window.GlobalManager_URLHome = mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join('');
window.GlobalManager_URLBisHome = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=';
window.GlobalManager_Timeouts = [];

window.GlobalManager_RunningPages = [];
for(var a=0;a<GlobalManager_RunningSkins.length;a++){
      GlobalManager_RunningPages.push(mw.config.get('wgFormattedNamespaces')[2] + ':' + mw.config.get('wgUserName').replace(/ /g, "_") + '/' + GlobalManager_RunningSkins[a] + '.js');
}
window.GlobalManager_CurrentRunningPage = mw.config.get('wgFormattedNamespaces')[2] + ':' + mw.config.get('wgUserName').replace(/ /g, "_") + '/' + mw.config.get('skin') + '.js';


// //////////////////////////////////////////////////////////// FONCTIONS

////////////////////////// ANALYSE CONFIG ACTUELLE

window.GlobalManager_InstalledScriptIds = [];

window.GlobalManager_GetConfig = function(){
   var Adresse = GlobalManager_URLBisHome + mw.config.get('wgPageName') + '&oldid='+mw.config.get('wgCurRevisionId')+'&action=raw';
   var RequeteEdition = new XMLHttpRequest();
   RequeteEdition.open("GET", Adresse, true);
   RequeteEdition.onreadystatechange = function() {
      if( !(RequeteEdition.readyState == 4 && RequeteEdition.status == 200) )  return;
      var Resultat = RequeteEdition.responseText;
      if(Resultat.indexOf(GlobalManager_CommConfig)!=-1)
      var Configuration = Resultat.split(GlobalManager_CommConfig)[1].split('\n')[0];
      if(Configuration){
         for(var a=0;a<GlobalManager_ScriptType.length;a++){
            if(GlobalManager_ScriptType[a]==1){
               if(Configuration.indexOf('setup-'+GlobalManager_ScriptId[a]+'.js')!=-1){
                  GlobalManager_InstalledScriptIds[a] = ' checked="checked" ';
               }else{
                  GlobalManager_InstalledScriptIds[a] = '';
               }
            }else{
               GlobalManager_InstalledScriptIds[a] = '';
            }
         }
      }else{
         for(var a=0;a<GlobalManager_ScriptType.length;a++){
            GlobalManager_InstalledScriptIds[a] = '';
         }
      }
      GlobalManager_CreateForm();
   }
   RequeteEdition.send(null);
}

////////////////////////// CRÉATION TABLEAU DE SÉLECTION

window.GlobalManager_CreateForm = function(){
   var DivRepere = document.getElementById('siteNotice');
   if(!DivRepere) return;
 
   var Form = document.createElement('div');
   DivRepere.parentNode.insertBefore(Form, DivRepere);
   DivRepere.style.display = 'none';

   var OKInput = '<p>'
                + '<input type="button" class="GlobalManager_Input" '
                + 'onclick="GlobalManager_CreateNewScript();" '
                + 'onselect="GlobalManager_CreateNewScript();" '
                + 'value="'+GlobalManager_Text.InputOK+'" />'
                + '&nbsp;'
                + '<input type="button" class="GlobalManager_Input" '
                + 'disabled="disabled" '
                + 'onclick="GlobalManager_SaveNewPersonalScripts();" '
                + 'onselect="GlobalManager_SaveNewPersonalScripts();" '
                + 'value="'+GlobalManager_Text.InputPersonal+'" />'
                + '</p>'

   var FormContent = '<fieldset id="GlobalManager_Fieldset" >'
                   +'<legend>'
                   + '<span style="font-size:120%;">'+GlobalManager_Text.SelectScripts
                   + '<b>' + mw.config.get('wgPageName').replace(/_/g," ") + '</b> '
                   + '<sup><small>'
                   + '<a href=\"https://fr.wikipedia.org/wiki/Discussion_Utilisateur:Dr_Brains/GlobalManager.js\">('+GlobalManager_Text.Help+')</a>'
                   + '</small></sup>'
                   + ' <a id=\"GlobalManager_ToggleLink\" href=\"javascript:GlobalManager_Toggle();\">'+GlobalManager_Text.Hide+'</a>'
                   + '</span>'
                   + '</legend>'
                   + '<div id=\"GlobalManager_ScriptList\">'
                   + '<table style=\"float:right;clear:right;\">'
                   + '<tr><td>'
                   + '<div style=\"background:#EEE;\">'
                   + '<center><h5><a href=\"http://fr.wikiversity.org/wiki/JavaScript\">Scripts JS</a></h5></center>'
                   + '<div style=\"font-size: 95%;background-color: white;color: black;border-collapse: collapse;border: 1px solid #aaa;padding: 0 .8em .3em .5em;\"><ul>'
                   + '<li><b><a href=' + GlobalManager_URLHome + GlobalManager_CurrentRunningPage + '>' + mw.config.get('skin') + '</a></b></li>';
   for(var b=0;b<GlobalManager_RunningPages.length;b++){
      if(GlobalManager_RunningPages[b]!=GlobalManager_CurrentRunningPage)
      FormContent += '<li>'
                   + '<a href=' + GlobalManager_URLHome + GlobalManager_RunningPages[b] + '>' 
                   + GlobalManager_RunningSkins[b] 
                   + '</a>'
                   + '</li>' ;
   }
   FormContent += '</ul></div></div>'
                + '</td></tr>'
                + '</table>'
                + '<form id="GlobalManager_Form">' + OKInput
                + '<div id="GlobalManager_Content"></div>'
                + OKInput + '</form><div id="GlobalManager_Running"></div></div></fieldset>';

   Form.innerHTML = FormContent;
   if(typeof(DeveloppementJavaScript_AddLinks)=="function") GlobalManager_Toggle();
   for(var c=0;c<GlobalManager_ScriptType.length;c++){
      GlobalManager_FillFormElement(c);
   }
}

////////////////////////// CRÉATION OU MODIFICATION D'UNE LIGNE DU TABLEAU DE SÉLECTION

window.GlobalManager_FillFormElement = function(c){
   var DivContainer = document.getElementById("GlobalManager_Content");
   if(!DivContainer) return;  
   if(!GlobalManager_ScriptType[c]) return;  
   var Element;
   var ElementContent = ""; 
   if(GlobalManager_ScriptType[c] == 1){
       Element = document.createElement('span');
       Element.id = "GM_Element_"+c; 
       ElementContent = '<input type=\"checkbox\" '
                      + 'id=\"'+GlobalManager_ScriptId[c]+'\" '
                      + GlobalManager_InstalledScriptIds[c]+' ></input>&nbsp;'
                      + '<label for=\"'+GlobalManager_ScriptId[c]+'\" ><a href=\"'+GlobalManager_URLFrom + GlobalManager_ScriptPage[c]+'\" '
                      + 'title=\"'+GlobalManager_ScriptPage[c]+'\" >'
                      + GlobalManager_ScriptId[c]
                      + '</a>'
                      + ' : '
                      + '<span class=GM_Element_Text" >'+GlobalManager_ScriptText[c] + '</span>'
                      + '</label>'
                      + '&nbsp;|&nbsp;'
                      + '<small><small><a href="javascript:GlobalManager_editLine('+c+');" '
                      + '>{'+GlobalManager_Text.EditLink+'}</a></small></small>'
                      + '<br\/>';
   }else{
       Element = document.createElement('h'+GlobalManager_ScriptType[c]);
       Element.id = "GM_Element_"+c; 
       ElementContent = '<span class="mw-headline GM_Element_Text" >'+GlobalManager_ScriptText[c] + '</span>'
                      + '</span>'
                      + '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;'
                      + '<small><a href="javascript:GlobalManager_CheckAll('+c+', true);">'+GlobalManager_Text.SelectAll+'</a></small>'
                      + '&nbsp;'
                      + '<small><a href="javascript:GlobalManager_CheckAll('+c+', false);">'+GlobalManager_Text.SelectNone+'</a></small>'
                      + '&nbsp;|&nbsp;'
                      + '<small><small><a href="javascript:GlobalManager_editLine('+c+');" >{'+GlobalManager_Text.EditLink+'}</a></small></small>';
   }
   Element.innerHTML = ElementContent;
   var OldElement = document.getElementById("GM_Element_"+c);
   if(OldElement){
      OldElement.parentNode.insertBefore(Element, OldElement);
      OldElement.parentNode.removeChild(OldElement); 
   }else{
      DivContainer.appendChild(Element);
   }
   return Element;
}

////////////////////////// INLINE EDITION PAGE JS

window.GlobalManager_editLine = function(c){
    var OldLine = document.getElementById("GM_Element_"+c+"_EDIT");
    if(OldLine){
        OldLine.parentNode.removeChild(OldLine);
        return;
    }
    var Line = document.getElementById("GM_Element_"+c);
    if(!Line) return;
    var EditContainer = document.createElement('div');
    EditContainer.id = "GM_Element_"+c+"_EDIT";
    Line.parentNode.insertBefore(EditContainer, Line.nextSibling);

    var ScriptType = parseInt(GlobalManager_ScriptType[c]);
    var ScriptTypeSelect = document.createElement('select');
    ScriptTypeSelect.name = "ScriptType";
    for(var a=1,l=7; a<l;a++){
        var ScriptTypeOption = document.createElement('option');
        ScriptTypeOption.value = (a==1 ? "Script" : "H"+a);
        ScriptTypeOption.innerHTML = (a==1 ? "Script" : "H"+a);
        ScriptTypeOption.selected = ( a==ScriptType ? "selected" : false );
        ScriptTypeSelect.appendChild(ScriptTypeOption);
    } 
    EditContainer.appendChild(ScriptTypeSelect);
    ScriptTypeSelect.onchange = function(){
        ScriptTypeSelectOnchange(this);
    }
    var ScriptId = GlobalManager_ScriptId[c];
    var ScriptIdInput = document.createElement('input');
    ScriptIdInput.name = "ScriptId";
    ScriptIdInput.className = "ScriptId";
    ScriptIdInput.type = "text";
    ScriptIdInput.value = GlobalManager_ScriptId[c];
    EditContainer.appendChild(ScriptIdInput);

    var ScriptPage = GlobalManager_ScriptPage[c];
    var ScriptPageInput = document.createElement('input');
    ScriptPageInput.name = "ScriptPage";
    ScriptPageInput.className = "ScriptPage";
    ScriptPageInput.type = "text";
    ScriptPageInput.value = GlobalManager_ScriptPage[c];
    EditContainer.appendChild(ScriptPageInput);

    var ScriptText = GlobalManager_ScriptText[c];
    var ScriptTextInput = document.createElement('input');
    ScriptTextInput.name = "ScriptText";
    ScriptTextInput.className = "ScriptText";
    ScriptTextInput.type = "text";
    ScriptTextInput.value = GlobalManager_ScriptText[c];
    EditContainer.appendChild(ScriptTextInput);


    var OKInput = document.createElement('input');
    OKInput.name = "ScriptText";
    OKInput.type = "button";
    OKInput.className = "GlobalManager_Input";
    OKInput.value = "OK";
    OKInput.onclick = function(){ GlobalManager_saveLine(c) };
    OKInput.select = function(){ GlobalManager_saveLine(c) };
    EditContainer.appendChild(OKInput);

    ScriptTypeSelectOnchange(ScriptTypeSelect);
}

window.ScriptTypeSelectOnchange = function(ScriptTypeSelect){
    var NewScriptType = 0;
    var ScriptTypeSelectOptions = ScriptTypeSelect.getElementsByTagName("option");
    for(var a=0,l=ScriptTypeSelectOptions.length;a<l;a++){
        if(ScriptTypeSelectOptions[a].selected)
        NewScriptType = parseInt(ScriptTypeSelectOptions[a].value);
    }
    if(typeof(NewScriptType)!=="number" || NewScriptType < 1 || NewScriptType > 6 ) return;
    var ThisDisabled = (NewScriptType !=1 ? "disabled": false);
    var ThisContainer = ScriptTypeSelect.parentNode;
    if(ThisContainer){
        var ScriptPageInput = getElementsByClassName(ThisContainer, "input", "ScriptPage")[0];
        if(ScriptPageInput && ThisDisabled) ScriptPageInput.disabled = ThisDisabled;
        var ScriptTextInput = getElementsByClassName(ThisContainer, "input", "ScriptText")[0];
        if(ScriptTextInput && ThisDisabled) ScriptTextInput.disabled = ThisDisabled;
    }
}

window.GlobalManager_saveLine = function(c){
    var Line = document.getElementById("GM_Element_"+c);
    var EditLine = document.getElementById("GM_Element_"+c+"_EDIT");
    if(!EditLine || !Line) return;
    
    var ScriptTypeSelect = getElementsByClassName(EditLine, "select", "ScriptType")[0];
    var ScriptType = parseInt(ScriptTypeSelect.value);
    if(typeof(ScriptType)!=="number" || ScriptType<1 || ScriptType > 6 ) return;
    var ScriptIdInput = getElementsByClassName(EditLine, "input", "ScriptId")[0];
    var ScriptId = ScriptIdInput.value;
    var ScriptPageInput = getElementsByClassName(EditLine, "input", "ScriptPage")[0];
    var ScriptPage = ScriptPageInput.value;
    var ScriptTextInput = getElementsByClassName(EditLine, "input", "ScriptText")[0];
    var ScriptText = ScriptTextInput.value;

    if(ScriptType==1){
        var checkBox = document.getElementById(GlobalManager_ScriptId[c]);
        if(checkBox && checkBox.checked){
            GlobalManager_InstalledScriptIds[a] = ' checked="checked" ';
        }else{
            GlobalManager_InstalledScriptIds[a] = '';
        }
    }else{
         GlobalManager_InstalledScriptIds[a] = '';
    }
    GlobalManager_ScriptType[c] = ScriptType;
    GlobalManager_ScriptText[c] = ScriptText;
    GlobalManager_ScriptId[c] =  ((ScriptType == 1) ? ScriptId : "");
    GlobalManager_ScriptPage[c] = ((ScriptType == 1) ? ScriptPage : "");

    GlobalManager_FillFormElement(c);

}

////////////////////////// MISE A JOUR PAGE JS

window.GlobalManager_NewScript = 'mw.loader.load("' + GlobalManager_URLBisFrom + GlobalManager_HomePage + '&action=raw&ctype=text/javascript"); \n\n';

window.GlobalManager_NewScriptConfig = GlobalManager_CommStart + GlobalManager_CommPlus + '\n' + GlobalManager_CommConfig;

window.GlobalManager_CreateNewScript = function(){
     var Form = document.getElementById('GlobalManager_Form');
     var ControlElement = document.getElementById('GlobalManager_Running');
     if((!Form)||(!ControlElement)) return;
     var Inputs = Form.getElementsByTagName("input");
     for(var a=0;a<Inputs.length;a++){
         Inputs[a].disabled = "disabled";
     }
     ControlElement.innerHTML = '<b>* '+GlobalManager_Text.Import+'</b><br/>';
     for(var d=(GlobalManager_ScriptId.length-1);d>-1;d--){
          if(GlobalManager_ScriptId[d]=='') continue;
          var Input = document.getElementById(GlobalManager_ScriptId[d]);
          if(!Input) continue;
          if(Input.checked){
               ControlElement.innerHTML +=  GlobalManager_ScriptPage[d] + ' — ';
               GlobalManager_NewScriptConfig += ' setup-'+GlobalManager_ScriptId[d]+'.js ';
               GlobalManager_NewScript += '// Importation de [['+GlobalManager_ScriptPage[d]+']]\n';
               GlobalManager_NewScript += 'mw.loader.load("' + GlobalManager_URLBisFrom + GlobalManager_ScriptPage[d] + '&action=raw&ctype=text/javascript"); \n\n';
          }
     }
     GlobalManager_NewScriptConfig += '\n\n';
     GlobalManager_NewScript += GlobalManager_CommEnd;

     ControlElement.innerHTML += '<br/><b>* '+GlobalManager_Text.Edit + mw.config.get('wgPageName').replace(/_/g, " ") + '</b><br/>';
     var Adresse = GlobalManager_URLBisHome + mw.config.get('wgPageName') + '&action=edit';
     var RequeteEdition = new XMLHttpRequest(); 
     RequeteEdition.open("GET", Adresse, true);
     RequeteEdition.onreadystatechange = function() {
          if( RequeteEdition.readyState != 4 )  return;
          var Temp = document.createElement('div');
          Temp.style.display = 'none';
          document.body.insertBefore(Temp, document.body.firstChild);
          Temp.innerHTML = RequeteEdition.responseText;  
          var ContenuTextarea = document.getElementById('wpTextbox1').value;
          if((ContenuTextarea.indexOf(GlobalManager_CommStart)!=-1)&&(ContenuTextarea.indexOf(GlobalManager_CommEnd)!=-1)){
               var Before = ContenuTextarea.split(GlobalManager_CommStart)[0];
               var After = ContenuTextarea.split(GlobalManager_CommEnd)[1];
               var TexteFinal = Before+GlobalManager_NewScriptConfig+GlobalManager_NewScript+After;
          }else{
               var TexteFinal = GlobalManager_NewScriptConfig+GlobalManager_NewScript+ContenuTextarea;
          }
           ControlElement.innerHTML += '<b>* '+ GlobalManager_Text.Save + mw.config.get('wgPageName') + '</b><br/>';
          var AdressePublication = document.getElementById("editform").action; 
          var boundary = '--------123xyz';
          var data = '';
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpTextbox1"\n\n' 
                + TexteFinal + '\n'
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpSection"\n\n' 
                + document.editform.wpSection.value + '\n'
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpSummary"\n\n' 
                + GlobalManager_Resume + '\n'
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpStarttime"\n\n' 
                + document.editform.wpStarttime.value + '\n'
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpEdittime"\n\n' 
                + document.editform.wpEdittime.value + '\n'
          data += '--' + boundary 
                + '\nContent-Disposition: form-data; name="wpEditToken"\n\n' 
                + document.editform.wpEditToken.value + '\n'
          var RequetePublication = new XMLHttpRequest();
          RequetePublication.open('POST', AdressePublication, true);
          RequetePublication.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+boundary);
          RequetePublication.onreadystatechange = function(){
               if (RequetePublication.readyState == 4){
                    Temp.innerHTML = RequetePublication.responseText;                     
                    if(!Temp.getElementsByTagName('textarea')[0]){
                         ControlElement.innerHTML += '<b><big>'+GlobalManager_Text.OK+'</big></b>';
                         window.location.reload();
                    }else{
                         GlobalManager_CreateNewScript();
                    }
               }
          }
          RequetePublication.send(data + '--' + boundary);
     }
     RequeteEdition.send(null);

}

////////////////////////// MASQUAGE/AFFICHAGE TABLEAU DE SÉLECTION

window.GlobalManager_Toggle = function(){
    var Link = document.getElementById("GlobalManager_ToggleLink");
    var Liste = document.getElementById("GlobalManager_ScriptList");
    if((!Link)||(!Liste)) return;
    if(Link.innerHTML == GlobalManager_Text.Hide){
        Liste.style.display = "none";
        Link.innerHTML = GlobalManager_Text.Show;
    }else{
        Liste.style.display = "block";
        Link.innerHTML = GlobalManager_Text.Hide;
    }
}

////////////////////////// SÉLECTION/DÉSÉLECTION DE TOUTE UNE SECTION

window.GlobalManager_CheckAll = function(ID, Check){

    var HeadLine = document.getElementById("GM_Element_"+ID);
    var Limit = HeadLine.tagName.toLowerCase();
    var Element = HeadLine.nextSibling;
    while(Element){
        if(Element.tagName){
            if(Element.tagName.toLowerCase()==Limit) break;
            if(Element.tagName.toLowerCase()=='input'){
                if(Element.type == 'checkbox'){
                    if(Check){
                        Element.checked = "checked";
                    }else{
                        Element.checked = false;                        
                    }
                }
            }
        }
        Element = Element.nextSibling
    }
}

////////////////////////// LANCEMENT

window.GlobalManager_Running = 0;

////////////////////////// AJOUT DES LIENS

window.GlobalManager_AddLinks = function(){
    if((mw.config.get('skin') == "monobook")||(mw.config.get('skin') == "vector")||(mw.config.get('skin') == "modern") ||(mw.config.get('skin') == "chick")||(mw.config.get('skin') == "myskin")||(mw.config.get('skin') == "simple")){
        var ManagerLinks = "<li id=\"ManagerLink\" >"
                         + "<a href=" + GlobalManager_URLFrom + GlobalManager_UserScriptPage + ">GlobalManager</a>"
                         + "</li>";



        if(typeof(DeveloppementJavaScript_AddLinks)!="function"){ 
            ManagerLinks += "<li id=\"pt-jspage\" >"
                          + "<a href=" + GlobalManager_URLHome + GlobalManager_CurrentRunningPage  + ">" + mw.config.get('skin') + ".js</a>"
                          + "</li>";
       }
       var conteneurDiv = document.getElementById("p-personal");
       if(!conteneurDiv) return;
       var conteneur = conteneurDiv.getElementsByTagName('ul')[0];
       conteneur.innerHTML = conteneur.innerHTML + ManagerLinks ;
    }else if((mw.config.get('skin') == "cologneblue")||(mw.config.get('skin') == "standard" )||(mw.config.get('skin') == "nostalgia" )){
        var ManagerLinks = "<small><center>"
                         + "<a href=" + GlobalManager_URLFrom + GlobalManager_UserScriptPage + ">GlobalManager</a>"
        if(typeof(DeveloppementJavaScript_AddLinks)!="function"){ 
            ManagerLinks += " • "
                         + "<a href=" + GlobalManager_URLHome + GlobalManager_CurrentRunningPage  + ">" + mw.config.get('skin') + ".js</a>"
        }
        ManagerLinks += "</center></small>";
        var ManagerlinkDiv = document.createElement("div");
        ManagerlinkDiv.id = "ManagerLink";
        ManagerlinkDiv.innerHTML = ManagerLinks;
        var contentNode = document.getElementById("article");
        if(!contentNode) return;
        contentNode.insertBefore(ManagerlinkDiv, contentNode.firstChild);
    }
}
$(GlobalManager_AddLinks);

window.GlobalManager_getScript = function(){
        if(GlobalManager_Running==1) return;
        GlobalManager_Running = 1;
        if(typeof(GlobalManager_LangCustom)=="function")GlobalManager_LangCustom();
        if(typeof(GlobalManager_UserCustom)=="function")GlobalManager_UserCustom();
        if(typeof(GlobalManager_GetUserScripts)=="function"){
            GlobalManager_GetUserScripts();
        }else{
            GlobalManager_GetDefaultScripts();
        }
        for(var p=0;p<GlobalManager_RunningPages.length;p++){
            if(mw.config.get('wgPageName') == GlobalManager_RunningPages[p]) GlobalManager_GetConfig();
    }
}
if((mw.config.get('wgAction')=="view")||(mw.config.get('wgAction')=="purge")){
    mw.loader.implement( "gm-getscripts", [GlobalManager_URLBisFrom + GlobalManager_UserScriptPage + "&action=raw&ctype=text/javascript"], {}, {}, {} );
    mw.loader.using( "gm-getscripts", function(){ $(GlobalManager_getScript); });
}
// </nowiki></pre>
OSZAR »