Wikipédia:LiveRC/Miroir

Une page de Wikipédia, l'encyclopédie libre.
Sauter à la navigation Sauter à la recherche

/*

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│                                                                              │
│     LLLL         III                          RRRRRRRRRR        CCCCC        │
│     LLLL         III                          RRRRRRRRRRRR    CCCCCCCCC      │
│     LLLL                                      RRR      RRR   CCC     CCC     │
│     LLLL         III  VV     VV  EEEEEEEEE    RRR      RRR  CCC              │
│     LLLL         III   VV   VV   EEE          RRRRRRRRRRR   CCC              │
│     LLLL         III   VV   VV   EEEEEE       RRRRRRRRRR    CCC              │
│     LLLL         III    VV VV    EEEEEE       RRR     RRR    CCC     CCC     │
│     LLLLLLLLLLL  III    VVVVV    EEE          RRR      RRR    CCCCCCCCC      │
│     LLLLLLLLLLL  III     VVV     EEEEEEEEE    RRR       RRR     CCCCC        │
│                                                                              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Legal announcements[modifier le code]

License[modifier le code]

Copyright © 2013, copyright holders : see below

For any purpose, you can choose one of the following licenses :

Authors[modifier le code]

Documentation[modifier le code]

Code source[modifier le code]

Variables globales[modifier le code]

 */

  window.LiveRC_Version = "1.0.5";
  window.LiveRC_Version_Dev = "1.0.6-beta";

/*

Paramètres de LiveRC[modifier le code]

 */

  window.Custom_lrcParams = {};

  window.lrcParams = {
    "Language"                : "en",                                                     // Langue de l’interface (par défaut)
    "PageTitle"               : mw.config.get('wgSiteName')+":LiveRC",                    // Page principale de LiveRC
    "SandboxPage"             : mw.config.get('wgSiteName')+":Bac à sable",               // Page bac à sable
    "CommonsURL"              : "//upload.wikimedia.org/wikipedia/commons/",              // Adresse des images Commons
    "SearchURL"               : "https://duckduckgo.com/?q=$1",                           // Moteur de recherche externe
    "TchatURL"                : "https://kiwiirc.com/client/irc.freenode.net/?nick=$2$1", // Adresse du client IRC
    "TchatChannel"            : "#wikipedia-fr-liverc",                                   // Canal de tchat
    "WhoisURL"                : "https://tools.wmflabs.org/whois/$1/lookup",              // URL de l’outil Whois
    "RClinkid"                : "n-recentchanges",                                        // ID du lien "Modifications récentes"
    "MiniPreviewHeight"       : '250px', // Hauteur maxi par défaut du minidiff;
    "PreviewWindowHeight"     : '250px', // Hauteur par défaut de la fenêtre de prévisualisation;
    "HistoryWindowHeight"     : '250px', // Hauteur par défaut de l’historique des prévisualisations;
    "SearchWindowHeight"      : '250px', // Hauteur par défaut de la fenêtre de recherche Google;
    "TchatWindowHeight"       : '350px', // Hauteur par défaut de la fenêtre de tchat;
    "FollowWindowHeight"      : '100px', // Hauteur des listes de suivi;
    "TZ"                      : '00:00', // Fuseau horaire (+02:00, 02:00, -0200, -05:45, ...)
    "InterwikiList"           : '',      // Langues des interwikis montrés (exemple : 'de|en|es|fr|it')
    "RCLimit"                 : 50,      // Nombre de ligne maximum de la table de RC;
    "Refresh"                 : 10,      // Délai de rafraichissement des RC
    "ArticleLengthLimit"      : 0,       // Limite du nombre de caractères affichés de l’article dans les RC
    "UserLengthLimit"         : 0,       // Limite du nombre de caractères affichés de l’utilisateur dans les RC
    "MinYellowWatchers"       : 5,       // Limite basse du nombre de suiveurs de la page (rouge/jaune)
    "MinGreenWatchers"        : 10,      // Limite basse du nombre de suiveurs de la page (jaune/vert)
    "MinBacklinks"            : 3,       // Limite basse du nombre de backlinks vers la page
    "MinLinks"                : 3,       // Limite basse du nombre de liens sur la page
    "BoldComments"            : false,   // Commentaires de modification en gras
    "ShowArticleLength"       : true,    // Afficher la taille totale de la page
    "ShowTimer"               : true,    // Afficher le timer
    "ShowPreviewOnTop"        : false,   // Afficher la prévisualisation au-dessus des RC
    "LoadUsersInGroupsList"   : true,    // Charger la liste des bots et sysops
    "LoadWatchlist"           : true,    // Charger la liste des articles et utilisateurs suivis (coûteux au démarrage)
    "LoadIPCat"               : true,    // Charger les catégories d'utilisateurs (coûteux au démarrage)
    "LoadLastBlocks"          : true,    // Charger les derniers blocages (coûteux au démarrage)
    "GetPageInfos"            : true,    // Charger les infos sur les pages (coûteux)
    "GetFileInfos"            : true,    // Charger les infos sur les images uploadées (coûteux)
    "GetWikidataInfos"        : false,   // Charger les infos wikidata sur les rc wikidata (coûteux)
    "UseMiniDiff"             : false,   // Afficher le diff-réduit (très coûteux)
    "ShowNotifications"       : true,    // Afficher les notifications
    "ShowInterwikiList"       : true,    // Montrer les liens inter-langues dans les RC
    "InterwikiPreviewEnabled" : true,    // Activer la prévisualisation des pages interwiki
    "KeepAllLines"            : false,   // Conserver toutes les lignes RC
    "InvertUpdate"            : false,   // Inverser le sens d’apparition des RC
    "AutoCloseDiff"           : false,   // Supprimer une ligne après visualisation du diff
    "PreloadLines"            : true,    // Préchargement des diff en utilisant le bouton [Suivant]
    "SubstWarnings"           : true,    // Substitution des modèles d'avertissement
    "BypassWatchdefault"      : true     // Ne pas ajouter automatiquement les pages modifiées à la liste de suivi
  };

/*

Options de démarrage[modifier le code]

 */

  window.Custom_lrcOptionMenuValues = {};

  window.lrcOptionMenuValues = {
    "LiveRCDisplayed"          : true,    // Afficher l’interface de LiveRC
    "LiveRCRCTableDisplayed"   : true,    // Afficher le tableau des RC
    "LiveRCTchatDisplayed"     : false,   // Afficher la fenêtre de tchat
    "LiveRCPreviewDisplayed"   : false,   // Afficher la fenêtre de prévisualisation
    "LiveRCFollowDisplayed"    : true,    // Afficher les listes de suivi
    "DisplayDebug"             : false,   // Afficher le panneau de débogage
    "Debug_Ajax"               : false,   // Panneau de débogage : Afficher les requêtes Ajax
    "Debug_Errors"             : false,   // Panneau de débogage : N’afficher que les erreurs
    "Stop"                     : false,   // Case "Pause"
    "Diff"                     : false,   // Case "Diff réduit"
    "RC"                       : true,    // Case "RC"
    "RC_edit"                  : true,    // Case "RC (modifications normales)"
    "RC_minor"                 : true,    // Case "RC (modifications mineurs)"
    "RC_new"                   : true,    // Case "RC (nouvelles pages)"
    "RC_categorize"            : false,   // Case "RC (changements de catégories)"
    "RC_external"              : false,   // Case "RC (edits wikidata)"
    "Log"                      : true,    // Case "Journaux"
    "WL_watched"               : true,    // Case "Pages suivies"
    "WL_unwatched"             : true,    // Case "Pages non suivies"
    "Tags"                     : false,   // Case "Balises"
    "Tags_notag"               : true,    // Case "Balises" : ''Pas de balise''
    "NS"                       : false,   // Case "Espaces de noms"
    "User"                     : true,    // Case "Utilisateurs"
    "User_IP"                  : true,    // Case "IP"
    "User_REGISTERED"          : true,    // Case "Enregistrés"
    "User_NEWBIE"              : true,    // Case "Débutants"
    "User_AUTOPATROLLED"       : false,   // Case "Confirmés"
    "User_HideOwnSubpage"      : false,   // Case "Masquer les modifications d’un utilisateur sur ses propres sous-pages"
    "User_ShowAllSelf"         : true,    // Case "Toujours afficher mes propres modifications"
    "User_ShowAllContact"      : true,    // Case "Toujours afficher mes contacts"
    "User_ShowAllWatchlist"    : true,    // Case "Toujours afficher ma liste de suivi"
    "User_ShowAllRevert"       : true,    // Case "Toujours afficher les révocations"
    "User_ShowAllBlanking"     : true,    // Case "Toujours afficher les blanchiments"
    "User_ShowAllReplaced"     : true     // Case "Toujours afficher les remplacements"
  };

/*

Textes de l'interface[modifier le code]

Textes non traduits[modifier le code]
 */

  window.Custom_UnTranslatedTexts = {};

  window.UnTranslatedTexts = {
    ON_ARTICLE:             "sur",
    UPDATEMESSAGES:         "Mise à jour de la configuration Mediawiki locale",
    MWSiteGlobalLegend:     "Configuration locale de Mediawiki",
    MWGeneralConfigLegend:  "Configuration générale de Mediawiki",
    MWLanguagesLegend:      "Langues supportées",
    MWMessagesLegend:       "Messages système",
    MWExtensionsLegend:     "Extensions Mediawiki",
    MWNamespacesLegend:     "Espaces de noms",
    MWMagicwordsLegend:     "Mots magiques",
    MWInterwikimapLegend:   "Table interwiki",
    MWWikibaseLegend:       "Wikibase",
    MWTagsLegend:           "Balises",
    TAG_RESUME:             "Bandeau",
    USERMSG_RESUME:         "Message",
    EMPTY_RESUME:           "Blanchiment",
    USERTHANK_RESUME:       "Remerciement",
    BLOCKTEMPLATE:          "Blocage",
    RESUMESTART:            "[[WP:LRC|LiveRC]] : ",
    Comment:                "Personnalisation pour LiveRC"
  };
/*
Textes traduits[modifier le code]
 */

   // Textes
  window.lrcTexts = {};
  window.lrcTranslatedTexts = {};
  window.Custom_lrcTranslatedTexts = {};

   // Descriptions de variables
  window.lrcParamDesc = {};
  window.lrcTranslatedParamDesc = {};
  window.Custom_lrcTranslatedParamDesc = {};

/*

Icônes[modifier le code]

 */

  window.Custom_lrcIcons = {};

  window.lrcIcons = {
  // Page & Edit type
    "AdQIcon" : {
      type:1,
      src:"thumb/c/c7/Fairytale_bookmark_gold.png/10px-Fairytale_bookmark_gold.png",
      width:10,
      height:10
    },
    "APDQIcon" : {
      type:1,
      src:"thumb/e/e0/Fairytale_bookmark_half_gold_silverlight_question.png/10px-Fairytale_bookmark_half_gold_silverlight_question.png",
      width:10,
      height:10
    },
    "BAIcon" : {
      type:1,
      src:"thumb/0/08/Fairytale_bookmark_silver.png/10px-Fairytale_bookmark_silver.png",
      width:10,
      height:10
    },
    "HomonIcon" : {
      type:0,
      src:"thumb/7/72/Disambig.svg/16px-Disambig.svg.png",
      width:16,
      height:16
    },
    "StubIcon" : {
      type:0,
      src:"thumb/a/a6/Construction_cone.png/16px-Construction_cone.png",
      width:16,
      height:16
    },
    "PaSIcon" : {
      type:0,
      src:"thumb/9/9e/Icono_consulta_borrar.png/16px-Icono_consulta_borrar.png",
      width:16,
      height:16
    },
    "CopyrightIcon" : {
      type:0,
      src:"thumb/b/b0/Copyright.svg/16px-Copyright.svg.png",
      width:16,
      height:16
    },
    "RecentIcon" : {
      type:0,
      src:"thumb/1/19/Ambox_currentevent.svg/16px-Ambox_currentevent.svg.png",
      width:16,
      height:16
    },
    "R3RIcon" : {
      type:0,
      src:"thumb/b/bc/R3R.svg/16px-R3R.svg.png",
      width:16,
      height:16
    },
    "WIPIcon" : {
      type:0,
      src:"thumb/6/6a/Under_construction_icon-orange.svg/16px-Under_construction_icon-orange.svg.png",
      width:16,
      height:13
    },
    "LockIcon" : {
      type:0,
      src:"thumb/e/e0/Padlock-gold.svg/16px-Padlock-gold.svg.png",
      width:16,
      height:16
    },
    "ExtendedLockIcon" : {
      type:0,
      src:"thumb/e/e0/Padlock-gold.svg/16px-Padlock-gold.svg.png", // TODO - créer une version grise de l'icône
      width:16,
      height:16
    },
    "FullLockIcon" : {
      type:0,
      src:"thumb/4/48/Padlock-red.svg/16px-Padlock-red.svg.png",
      width:16,
      height:16
    },
    "TrackingCategoriesIcon" : {
      type:0,
      src:"4/49/Error.png",
      width:16,
      height:16
    },
    "Watchers0Icon" : {
      type:0,
      src:"thumb/b/b5/Webroot_Spy_Sweeper_%28red%29.png/12px-Webroot_Spy_Sweeper_%28red%29.png",
      width:12,
      height:12
    },
    "Watchers1Icon" : {
      type:0,
      src:"thumb/4/48/Webroot_Spy_Sweeper_%28orange%29.png/12px-Webroot_Spy_Sweeper_%28orange%29.png",
      width:12,
      height:12
    },
    "Watchers2Icon" : {
      type:0,
      src:"thumb/f/ff/Webroot_Spy_Sweeper_%28yellow%29.png/12px-Webroot_Spy_Sweeper_%28yellow%29.png",
      width:12,
      height:12
    },
    "Watchers3Icon" : {
      type:0,
      src:"thumb/0/01/Webroot_Spy_Sweeper_%28green%29.png/12px-Webroot_Spy_Sweeper_%28green%29.png",
      width:12,
      height:12
    },
    "RedirectIcon" : {
      type:0,
      src:"thumb/7/71/Symbol_redirect_arrow_with_gradient.svg/16px-Symbol_redirect_arrow_with_gradient.svg.png",
      width:16,
      height:10
    },
    "ExternalIcon" : {
      type:0,
      src:"thumb/e/e4/Wikidata-logo_S.svg/16px-Wikidata-logo_S.svg.png",
      width:16,
      height:9
    },
    "FlowIcon" : {
      type:0,
      src:"thumb/6/64/Talk_page_icon_crystal.png/16px-Talk_page_icon_crystal.png",
      width:16,
      height:16
    },
  // Logs
    "ManagetagsIcon" : {
      type:0,
      src:"thumb/7/7b/Gnome-mime-manpage.png/16px-Gnome-mime-manpage.png",
      width:16,
      height:16
    },
    "ChangetagIcon" : {
      type:0,
      src:"thumb/b/b4/Curation_Bar_Icon_Add_Tags_Blue_with_transparent_background.png/16px-Curation_Bar_Icon_Add_Tags_Blue_with_transparent_background.png",
      width:16,
      height:16
    },
    "AbusefilterIcon" : {
      type:0,
      src:"thumb/7/78/Nuvola_apps-agent_and_Icon_tools_red.png/16px-Nuvola_apps-agent_and_Icon_tools_red.png",
      width:16,
      height:13
    },
    "AbuselogIcon" : {
      type:0,
      src:"thumb/5/5e/Nuvola_apps_agent.svg/16px-Nuvola_apps_agent.svg.png",
      width:16,
      height:13
    },
    "UploadIcon" : {
      type:0,
      src:"thumb/4/47/Gartoon-Gnome-dev-floppy.png/16px-Gartoon-Gnome-dev-floppy.png",
      width:16,
      height:16
    },
    "ImportIcon" : {
      type:0,
      src:"thumb/a/a0/Document_arrow_green.svg/32px-Document_arrow_green.svg.png",
      width:32,
      height:16
    },
    "NewUserIcon" : {
      type:0,
      src:"thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png",
      width:16,
      height:16
    },
    "BlockIcon" : {
      type:0,
      src:"thumb/8/8b/B1.svg/16px-B1.svg.png",
      width:16,
      height:16
   },
    "DeleteIcon" : {
      type:0,
      src:"thumb/e/ef/Editcut.png/16px-Editcut.png",
      width:16,
      height:16
    },
    "MoveIcon" : {
      type:0,
      src:"thumb/0/0e/Forward.png/16px-Forward.png",
      width:16,
      height:16
    },
    "ProtectIcon" : {
      type:0,
      src:"thumb/6/64/Crystal_Clear_action_lock3.png/16px-Crystal_Clear_action_lock3.png",
      width:16,
      height:16
    },
    "ThanksIcon" : {
      type:0,
      src:"thumb/7/7d/Heart_icon.svg/16px-Heart_icon.svg.png",
      width:16,
      height:16
    },
    "RenameuserIcon" : {
      type:0,
      src:"thumb/b/b9/Blue_&_gray_people.png/15px-Blue_&_gray_people.png",
      width:16,
      height:16
    },
    "RightsIcon" : {
      type:0,
      src:"thumb/0/07/Fairytale_kdmconfig.png/18px-Fairytale_kdmconfig.png",
      width:16,
      height:16
    },
    "MassMessageIcon" : {
      type:0,
      src:"thumb/b/b3/Nuvola_apps_email-several.png/16px-Nuvola_apps_email-several.png",
      width:16,
      height:16
    },
    "CheckUserIcon" : {
      type:0,
      src:"thumb/c/cb/Nuvola_search_person.png/16px-Nuvola_search_person.png",
      width:16,
      height:16
    },
    "OversightIcon" : {
      type:0,
      src:"thumb/2/2c/Icon_delete.svg/16px-Icon_delete.svg.png",
      width:16,
      height:16
    },
    "ReviewIcon" : {
      type:0,
      src:"thumb/6/66/Copyvio-NormalMagnifier.png/16px-Copyvio-NormalMagnifier.png",
      width:16,
      height:16
    },
    "StableIcon" : {
      type:0,
      src:"thumb/a/a7/Copyvio-WarningMagnifier.png/16px-Copyvio-WarningMagnifier.png",
      width:16,
      height:16
    },
    "PagetriageDeletionIcon" : {
      type:0,
      src:"thumb/c/cb/Curation_Bar_Icon_Trash_Blue_with_transparent_background.png/16px-Curation_Bar_Icon_Trash_Blue_with_transparent_background.png",
      width:16,
      height:16
    },
    "PagetriageCurationIcon" : {
      type:0,
      src:"thumb/5/5c/Curation_Bar_Icon_Love_Blue_with_transparent_background.png/16px-Curation_Bar_Icon_Love_Blue_with_transparent_background.png",
      width:16,
      height:16
    },
    "EducationProgramIcon" : {
      type:0,
      src:"thumb/4/47/WIKI_AND_ACADEMIA.PNG/16px-WIKI_AND_ACADEMIA.PNG",
      width:16,
      height:16
    },
    "LiquidThreadsIcon" : {
      type:0,
      src:"thumb/e/e7/FAQ_icon.svg/16px-FAQ_icon.svg.png",
      width:16,
      height:16
    },
    "TranslateIcon" : {
      type:0,
      src:"thumb/4/40/Icono_de_traducción.svg/16px-Icono_de_traducción.svg.png",
      width:16,
      height:16
    },
    "OAuthIcon" : {
      type:0,
      src:"thumb/e/e9/Crystal_Clear_Password.png/16px-Crystal_Clear_Password.png",
      width:16,
      height:16
    },
    "MoodBarIcon" : {
      type:0,
      src:"thumb/7/75/Oxygen480-emotes-face-plain.svg/16px-Oxygen480-emotes-face-plain.svg.png",
      width:16,
      height:16
    },
    "InterwikiIcon" : {
      type:0,
      src:"thumb/1/19/Interprogetto.png/16px-Interprogetto.png",
      width:16,
      height:16
    },
  // User type
    "SharedIPIcon" : {
      type:0,
      src:"thumb/b/b7/WLM_logo.svg/16px-WLM_logo.svg.png",
      width:16,
      height:16
    },
    "ScolarIPIcon" : {
      type:0,
      src:"thumb/9/98/Crystal_kdmconfig.png/16px-Crystal_kdmconfig.png",
      width:16,
      height:16
    },
    "OpenProxyIcon" : {
      type:0,
      src:"thumb/0/0a/Crystal_Clear_kdmconfig-danger.png/16px-Crystal_Clear_kdmconfig-danger.png",
      width:16,
      height:16
    },
    "NewbieIcon" : {
      type:0,
      src:"thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png",
      width:16,
      height:16
    },
    "SysopIcon" : {
      type:0,
      src:"thumb/6/61/Gnome-stock_person_admin2.svg/16px-Gnome-stock_person_admin2.svg.png",
      width:16,
      height:16
   },
    "BotIcon" : {
      type:0,
      src:"thumb/c/c2/Gnome-stock_person_bot.svg/16px-Gnome-stock_person_bot.svg.png",
      width:16,
      height:16
    },
    "BlockedIcon" : {
      type:0,
      src:"thumb/b/b8/Modern_clock_chris_kemps_01_with_Octagon-warning.svg/16px-Modern_clock_chris_kemps_01_with_Octagon-warning.svg.png",
      width:16,
      height:16
    },
    "CopyrightUserIcon" : {
      type:0,
      src:"thumb/b/b0/Copyright.svg/16px-Copyright.svg.png",
      width:16,
      height:16
    },
    "SpamblacklistUserIcon" : {
      type:0,
      src:"thumb/b/b5/Nospam_at.svg/16px-Nospam_at.svg.png",
      width:16,
      height:16
    },
    "PediaProjectIcon" : {
      type:0,
      src:"thumb/7/79/A13a_French_road_sign.svg/15px-A13a_French_road_sign.svg.png",
      width:16,
      height:16
    },
// Edit type (comments)
    "MinorEditIcon" : {
      type:0,
      src:"thumb/d/d0/M_in_a_Circle.png/12px-M_in_a_Circle.png",
      width:12,
      height:12
    },
    "RevertIcon" : {
      type:0,
      src:"thumb/2/2c/Nuvola_actions_undo.png/12px-Nuvola_actions_undo.png",
      width:12,
      height:12
    },
    "ReplacedIcon" : {
      type:0,
      src:"thumb/9/95/Categorie_III.svg/12px-Categorie_III.svg.png",
      width:12,
      height:12
    },
    "RedirectedIcon" : {
      type:0,
      src:"thumb/7/7f/Redirect_arrow_without_text_(cropped).svg/12px-Redirect_arrow_without_text_(cropped).svg.png",
      width:12,
      height:12
    },
    "BlankingIcon" : {
      type:0,
      src:"thumb/4/41/Kde_crystalsvg_eraser.png/12px-Kde_crystalsvg_eraser.png",
      width:12,
      height:12
    },
    "WPCIcon" : {
      type:0,
      src:"thumb/2/2d/Nuvola_web_broom.svg/12px-Nuvola_web_broom.svg.png",
      width:12,
      height:12
    },
    "AWBIcon" : {
      type:0,
      src:"thumb/b/b4/AWB_logo_draft.png/12px-AWB_logo_draft.png",
      width:12,
      height:12
    },
    "BandeauxPortailsIcon" : {
      type:0,
      src:"thumb/e/e1/Portal_icon.svg/12px-Portal_icon.svg.png",
      width:12,
      height:12
    },
    "BandeauxEbauchesIcon" : {
      type:0,
      src:"thumb/3/37/Icon-wrench.png/12px-Icon-wrench.png",
      width:12,
      height:12
    },
    "HotCatIcon" : {
      type:0,
      src:"thumb/f/fd/Magnify-clip_%28sans_arrow%29.svg/12px-Magnify-clip_(sans_arrow).svg.png",
      width:12,
      height:12
    },
    "PopupsIcon" : {
      type:0,
      src:"thumb/1/11/Toolbaricon_hiddencomment.png/12px-Toolbaricon_hiddencomment.png",
      width:12,
      height:12
    },
    "CatRenameIcon" : {
      type:0,
      src:"thumb/5/56/Crystal_Project_2rightarrow.png/12px-Crystal_Project_2rightarrow.png",
      width:12,
      height:12
    },
    "LRCIcon" : {
      type:0,
      src:"thumb/b/b2/LiveRC.svg/12px-LiveRC.svg.png",
      width:12,
      height:12
    },
  // Interface icons
    "TchatButtonIcon" : {
      type:0,
      src:"thumb/7/7a/Mercury_bw.png/25px-Mercury_bw.png",
      width:32,
      height:32
    },
    "DebugButtonIcon" : {
      type:0,
      src:"thumb/6/69/Logviewer_bw.png/32px-Logviewer_bw.png",
      width:32,
      height:32
    },
    "ConfigButtonIcon" : {
      type:0,
      src:"thumb/2/27/Folder-system.png/32px-Folder-system.png",
      width:32,
      height:32
    },
    "LiveRCButtonIcon" : {
      type:0,
      src:"thumb/6/66/Exaile_bw.png/32px-Exaile_bw.png",
      width:32,
      height:32
    },
    "RCListButtonIcon" : {
      type:0,
      src:"thumb/7/78/Ethereal.png/25px-Ethereal.png",
      width:25,
      height:25
    },
    "PreviewButtonIcon" : {
      type:0,
      src:"thumb/0/05/Preferences-desktop-screensaver.png/25px-Preferences-desktop-screensaver.png",
      width:25,
      height:25
    },
    "FollowButtonIcon" : {
      type:0,
      src:"thumb/3/35/Utilities-system-monitor.png/25px-Utilities-system-monitor.png",
      width:25,
      height:25
    },
    "HistoryButtonIcon" : {
      type:0,
      src:"thumb/c/c7/File-manager.png/25px-File-manager.png",
      width:25,
      height:25
    },
    "LogoIcon" : {
      type:0,
      src:"thumb/2/2d/LiveRC_Ts-for_anim.svg/52px-LiveRC_Ts-for_anim.svg.png",
      width:52,
      height:32
    },
    "AnimatedLogoIcon" : {
      type:0,
      src:"9/97/LiveRC_Ts-anim1.gif",
      width:52,
      height:32
    },
    "FavIcon" : {
      type:0,
      src:"thumb/b/b2/LiveRC.svg/16px-LiveRC.svg.png",
      width:16,
      height:16
    },
    "SuggestExistIcon" : {
      type:0,
      src:"thumb/b/be/P_yes.svg/20px-P_yes.svg.png",
      width:20,
      height:20
    },
    "SuggestNoExistIcon" : {
      type:0,
      src:"thumb/4/42/P_no.svg/20px-P_no.svg.png",
      width:20,
      height:20
    }
  };

/*

Paramètres des fonctions automatiques[modifier le code]

Avertissement[modifier le code]
 */

  window.Custom_lstAverto = [];

  window.lstAverto = [
    { template: "Test 0"                , string: "Test 0"            , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Test 1"                , string: "Test 1"            , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Test 2"                , string: "Test 2"            , hasPage: false, addName: false, addSectionTitle: false },
    { template: "Test 3"                , string: "Test 3"            , hasPage: false, addName: false, addSectionTitle: false },
    { template: "Seul avertissement"    , string: "Test 4"            , hasPage: false, addName: false, addSectionTitle: false },
    { template: "Retrait injustifié"    , string: "Retrait injustifié", hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Motivation modif"      , string: "Résumé"            , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "LE HC"                 , string: "LE hors-critères"  , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "LE dans texte"         , string: "LE dans texte"     , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Spammeur"              , string: "Spam"              , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Ortho"                 , string: "Ortho"             , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Ajout POV"             , string: "Non-neutre"        , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Non-encyclo"           , string: "Non-encyclo"       , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Faut sourcer"          , string: "Faut sourcer"      , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Faut sourcer EV"       , string: "Faut sourcer EV"   , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Maladresse"            , string: "Modif corrigée"    , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Suppr Bandeaux"        , string: "Bandeaux"          , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Bienvenue Copyvio 1"   , string: "Copyright"         , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Compte publicitaire"   , string: "PU publicitaire"   , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "BSI CAA"               , string: "BSI CAA"           , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "BSI BàS"               , string: "BSI BàS"           , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "BSI promo"             , string: "BSI promo"         , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "BSI canular"           , string: "BSI canular"       , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Aide sources"          , string: "Aide sources"      , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "Aide images"           , string: "Aide images"       , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "Aide wikification"     , string: "Aide wikif"        , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Aide liens"            , string: "Aide liens"        , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "AideMeta/Promo"        , string: "Aide BandoPromo"   , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "AideMeta/RefLié"       , string: "Aide BandoRefLié"  , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "AideMeta/RefSec"       , string: "Aide BandoRefSec"  , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "AideMeta/TI"           , string: "Aide BandoTI"      , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "AideMeta/Delist"       , string: "Aide BandoDelist"  , hasPage: true,  addName: true,  addSectionTitle: false },
    { template: "Bienvenue"             , string: "Bienvenue"         , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "Bienvenue IP"          , string: "Bienvenue IP"      , hasPage: false, addName: true,  addSectionTitle: false },
    { template: "Bienvenue IP méritante", string: "Bienvenue IP +"    , hasPage: false, addName: true,  addSectionTitle: false }
  ];

/*
Blanchiment[modifier le code]
 */

  window.Custom_lstBlank = [];

  window.lstBlank = [
    {tooltip: "copyvio"      , resume: "[[WP:COPY|copie de site web sans autorisation explicite]]" },
    {tooltip: "CAA"          , resume: "[[WP:CAA|critères d’admissibilité non atteints]]"          },
    {tooltip: "non encyclo"  , resume: "[[WP:P|non encyclopédique en l’état]]"                     },
    {tooltip: "BaS"          , resume: "bac à sable"                                               },
    {tooltip: "vandalisme"   , resume: "vandalisme"                                                }
  ];

/*
Révocation[modifier le code]
 */

  window.Custom_lrcRevertMessages = [];

  window.lrcRevertMessages = [
    { resume: "[[Wikipédia:Bac à sable|Bac à sable]]" , text: "Bac à sable" },
    { resume: "[[Wikipédia:Vandalisme|Vandalisme]]"   , text: "Vandalisme"  },
    { resume: "Retrait d’information non sourcée"     , text: "Non-sourcé"  },
    { resume: "Traduction automatique"                , text: "Trad auto"   }
  ];

/*
Bandeaux[modifier le code]
 */

  window.Custom_lstBando = [];

  window.lstBando = [
    { template: "Admissibilité à vérifier" , string: "admissibilité"          , withDate: "$month $year" },
    { template: "Copie à vérifier"         , string: "copyvio"                , withDate: ""             },
    { template: "À sourcer"                , string: "à sourcer"              , withDate: "$month $year" },
    { template: "À wikifier"               , string: "à wikifier"             , withDate: "$month $year" },
    { template: "Sources secondaires"      , string: "sources secondaires"    , withDate: "$month $year" },
    { template: "Sources à lier"           , string: "sources à lier"         , withDate: "$month $year" },
    { template: "À délister"               , string: "à délister"             , withDate: "$month $year" },
    { template: "Rédaction"                , string: "rédaction"              , withDate: "$month $year" },
    { template: "Travail inédit"           , string: "TI"                     , withDate: ""             },
    { template: "Règle des 3 révocations"  , string: "R3R"                    , withDate: ""             }
  ];

/*
Requête aux administrateurs[modifier le code]
 */

  window.Custom_lstReport = [];

  window.lstReport = [
        {  userright:"delete",
           text:"REPORTING_DELETION",
           page:"Wikipédia:Demande de suppression immédiate",
           template:"Wikipédia:LiveRC/Modèles/Demande de suppression",
           parampage:true,
           paramuser:false,
           resume:"[[:$1]]",
           reasonsdropdownname:"deletereason-dropdown"
        },
        {  userright:"protect",
           text:"REPORTING_PROTECTION",
           page:"Wikipédia:Demande de protection de page",
           template:"Wikipédia:LiveRC/Modèles/Demande de protection",
           parampage:true,
           paramuser:false,
           resume:"{{a-court|$1}}",
           reasonsdropdownname:"protect-dropdown"
        },
        {  userright:"block",
           text:"REPORTING_BLOCK",
           page:"Wikipédia:Vandalisme en cours",
           template:"Wikipédia:LiveRC/Modèles/Demande de blocage",
           parampage:false,
           paramuser:true,
           resume:"Demande de blocage : [[User:$2|$2]]",
           reasonsdropdownname:"ipbreason-dropdown"
        },
        {  userright:"anyRight",
           text:"REPORTING_HELP",
           page:"Wikipédia:Forum des nouveaux",
           template:"Wikipédia:LiveRC/Modèles/Nouveau ayant besoin d'aide",
           parampage:false,
           paramuser:true,
           resume:"Demande d'aide pour un nouveau : [[User:$2|$2]]",
           reasonsdropdownname:""
        }
    ];

/*

Boutons de suppression de lignes[modifier le code]

 */

  window.Custom_lrcSupprLineParams = [];

  window.lrcSupprLineParams = [
    {textid:"HIDE_ALL"      , color:"red"              , class:"*"          , separator:"|" },
    {textid:"HIDE_REVIEWED" , color:"rgb(255,235,71)"  , class:"RcChecked"  , separator:""  },
    {textid:"HIDE_REVERTS"  , color:"rgb(255,99,83)"   , class:"RcRevert"   , separator:""  },
    {textid:"HIDE_NEW"      , color:"rgb(178,243,113)" , class:"RcNew"      , separator:""  },
    {textid:"HIDE_BLANKING" , color:"white"            , class:"RcBlanking" , separator:""  },
    {textid:"HIDE_LOG"      , color:"blue"             , class:"RcLog"      , separator:""  }
  ];

/*

Variables d'état (pour test sur rc.state)[modifier le code]

Commentaire de modif[modifier le code]
 */

  window.Custom_commenttests = [];

  window.commenttests = [
    { state: "REVERT"     , icon:"RevertIcon",           class:"RcRevert",           regex: /\b([Aa]nnulation|[Rr]évocation)\b|^(Undid|Revert to( the)?) revision|^(Undoing|Reverted( \d+)?) edit|^r(e)?v(ert(ing|ed)?)?\b|^La dernière modification du texte .* a été rejetée/, hide:false},
    { state: "BLANKING"   , icon:"BlankingIcon",         class:"RcBlanking",         regex: /^Résumé automatique : blanchiment|^[Bb]lanchi|(Live|Patrouille) *(RC)?( : )?Blanchiment/  , hide:false},
    { state: "REPLACED"   , icon:"ReplacedIcon",         class:"RcReplaced",         regex: /^Résumé automatique : contenu remplacé par/  , hide:false},
    { state: "REDIRECTED" , icon:"RedirectedIcon",       class:"RcRedirected",       regex: /^Page redirigée vers|^#REDIRECT/,   hide:false},
    { state: "WPCLEANER"  , icon:"WPCIcon",              class:"RcWPC",              regex: /(WPCleaner|Correction syntaxique)/, hide:false},
    { state: "AWB"        , icon:"AWBIcon",              class:"RcAWB",              regex: /(AWB|AutoWikiBrowser)/,             hide:false},
    { state: "POPUPS"     , icon:"PopupsIcon",           class:"RcPopups",           regex: /(P|p)opups/,                        hide:false}
  ];

/*
Catégories de pages[modifier le code]
 */

  window.Custom_categoriestests = [];

  window.categoriestests = [
    { state: "ADQ"       , icon:"AdQIcon"      , class:"RcADQ",       regex: /Article de qualité( contesté|)$/                },
    { state: "BA"        , icon:"BAIcon"       , class:"RcBA",        regex: /Bon article$/                                   },
    { state: "APDQ"      , icon:"APDQIcon"     , class:"RcAPDQ",      regex: /Article potentiellement (bon|de qualité)/       },
    { state: "STUB"      , icon:"StubIcon"     , class:"RcStub",      regex: /Wikipédia:ébauche/                              },
    { state: "COPYRIGHT" , icon:"CopyrightIcon", class:"RcCopyright", regex: /Article soupçonné de travail sous copyright/    },
    { state: "PAS"       , icon:"PaSIcon"      , class:"RcPaS",       regex: /Page proposée à la suppression/                 }
  ];

/*
Catégories d'utilisateurs[modifier le code]
 */

  window.Custom_watchCategories = [];

  window.watchCategories = [
    { state: "SCOLARIP"      , icon:"ScolarIPIcon"      , class:"RcScolarIP",      category: "Adresse IP scolaire"                  },
    { state: "SHAREDIP"      , icon:"SharedIPIcon"      , class:"RcSharedIP",      category: "Adresse IP partagée"                  },
    { state: "OPENPROXY"     , icon:"OpenProxyIcon"     , class:"RcOpenProxy",     category: "Proxy ouvert"                         },
    { state: "COPYRIGHTUSER" , icon:"CopyrightUserIcon" , class:"RcCopyrightUser", category: "Utilisateur enfreignant un copyright" },
    { state: "PEDIAPROJECT"  , icon:"PediaProjectIcon"  , class:"RcPediaProject",  category: "Utilisateur projet pédagogique"       }
  ];

/*
Modèles[modifier le code]
 */

  window.Custom_templatestests = [];

  window.templatestests = [
    { state: "PORTAIL"    , icon:""             , class:"RcPortail"  , template: "Méta lien vers portail"          },
    { state: "RECENT"     , icon:"RecentIcon"   , class:"RcRecent"   , template: "Méta bandeau d'événement récent" },
    { state: "R3R"        , icon:"R3RIcon"      , class:"RcR3R"      , template: "Règle des 3 révocations"         },
    { state: "PAS"        , icon:"PaSIcon"      , class:"RcPaS"      , template: "Suppression"                     },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Copie de site"                   },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Copie à vérifier"                },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Copyrighté"                      },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Texte copyvio"                   },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Image copyvio"                   },
    { state: "COPYRIGHT"  , icon:"CopyrightIcon", class:"RcCopyright", template: "Synopsis"                        },
    { state: "WIP"        , icon:"WIPIcon"      , class:"RcWIP"      , template: "En cours"                        },
    { state: "WIP"        , icon:"WIPIcon"      , class:"RcWIP"      , template: "En travaux"                      }
  ];

/*

Autres variables personnalisables[modifier le code]

Extensions[modifier le code]
 */

  window.Custom_lrcExtensions = [];

  window.lrcExtensions = [
    {
      "name":"ProposeTranslationExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/ProposeTranslationExtension.js",
      "desc":"Ajoute un formulaire pour proposer une traduction de l’interface.",
      "neededright": ""
    },
    {
      "name":"InstallAndConfigLiveRCExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/InstallAndConfigLiveRCExtension.js",
      "desc":"Fournit une interface de configuration lorsque l’utilisateur est présent sur la page d’installation",
      "neededright": ""
    },
    {
      "name":"UserWarningsExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/UserWarningsExtension.js",
      "desc":"Ajoute une icône aux utilisateurs ayant reçu un avertissement. En option, indique si la page de discussion de l’utilisateur existe ou non.",
      "neededright": ""
    },
    {
      "name":"MostModifiedPagesExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/MostModifiedPagesExtension.js",
      "desc":"Ajoute une icône aux pages ayant été modifiées récemment par plusieurs utilisateurs ou ayant fait l’objet de plusieurs reverts.",
      "neededright": ""
    },
    {
      "name":"LinkOnIconExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/LinkOnIconExtension.js",
      "desc":"Lie les icônes PàS, AdQ, BA et copyvio aux pages de discussion associées.",
      "neededright": ""
    },
    {
      "name":"LinkOnLanglinkCountExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/LinkOnLanglinkCountExtension.js",
      "desc":"Ajoute un lien vers wikidata par dessus le compteur de liens inter-langues.",
      "neededright": ""
    },
    {
      "name":"ToolbarExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/ToolbarExtension.js",
      "desc":"Fournit une barre d’outils lors d’une édition.",
      "neededright": ""
    },
    {
      "name":"HotCatsMulti",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/HotCatsMulti.js",
      "desc":"Permet d’ajouter/modifier/retirer une ou plusieurs catégories lors de la prévisualisation d’une page",
      "neededright": ""
    },
    {
      "name":"CategoryRC",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/CategoryRCExtension.js",
      "desc":"Permet de ne surveiller que les pages appartenant à une ou plusieur catégories",
      "neededright": ""
    },
    {
      "name":"PreviewAllLinksExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/PreviewAllLinksExtension.js",
      "desc":"Permet de prévisualiser tout lien interne de la fenêtre de prévisualisation",
      "neededright": ""
    },
    {
      "name":"PreviewThisPageExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/PreviewThisPageExtension.js",
      "desc":"Permet de prévisualiser une page au choix",
      "neededright": ""
    },
    {
      "name":"DiffExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/DiffExtension.js",
      "desc":"Permet d’avoir les fonctions automatiques de LiveRC dans les diff \"normaux\"",
      "neededright": ""
    },
    {
      "name":"AskForRevisionDeleteFromHistExtension",
      "url":"//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LiveRC.js/Extensions/AskForRevisionDeleteFromHistExtension.js",
      "desc":"Ajoute des cases à cocher et un bouton dans la prévisualisation d’un historique pour demander un masquage (non sysop)",
      "neededright": "!deleterevision"
    }

  ];


/*
Styles CSS[modifier le code]
Voir MediaWiki:Gadget-LiveRC.js/CSS.js
 */


/*
Onglets du menu de configuration[modifier le code]
 */

    // Config panel tabs
  window.Custom_lstParamMenuTabs = {};
  window.lstParamMenuTabs = {
    "lrcParams"              : true,
    "lrcOptionMenuValues"    : true,
    "lstBlank"               : true,
    "lrcRevertMessages"      : true,
    "lstAverto"              : true,
    "lstBando"               : true,
    "lstReport"              : false,
    "lrcIcons"               : true,
    "lrcTranslatedTexts"     : true,
    "lrcTranslatedParamDesc" : true,
    "UnTranslatedTexts"      : true,
    "lrcExtensions"          : false,
    "commenttests"           : true,
    "categoriestests"        : true,
    "templatestests"         : true,
    "watchCategories"        : true,
    "lrcSupprLineParams"     : false,
    "ContactListLegend"      : true,
    "HiddenListLegend"       : true,
    "ExtensionsLegend"       : true,
    "lrcCSSstyles"           : true
  };

/*

Variables non personnalisables[modifier le code]

 */

// Configuration

  if(typeof(window.LiveRC_Config)==="undefined") window.LiveRC_Config = {};

  if(typeof(LiveRC_Config["InstallationPage"])==="undefined")
    LiveRC_Config["InstallationPage"] = ( mw.config.get('wgServer')==='//fr.wikipedia.org' ? "MediaWiki:Gadget-LiveRC-frWP.js" : "Mediawiki:Gadget-LiveRC.js" );

  if(typeof(LiveRC_Config["SiteConfigPage"])==="undefined")
    LiveRC_Config["SiteConfigPage"] = "MediaWiki:Gadget-LiveRCSiteConfig.js";      // Page de stockage de la config locale

  if(typeof(LiveRC_Config["CSSPage"])==="undefined")
    LiveRC_Config["CSSPage"] = "MediaWiki:Gadget-LiveRC-local.css";                // Page de stockage du css local

  if(typeof(LiveRC_Config["UserParamPage"])==="undefined")
    LiveRC_Config["UserParamPage"] = "/LiveRCparam";                               // Sous-page utilisateur de stockage des personnalisations

  if(typeof(LiveRC_Config["HostServerPath"])==="undefined")
    LiveRC_Config["HostServerPath"] = "//fr.wikipedia.org/w/index.php?title=";     // Serveur hébergeant le code de LiveRC


  LiveRC_Config["BugzillaURL"] = "https://fr.wikipedia.org/wiki/Discussion MediaWiki:Gadget-LiveRC.js";

  LiveRC_Config["LaunchProcess"] = [];    // Process d'initialisation
  LiveRC_Config["LaunchProcessForce"] = {};

    // Configuration du wiki local
  LiveRC_Config["MediawikiGeneralConfig"] = {};                        // Liste des paramètres de configuration
  LiveRC_Config["MediawikiLanguages"] = {};                            // Liste des langues supportées
  LiveRC_Config["MediawikiMessages"] = {};                             // Liste des messages système Mediawiki
  LiveRC_Config["MediawikiExtensions"] = {};                           // Liste des extensions Mediawiki
  LiveRC_Config["MediawikiNamespaces"] = {};                           // Liste des espaces de noms
  LiveRC_Config["MediawikiMagicwords"] = {};                           // Liste des mots magiques
  LiveRC_Config["MediawikiUsergroups"] = {};                           // Liste des groupes d'utilisateurs et des droits associés
  LiveRC_Config["MediawikiInterwikimap"] = {};                         // Liste des liens interwiki possibles
  LiveRC_Config["MediawikiWikibase"] = {};                             // Liste des paramètres de la wikibase
  LiveRC_Config["MediawikiTags"] = {};                                 // Liste des balises Abuse filter

  LiveRC_Config["ToolTags"] = {   // Balises pour marquer les édits faits avec des outils automatiques
    "LiveRC" : ""
  };

    // Informations sur l'utilisateur courant
  LiveRC_Config["UserInfos"] = {
    Rights      : [],                                                   // Liste des droits
    Groups      : [],                                                   // Liste des groupes
    isAdmin     : (mw.config.get('wgUserGroups').indexOf("sysop")!=-1), // Utilisateur administrateur;
    isBlocked   : false,                                                // Utilisateur bloqué
    EditCount   : 0,                                                    // Editcount
    RealName    : "",                                                   // "Vrai" nom (si renseigné)
    eMail       : "",                                                   // adresse mail (si renseignée)
    Preferences : {},                                                   // Préférences
    APIlimit    : 499                                                   // Limite de requête API
  };
    // Gestion des langues
  LiveRC_Config["SupportedLanguages"] = ["fr", "en", "it"];
  LiveRC_Config["AvailableLanguages"] = [];
  LiveRC_Config["LoadedLanguages"] = [];
  LiveRC_Config["LoadFunctions"] = [];

    //Historique des prévisualisations
  LiveRC_Config["History"] = {
    "Type"   : [],
    "Params" : [],
    "URL"    : [],
    "Text"   : [],
    "Index"  : -1,
    "IsOld"  : false
  };

    // Listes de suivi spéciales
  LiveRC_Config["SpecialLogList"] = [];         // Définition des listes de suivi spéciales
  LiveRC_Config["SpecialLogListConfig"] = {     // Configuration des listes spéciales
    "liveAbuseLog"       : { "Values" : {}, "DefaultState" : true  },  // Liste des déclenchements de filtre anti-abus
    "liveTag"            : { "Values" : {}, "DefaultState" : true  },  // Liste des modifications balisées
    "liveSpam"           : { "Values" : {}, "DefaultState" : false },  // Liste des utilisateurs ayant déclenché le filtre anti-spam
    "liveRevoc"          : { "Values" : {}, "DefaultState" : true  },  // Liste des utilisateurs révoqués
    "liveNewUsers"       : { "Values" : {}, "DefaultState" : true  },  // Liste des utilisateurs inscrits durant la session
    "liveContact"        : { "Values" : {}, "DefaultState" : false },  // Liste des utilisateurs suivis
    "liveHidden"         : { "Values" : {}, "DefaultState" : false },  // Liste des utilisateurs masqués
    "liveSuivi"          : { "Values" : {}, "DefaultState" : false },  // Liste des pages suivies
    "liveHiddenPages"    : { "Values" : {}, "DefaultState" : false },  // Liste des pages masquées
    "liveNewPages"       : { "Values" : {}, "DefaultState" : true  },  // Liste des nouvelles pages
    "livePendingChanges" : { "Values" : {}, "DefaultState" : true  }   // Liste des pages en attente de validation
  };


   // Listes d'utilisateurs locaux par groupe
  LiveRC_Config["UserGroupList"] = {
    "sysop" : { list:[], show:false },
    "bot"   : { list:[], show:false }
  };

    // Autres listes
  LiveRC_Config["Blocks"] = [];                // Liste des utilisateurs récemment bloqués
  LiveRC_Config["UserCat"] = {};               // Liste des catégories d'utilisateurs
  LiveRC_Config["Blocked"] = [];               // Liste des utilisateurs bloqués durant la session
  LiveRC_Config["Notificationtimestamp"] = {}; // Liste des notificationtimestamp
  LiveRC_Config["ListLoaded"] = {};            // État de chargement des liste spéciales

    // IDs à rechercher pour le contenu d'une page
  LiveRC_Config["PageContentIds"] = [
    'bodyContent',
    'article',
    'mw_contentholder'
  ];

    // Menu de paramétrage
  LiveRC_Config["LiveRCcustomParams"] = {};
  LiveRC_Config["ParamStartComment"] = '//<sou'+'rce lang="javascript">//<pr'+'e>//<no'+'wiki>\n\n';
  LiveRC_Config["ParamEndComment"] = '//END PARAMS\n//</no'+'wiki></pr'+'e></sour'+'ce>\n';
  LiveRC_Config["MediawikiConfigComment1"] = "// AUTOMATIC SAVE BEGIN";  // Config locale : commentaire début
  LiveRC_Config["MediawikiConfigComment2"] = "// AUTOMATIC SAVE END";    // Config locale : commentaire fin
  LiveRC_Config["CustomCatTemplate"] = 'Catégorisation JS';
  LiveRC_Config["AlwaysShownTabs"] = ["lstParamMenuTabs"];

    // Z-index Checklists
  LiveRC_Config["CheckListZIndex"] = 6000;

  // Limitations
  LiveRC_Config["RevertLimit"] = 10;
  LiveRC_Config["LimitationsRight"] = {
    "Default" : "autopatrol",
    "Revert"  : "autopatrol",
    "Blank"   : "autopatrol",
    "Tag"     : "autopatrol",
    "Message" : "autopatrol",
    "Thank"   : "autopatrol",
    "Report"  : "autopatrol"
  };
  // Utilisateurs qui ne sont pas concernés par la limitation (reservé aux développeurs)
  LiveRC_Config["LimitationsWhitelist"] = ["Dr Brains"];
  // Utilisateurs qui sont interdits d'outils automatiques
  LiveRC_Config["LimitationsBlacklist"] = [];

// Timestamps d'initialisation des RC, Log et Filtres
  LiveRC_Config["LastRCid"] = 0;
  LiveRC_Config["LastLOGid"] = 0;
  LiveRC_Config["LastFILTERid"] = 0;
  LiveRC_Config["LastRCtimestamp"] = 1;
  LiveRC_Config["LastLOGtimestamp"] = 1;
  LiveRC_Config["LastFILTERtimestamp"] = 1;
  LiveRC_Config["LastCUtimestamp"] = 1;

// Autres initialisations
  LiveRC_Config["ClockTime"] = {};             // Horloge de LiveRC ("H","M","S")
  LiveRC_Config["Timeout"] = {};               // Liste des timeout
  LiveRC_Config["LoadingTime"] = 0;            // Temps de chargement, en secondes
  LiveRC_Config["RequestError"] = 0;           // Nombre de requêtes RC consécutives échoués
  LiveRC_Config["PendingDebug"] = [];          // Ligne de débogage en attente
  LiveRC_Config["AlertCount"] = -1;            // Index des alertes
  LiveRC_Config["NextFreeID"] = 0;             // Index des ID automatiques
  LiveRC_Config["NextPreviewIndex"] = 0;       // Index des prévisualisations

  // Préchargement de la prévisualisation
  LiveRC_Config["RCEvents"] = {};
  LiveRC_Config["AllLinesSeen"] = true;

    // Suggestions de pages
  LiveRC_Config["SuggestParams"] = {};
  LiveRC_Config["SuggestParams"]["ZIndex"] = 5;                // Propriété "z-index" de départ
  LiveRC_Config["SuggestParams"]["Input"] = [];                // Matrice des <input> (champ de saisie)
  LiveRC_Config["SuggestParams"]["Suggest"] = [];              // Matrice des <select> (liste de suggestions)
  LiveRC_Config["SuggestParams"]["ExistInput"] = [];           // Matrice des <input> (page existe ou pas)
  LiveRC_Config["SuggestParams"]["ExistImg"] = [];             // Matrice des <img> (page existe ou pas)
  LiveRC_Config["SuggestParams"]["IsRunning"] = [];            // Matrice de l'état de la requête de suggestions
  LiveRC_Config["SuggestParams"]["Index"] = 1;                 // Index de départ (id)
      // Valeurs configurables
  LiveRC_Config["SuggestParams"]["NSFilter"] = [];             // Matrice de l'option de filtrage par espace de noms
  LiveRC_Config["SuggestParams"]["StripNS"] = [];              // Matrice de l'option d'affichage de l'espace de noms
  LiveRC_Config["SuggestParams"]["SuggestLimit"] = [];         // Matrice de la limite des suggestions
  LiveRC_Config["SuggestParams"]["SuggestSelectLimit"] = [];   // Matrice de la taille de la liste de suggestions
  LiveRC_Config["SuggestParams"]["ListDown"] = [];             // Matrice de l'affichage de la liste de suggestions
  LiveRC_Config["SuggestParams"]["AddExist"] = [];             // Matrice de l'affichage de l'icône
  LiveRC_Config["SuggestParams"]["Prefix"] = [];               // Matrice des préfixes de filtrage
  LiveRC_Config["SuggestParams"]["Suffix"] = [];               // Matrice des suffixes de filtrage
  LiveRC_Config["SuggestParams"]["RedirectFilter"] = [];       // Matrice des filtrages de redirection
      // Valeurs par défaut
  LiveRC_Config["SuggestParams"]["NSFilter"][0] = false;
  LiveRC_Config["SuggestParams"]["StripNS"][0] = false;
  LiveRC_Config["SuggestParams"]["SuggestLimit"][0] = 10;
  LiveRC_Config["SuggestParams"]["SuggestSelectLimit"][0] = 5;
  LiveRC_Config["SuggestParams"]["ListDown"][0] = false;
  LiveRC_Config["SuggestParams"]["AddExist"][0] = false;
  LiveRC_Config["SuggestParams"]["Prefix"][0] = false;
  LiveRC_Config["SuggestParams"]["Suffix"][0] = false;
  LiveRC_Config["SuggestParams"]["RedirectFilter"][0] = "all";

    // List des extensions LiveRC installées par l'utilisateur
  LiveRC_Config["InstalledLiveRCExtensions"] = [];
  LiveRC_Config["UsedLiveRCExtensions"] = [];

    // List des mots magiques utilisés
  LiveRC_Config["NeededMagicWords"] = [];

    // Liste des messages systèmes utilisés
  LiveRC_Config["NeededMessages"] = [
    "abusefilter-log",
    "abusefilter-action-block",
    "abusefilter-action-blockautopromote",
    "abusefilter-action-degroup",
    "abusefilter-action-disallow",
    "abusefilter-action-rangeblock",
    "abusefilter-action-tag",
    "abusefilter-action-throttle",
    "abusefilter-action-warn",
    "abusefilter-log-noactions",
    "abusefilter-edit-warn-actions",
    "block-log-flags-angry-autoblock",
    "block-log-flags-anononly",
    "block-log-flags-hiddenname",
    "block-log-flags-noautoblock",
    "block-log-flags-nocreate",
    "block-log-flags-noemail",
    "block-log-flags-nousertalk",
    "hide",
    "show",
    "watch",
    "unwatch",
    "log",
    "mycontris",
    "protect-unchain-permissions",
    "red-link-title",
    "revertpage",
    "markedaspatrolled",
    "whatlinkshere-filters",
    "whatlinkshere-hideimages",
    "whatlinkshere-hidelinks",
    "whatlinkshere-hideredirs",
    "whatlinkshere-hidetrans",
    "january",
    "february",
    "march",
    "april",
    "may",
    "june",
    "july",
    "august",
    "september",
    "october",
    "november",
    "december"
  ];

    // Types de journaux, avec extensions mediawiki et/ou droits nécessaires
  LiveRC_Config["LogNames"] = {
    'upload':             {page:'uploadlogpage'                                                                         },
    'newusers':           {page:'newuserlogpage'                                                                        },
    'patrol':             {page:'patrol-log-page'                                                                       },
    'move':               {page:'movelogpage'                                                                           },
    'merge':              {page:'mergelog'                                                                              },
    'protect':            {page:'protectlogpage'                                                                        },
    'delete':             {page:'dellogpage'                                                                            },
    'block':              {page:'blocklogpage'                                                                          },
    'rights':             {page:'rightslog'                                                                             },
    'import':             {page:'importlogpage'                                                                         },
    'managetags':         {page:'log-name-managetags'                                                                   },
    'tag':                {page:'log-name-tag'                                                                          },
    'gblblock':           {page:'globalblocking-logpage',           extension:'GlobalBlocking'                          },
    'globalauth':         {page:'centralauth-log-name',             extension:'Central Auth'                            },
    'gblrename':          {page:'log-name-gblrename',               extension:'Central Auth'                            },
    'gblrights':          {page:'centralauth-rightslog-name',       extension:'Central Auth'                            },
    'renameuser':         {page:'log-name-renameuser',              extension:'Renameuser'                              },
    'abusefilter':        {page:'abusefilter-log-name',             extension:'Abuse Filter'                            },
    'abuselog':           {page:'abusefilter-log',                  extension:'Abuse Filter'                            },
    'thanks':             {page:'log-name-thanks',                  extension:'Thanks'                                  },
    'massmessage':        {page:'log-name-massmessage',             extension:'MassMessage'                             },
    'suppress':           {page:'suppressionlog',                   extension:'Oversight',        right:'suppressionlog'},
    'checkuser':          {page:'checkuserlog',                     extension:'CheckUser',        right:'checkuser-log' },
    'pagetriage-curation':{page:'log-name-pagetriage-curation',     extension:'PageTriage'                              },
    'pagetriage-deletion':{page:'log-name-pagetriage-deletion',     extension:'PageTriage'                              },
    'review':             {page:'review-logpage',                   extension:'Flagged Revisions'                       },
    'stable':             {page:'stable-logpage',                   extension:'Flagged Revisions'                       },
    'online':             {page:'log-name-online',                  extension:'Education Program'                       },
    'campus':             {page:'log-name-campus',                  extension:'Education Program'                       },
    'course':             {page:'log-name-course',                  extension:'Education Program'                       },
    'institution':        {page:'log-name-institution',             extension:'Education Program'                       },
    'instructor':         {page:'log-name-instructor',              extension:'Education Program'                       },
    'student':            {page:'log-name-student',                 extension:'Education Program'                       },
    'student':            {page:'log-name-student',                 extension:'Education Program'                       },
    'translatorsandbox':  {page:'log-name-translatorsandbox',       extension:'Translate'                               },
    'translationreview':  {page:'log-name-translationreview',       extension:'Translate'                               },
    'pagetranslation':    {page:'log-name-pagetranslation',         extension:'Translate'                               },
    'notifytranslators':  {page:'log-name-notifytranslators',       extension:'TranslationNotifications'                },
    'liquidthreads':      {page:'lqt-log-name',                     extension:'Liquid Threads'                          },
    'mwoauthconsumer':    {page:'mwoauthconsumer-consumer-logpage', extension:'OAuth'                                   },
    'moodbar':            {page:'moodbar-log-name',                 extension:'MoodBar'                                 },
    'interwiki':          {page:'log-name-interwiki',               extension:'Interwiki'                               }
  };

    // Catégories de suivi ([[Special:TrackingCategories]])
  LiveRC_Config["TrackingCategories"] = [
    "expensive-parserfunction-category",
    "post-expand-template-argument-category",
    "post-expand-template-inclusion-category",
    "hidden-category-category",
    "broken-file-category",
    "node-count-exceeded-category",
    "expansion-depth-exceeded-category",
    "score-error-category",
    "massmessage-list-category",
    "commonsmetadata-trackingcategory-no-license",
    "commonsmetadata-trackingcategory-no-description",
    "commonsmetadata-trackingcategory-no-author",
    "commonsmetadata-trackingcategory-no-source",
    "geodata-broken-tags-category",
    "geodata-unknown-globe-category",
    "geodata-unknown-region-category",
    "geodata-unknown-type-category",
    "scribunto-common-error-category",
    "scribunto-module-with-errors-category"
  ];


    // Hooks
  LiveRC_Config["Hooks"] = {
  /* Lancement */
    "BeforeInitActivationProcess"   : [],
    "AfterInitActivationProcess"    : [],
    "AfterGotUserInfos"             : [],
    "AfterGotSiteInfos"             : [],
    "AfterTranslationsLoaded"       : [],
    "AfterSpecialLogList"           : [],
    "AfterOptions"                  : [],
  /* Requête RC */
    "BeforeRC"                      : [],
    "AfterRC"                       : [],
    "AfterRCNotification"           : [],
    "AfterSpecialLogListUpdated"    : [],
    "AfterAllSpecialLogListUpdated" : [],
  /* Prévisualisation */
    "AfterPreviewDiff"              : [],
    "AfterPreviewArticle"           : [],
    "AfterPreviewHistory"           : [],
    "AfterPreviewContribs"          : [],
    "AfterPreviewDeletedContribs"   : [],
    "AfterPreviewLog"               : [],
    "AfterPreviewFilter"            : [],
    "AfterPreviewEdit"              : [],
    "AfterPreviewMove"              : [],
    "AfterPreviewProtect"           : [],
    "AfterPreviewDelete"            : [],
    "AfterPreviewBlock"             : [],
    "AfterPreviewRevisiondelete"    : [],
    "AfterPreviewWhatlinkshere"     : [],
    "AfterPreviewStabilization"     : [],
    "AfterPreviewChangetag"         : [],
    "AfterPreviewInterwiki"         : [],
    "AfterMiniDiffPrewiew"          : [],
  /* Menu de configuration */
    "AfterFillParamPanel"           : [],
    "AfterCreateParamPanel"         : [],
    "BeforeParamPanelSaved"         : [],
  /* Autres */
    "AfterDisplayDebug"             : [],
    "AfterDisplayTchat"             : [],
    "AfterDisplayNewWindowTchat"    : []
  };

  // Config extensions mediawiki. TODO : trouver un moyen pour remplir ces variables automatiquement (via l'API ?)
    /* === Flagged Revisions === */
     // Liste des namespaces où la validation est active
  LiveRC_Config["FlagRevNamespaces"] = [0, 6, 10, 828];
     // Stabilisation intégrée à l'outil de protection
  LiveRC_Config["FlagRevProtection"] = false;
    /* === Flow === */
     // Liste des pages où flow est actif
  LiveRC_Config["FlowOccupyPages"] = ["Discussion Wikipédia:Flow", "Wikipédia:Forum des nouveaux/Flow"];
     // Liste des namespaces où flow est actif
  LiveRC_Config["FlowOccupyNamespaces"] = [2600];
     // Actions permises sur les pages où flow est actif
  LiveRC_Config["FlowCoreActionWhitelist"] = ['info', 'history', 'protect', 'unprotect', 'unwatch', 'watch'];



    // Variables obsolètes, conservées pour compatibilité avec anciennes personnalisations
  var lang_log = [];
  var lrcManageParamsDesc = [];
  var lrcHotCatsVariables = [];
  var lrcHotCatsText = [];
  var lrcHooks = [];
  var lrcIcon = [];
  var lrcManageParams_Desc = [];
  var lrcParams_Custom = [];
  var lrcOptionMenuValues_Custom = [];
  var lstBlank_Custom = [];
  var lrcRevertMessages_Custom = [];
  var lstAverto_Custom = [];
  var lstBando_Custom = [];
  var lrcIcons_Custom = [];
  var lrcExtensions_Custom = [];
  var UnTranslatedTexts_Custom = [];
  var lrcTexts_Custom = [];
  var lrcParamDesc_Custom = [];

  // fonction spéciale pour supprimer/modifier un paramètre chargé dans le LiveRCparam.js d'un utilisateur

window.LiveRC_getSpecialCustom = function(){

    for(var tag in LiveRC_Config["MediawikiTags"]){
        if(typeof(LiveRC_Config["MediawikiTags"][tag]) === "boolean") delete LiveRC_Config["MediawikiTags"][tag];
    }

    for(var a=0,l=lrcIcons.length;a<l;a++){
      if(lrcIcons[a].type == "sup_img") lrcIcons[a].type = 1;
      else if(lrcIcons[a].type == "sub_img") lrcIcons[a].type = 2;
      else lrcIcons[a].type = 0;
      if(!lrcIcons[a].height) lrcIcons[a].height = lrcIcons[a].width;
    }
    for(var a=0,l=Custom_lrcIcons.length;a<l;a++){
      if(Custom_lrcIcons[a].type == "sup_img") Custom_lrcIcons[a].type = 1;
      else if(Custom_lrcIcons[a].type == "sub_img") Custom_lrcIcons[a].type = 2;
      else Custom_lrcIcons[a].type = 0;
      if(!Custom_lrcIcons[a].height) lrcIcons[a].height = Custom_lrcIcons[a].width;
    }
    for(var a=0,l=Custom_commenttests.length;a<l;a++){
      if(!Custom_commenttests[a].hide) Custom_commenttests[a].hide = false;
      if(Realtypeof(Custom_commenttests[a].regex)=="string") Custom_commenttests[a].regex = new RegExp(Custom_commenttests[a].regex);
    }
    for(var a=0,l=commenttests.length;a<l;a++){
      if(Realtypeof(commenttests[a].regex)=="string") commenttests[a].regex = new RegExp(commenttests[a].regex);
    }
    for(var a=0,l=Custom_categoriestests.length;a<l;a++){
      if(Realtypeof(Custom_categoriestests[a].regex)=="string") Custom_categoriestests[a].regex = new RegExp(Custom_categoriestests[a].regex);
    }
    for(var a=0,l=categoriestests.length;a<l;a++){
      if(Realtypeof(categoriestests[a].regex)=="string") categoriestests[a].regex = new RegExp(categoriestests[a].regex);
    }
    if(typeof(lrcUserWarningsMessages)!="undefined"){
      for(var a=0,l=lrcUserWarningsMessages.length;a<l;a++){
        if(Realtypeof(lrcUserWarningsMessages[a].regex)=="string") lrcUserWarningsMessages[a].regex = new RegExp(lrcUserWarningsMessages[a].regex);
      }
    }
    if(typeof(Custom_lrcUserWarningsMessages)!="undefined"){
      for(var a=0,l=Custom_lrcUserWarningsMessages.length;a<l;a++){
        if(Realtypeof(Custom_lrcUserWarningsMessages[a].regex)=="string") Custom_lrcUserWarningsMessages[a].regex = new RegExp(Custom_lrcUserWarningsMessages[a].regex);
      }
    }
    for(var a=0,l=Custom_lstBando.length;a<l;a++){
      if(typeof(Custom_lstBando[a].withDate)==="boolean" && Custom_lstBando[a].withDate) Custom_lstBando[a].withDate = "$month $year";
      else if(!Custom_lstBando[a].withDate) Custom_lstBando[a].withDate = "";
    }
    for(var a=0,l=Custom_lstAverto.length;a<l;a++){
      if(typeof(Custom_lstAverto[a].addSectionTitle)==="undefined") Custom_lstAverto[a].addSectionTitle = false;
    }
    if(typeof(Custom_lrcParams["LoadSysopBotList"])!="undefined") Custom_lrcParams["LoadUsersInGroupsList"] = Custom_lrcParams["LoadSysopBotList"];

    for(var a=0,l=Custom_lrcExtensions.length;a<l;a++){
      delete Custom_lrcExtensions[a]["Installed"];
      if(!Custom_lrcExtensions[a]["neededright"]) Custom_lrcExtensions[a]["neededright"] = "";
    }
    for(var a=0,l=lrcExtensions.length;a<l;a++){
      if(!lrcExtensions[a]["neededright"]) lrcExtensions[a]["neededright"] = "";
    }
    if(typeof(Custom_lrcEditToolBarSetup)==="object" && typeof(lrcEditToolBarSetup)==="object"){
      for(var a=0,l=Custom_lrcEditToolBarSetup.length;a<l;a++){
        var IconId = Custom_lrcEditToolBarSetup[a].iconid.split("ToolbarIcon_").join("");
        if(["enum", "list", "gallery", "table", "math"].indexOf(IconId)!==-1 && Custom_lrcEditToolBarSetup[a].before.indexOf("\n")==-1){
          for(var b=0,m=lrcEditToolBarSetup.length;b<m;b++){
            if(lrcEditToolBarSetup[b].iconid.split("ToolbarIcon_").join("") != IconId) continue;
            Custom_lrcEditToolBarSetup[a] = lrcEditToolBarSetup[b];
          }
        }
      }
    }
    var ObsoleteCustomParams = [
      "AddExtensionCustom",
      "LoadSysopBotList",
      "ShowAllRevoc",
      "ShowAllBlank",
      "HideWPCleaner",
      "HideAWB",
      "RvMinorEdit",
      "AddStyleCustom",
      "RCType",
      "RCns",
      "ShowUserInfos"
    ];
    var ParamToOption = [
      "ShowAllSelf",
      "ShowAllContact",
      "ShowAllWatchlist",
      "HideOwnSubpage"
    ];
    var OptionToParam = [
      "InterwikiList"
    ];
    for(var param in Custom_lrcParams){
      if(ObsoleteCustomParams.indexOf(param)!=-1) delete Custom_lrcParams[param];
      if(ParamToOption.indexOf(param)!=-1){
        Custom_lrcOptionMenuValues[("User_"+param)] = Custom_lrcParams[param];
        delete Custom_lrcParams[param];
      }
    }
    for(var option in Custom_lrcOptionMenuValues){
      if(ObsoleteCustomParams.indexOf(option)!=-1) delete Custom_lrcOptionMenuValues[option];
      if(OptionToParam.indexOf(option)!=-1){
        Custom_lrcParams[option] = Custom_lrcOptionMenuValues[option];
        delete Custom_lrcOptionMenuValues[option];
      }
    }

  };

/*

Fonctions utilitaires[modifier le code]

Ajax[modifier le code]

 */

window.wpajax = {
  initReq: function() {
    var xmlhttp;
    try {
      xmlhttp = new XMLHttpRequest();
    } catch(e) {
      try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
        try {
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {
          xmlhttp = false;
        }
      }
    }
    return xmlhttp;
  },
  /* preloadReq.state
     0 : no request
     1 : pending request
     2 : pending request, the result will be used with preloadReq.bundle
         (preloadReq is locked until the request is complete)
     3 : completed request
  */
  preloadReq: {url: null, xmlhttp: null, bundle: null, state: 0},
  preload: function(url) {
    if (!lrcMakeParam("PreloadLines")) return;
    var plr = wpajax.preloadReq;
    if (plr.state == 2) return 0;
    var xmlhttp = wpajax.initReq();
    if (!xmlhttp) return 0;
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState != 4
          || !((plr.state == 1 || plr.state == 2) && plr.url == url)) return;
      var oldState = plr.state;
      plr.xmlhttp = xmlhttp;
      plr.state = 3;
      if (oldState == 2)
        wpajax.httpComplete(xmlhttp, plr.bundle);
    };
    plr.state = 1;
    plr.url = url;
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);
    return 1;
  },
  // mandatory: bundle.url
  // optional:  bundle.async
  // optional:  bundle.method
  // optional:  bundle.headers
  // optional:  bundle.data
  // optional:  bundle.onSuccess (xmlhttprequest, bundle)
  // optional:  bundle.onFailure (xmlhttprequest, bundle)
  // optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure
  http: function(bundle) {
    lrcDisplayDebug("Ajax request sent : " + bundle.url + (bundle.data ? " ; data = "+bundle.data : ""), true);
    var plr = wpajax.preloadReq;
    if (!(bundle.method || bundle.headers || bundle.async == false || bundle.data)
        && (plr.state == 1 || plr.state == 3) && plr.url == bundle.url) {
      if (plr.state == 1) {
        plr.state = 2;
        plr.bundle = bundle;
      } else {
        wpajax.httpComplete(plr.xmlhttp, bundle);
      }
      return 2;
    }
    var xmlhttp = wpajax.initReq();
    if (!xmlhttp) return 0;
    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4)
        wpajax.httpComplete(xmlhttp, bundle);
    };
    xmlhttp.open(bundle.method ? bundle.method : "GET", bundle.url, bundle.async == false ? false : true);
    if (bundle.headers) {
      for (var field in bundle.headers)
        try {
          xmlhttp.setRequestHeader(field, bundle.headers[field]);
        } catch(err) {
          //Argos42 : pour rendre LiveRC fonctionnel sur chrome
        }
    }
    xmlhttp.send(bundle.data ? bundle.data : null);
    return 1;
  },
  httpComplete: function(xmlhttp, bundle) {
    if (xmlhttp.status == 200 || xmlhttp.status == 302) {
      if (bundle.onSuccess)
        bundle.onSuccess(xmlhttp, bundle);
    } else if (bundle.onFailure) {
      bundle.onFailure(xmlhttp, bundle);
    }
    lrcDisplayDebug("Ajax request received : " + bundle.url + (bundle.data ? " ; data = "+bundle.data : "") + " (" + xmlhttp.status+")", true);
  }
};

/*

Hook functions[modifier le code]

 */

// Ajout d'une fonction à un hook

window.LiveRC_AddHook = function(Type, func){
  if(typeof(LiveRC_Config["Hooks"][Type])==="undefined") LiveRC_Config["Hooks"][Type] = [];
  if(typeof(func)==="function") LiveRC_Config["Hooks"][Type].push(func);
};

// Exécution des fonctions

window.LiveRC_RunHooks = function(Type, Params){
  var HookResult = true;
  if(typeof(LiveRC_Config["Hooks"][Type])!='undefined'){
    lrcDisplayDebug("Run hook ("+Type+")");
    for(var a=0,l=LiveRC_Config["Hooks"][Type].length;a<l;a++){
      var ThisHookResult = LiveRC_Config["Hooks"][Type][a](Params);
      if(ThisHookResult===false) HookResult = false;
    }
  }
  return HookResult;
};

/*

Fonctions d'état[modifier le code]

 */

window.lrcHasState = function(state, thisState){
    if(!state) return false;
    return (state.indexOf(thisState)!=-1);
};

window.lrcAddState = function(state, thisState){
    if(!state) state = [];
    if(!lrcHasState(state, thisState)) state[(state.length)] = thisState;
    return state;
};

window.lrcRemoveState = function(state, thisState){
    if(!state) return [];
    var index = state.indexOf(thisState);
    if(index!=-1) state = state.splice(index, 1);
    return state;
};

/*

Fonctions de suivi[modifier le code]

 */

// Requête AJAX Ajout/Retrait d'un utilisateur ou d'une page du suivi

window.watchAPICall = function(title, watch) {
  var url = lrcGetAPIURL({format:"xml",action:"query",meta:"tokens",type:"watch"});
  wpajax.http({url: url, onSuccess: watchAPICallStep2, title: title, watch: watch});
};

window.watchAPICallStep2 = function(xmlreq, data){
  var tokens = xmlreq.responseXML.getElementsByTagName("tokens")[0];
  var url = lrcGetAPIURL({format:"xml",action:'watch'});
  var postdata = "title=" + encodeURIComponent(data.title)
              + "&token=" + encodeURIComponent(tokens.getAttribute("watchtoken"))
              + (data.watch ? "" : "&unwatch=1");
  var headers = {"Content-Type": "application/x-www-form-urlencoded"};
  wpajax.http({url: url, method: "POST", headers: headers, data: postdata, onSuccess: watchAPICallStep3,datas:data});
};

window.watchAPICallStep3 = function(xmlreq, data){
  var olddatas = data.datas;
  if(!olddatas) return;
  var title = olddatas.title;
  if(!title) return;
  var messageprefix = "WATCHLIST";
  if(title.indexOf('LiveRCWatch:')!=-1){
    title = title.split('LiveRCWatch:').join('');
    messageprefix = "WATCHUSER";
    try{ updateFollowContact(); }catch(e){ };
  }else if(title.indexOf('LiveRCHidden:')!=-1){
    title = title.split('LiveRCHidden:').join('');
    messageprefix = "HIDEUSER";
    try{ updateFollowHiddenUsers(); }catch(e){ };
  }else if(title.indexOf('LiveRCHiddenPage:')!=-1){
    title = title.split('LiveRCHiddenPage:').join('');
    messageprefix = "HIDEPAGE";
    try{ updateFollowHiddenPages(); }catch(e){ };
  }else{
    try{ updateFollowWatchlist(); }catch(e){ };
  }
  var messagesuffix = (olddatas.watch ? "ON" : "OFF");
  LiveRC_alert(lrcMakeText(messageprefix+messagesuffix).split("$1").join("<b>"+title+"</b>"));
};

// Basculement du bouton de suivi/masquage d'utilisateur

window.lrcToggleWatchLink = function(WatchLink){
   try{
     var Li = WatchLink.parentNode.parentNode;
     var Spans = lrcGetElementsByClass("watchedLink", Li, "span");
     for(var a=0,l=Spans.length;a<l;a++){
        if(Spans[a].style.display == "none"){
          Spans[a].style.display = "";
        }else{
          Spans[a].style.display = "none";
        }
     }
  }catch(e){ }
};

window.addPageToSuivi = function(title){
  if(typeof(LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title])!="undefined") return
  LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title] = {};
  LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title].ts = "--:--";
  LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title].edits = [];
};


window.removePageFromSuivi = function(title){
  if(typeof(LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title])=="undefined") return
  delete LiveRC_Config["SpecialLogListConfig"]["liveSuivi"]["Values"][title];
};
/*
Hors LiveRC[modifier le code]
 */

// Ajout du bouton de suivi d'utilisateur

window.LiveWatchInitButtons = function(Req, data) {
  var Li = document.getElementById('n-liveRC');
  if(!Li) return;
  var user = data.user;
  var api = Req.responseXML.getElementsByTagName('api')[0];
  if (api.firstChild.nodeName == "error") return;
  LiveRC_getMediawikiDefaultLanguage();
  if(!LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"]) LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"] = {};
  if(!LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"]) LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"] = {};
  var ThisIsContact = false;
  var ThisIsHidden = false;
  var Pages = api.getElementsByTagName('page');
  if(Pages[0] && Pages[0].getAttributeNode('watched')){
    ThisIsContact = true;
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][user] = {};
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][user].ts = "--:--";
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][user].edits = [];
  }
  if(Pages[1] && Pages[1].getAttributeNode('watched')){
    ThisIsHidden = true;
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][user] = {};
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][user].ts = "--:--";
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][user].edits = [];
  }
  var UL = Li.getElementsByTagName('ul')[0];
  if(!UL){
    UL = document.createElement('ul');
    Li.appendChild(UL);
  }
  var ContactLi = document.createElement('li');
  ContactLi.appendChild(lrcCreateWatchUserLink(mw.config.get('wgTitle'), ThisIsContact, 1));
  ContactLi.id = 'n-liveRC-contact';
  var HiddenLi = document.createElement('li');
  HiddenLi.appendChild(lrcCreateHideUserLink(mw.config.get('wgTitle'), ThisIsHidden, 1));
  HiddenLi.id = 'n-liveRC-hidden';
  UL.appendChild(ContactLi);
  UL.appendChild(HiddenLi);

  var Links = Li.getElementsByTagName('a');
  for(var a=1,l=Links.length;a<l;a++){
    var Link = Links[a];
    Link.title = Link.title + ' (LiveRC)';
    Link.className = "";
  }
  lrcDisplayDebug('Add watch/hide links in tools panel : got user status (watched='+ThisIsContact+' ; hidden='+ThisIsHidden+')');
};

/*
Dans LiveRC[modifier le code]
Suivi de page[modifier le code]
 */

// Création du bouton de suivi de page

window.lrcCreateWatchPageLink = function(title, watched, type, trID){
  var UnwatchLinkText = (type ? lrcGetMediawikiMessage("unwatch", true) : lrcMakeText("USER_UNWATCH_SHORT") );
  var WatchLinkText = (type ? lrcGetMediawikiMessage("watch", true) : lrcMakeText("USER_WATCH_SHORT") );
  var WatchLinks = document.createElement('span');
  if(!lrcGetFlowStatusForAction(title, "watch")) return WatchLinks;
  var WatchLinks_UnWatch = document.createElement('span');
  WatchLinks_UnWatch.className = "watchedLink";
  if(!watched) WatchLinks_UnWatch.style.display = "none";
  var UnWatchLink = document.createElement('a');
  if(!type) UnWatchLink.className = "pageunwatchLink";
  UnWatchLink.href = lrcGetUglyPageURL(title,'&action=unwatch');
  UnWatchLink.onclick = function(){
    LiveRC_WatchArticle(title, false, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  UnWatchLink.title = lrcGetMediawikiMessage("unwatch", true) + ' « '+title+' »';
  UnWatchLink.innerHTML = UnwatchLinkText;
  WatchLinks_UnWatch.appendChild(UnWatchLink);
  WatchLinks.appendChild(WatchLinks_UnWatch);
  var WatchLinks_Watch = document.createElement('span');
  WatchLinks_Watch.className = "watchedLink";
  if(watched) WatchLinks_Watch.style.display = "none";
  var WatchLink = document.createElement('a');
  if(!type) WatchLink.className = "pagewatchLink";
  WatchLink.href = lrcGetUglyPageURL(title,'&action=watch');
  WatchLink.onclick = function(){
    LiveRC_WatchArticle(title, true, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  WatchLink.title = lrcGetMediawikiMessage("watch", true) + ' « '+title+' »';
  WatchLink.innerHTML = WatchLinkText;
  WatchLinks_Watch.appendChild(WatchLink);
  WatchLinks.appendChild(WatchLinks_Watch);
  return WatchLinks;
};

// Ajout du bouton de suivi de page

window.LiveRC_WatchArticle = function(page, watch, trid){
  var sothername = lrcGetOtherPagename(page);
  if(watch){
    addPageToSuivi(page);
    if(sothername) addPageToSuivi(sothername);
    watchAPICall(page, true);
  }else{
    removePageFromSuivi(page);
    if(sothername) removePageFromSuivi(sothername);
    watchAPICall(page, false);
  }
  if (trid == null) return;
  var tr = document.getElementById(trid);
  if (tr == null) return;
  if(watch) {
    lrcAddClass(tr, "RcWatched");
  }else{
    lrcRemoveClass(tr, "RcWatched");
  }
};

/*
Suivi d'utilisateur[modifier le code]
 */

window.lrcCreateWatchUserLink = function(user, watched, type, trID){
  var UnwatchLinkText = (type ? lrcGetMediawikiMessage("unwatch", true) : lrcMakeText("USER_UNWATCH_SHORT") );
  var WatchLinkText = (type ? lrcGetMediawikiMessage("watch", true) : lrcMakeText("USER_WATCH_SHORT") );
  var ContactLinks = document.createElement('span');
  var ContactLinks_UnWatch = document.createElement('span');
  ContactLinks_UnWatch.className = "watchedLink";
  if(!watched) ContactLinks_UnWatch.style.display = "none";
  var UnWatchLink = document.createElement('a');
  if(!type) UnWatchLink.className = "userwatchLink";
  UnWatchLink.href = "javascript:;";
  UnWatchLink.onclick = function(){
    LiveRC_WatchUser(user, false, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  UnWatchLink.title = lrcGetMediawikiMessage("unwatch", true) + ' « '+user+' »';
  UnWatchLink.innerHTML = UnwatchLinkText;
  ContactLinks_UnWatch.appendChild(UnWatchLink);
  ContactLinks.appendChild(ContactLinks_UnWatch);
  var ContactLinks_Watch = document.createElement('span');
  ContactLinks_Watch.className = "watchedLink";
  if(watched) ContactLinks_Watch.style.display = "none";
  var WatchLink = document.createElement('a');
  if(!type) WatchLink.className = "userunwatchLink";
  WatchLink.href = "javascript:;";
  WatchLink.onclick = function(){
    LiveRC_WatchUser(user, true, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  WatchLink.title = lrcGetMediawikiMessage("watch", true) + ' « '+user+' »';
  WatchLink.innerHTML = WatchLinkText;
  ContactLinks_Watch.appendChild(WatchLink);
  ContactLinks.appendChild(ContactLinks_Watch);
  return ContactLinks;
};

window.LiveRC_WatchUser = function(uname, watch, trid) {
  var WLitem = LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][uname];
  var page = 'LiveRCWatch:' + uname;
  if (!WLitem && watch) {
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][uname] = {};
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][uname].ts = "--:--";
    LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][uname].edits = [];
    watchAPICall(page, true);
  } else if (WLitem && !watch) {
    watchAPICall(page, false);
    delete LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][uname];
  }else{
    return;
  }
  if (trid == null) return;
  var tr = document.getElementById(trid);
  if (tr == null) return;
  if(watch) {
    lrcAddClass(tr, "RcContact");
  }else{
    lrcRemoveClass(tr, "RcContact");
  }
};

/*
Masquage d'utilisateur[modifier le code]
 */

window.lrcCreateHideUserLink = function(user, hidden, type, trID){
  var UnhideLinkText = (type ? lrcGetMediawikiMessage("show", true) : lrcMakeText("USER_UNHIDE_SHORT") );
  var HideLinkText = (type ? lrcGetMediawikiMessage("hide", true) : lrcMakeText("USER_HIDE_SHORT") );
  var HiddenLinks = document.createElement('span');
  var HiddenLinks_UnHide = document.createElement('span');
  HiddenLinks_UnHide.className = "watchedLink";
  if(!hidden) HiddenLinks_UnHide.style.display = "none";
  var UnHideLink = document.createElement('a');
  if(!type) UnHideLink.className = "userhideLink";
  UnHideLink.href = "javascript:;";
  UnHideLink.onclick = function(){
    LiveRC_HideUser(user, false, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  UnHideLink.title = lrcGetMediawikiMessage("show") + ' « '+user+' »';
  UnHideLink.innerHTML = UnhideLinkText;
  HiddenLinks_UnHide.appendChild(UnHideLink);
  HiddenLinks.appendChild(HiddenLinks_UnHide);

  var HiddenLinks_Hide = document.createElement('span');
  HiddenLinks_Hide.className = "watchedLink";
  if(hidden) HiddenLinks_Hide.style.display = "none";
  var HideLink = document.createElement('a');
  if(!type) HideLink.className = "userhideLink";
  HideLink.href = "javascript:;";
  HideLink.onclick = function(){
    LiveRC_HideUser(user, true, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  HideLink.title = lrcGetMediawikiMessage("hide") + ' « '+user+' »';
  HideLink.innerHTML = HideLinkText;
  HiddenLinks_Hide.appendChild(HideLink);
  HiddenLinks.appendChild(HiddenLinks_Hide);
  return HiddenLinks;
};


window.LiveRC_HideUser = function(uname, hide, trid) {
  var WLitem = LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][uname];
  var page = 'LiveRCHidden:' + uname;
  if (!WLitem && hide) {
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][uname] = {};
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][uname].ts = "--:--";
    LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][uname].edits = [];
    watchAPICall(page, true);
  } else if (WLitem && !hide) {
    watchAPICall(page, false);
    delete LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][uname];
  }
  if(trid == null) return;
  var tr = document.getElementById(trid);
  if(tr == null) return;
  if(hide){
    supprLigne(tr.id);
  }
};

/*
Masquage de page[modifier le code]
 */

window.lrcCreateHidePageLink = function(title, hidden, type, trID){
  var UnhideLinkText = (type ? lrcGetMediawikiMessage("show", true) : lrcMakeText("USER_UNHIDE_SHORT") );
  var HideLinkText = (type ? lrcGetMediawikiMessage("hide", true) : lrcMakeText("USER_HIDE_SHORT") );
  var HiddenLinks = document.createElement('span');
  var HiddenLinks_UnHide = document.createElement('span');
  HiddenLinks_UnHide.className = "watchedLink";
  if(!hidden) HiddenLinks_UnHide.style.display = "none";
  var UnHideLink = document.createElement('a');
  if(!type) UnHideLink.className = "pagehideLink";
  UnHideLink.href = "javascript:;";
  UnHideLink.onclick = function(){
    LiveRC_HidePage(title, false, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  UnHideLink.title = lrcGetMediawikiMessage("show") + ' « '+title+' »';
  UnHideLink.innerHTML = UnhideLinkText;
  HiddenLinks_UnHide.appendChild(UnHideLink);
  HiddenLinks.appendChild(HiddenLinks_UnHide);

  var HiddenLinks_Hide = document.createElement('span');
  HiddenLinks_Hide.className = "watchedLink";
  if(hidden) HiddenLinks_Hide.style.display = "none";
  var HideLink = document.createElement('a');
  if(!type) HideLink.className = "pagehideLink";
  HideLink.href = "javascript:;";
  HideLink.onclick = function(){
    LiveRC_HidePage(title, true, trID);
    lrcToggleWatchLink(this);
    return false;
  };
  HideLink.title = lrcGetMediawikiMessage("hide") + ' « '+title+' »';
  HideLink.innerHTML = HideLinkText;
  HiddenLinks_Hide.appendChild(HideLink);
  HiddenLinks.appendChild(HiddenLinks_Hide);
  return HiddenLinks;
};


window.LiveRC_HidePage = function(title, hide, trid) {
  var WLitem = LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title];
  var page = 'LiveRCHiddenPage:' + title;
  if (!WLitem && hide) {
    LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title] = {};
    LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title].ts = "--:--";
    LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title].edits = [];
    watchAPICall(page, true);
  } else if (WLitem && !hide) {
    watchAPICall(page, false);
    delete LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title];
  }
  if(trid == null) return;
  var tr = document.getElementById(trid);
  if(tr == null) return;
  if(hide){
    supprLigne(tr.id);
  }
};


/*
Remise à zéro des notificationtimestamp[modifier le code]
 */

window.RAZnotificationtimestamps = function(){
  for(var title in LiveRC_Config["Notificationtimestamp"]){
    var timestamp = LiveRC_Config["Notificationtimestamp"][title];
    if(!timestamp) continue;
    var URL = lrcGetAPIURL({format:'xml',action:'query',prop:'info',intoken:'edit',inprop:'notificationtimestamp',titles:title});
    wpajax.http({ url: URL,
                onSuccess: RAZthisnotificationtimestamp,
                title: title,
                timestamp:timestamp
    });
  }
};

window.RAZthisnotificationtimestamp = function(Req, data){
  var title = data.title;
  var timestamp = data.timestamp;

  var Page = Req.responseXML.getElementsByTagName("page")[0];
  var notificationtimestamp = encodeURIComponent(Page.getAttribute("notificationtimestamp"));
  if(notificationtimestamp == timestamp) return;
  var EditParam = {};
  EditParam["titles"] = title;
  EditParam["timestamp"] = timestamp;
  EditParam["converttitles"] = "1";
  EditParam["token"] = Page.getAttribute("edittoken");
  var Params = [];
  for(var Param in EditParam){
    Params.push(Param+"="+encodeURIComponent(EditParam[Param]));
  }
  Params = Params.join("&");
  var headers = {'Content-Type':'application/x-www-form-urlencoded'};
  wpajax.http({ url: lrcGetAPIURL({action:'setnotificationtimestamp'}),
                  method: "POST", headers: headers,
                  onSuccess:RAZthisnotificationtimestampDone,
                  data: Params,
                  editparams:EditParam
  });
};

window.RAZthisnotificationtimestampDone = function(Req, data){
  var title = data.editparams["titles"];
  var ts = data.editparams["timestamp"];
  var translatedts = tsToDate(ts)+' '+tsToHhMm(ts);
  lrcDisplayDebug("notificationtimestamp reset for page "+title+" done ("+translatedts+")");
  delete LiveRC_Config["Notificationtimestamp"][title];
};

/*

Horloges[modifier le code]

 */

window.lrcSetClocks = function(){
  var ClockSpanTitle = document.getElementById('ClockSpanTitle');
  if(ClockSpanTitle){
    ClockSpanTitle.className="RunningClock";
    var Link = ClockSpanTitle.parentNode;
    if(Link){
      Link.href= "javascript:lrcToggleClockState('ClockSpanTitle');";
      Link.title= lrcMakeText("CLOCKTITLE");
      lrcClockTimer("ClockSpanTitle");
    }
  }
};

window.lrcClockTimer = function(ID){
  var Now = new Date();
  var Heures = Now.getHours();
  var Minutes = Now.getMinutes();
  var Secondes = Now.getSeconds();
  LiveRC_Config["ClockTime"]["H"] = Heures;
  LiveRC_Config["ClockTime"]["M"] = Minutes;
  LiveRC_Config["ClockTime"]["S"] = Secondes;
  if(ID){
    var ClockSpan = document.getElementById(ID);
    if(ClockSpan){
      if(lrcHasClass(ClockSpan, "RunningClock")){
        ClockSpan.innerHTML =  (Heures < 10 ? '0' : '') + Heures + ':' + (Minutes < 10 ? '0' : '') + Minutes + ':' + (Secondes<10 ? '0' : '') + Secondes;
      }
    }
  }
  if(LiveRC_Config["Timeout"][("Clock_"+ID)]) clearTimeout(LiveRC_Config["Timeout"][("Clock_"+ID)]);
  LiveRC_Config["Timeout"][("Clock_"+ID)] = setTimeout("lrcClockTimer("+lrcEscapeStr(ID)+");", 1000);
};

window.lrcToggleClockState = function(ID){
  var ClockSpan = document.getElementById(ID);
  if(!ClockSpan) return;
  if(lrcHasClass(ClockSpan, "RunningClock")){
    lrcRemoveClass(ClockSpan, "RunningClock");
    lrcAddClass(ClockSpan, "FrozenClock");
  }else{
    lrcRemoveClass(ClockSpan, "FrozenClock");
    lrcAddClass(ClockSpan, "RunningClock");
  }
};

window.LiveRC_CreateTimer = function(){
  var TimerTD = document.getElementById("LiveRCTimer");
  if(!TimerTD) return;
  var Buttons = document.getElementById("LiveRCButtons");
  if(Buttons) TimerTD.style.width = Buttons.offsetWidth + "px";
  if(!lrcMakeParam("ShowTimer")) return;
  var divtimer = document.createElement('div');
  divtimer.id = "lrctimecount";
  divtimer.className = "lrctimecount";
  TimerTD.appendChild(divtimer);
  var tenhour = document.createElement('div');
  tenhour.className = "lrctimecountelement tenhours";
  var hour = document.createElement('div');
  hour.className = "lrctimecountelement hours";
  var tenminut = document.createElement('div');
  tenminut.className = "lrctimecountelement tenminuts";
  var minut = document.createElement('div');
  minut.className = "lrctimecountelement minuts";
  var tensecond = document.createElement('div');
  tensecond.className = "lrctimecountelement tenseconds";
  var second = document.createElement('div');
  second.className = "lrctimecountelement seconds";
  divtimer.appendChild(tenhour);
  divtimer.appendChild(hour);
  divtimer.appendChild(document.createTextNode(' '));
  divtimer.appendChild(tenminut);
  divtimer.appendChild(minut);
  divtimer.appendChild(document.createTextNode(' '));
  divtimer.appendChild(tensecond);
  divtimer.appendChild(second);
  var Now = new Date();
  var H = Now.getHours();
  var M = Now.getMinutes();
  var S = Now.getSeconds();
  var TH =  Math.floor(H/10);
  H = H - (TH * 10);
  var TM =  Math.floor(M/10);
  M = M - (TM * 10);
  var TS =  Math.floor(S/10);
  S = S - (TS * 10);
  LiveRC_Config["TimerInitialValues"] = {Global:Now.getTime(), TH:TH, H:H, TM:TM, M:M, TS:TS, S:S};
  lrcSetTimer();
};

window.lrcSetTimer = function(){
  var divtimer = document.getElementById("lrctimecount");
  if(!divtimer) return;
  var InitialValues = LiveRC_Config["TimerInitialValues"];
  var Now = new Date().getTime();
  var time = Now - InitialValues["Global"];
  var TH = Math.floor(time/36000000);
  time = time - (TH*36000000);
  var H = Math.floor(time/3600000);
  time = time - ( H*3600000);
  var TM = Math.floor(time/600000);
  time = time - (TM*600000);
  var M = Math.floor(time/60000);
  time = time - ( M*60000);
  var TS = Math.floor(time/10000);
  time = time - (TS*10000);
  var S = Math.floor(time/1000);
  var tenhour = $(divtimer).find("div.tenhours")[0];
  var hour = $(divtimer).find("div.hours")[0];
  var tenminut = $(divtimer).find("div.tenminuts")[0];
  var minut = $(divtimer).find("div.minuts")[0];
  var tensecond = $(divtimer).find("div.tenseconds")[0];
  var second = $(divtimer).find("div.seconds")[0];
  if(TH != InitialValues["TH"]){
    lrcSetTimerElement(tenhour, TH);
    LiveRC_Config["TimerInitialValues"]["TH"] = TH;
  }
  if(H != InitialValues["H"]){
    lrcSetTimerElement(hour, H);
    LiveRC_Config["TimerInitialValues"]["H"] = H;
  }
  if(TM != InitialValues["TM"]){
    lrcSetTimerElement(tenminut, TM);
    LiveRC_Config["TimerInitialValues"]["TM"] = TM;
  }
  if(M != InitialValues["M"]){
    lrcSetTimerElement(minut, M);
    LiveRC_Config["TimerInitialValues"]["M"] = M;
  }
  if(TS != InitialValues["TS"]){
    lrcSetTimerElement(tensecond, TS);
    LiveRC_Config["TimerInitialValues"]["TS"] = TS;
  }
  if(S != InitialValues["S"]){
    lrcSetTimerElement(second, S);
    LiveRC_Config["TimerInitialValues"]["S"] = S;
  }
  if(LiveRC_Config["Timeout"]["Timer"]) clearTimeout(LiveRC_Config["Timeout"]["Timer"]);
  LiveRC_Config["Timeout"]["Timer"] = setTimeout(function(){ lrcSetTimer(); }, 1000 );
};

window.lrcSetTimerElement = function(el, val){
  if(!el) return;
  var posX = (Math.round(10*(-12.5 * val))/10);
  var posY = 0;
  el.style.backgroundPosition = posX+"px "+posY+"px";
};

/*

Zones de déplacement et redimensionnement[modifier le code]

 */

// Détermination du type de navigateur

window.LiveRC_NavIsIE = (function () {
    var agt = navigator.userAgent.toLowerCase();
    var is_ie = agt.indexOf("msie") !== -1 && agt.indexOf("opera") === -1;
    return function () {
        return is_ie;
    };
})();

// Détermination de la hauteur de l'écran

window.LiveRC_GetScreenHeight = function(){
     var ScreenHeight = 0;
     if( typeof( window.innerHeight ) == 'number' ) {
          ScreenHeight = parseInt(window.innerHeight);
     }else if( document.documentElement && document.documentElement.clientHeight ){
          ScreenHeight = parseInt(document.documentElement.clientHeight);
     }else if( document.body && document.body.clientHeight ){
          ScreenHeight = parseInt(document.body.clientHeight);
     }
     return ScreenHeight;
};

// Détermination de la largeur de l'écran

window.LiveRC_GetScreenWidth = function(){
     var ScreenWidth = 0;
     if( typeof( window.innerWidth ) == 'number' ) {
          ScreenWidth = parseInt(window.innerWidth);
     }else if( document.documentElement && document.documentElement.clientWidth ){
          ScreenWidth = parseInt(document.documentElement.clientWidth);
     }else if( document.body && document.body.clientWidth ){
          ScreenWidth = parseInt(document.body.clientWidth);
     }
     return ScreenWidth;
};

// Détermination du positionnement de la souris

window.LiveRC_GetMousePosition = function(event){
     if(LiveRC_NavIsIE()){
          var Mouse_X = parseInt( event.clientX + document.getElementsByTagName('body')[0].scrollLeft );
          var Mouse_Y = parseInt( event.clientY + document.getElementsByTagName('body')[0].scrollTop );
     }else{
          var Mouse_X = parseInt( event.clientX );
          var Mouse_Y = parseInt( event.clientY );
     }
     return {"X": Mouse_X, "Y": Mouse_Y};
};

// Mise en place d'une zone de déplacement

window.LiveRC_SetMoveZone = function(anchorNode, elementsToMove){
     if((!anchorNode)||(!elementsToMove)) return;
     anchorNode.onmousedown = function(event){
          if(!event) { event = window.event; }
          var PositionSouris = LiveRC_GetMousePosition(event);
          var PositionSouris_X = PositionSouris["X"];
          var PositionSouris_Y = PositionSouris["Y"];
          for(var a=0;a<elementsToMove.length;a++){
               elementsToMove[a].initialX = parseInt( PositionSouris_X - elementsToMove[a].offsetLeft);
               elementsToMove[a].initialY = parseInt( PositionSouris_Y - elementsToMove[a].offsetTop);
          }
          lrcAddClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
          document.getElementsByTagName('body')[0].onmousemove = function(event) {
               if(!event) { event = window.event; }
               PositionSouris = LiveRC_GetMousePosition(event);
               PositionSouris_X = PositionSouris["X"];
               PositionSouris_Y = PositionSouris["Y"];
               for(var a=0;a<elementsToMove.length;a++){
                    var Element = elementsToMove[a];
                    if(!Element) continue;
                    var PositionGauche = parseInt( PositionSouris_X ) - Element.initialX;
                    var PositionHaut = parseInt(PositionSouris_Y ) - Element.initialY;
                    Element.style.left = PositionGauche + 'px';
                    Element.style.top = PositionHaut + 'px';
                    Element.style.right = '';
                    Element.style.bottom = '';
               }
          };
          document.getElementsByTagName('body')[0].onmouseup=function(event){
               document.getElementsByTagName('body')[0].onmousemove = null;
               document.getElementsByTagName('body')[0].onmouseup = null;
               lrcRemoveClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
          };
     }
     anchorNode.style.cursor = "move";
};

// Mise en place d'une zone de redimensionnement vertical

window.LiveRC_SetVerticalResizeZone = function(anchorNode, ToResizeNodes, containerNode, invert){
     if((!anchorNode)||(!ToResizeNodes)) return;
     invert = (invert===true ? -1 : 1);
     anchorNode.onmousedown = function(event){
          if(!event) { event = window.event; }
          var positionSouris_Y = (LiveRC_GetMousePosition(event)["Y"] * invert);
          var MaxHeight = LiveRC_GetScreenHeight();
          for(var a=0;a<ToResizeNodes.length;a++){
               ToResizeNodes[a].initialHeight = parseInt( (MaxHeight-positionSouris_Y) - ToResizeNodes[a].offsetHeight );
          }
          lrcAddClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
          document.getElementsByTagName('body')[0].onmousemove=function(event) {
               if(!event) { event = window.event; }
               var positionSouris_Y = (LiveRC_GetMousePosition(event)["Y"] * invert);
               var MaxHeight = LiveRC_GetScreenHeight();
               var HeightLimit = false;
               for(var a=0;a<ToResizeNodes.length;a++){
                    var NewHeight = parseInt((MaxHeight-positionSouris_Y) - ToResizeNodes[a].initialHeight);
                    if(NewHeight>MaxHeight) HeightLimit = true;
               }
               if(HeightLimit) return;
               for(var a=0;a<ToResizeNodes.length;a++){
                    var Element = ToResizeNodes[a];
                    if(!Element) continue;
                    var NewHeight = parseInt((MaxHeight-positionSouris_Y) - Element.initialHeight);
                    NewHeight = (NewHeight>0 ? NewHeight : 1);
                    if(Element.tagName && (Element.tagName.toLowerCase()=="iframe" || Element.tagName.toLowerCase()=="img")){
                         Element.height = NewHeight;
                    }else{
                         Element.style.height = NewHeight + 'px';
                    }
               }
               lrcInitTableHeight();

          };
          document.getElementsByTagName('body')[0].onmouseup = function(event) {
               document.getElementsByTagName('body')[0].onmousemove = null;
               document.getElementsByTagName('body')[0].onmouseup = null;
               lrcRemoveClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
          };
     };
     lrcaddCustomizableClasses(anchorNode, "LiveRC_MenuAnchor");
     lrcAddClass(containerNode, "LiveRC_MenuContainer");
     anchorNode.style.cursor = "n-resize";
};

// Mise en place d'une zone de redimensionnement total

window.LiveRC_SetTotalResizeZone = function(anchorNode, elementsToResize, Container){
  if((!anchorNode)||(!elementsToResize)) return;
  if(!LiveRC_Config["TotalResize"]) LiveRC_Config["TotalResize"] = [];
  var ID = Container.id;
  if(!ID) return;
  LiveRC_Config["TotalResize"][ID] = [];
  LiveRC_Config["TotalResize"][ID].initialWidthDiffs = [];
  LiveRC_Config["TotalResize"][ID].initialHeightDiffs  = [];
  for(var a=0;a<elementsToResize.length;a++){
    var element = elementsToResize[a];
    LiveRC_Config["TotalResize"][ID].initialWidthDiffs[a] = ( Container.offsetWidth - element.offsetWidth );
    LiveRC_Config["TotalResize"][ID].initialHeightDiffs[a] = ( Container.offsetHeight - element.offsetHeight );
  }
  anchorNode.onmousedown = function(event){
    if(!event) { event = window.event; }
    var PositionSouris = LiveRC_GetMousePosition(event);
    var PositionSouris_X = PositionSouris["X"];
    var PositionSouris_Y = PositionSouris["Y"];
    Container.initialWidth = ( PositionSouris_X - Container.offsetWidth ) ;
    Container.initialHeight = ( PositionSouris_Y - Container.offsetHeight ) ;
    Container.style.top = Container.offsetTop + 'px';
    Container.style.left = Container.offsetLeft + 'px';
    Container.style.right = '';
    Container.style.bottom = '';
    lrcAddClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
    document.getElementsByTagName('body')[0].onmousemove = function(event) {
      if(!event) { event = window.event; }
      var PositionSouris = LiveRC_GetMousePosition(event);
      var PositionSouris_X = PositionSouris["X"];
      var PositionSouris_Y = PositionSouris["Y"];
      var NewWidth = ( PositionSouris_X - Container.initialWidth );
      var NewHeight = ( PositionSouris_Y - Container.initialHeight );
      Container.style.width = parseInt( NewWidth ) + 'px';
      Container.style.height = parseInt( NewHeight ) + 'px';
      for(var a=0;a<elementsToResize.length;a++){
        var Element = elementsToResize[a];
        if(!Element) continue;
        var NewElementWidth = parseInt( NewWidth - LiveRC_Config["TotalResize"][(Container.id)].initialWidthDiffs[a] );
        var NewElementHeight = parseInt( NewHeight - LiveRC_Config["TotalResize"][(Container.id)].initialHeightDiffs[a] );
        NewElementWidth = (NewElementWidth > 0 ? NewElementWidth : 1);
        NewElementHeight = (NewElementHeight > 0 ? NewElementHeight : 1);
        if(Element.tagName && (Element.tagName.toLowerCase()=="iframe" || Element.tagName.toLowerCase()=="img")){
          Element.width  = NewElementWidth + 'px';
          Element.height = NewElementHeight + 'px';
        }else{
          Element.style.width  = NewElementWidth + 'px';
          Element.style.height = NewElementHeight + 'px';
        }
      }
    };
    document.getElementsByTagName('body')[0].onmouseup = function(event) {
      document.getElementsByTagName('body')[0].onmousemove = null;
      document.getElementsByTagName('body')[0].onmouseup = null;
      lrcRemoveClass(document.getElementsByTagName('body')[0], "MouseMoveFunctionRunning");
    };
  };
  anchorNode.style.cursor = "se-resize";
};

/*

Suggestions[modifier le code]

 */

window.LiveRC_Suggest_UpDateLabel = function(InputNode, NewID){
     var OldId = InputNode.id;
     var TheNode = InputNode.parentNode;
     if(!OldId || !TheNode) return;
     var Labels = TheNode.getElementsByTagName('label');
     for(var a=0,l=Labels.length;a<l;a++){
          var For = Labels[a].getAttribute("for");
          if(For){
               if(For == OldId){
                    Labels[a].setAttribute("for", NewID);
                    return;
               }
          }
     }
};

window.LiveRC_Suggest_GetSuggestionIndex = function( Element ){
    return parseInt(Element.id.replace(/[^0-9]/g, ""));
};

window.LiveRC_Suggest_ucFirst = function(Text, Namespace) {
    if(LiveRC_Config["MediawikiNamespaces"][Namespace]["case"] === "first-letter"){
        Text = Text.substr(0,1).toUpperCase() + Text.substr(1,Text.length);
    }
    return Text;
};

window.LiveRC_Suggest_setVar = function(Args, id) {
    if(typeof(Args[id])!="undefined") return Args[id];
    return LiveRC_Config["SuggestParams"][id][0];
};

/*
Suggestions de page[modifier le code]
 */

window.LiveRC_Suggest_AddPageSuggestion = function(Args){
     if(!Args) return;
     var InputNode = Args["InputNode"];
     if(!InputNode) return;
     var GlobalIndex = LiveRC_Config["SuggestParams"]["Index"]++;
     var NSFilter = LiveRC_Suggest_setVar(Args, "NSFilter");
     var StripNS = LiveRC_Suggest_setVar(Args, "StripNS");
     var SuggestLimit = LiveRC_Suggest_setVar(Args, "SuggestLimit");
     var SuggestListSize = LiveRC_Suggest_setVar(Args, "SuggestSelectLimit");
     var AddExist = LiveRC_Suggest_setVar(Args, "AddExist");
     var ListDown = LiveRC_Suggest_setVar(Args, "ListDown");
     var Prefix = LiveRC_Suggest_setVar(Args, "Prefix");
     var Suffix = LiveRC_Suggest_setVar(Args, "Suffix");
     var RedirectFilter = LiveRC_Suggest_setVar(Args, "RedirectFilter");
     LiveRC_Suggest_UpDateLabel(InputNode, "InputWithSuggestion_"+GlobalIndex);
     InputNode.id = "InputWithSuggestion_"+GlobalIndex;
     var ExistInputNode = document.createElement("input");
     ExistInputNode.type = "hidden";
     ExistInputNode.id = "ThisPageExist_"+GlobalIndex;
     ExistInputNode.value = "0";
     InputNode.parentNode.insertBefore(ExistInputNode, InputNode.nextSibling);
     if(AddExist===true){
          var ExistImgNode = document.createElement("span");
          ExistImgNode.id = "ThisPageExistIMG_"+GlobalIndex;
          ExistImgNode.className = "SuggestionExist";
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestNoExistIcon").split("$1").join("").split("  ").join(" ");
          InputNode.parentNode.insertBefore(ExistImgNode, InputNode.nextSibling);
     }
     var SelectNode = document.createElement('select');
     SelectNode.id = "SuggestionForInput_"+GlobalIndex;
     SelectNode.style.display = "none";
     SelectNode.className = "SuggestionList";
     InputNode.parentNode.insertBefore(SelectNode, InputNode.nextSibling);
     LiveRC_Config["SuggestParams"]["Input"][GlobalIndex] = InputNode;
     LiveRC_Config["SuggestParams"]["Suggest"][GlobalIndex] = SelectNode;
          LiveRC_Config["SuggestParams"]["ExistInput"][GlobalIndex] = ExistInputNode;
     if(AddExist===true){
          LiveRC_Config["SuggestParams"]["ExistImg"][GlobalIndex] = ExistImgNode;
     }
     LiveRC_Config["SuggestParams"]["NSFilter"][GlobalIndex] = NSFilter;
     if(!NSFilter) StripNS = false;
     if(Prefix){
          if(NSFilter){
               var ThisNamespaceName = lrcGetNamespaceName(NSFilter);
               var Match = new RegExp("^"+ThisNamespaceName+":", "ig");
               if(Prefix.match(Match)!=null){
                    Prefix = Prefix.substring((ThisNamespaceName=="" ? "" : ThisNamespaceName+":").length, Prefix.length);
               }
               StripNS = true;
          }
     }
     LiveRC_Config["SuggestParams"]["NSFilter"][GlobalIndex] = NSFilter;
     LiveRC_Config["SuggestParams"]["StripNS"][GlobalIndex] = StripNS;
     LiveRC_Config["SuggestParams"]["Prefix"][GlobalIndex] = Prefix;
     LiveRC_Config["SuggestParams"]["Suffix"][GlobalIndex] = Suffix;
     LiveRC_Config["SuggestParams"]["SuggestLimit"][GlobalIndex] = SuggestLimit;
     LiveRC_Config["SuggestParams"]["SuggestSelectLimit"][GlobalIndex] = SuggestListSize;
     LiveRC_Config["SuggestParams"]["ListDown"][GlobalIndex] = ListDown;
     LiveRC_Config["SuggestParams"]["AddExist"][GlobalIndex] = AddExist;
     LiveRC_Config["SuggestParams"]["RedirectFilter"][GlobalIndex] = RedirectFilter;
     LiveRC_Config["SuggestParams"]["IsRunning"][GlobalIndex] = false;
     InputNode.onkeyup = function(){
          var ThisIndex = LiveRC_Suggest_GetSuggestionIndex(this);
          LiveRC_Suggest_GetPageSuggestions(ThisIndex);
     };
     return GlobalIndex;
};

window.LiveRC_Suggest_GetPageSuggestions = function(Index){
     var IsRunning = LiveRC_Config["SuggestParams"]["IsRunning"][Index];
     if(IsRunning===true) return;
     var NamespaceFilter = LiveRC_Config["SuggestParams"]["NSFilter"][Index];
     var StripNamespace = LiveRC_Config["SuggestParams"]["StripNS"][Index];
     var Limit = LiveRC_Config["SuggestParams"]["SuggestLimit"][Index];
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     var Prefix = LiveRC_Config["SuggestParams"]["Prefix"][Index];
     var Suffix = LiveRC_Config["SuggestParams"]["Suffix"][Index];
     var RedirectFilter = LiveRC_Config["SuggestParams"]["RedirectFilter"][Index];
     var Page = Input.value;
     if(Page===""){
          Select.style.display = "none";
          return;
     }
     var ValueNamespace = (NamespaceFilter ? NamespaceFilter : getNamespaceInfoFromPage(Prefix+Page));
     var ValuePageName = getNamespaceInfoFromPage(Page, "PageName");
     if(StripNamespace && NamespaceFilter && !Prefix){
          var ThisNamespaceName = lrcGetNamespaceName(NamespaceFilter);
          var Match = new RegExp("^"+ThisNamespaceName+":", "ig");
          if(Page.match(Match)!=null){ Page = ValuePageName; }
          var ThisCanonicalNamespaceName = lrcGetNamespaceName(NamespaceFilter, true);
          var CanonicalMatch = new RegExp("^"+ThisCanonicalNamespaceName+":", "ig");
          if(Page.match(CanonicalMatch)!=null){ Page = LiveRC_Suggest_ucFirst(ValuePageName, NamespaceFilter); }
          Input.value = LiveRC_Suggest_ucFirst(Page, NamespaceFilter);
     }else if(Prefix && NamespaceFilter){
          Match = new RegExp("^"+Prefix, "ig");
          if(Page.match(Match)!=null){
               Page = Page.substring(Prefix.length, Page.length);
          }
          Page = Prefix+Page;
     }else if(Prefix && !NamespaceFilter){
          ValueNamespace = getNamespaceInfoFromPage((Prefix+Page),"NamespaceNumber");
          Page = getNamespaceInfoFromPage((Prefix+Page), "PageName");
     }else if(!Prefix && !NamespaceFilter){
          ValueNamespace = getNamespaceInfoFromPage(Page,"NamespaceNumber");
          Page = getNamespaceInfoFromPage(Page, "PageName");
          Input.value = lrcGetNamespaceName(ValueNamespace)+(ValueNamespace ? ":" : "") + LiveRC_Suggest_ucFirst(Page, ValueNamespace);
     }
     LiveRC_Config["SuggestParams"]["IsRunning"][Index] = true;
     var APILimit = LiveRC_Config["UserInfos"].APIlimit;
     if(Limit>APILimit) Limit = APILimit;
     var URL =  lrcGetAPIURL({format:'xml',action:'query',list:'allpages',apnamespace:ValueNamespace,apprefix:Page,apfilterredir:RedirectFilter,aplimit:Limit});
     wpajax.http({url:URL,
                  onSuccess:LiveRC_Suggest_GetPageSuggestionsDone,
                  index: Index
     });
};

window.LiveRC_Suggest_GetPageSuggestionsDone = function(Req, data){
     var Index = data.index;
     var NamespaceFilter = LiveRC_Config["SuggestParams"]["NSFilter"][Index];
     var StripNamespace = LiveRC_Config["SuggestParams"]["StripNS"][Index];
     var Limit = LiveRC_Config["SuggestParams"]["SuggestLimit"][Index];
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     var Prefix = LiveRC_Config["SuggestParams"]["Prefix"][Index];
     var Suffix = LiveRC_Config["SuggestParams"]["Suffix"][Index];
     var RedirectFilter = LiveRC_Config["SuggestParams"]["RedirectFilter"][Index];
     var xml = Req.responseXML ;
     if ( xml == null ) return ;
     var titles = new Array () ;
     var pages = xml.getElementsByTagName("p") ;
     for(var i=0;i<pages.length;i++){
          var s = pages[i].getAttribute("title");
          if(Suffix){
               var Reg = new RegExp(Suffix+"$", "g");
               if(s.match(Reg)==null) continue;
          }
          if(StripNamespace){
               var ThisNamespaceName = lrcGetNamespaceName(NamespaceFilter);
               var Match = new RegExp("^"+ThisNamespaceName+":", "ig");
               if(s.match(Match)!=null){
                    s = getNamespaceInfoFromPage(s, "PageName");
               }
               var CanonicalThisNamespaceName = lrcGetNamespaceName(NamespaceFilter, true);
               var Cani=onicalMatch = new RegExp("^"+CanonicalThisNamespaceName+":", "ig");
               if(s.match(Cani=onicalMatch)!=null){
                    s = getNamespaceInfoFromPage(s, "PageName");
               }
          }
          if(Prefix){
               s = s.substring(s.indexOf(Prefix)+Prefix.length, s.length);
          }
          if(titles.indexOf(s)==-1) titles.push(s);
     }
     LiveRC_Config["SuggestParams"]["IsRunning"][Index] = false;
     LiveRC_Suggest_ShowPageSuggestions(titles, Index);
};

window.LiveRC_Suggest_ShowPageSuggestions = function(titles, Index){
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     var ExistInputNode = LiveRC_Config["SuggestParams"]["ExistInput"][Index];
     var ExistImgNode = LiveRC_Config["SuggestParams"]["ExistImg"][Index];
     var ListDown = LiveRC_Config["SuggestParams"]["ListDown"][Index];
     var NamespaceFilter = LiveRC_Config["SuggestParams"]["NSFilter"][Index];
     var Prefix = LiveRC_Config["SuggestParams"]["Prefix"][Index];
     var TheNamespace = "";
     if(NamespaceFilter!==false){
          TheNamespace = lrcGetNamespaceName(NamespaceFilter);
          TheNamespace = (TheNamespace ==="" ? "" : TheNamespace+":");
     }
     if(Prefix){
          TheNamespace += Prefix;
     }
     var CurrentValue = Input.value;
     if(ExistInputNode) ExistInputNode.value = "0";
     if(ExistImgNode){
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestNoExistIcon").split("$1").join(TheNamespace+CurrentValue);
     }
     if(titles.length==0){
          Select.style.display = "none" ;
          Input.title = "";
          return;
     }
     Select.style.display = "inline" ;
     if(ExistInputNode) ExistInputNode.value = "1";
     if(ExistImgNode){
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestExistIcon").split("$1").join(TheNamespace+CurrentValue);
     }
     if(titles[0]===Input.value){
          Select.style.display = "none" ;
          Input.title = "";
          return;
     }
     var TailleListe = LiveRC_Config["SuggestParams"]["SuggestSelectLimit"][Index];
     if (titles.length < TailleListe ) TailleListe = titles.length;
     Select.size = TailleListe ;
     Select.style.align = "left" ;
     Select.style.zIndex = LiveRC_Config["SuggestParams"]["ZIndex"]++ ;
     Select.style.position = "relative" ;
     Select.style.width = Input.offsetWidth + "px" ;
     Select.style.height = (TailleListe * 20) + "px" ;
     while(Select.firstChild) Select.removeChild(Select.firstChild);
     for ( var i = 0 ; i < titles.length ; i++ ) {
          var opt = document.createElement("option");
          var ot = document.createTextNode(titles[i]);
          opt.appendChild(ot) ;
          opt.value = titles[i];
          Select.appendChild(opt) ;
     }
     Select.onkeyup = LiveRC_Suggest_ReplacePageSuggestionsKeyPress;
     Select.onclick = LiveRC_Suggest_ReplacePageSuggestions;
     if(ListDown){
          Select.style.top = parseInt(Input.offsetHeight) + "px";
          Select.style.marginBottom = "-" + ((TailleListe * 20) + parseInt(Input.offsetHeight)) + "px" ;
     }else{
          Select.style.marginTop = "-" + (TailleListe * 20) + "px" ;
     }
     Select.style.marginLeft = "-" + Input.offsetWidth + "px" ;
     var suggestion = titles[0] ;
     if(suggestion.match(new RegExp("^"+CurrentValue))==null){
          LiveRC_Suggest_GetPageSuggestions(Index);
          return;
     }
     var StripNamespace = LiveRC_Config["SuggestParams"]["StripNS"][Index];
     var CurrentValueLength = CurrentValue.length;
     if(StripNamespace){
          var NamespaceName = getNamespaceInfoFromPage(CurrentValue,"NamespaceName");
          NamespaceName = ( NamespaceName==="" ? "" : NamespaceName+":");
          if(NamespaceName==TheNamespace){
               CurrentValueLength = getNamespaceInfoFromPage(CurrentValue,"PageName").length + TheNamespace.length;
          }
     }else if(NamespaceFilter!==false && !Prefix){
          var NamespaceName = getNamespaceInfoFromPage(CurrentValue,"NamespaceName");
          NamespaceName = ( NamespaceName==="" ? "" : NamespaceName+":");
          if(NamespaceName==TheNamespace){
               CurrentValueLength = getNamespaceInfoFromPage(CurrentValue,"PageName").length + TheNamespace.length;
          }else{
               CurrentValueLength = CurrentValueLength  + TheNamespace.length;
          }
     }
     //alert("CurrentValueLength : "+CurrentValueLength+"\nsuggestion.length : "+suggestion.length);
     Input.value = suggestion;
     Input.title = TheNamespace + suggestion;
     if (Input.createTextRange) {
          var ra = Input.createTextRange();
          ra.moveStart("character", CurrentValueLength);
          ra.moveEnd("character", suggestion.length);
          ra.select();
     } else if( Input.setSelectionRange ) {
          Input.setSelectionRange( CurrentValueLength, suggestion.length );
     } else {
          Input.selectionStart = CurrentValueLength;
          Input.selectionEnd = suggestion.length ;
     }
     if(ExistImgNode){
          CurrentValue = Input.value;
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestExistIcon").split("$1").join(TheNamespace+CurrentValue);
     }
};

window.LiveRC_Suggest_ReplacePageSuggestionsKeyPress = function(e){
     if (!e) e = window.event;
     if (e.keyCode != 13) return;
     LiveRC_Suggest_ReplacePageSuggestions();
};

window.LiveRC_Suggest_ReplacePageSuggestions = function(){
     var Index = LiveRC_Suggest_GetSuggestionIndex(this);
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     if(!Input|| !Select) return;
     var NamespaceFilter = LiveRC_Config["SuggestParams"]["NSFilter"][Index];
     var Prefix = LiveRC_Config["SuggestParams"]["Prefix"][Index];
     var TheNamespace = "";
     if(NamespaceFilter){
          TheNamespace = lrcGetNamespaceName(NamespaceFilter);
          TheNamespace = (TheNamespace ==="" ? "" : TheNamespace+":");
     }
     if(Prefix){
          TheNamespace += Prefix;
     }
     Select.style.zIndex = LiveRC_Config["SuggestParams"]["ZIndex"]++ ;
     var Options = Select.getElementsByTagName('option');
     for(var a=0;a<Options.length;a++){
          if(Options[a].selected){
            Input.value = Options[a].value;
            Input.title = TheNamespace+Options[a].value;
            Input.focus();
            LiveRC_Suggest_GetPageSuggestions(Index);
            return;
        }
    }
};

/*
Suggestions d'utilisateur[modifier le code]
 */

window.LiveRC_Suggest_AddUserSuggestion = function(Args){
     if(!Args) return;
     var InputNode = Args["InputNode"];
     if(!InputNode) return;
     var GlobalIndex = LiveRC_Config["SuggestParams"]["Index"]++;
     var SuggestLimit = LiveRC_Suggest_setVar(Args, "SuggestLimit");
     var SuggestListSize = LiveRC_Suggest_setVar(Args, "SuggestSelectLimit");
     var AddExist = LiveRC_Suggest_setVar(Args, "AddExist");
     var ListDown = LiveRC_Suggest_setVar(Args, "ListDown");
     LiveRC_Suggest_UpDateLabel(InputNode, "InputWithSuggestion_"+GlobalIndex);
     InputNode.id = "InputWithSuggestion_"+GlobalIndex;
     var ExistInputNode = document.createElement("input");
     ExistInputNode.type = "hidden";
     ExistInputNode.id = "ThisPageExist_"+GlobalIndex;
     ExistInputNode.value = "0";
     InputNode.parentNode.insertBefore(ExistInputNode, InputNode.nextSibling);
     if(AddExist===true){
          var ExistImgNode = document.createElement("span");
          ExistImgNode.id = "ThisPageExistIMG_"+GlobalIndex;
          ExistImgNode.className = "SuggestionExist";
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestNoExistIcon").split("$1").join("").split("  ").join(" ");
          InputNode.parentNode.insertBefore(ExistImgNode, InputNode.nextSibling);
     }
     var SelectNode = document.createElement('select');
     SelectNode.id = "SuggestionForInput_"+GlobalIndex;
     SelectNode.style.display = "none";
     SelectNode.className = "SuggestionList";
     InputNode.parentNode.insertBefore(SelectNode, InputNode.nextSibling);
     LiveRC_Config["SuggestParams"]["Input"][GlobalIndex] = InputNode;
     LiveRC_Config["SuggestParams"]["Suggest"][GlobalIndex] = SelectNode;
          LiveRC_Config["SuggestParams"]["ExistInput"][GlobalIndex] = ExistInputNode;
     if(AddExist===true){
          LiveRC_Config["SuggestParams"]["ExistImg"][GlobalIndex] = ExistImgNode;
     }
     LiveRC_Config["SuggestParams"]["SuggestLimit"][GlobalIndex] = SuggestLimit;
     LiveRC_Config["SuggestParams"]["SuggestSelectLimit"][GlobalIndex] = SuggestListSize;
     LiveRC_Config["SuggestParams"]["ListDown"][GlobalIndex] = ListDown;
     LiveRC_Config["SuggestParams"]["AddExist"][GlobalIndex] = AddExist;
     LiveRC_Config["SuggestParams"]["IsRunning"][GlobalIndex] = false;
     InputNode.onkeyup = function(){
          var ThisIndex = LiveRC_Suggest_GetSuggestionIndex(this);
          LiveRC_Suggest_GetUserSuggestions(ThisIndex);
     };
     return GlobalIndex;
};

window.LiveRC_Suggest_GetUserSuggestions = function(Index){
     var IsRunning = LiveRC_Config["SuggestParams"]["IsRunning"][Index];
     if(IsRunning===true) return;
     var Limit = LiveRC_Config["SuggestParams"]["SuggestLimit"][Index];
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     var Page = Input.value;
     if(Page===""){
          Select.style.display = "none";
          return;
     }
     LiveRC_Config["SuggestParams"]["IsRunning"][Index] = true;
     var APILimit = LiveRC_Config["UserInfos"].APIlimit;
     if(Limit>APILimit) Limit = APILimit;
     var URL = lrcGetAPIURL({format:'xml',action:'query',list:'allusers',auprefix:Page,aulimit:Limit});
     wpajax.http({url:URL,
                  onSuccess:LiveRC_Suggest_GetUserSuggestionsDone,
                  index: Index
     });
};

window.LiveRC_Suggest_GetUserSuggestionsDone = function(Req, data){
     var Index = data.index;
     var xml = Req.responseXML ;
     if ( xml == null ) return ;
     var titles = new Array () ;
     var pages = xml.getElementsByTagName("u") ;
     for(var i=0;i<pages.length;i++){
          var s = pages[i].getAttribute("name");
        if(titles.indexOf(s)==-1) titles.push(s);
     }
     LiveRC_Config["SuggestParams"]["IsRunning"][Index] = false;
     LiveRC_Suggest_ShowUserSuggestions(titles, Index);
};

window.LiveRC_Suggest_ShowUserSuggestions = function(titles, Index){
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     var ExistInputNode = LiveRC_Config["SuggestParams"]["ExistInput"][Index];
     var ExistImgNode = LiveRC_Config["SuggestParams"]["ExistImg"][Index];
     var ListDown = LiveRC_Config["SuggestParams"]["ListDown"][Index];
     var TailleListe = LiveRC_Config["SuggestParams"]["SuggestSelectLimit"][Index];

     var CurrentValue = Input.value;
     if(ExistInputNode) ExistInputNode.value = "0";
     if(ExistImgNode){
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestNoExistIcon").split("$1").join(CurrentValue);
     }
     if(titles.length==0){
          Select.style.display = "none" ;
          Input.title = "";
          return;
     }
     Select.style.display = "inline" ;
     if(ExistInputNode) ExistInputNode.value = "1";
     if(ExistImgNode){
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestExistIcon").split("$1").join(TCurrentValue);
     }
     if(titles[0]===Input.value){
          Select.style.display = "none" ;
          Input.title = "";
          return;
     }
     if (titles.length < TailleListe ) TailleListe = titles.length;
     Select.size = TailleListe ;
     Select.style.align = "left" ;
     Select.style.zIndex = LiveRC_Config["SuggestParams"]["ZIndex"]++ ;
     Select.style.position = "relative" ;
     Select.style.width = Input.offsetWidth + "px" ;
     Select.style.height = (TailleListe * 20) + "px" ;
     while(Select.firstChild) Select.removeChild(Select.firstChild);
     for ( var i = 0 ; i < titles.length ; i++ ) {
          var opt = document.createElement("option");
          var ot = document.createTextNode(titles[i]);
          opt.appendChild(ot) ;
          opt.value = titles[i];
          Select.appendChild(opt) ;
     }
     Select.onkeyup = LiveRC_Suggest_ReplaceUserSuggestionsKeyPress;
     Select.onclick = LiveRC_Suggest_ReplaceUserSuggestions;
     if(ListDown){
          Select.style.top = parseInt(Input.offsetHeight) + "px";
          Select.style.marginBottom = "-" + ((TailleListe * 20) + parseInt(Input.offsetHeight)) + "px" ;
     }else{
          Select.style.marginTop = "-" + (TailleListe * 20) + "px" ;
     }
     Select.style.marginLeft = "-" + Input.offsetWidth + "px" ;
     var suggestion = titles[0] ;
     if(suggestion.match(new RegExp("^"+CurrentValue))==null){
          LiveRC_Suggest_GetUserSuggestions(Index);
          return;
     }
     var CurrentValueLength = CurrentValue.length;
     Input.value = suggestion;
     Input.title = lrcGetNamespaceName(2, true)+":"+suggestion;
     if (Input.createTextRange) {
          var ra = Input.createTextRange();
          ra.moveStart("character", CurrentValueLength);
          ra.moveEnd("character", suggestion.length);
          ra.select();
     } else if( Input.setSelectionRange ) {
          Input.setSelectionRange( CurrentValueLength, suggestion.length );
     } else {
          Input.selectionStart = CurrentValueLength;
          Input.selectionEnd = suggestion.length ;
     }
     if(ExistImgNode){
          CurrentValue = Input.value;
          ExistImgNode.innerHTML = lrcMakeIcon("SuggestExistIcon").split("$1").join(suggestion);
     }
};

window.LiveRC_Suggest_ReplaceUserSuggestionsKeyPress = function(e){
     if (!e) e = window.event;
     if (e.keyCode != 13) return;
     LiveRC_Suggest_ReplaceUserSuggestions();
};

window.LiveRC_Suggest_ReplaceUserSuggestions = function(){
     var Index = LiveRC_Suggest_GetSuggestionIndex(this);
     var Select = LiveRC_Config["SuggestParams"]["Suggest"][Index];
     var Input = LiveRC_Config["SuggestParams"]["Input"][Index];
     if(!Input|| !Select) return;
     Select.style.zIndex = LiveRC_Config["SuggestParams"]["ZIndex"]++ ;
     var Options = Select.getElementsByTagName('option');
     for(var a=0;a<Options.length;a++){
          if(Options[a].selected){
            Input.value = Options[a].value;
            Input.title = lrcGetNamespaceName(2, true)+":"+Options[a].value;
            Input.focus();
            LiveRC_Suggest_GetUserSuggestions(Index);
            return;
        }
    }
};

/*

Boîtes pop-up[modifier le code]

 */

window.LiveRC_CreateNewAlert = function(){
  var Alert = document.getElementById("LiveRCAlert");
  if(!Alert){
    var Target = document.getElementById("LiveRCContainer");
    if(!Target) Target = document.body;
    if(!Target) return;
    Alert = document.createElement('ul');
    Alert.id = "LiveRCAlert";
    lrcAddClass(Alert, "error");
    lrcaddCustomizableClasses(Alert, "LiveRCAlert");
    Target.insertBefore(Alert, Target.firstChild);
  }
  Alert.style.maxWidth = Math.round(LiveRC_GetScreenWidth()/2) + "px";
  Alert.style.minWidth = Math.round(LiveRC_GetScreenWidth()/4) + "px";
  LiveRC_Config["AlertCount"]++;
  var Lis = Alert.getElementsByTagName('li');
  var index = LiveRC_Config["AlertCount"];
  var id = "LiveRCAlert_"+index;
  var NewLi = document.createElement('li');
  NewLi.id = id;
  lrcAddClass(NewLi, "LiveRC_Opacity_100");
  Alert.appendChild(NewLi);
  return NewLi;
};

/*
prompt[modifier le code]
 */

window.LiveRC_prompt = function(text, onOK, onCancel, suggestion){
  if(!text) return;
  if(!suggestion) suggestion = '';
  text = text.split("\n").join("");
  var NewLi = LiveRC_CreateNewAlert();
  var id = NewLi.id;
  var Fieldset = document.createElement('fieldset');
  NewLi.appendChild(Fieldset);
  var Ptext = document.createElement('p');
  Ptext.className = "AlertText";
  Ptext.innerHTML = text;
  Fieldset.appendChild(Ptext);
  var Psuggest = document.createElement('input');
  Psuggest.id = id+"_AlertSuggest";
  Psuggest.type = "text";
  Psuggest.className = "AlertSuggest";
  if(suggestion) Psuggest.value = suggestion;
  Fieldset.appendChild(Psuggest);
  var Pbuttons = document.createElement('p');
  var OKInput = document.createElement('input');
  OKInput.type = "button";
  OKInput.value = lrcMakeText("OK");
  var OKFunction = function(){
    var SuggestInput = document.getElementById(id+"_AlertSuggest");
    if(typeof(onOK)==="function" && SuggestInput) onOK(SuggestInput.value);
    NewLi.parentNode.removeChild(NewLi);
    return false;
  };
  OKInput.onclick = OKFunction;
  OKInput.onselect = OKFunction;
  Pbuttons.appendChild(OKInput);
  var CancelInput = document.createElement('input');
  CancelInput.type = "button";
  CancelInput.value = lrcMakeText("Cancel");
  var CancelFunction = function(){
    var SuggestInput = document.getElementById(id+"_AlertSuggest");
    if(typeof(onCancel)==="function" && SuggestInput) onCancel(SuggestInput.value);
    NewLi.parentNode.removeChild(NewLi);
    return false;
  };
  CancelInput.onclick = CancelFunction;
  CancelInput.onselect = CancelFunction;
  Pbuttons.appendChild(CancelInput);
  NewLi.appendChild(Pbuttons);
  Psuggest.focus();
  return NewLi;
};

/*
confirm[modifier le code]
 */

window.LiveRC_confirm = function(text, onOK, onCancel){
  if(!text) return;
  text = text.split("\n").join("");
  var NewLi = LiveRC_CreateNewAlert();
  var Fieldset = document.createElement('fieldset');
  NewLi.appendChild(Fieldset);
  var Ptext = document.createElement('p');
  Ptext.className = "AlertText";
  Ptext.innerHTML = text;
  Fieldset.appendChild(Ptext);
  var Pbuttons = document.createElement('p');
  var OKInput = document.createElement('input');
  OKInput.type = "button";
  OKInput.value = lrcMakeText("OK");
  var OKFunction = function(){
    if(typeof(onOK)==="function") onOK();
    NewLi.parentNode.removeChild(NewLi);
    return false;
  };
  OKInput.onclick = OKFunction;
  OKInput.onselect = OKFunction;
  Pbuttons.appendChild(OKInput);
  var CancelInput = document.createElement('input');
  CancelInput.type = "button";
  CancelInput.value = lrcMakeText("Cancel");
  var CancelFunction = function(){
    if(typeof(onCancel)==="function") onCancel();
    NewLi.parentNode.removeChild(NewLi);
    return false;
  };
  CancelInput.onclick = CancelFunction;
  CancelInput.onselect = CancelFunction;
  Pbuttons.appendChild(CancelInput);
  NewLi.appendChild(Pbuttons);
  OKInput.focus();
  return NewLi;
};

/*
alert[modifier le code]
 */

window.LiveRC_alert = function(text){
  if(!text) return;
  var NewLi = LiveRC_CreateNewAlert();
  var id = NewLi.id;
  NewLi.innerHTML = text.split("\n").join("");
  NewLi.onmouseover = function(){
    LiveRC_alert_stopOpacity(this.id);
  };
  NewLi.onmouseout = function(){
    LiveRC_Config["Timeout"][this.id] = setTimeout("LiveRC_alert_setOpacity("+lrcEscapeStr(this.id)+", false, 5, 75);", 500);
  };
  LiveRC_Config["Timeout"][id] = setTimeout("LiveRC_alert_setOpacity("+lrcEscapeStr(id)+", false, 5, 75);", 3000);
  return NewLi;
};

window.LiveRC_alert_setOpacity = function(id, removefunc, diff, delay){
  if(!diff) diff = 5;
  if(!delay) delay = 75;
  var Element = document.getElementById(id);
  if(!Element || !Element.className) return;
  var ElClass = Element.className.match(/LiveRC_Opacity_[0-9]*/);
  if(ElClass==null){
    lrcAddClass(Element, "LiveRC_Opacity_100");
    LiveRC_alert_setOpacity(id, removefunc, diff, delay);
    return;
  }
  clearTimeout(LiveRC_Config["Timeout"][id]);
  var Opacity = parseInt(ElClass[0].replace(/\D/g, ""));
  if(typeof(Opacity)!="number") return;
  var NewOpacity = (Opacity-parseInt(diff));
  if(NewOpacity < 1){
    if(!removefunc){
      Element.parentNode.removeChild(Element);
    }else{
      if(typeof(removefunc)==="function") removefunc(ElClass[0]);
    }
    return;
  }
  if(NewOpacity > 100){
    Element.className = Element.className.replace(ElClass[0], "LiveRC_Opacity_100");
    return;
  }
  Element.className = Element.className.replace(ElClass[0], "LiveRC_Opacity_"+NewOpacity);
  LiveRC_Config["Timeout"][id] = setTimeout(function(){ LiveRC_alert_setOpacity(id, removefunc, diff, delay); }, delay);
};

window.LiveRC_alert_stopOpacity = function(id){
  var Element = document.getElementById(id);
  if(!Element || !Element.className) return;
  var ElClass = Element.className.match(/LiveRC_Opacity_[0-9]*/);
  if(ElClass==null) return;
  Element.className = Element.className.replace(ElClass[0], "LiveRC_Opacity_100");
  LiveRC_Config["Timeout"][id] = clearTimeout(LiveRC_Config["Timeout"][id]);
};

/*

Module de gestion des variables[modifier le code]

Récupération des styles locaux[modifier le code]
 */

window.liveOldLocalCSS = function(){
    lrcDisplayDebug("Get LiveRC local styles");
    var URL = lrcGetAPIURL({format:'xml',action:'query',prop:'revisions',rvlimit:'1',rvprop:'ids',titles:LiveRC_Config["CSSPage"]});
    wpajax.http({url: URL, onSuccess: liveOldLocalCSSOldid});
    LiveRC_LaunchProcessNextStep();
};

window.liveOldLocalCSSOldid = function(RequeteOldid){
  var ObjetXML = RequeteOldid.responseXML;
  if (ObjetXML){
    var LastRevision = ObjetXML.getElementsByTagName('rev')[0];
    if (LastRevision){
      var Oldid = LastRevision.getAttribute('revid');
      var URL = lrcGetUglyPageURL(LiveRC_Config["CSSPage"],'&action=raw&oldid='+Oldid);
      wpajax.http({url:URL, onSuccess:LiveRC_ManageParams_GetOldCSS, page:LiveRC_Config["CSSPage"]});
    }
  }
};

/*
Récupération des styles personnalisés[modifier le code]
 */

window.liveOldPersonalCSS = function(){
    lrcDisplayDebug("Get LiveRC personal styles");
    var Page = 'User:'+mw.config.get('wgUserName')+ LiveRC_Config["UserParamPage"]+".css";
    var URL = lrcGetAPIURL({format:'xml',action:'query',prop:'revisions',rvlimit:'1',rvprop:'ids',titles:Page});
    wpajax.http({url: URL, onSuccess: LiveRC_ManageParams_GetOldCSSOldid});
    LiveRC_LaunchProcessNextStep();
};

window.LiveRC_ManageParams_GetOldCSSOldid = function(RequeteOldid){
  var ObjetXML = RequeteOldid.responseXML;
  if (ObjetXML){
    var LastRevision = ObjetXML.getElementsByTagName('rev')[0];
    if (LastRevision){
      var Oldid = LastRevision.getAttribute('revid');
      var URL = lrcGetUglyPageURL('User:'+mw.config.get('wgUserName')+LiveRC_Config["UserParamPage"]+'.css','&action=raw&oldid='+Oldid);
      wpajax.http({url:URL, onSuccess:LiveRC_ManageParams_GetOldCSS, page:'User:'+mw.config.get('wgUserName')+LiveRC_Config["UserParamPage"]+'.css'});
    }
  }
};

/*
Parsing des styles[modifier le code]
 */

window.LiveRC_ManageParams_GetOldCSS = function(Req, data){
     var localpage = (data.page === LiveRC_Config["CSSPage"]);
     var Response = Req.responseText;
     if(Response=="") return;
     Response = Response.split("/*");
     for(var a=0,l=Response.length;a<l;a++){
       if(Response[a].indexOf("*/")!=-1) Response[a] = Response[a].split("*/")[1];
     }
     Response = Response.join("");
     Response = Response.replace(/[ ]*\n[ ]*/g, "");
     var FoundSetup = false;
     var Reg = new RegExp("[^\\}]*\\{[^\\}]*\\}", "g");
     var matches = Response.match(Reg);
     if(matches == null) return;
     var personalstylescount = 0;
     for(var a=0,l=matches.length;a<l;a++){
         var Thismatch = matches[a];
         var matchtarget = Thismatch.split("{")[0];
         matchtarget = matchtarget.replace(/^ /g, "").replace(/ $/g, "");
         var matchstyle = Thismatch.split("}")[0].split("{")[1];
         matchstyle = LiveRC_ManageParams_StripStyle(matchstyle);
         var styleupdated = false;
         for(var b=0,r=lrcCSSstyles.length;b<r;b++){
             var target = lrcCSSstyles[b].target;
             if(target != matchtarget) continue;
             lrcCSSstyles[b].style = LiveRC_ManageParams_StripStyle(lrcCSSstyles[b].style);
             if(localpage) lrcCSSstyles[b].localstyle = matchstyle;
             else lrcCSSstyles[b].customstyle = matchstyle;
             styleupdated = true;
         }
         if(!styleupdated){
             personalstylescount++;
             var NewStyleItem = {};
             if(localpage){
               NewStyleItem.localtarget = matchtarget;
               NewStyleItem.localstyle = matchstyle;
             }else{
               NewStyleItem.customtarget = matchtarget;
               NewStyleItem.customstyle = matchstyle;
             }
             lrcCSSstyles.push(NewStyleItem);
         }
     }
     LiveRC_ManageParams_FillOpenedStylesMenu();
};

window.LiveRC_ManageParams_StripStyle = function(style){
  if(!style) return "";
  return style.replace(/^ /g, "").replace(/ $/g, "").replace(/( )*;( )*/g, ";").replace(/( )*:( )*/g, ":").replace(/;;/g, ";");
};

/*
Fonctions d'ajout de variables[modifier le code]
Variables par défaut[modifier le code]
 */

window.defineParam = function(textcode, Param){
  lrcParams[textcode] = Param;
};

window.defineOption = function(textcode, Option){
  lrcOptionMenuValues[textcode] = Option;
};

window.defineBlankMessages = function(BlankMessages){
  lstBlank = BlankMessages;
};

window.defineRevertMessages = function(RevertMessages){
  lrcRevertMessages = RevertMessages;
};

window.defineWarningTemplates = function(WarningTemplates){
  lstAverto = WarningTemplates;
};

window.defineTagTemplates = function(TagTemplates){
  lstBando = TagTemplates;
};

window.defineReportParams = function(ReportParams){
  lstReport = ReportParams;
};

window.defineIcon = function(textcode, Icon){
  lrcIcons[textcode] = Icon;
};

window.defineUnTranslatedText = function(textcode, UnTranslatedText){
  UnTranslatedTexts[textcode] = UnTranslatedText;
};

window.defineExtensions = function(Extensions){
  lrcExtensions = Extensions;
};

window.defineCommentTests = function(CommentTests){
  commenttests = CommentTests;
};

window.defineTemplateTest = function(TemplateTest){
  templatestests = TemplateTest;
};

window.definePageCategoryTests = function(PageCategoryTests){
  categoriestests = PageCategoryTests;
};

window.defineUserCategoryTests = function(UserCategoryTests){
  watchCategories = UserCategoryTests;
};

window.defineSupprLineParams = function(SupprLineParams){
  lrcSupprLineParams = SupprLineParams;
};

window.addParamMenuTab = function(textcode, ParamMenuTab){
  lstParamMenuTabs[textcode] = ParamMenuTab;
};

window.addTradToTranslatedTexts = function(textcode, lang, text){
  if(typeof(lrcTranslatedTexts[textcode])!="object") lrcTranslatedTexts[textcode] = [];
  if(typeof(lrcTranslatedTexts[textcode][lang])==="undefined") lrcTranslatedTexts[textcode][lang] = text;
};

window.addTradToTranslatedParamDesc = function(textcode, lang, text){
  if(typeof(lrcTranslatedParamDesc[textcode])!="object") lrcTranslatedParamDesc[textcode] = [];
  if(typeof(lrcTranslatedParamDesc[textcode][lang])==="undefined") lrcTranslatedParamDesc[textcode][lang] = text;
};

window.addTradToExtensions = function(extensionname, lang, text){
  for(var a=0,l=lrcExtensions.length;a<l;a++){
    if(lrcExtensions[a]["name"] != extensionname) continue;
    lrcExtensions[a][("desc-"+lang)] = text;
    delete lrcExtensions[a]["desc"];
  }
};

window.addTradToCSSstyles = function(stylename, lang, text){
  for(var a=0,l=lrcCSSstyles.length;a<l;a++){
    if(lrcCSSstyles[a]["target"] != stylename) continue;
    lrcCSSstyles[a][("desc-"+lang)] = text;
    delete lrcCSSstyles[a]["desc"];
  }
};

/*
Variables personnalisées[modifier le code]
 */

window.addCustomParam = function(textcode, Param){
  Custom_lrcParams[textcode] = Param;
};

window.addCustomOption = function(textcode, Option){
  Custom_lrcOptionMenuValues[textcode] = Option;
};

window.defineCustomBlankMessages = function(BlankMessages){
  Custom_lstBlank = BlankMessages;
};

window.defineCustomRevertMessages = function(RevertMessages){
  Custom_lrcRevertMessages = RevertMessages;
};

window.defineCustomWarningTemplates = function(WarningTemplates){
  Custom_lstAverto = WarningTemplates;
};

window.defineCustomTagTemplates = function(TagTemplates){
  Custom_lstBando = TagTemplates;
};

window.defineCustomReportParams = function(ReportParams){
  Custom_lstReport = ReportParams;
};

window.addCustomIcon = function(textcode, Icon){
  Custom_lrcIcons[textcode] = Icon;
};

window.addCustomTradToTranslatedTexts = function(textcode, Args){
  if(typeof(Custom_lrcTranslatedTexts[textcode])!="object") Custom_lrcTranslatedTexts[textcode] = [];
  for(var lang in Args){
    var text = Args[lang];
    Custom_lrcTranslatedTexts[textcode][lang] = text;
  }
};

window.addCustomTradToTranslatedParamDesc = function(textcode, Args){
  if(typeof(Custom_lrcTranslatedParamDesc[textcode])!="object") Custom_lrcTranslatedParamDesc[textcode] = [];
  for(var lang in Args){
    var text = Args[lang];
    Custom_lrcTranslatedParamDesc[textcode][lang] = text;
  }
};

window.addCustomUnTranslatedText = function(textcode, UnTranslatedText){
  Custom_UnTranslatedTexts[textcode] = UnTranslatedText;
};

window.defineCustomExtensions = function(Extensions){
  Custom_lrcExtensions = Extensions;
};

window.defineCustomCommentTests = function(CommentTests){
  Custom_commenttests = CommentTests;
};

window.defineCustomTemplateTest = function(TemplateTest){
  Custom_templatestests = TemplateTest;
};

window.defineCustomPageCategoryTests = function(PageCategoryTests){
  Custom_categoriestests = PageCategoryTests;
};

window.defineCustomUserCategoryTests = function(UserCategoryTests){
  Custom_watchCategories = UserCategoryTests;
};

window.defineCustomSupprLineParams = function(SupprLineParams){
  Custom_lrcSupprLineParams = SupprLineParams;
};

window.addCustomParamMenuTab = function(textcode, ParamMenuTab){
  Custom_lstParamMenuTabs[textcode] = ParamMenuTab;
};

window.lrcSetConfigSetting = function(variable, textcode, value){
  if(typeof(window[variable])==="undefined") return;
  if(textcode===false){
    window[variable] = value;
  }else{
    if(typeof(textcode)!=="undefined") window[variable][textcode] = value;
  }
};

/*
Création du menu de paramétrage[modifier le code]
Remplissage de la variable globale[modifier le code]
 */

// Création des variables

window.LiveRC_ManageParams_GlobalFill = function(){
    LiveRC_Config["LiveRCcustomParams"] = [];
    LiveRC_ManageParams_Fill(lrcParams              , "lrcParams"              , "addCustomParam"                      , false );
    LiveRC_ManageParams_Fill(lrcOptionMenuValues    , "lrcOptionMenuValues"    , "addCustomOption"                     , false );
    LiveRC_ManageParams_Fill(lstBlank               , "lstBlank"               , "defineCustomBlankMessages"           , true  );
    LiveRC_ManageParams_Fill(lrcRevertMessages      , "lrcRevertMessages"      , "defineCustomRevertMessages"          , true  );
    LiveRC_ManageParams_Fill(lstAverto              , "lstAverto"              , "defineCustomWarningTemplates"        , true  );
    LiveRC_ManageParams_Fill(lstBando               , "lstBando"               , "defineCustomTagTemplates"            , true  );
    LiveRC_ManageParams_Fill(lstReport              , "lstReport"              , "defineCustomReportParams"            , true  );
    LiveRC_ManageParams_Fill(lrcIcons               , "lrcIcons"               , "addCustomIcon"                       , false );
    LiveRC_ManageParams_Fill(lrcTranslatedTexts     , "lrcTranslatedTexts"     , "addCustomTradToTranslatedTexts"      , false );
    LiveRC_ManageParams_Fill(lrcTranslatedParamDesc , "lrcTranslatedParamDesc" , "addCustomTradToTranslatedParamDesc"  , false );
    LiveRC_ManageParams_Fill(UnTranslatedTexts      , "UnTranslatedTexts"      , "addCustomUnTranslatedText"           , false );
    LiveRC_ManageParams_Fill(lrcExtensions          , "lrcExtensions"          , "defineCustomExtensions"              , true  );
    LiveRC_ManageParams_Fill(commenttests           , "commenttests"           , "defineCustomCommentTests"            , true  );
    LiveRC_ManageParams_Fill(templatestests         , "templatestests"         , "defineCustomTemplateTest"            , true  );
    LiveRC_ManageParams_Fill(categoriestests        , "categoriestests"        , "defineCustomPageCategoryTests"       , true  );
    LiveRC_ManageParams_Fill(watchCategories        , "watchCategories"        , "defineCustomUserCategoryTests"       , true  );
    LiveRC_ManageParams_Fill(lrcSupprLineParams     , "lrcSupprLineParams"     , "defineCustomSupprLineParams"         , true  );
    LiveRC_RunHooks("AfterFillParamPanel");
    LiveRC_ManageParams_Fill(lstParamMenuTabs       , "lstParamMenuTabs"       , "addCustomParamMenuTab"               , false);
};

window.LiveRC_ManageParams_Fill = function(OptionArray, ArrayName, AddCustomFunction, AddButton){
    if(typeof(lstParamMenuTabs[ArrayName])==="undefined") lstParamMenuTabs[ArrayName] = true;
    var TheOptionArray = [];
    var CustomOptionArray = false;
    var test = "Custom_"+ ArrayName;
    if(!LiveRC_Config["GlobalFill_OnlyDefault"]){
        CustomOptionArray = eval( test );
        if(typeof(CustomOptionArray) !== "object"){
            test = ArrayName + "_Custom";
            try{ CustomOptionArray = eval( test ); }catch(e){ };
        }
    }else{
        CustomOptionArray = OptionArray;
    }
    if(typeof(CustomOptionArray) === "object" && !LiveRC_Config["GlobalFill_OnlyDefault"]){
        if(AddButton){ // ------------------------------------------- if there is a custom array, search values
            var foundvalues = false;
            for(var val in CustomOptionArray){
                if(['number','string','boolean','object','regexp'].indexOf(Realtypeof(CustomOptionArray[val]))!=-1)
                    foundvalues = true;
            }
            if(foundvalues) TheOptionArray = CustomOptionArray; // --- if found values : take in account the custom array
            else TheOptionArray = OptionArray;                  // --- if not, take in account the normal array
        }else{  // --------------------------------------------------- otherwise, merge the two arrays
            for(var val in OptionArray) TheOptionArray[val] = OptionArray[val];
            for(var val in CustomOptionArray) TheOptionArray[val] = CustomOptionArray[val];
        }
    }else{
        TheOptionArray = OptionArray;
    }
    var Types = null;
    for(var Param in TheOptionArray){
        var ParamName = Param;
        var ParamDefValue = OptionArray[Param];
        var ParamCustomValue = CustomOptionArray[Param];
        var CustomValueType = Realtypeof(ParamCustomValue);
        var CustomValueTest = (['number','string','boolean','regexp'].indexOf(CustomValueType) != -1 );
        if(CustomValueType == "object"){
            CustomValueTest = false;
            for(var X in ParamCustomValue){
                if(['number','string','boolean','regexp'].indexOf(Realtypeof(ParamCustomValue[X]))!= -1 ) CustomValueTest = true;
            }
        }
        if(!Types && AddButton) Types = LiveRC_ManageParams_Fill_GetVarTypes(ParamOldValue);
        var ParamOldValue = ( CustomValueTest ? ParamCustomValue : ParamDefValue);
        var ParamType = Realtypeof(ParamOldValue);  // 'number', 'string', 'boolean', 'object', 'regexp';
        if(['number', 'string', 'boolean', 'object', 'regexp'].indexOf(ParamType) !== -1){
            var NewArray = {};
            NewArray["ArrayName"]            = ArrayName;
            NewArray["Name"]                 = ParamName;
            NewArray["Desc"]                 = lrcMakeParamDescription(ParamName);
            NewArray["ValueType"]            = ParamType;
            NewArray["AddButton"]            = (AddButton ? true : false);
            NewArray["AddCustomFunction"]    = AddCustomFunction;
            NewArray["CustomValue"]          = ParamCustomValue;
            NewArray["DefaultValue"]         = ParamDefValue;
            NewArray["OldValue"]             = ParamOldValue;
            if(Types) NewArray["ItemsTypes"] = Types;
            if(!LiveRC_Config["LiveRCcustomParams"][ArrayName])
              LiveRC_Config["LiveRCcustomParams"][ArrayName] = [];
            LiveRC_Config["LiveRCcustomParams"][ArrayName][ParamName] = NewArray;
        }
    }
};

window.LiveRC_ManageParams_Fill_GetVarTypes = function(ParamObject){
    var Types = [];
    if(Realtypeof(ParamObject)!="object") return false;
    for(var VarIndex in ParamObject){
        if(!ParamObject.hasOwnProperty(VarIndex)) continue;
        Types.push(lrcEscapeStr(VarIndex)+":"+lrcEscapeStr(Realtypeof(ParamObject[VarIndex])));
    }
    if(Types.length===0) return null;
    return '{'+Types.join(",")+'}';
};

/*
Ouverture/Fermeture du menu de paramétrage[modifier le code]
 */

// Fermeture du menu

window.LiveRC_ManageParams_CloseMenu = function(){
    var ID = "LiveRC_ParamMenu";
    var Menu = document.getElementById(ID);
    if(Menu){
        lrcRemoveClass(document.body, "LiveRCConfigDisplayed");
        Menu.parentNode.removeChild(Menu);
        clearTimeout(LiveRC_Config["Timeout"]["ManageParams"]);
        updateFollowContact();
        updateFollowHiddenUsers();
        updateFollowHiddenPages();
        lrcInitTableHeight();
    }
};

// Création du menu

window.LiveRC_ManageParams_OpenMenu = function(onlydefault){
    var OldMenu = document.getElementById("LiveRC_ParamMenu");
    if(OldMenu){
        LiveRC_ManageParams_CloseMenu();
        return;
    }
    lrcAddClass(document.body, "LiveRCConfigDisplayed");
    LiveRC_Config["GlobalFill_OnlyDefault"] = (!onlydefault ? false : true);

    LiveRC_ManageParams_GlobalFill();
    var TargetDiv = document.getElementById("OutFixedBottomPanel");
    if(!TargetDiv) return;

    var Menu = document.createElement('div');
    Menu.id = "LiveRC_ParamMenu";
    lrcAddClass(Menu, "LiveRC_Opacity_100");
    var MenuAnchor = document.createElement('div');
    MenuAnchor.id = "LiveRC_ParamMenuAnchor";
    MenuAnchor.innerHTML = lrcMakeText("ConfigMenuTitle");
    Menu.appendChild(MenuAnchor);
    var MenuContent = document.createElement('div');
    MenuContent.id = "LiveRC_ParamMenuContent";
    lrcaddCustomizableClasses(MenuContent, "LiveRC_MenuContent");
    var Form = document.createElement('form');
    Form.id = "LiveRC_ParamMenuForm";
    MenuContent.appendChild(Form);
    for(var ThisVariableIndex in LiveRC_Config["LiveRCcustomParams"]){
        var ArrayVariable = LiveRC_Config["LiveRCcustomParams"][ThisVariableIndex];
        var VariableFieldset = document.createElement('fieldset');
        VariableFieldset.id = "LiveRC_OptionsContent_"+ThisVariableIndex;
        VariableFieldset.className = "LiveRC_ParamMenuFieldset";
        VariableFieldset.setAttribute("style", "text-align:left;");
        var VariableLegend = document.createElement('legend');
        VariableLegend.appendChild(document.createTextNode(lrcMakeParamDescription(ThisVariableIndex)));
        VariableFieldset.appendChild(VariableLegend);
        VariableFieldset.appendChild(LiveRC_ManageParams_CreateActionButtons());
        var VariableDiv = document.createElement('div');
        VariableDiv.className = "LiveRC_ParamMenuPart";
        var VariableUl = document.createElement('ul');
        var ArraysInArray = false;
        var count = 0;
        for(var q in ArrayVariable){
          count++;
          if(ArrayVariable[q]["ValueType"]=='object') ArraysInArray = true;
        }
        if(count==0) continue;
        if(!ArraysInArray) VariableUl.setAttribute("style", "-moz-column-count:2;-webkit-column-count:2;column-count:2;");
        VariableDiv.appendChild(VariableUl);
        VariableFieldset.appendChild(VariableDiv);
        var AddButton;
        for(var a in ArrayVariable){
            var ThisVariable = ArrayVariable[a];
            AddButton = ThisVariable["AddButton"];
            var P = LiveRC_ManageParams_CreateLiFromParam(ThisVariable);
            VariableUl.appendChild(P);
        }
        if(AddButton && ThisVariable["ItemsTypes"]){
            var P = document.createElement('li');
            var Types = ThisVariable["ItemsTypes"];
            var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr(ThisVariableIndex)+', '+Types+');';
            P.innerHTML = '<a id="AddParam_'+ThisVariableIndex+'" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
            VariableUl.appendChild(P);
        }
        Form.appendChild(VariableFieldset);
    }
    Menu.appendChild(MenuContent);
    TargetDiv.appendChild(Menu);
    LiveRC_ManageParams_TransformInputToSelect();
    LiveRC_ManageParams_MoveFollowListsOptions();
    LiveRC_ManageParams_MoveLogOptions();
    LiveRC_ManageParams_MoveTagsOptions();
    LiveRC_ManageParams_MoveNamespaceOptions();
    LiveRC_ManageParams_MoveUsersOptions();
    LiveRC_ManageParams_AddIconsDescriptions();
    LiveRC_ManageParams_AddNewIcon_CreateAddButton();
    LiveRC_ManageParams_AddTextTranslationsLangToggleAndDescriptions();
    LiveRC_ManageParams_AddNewText_CreateAddButton();
    LiveRC_ManageParams_RemoveSomeExtensions();
    LiveRC_ManageParams_AddContactListMenu();
    LiveRC_ManageParams_AddHiddenListMenu();
    LiveRC_ManageParams_AddHiddenPagesListMenu();
    LiveRC_ManageParams_AddExtensionsMenu();
    LiveRC_ManageParams_AddStylesMenu();

    LiveRC_RunHooks("AfterCreateParamPanel");

    LiveRC_ManageParams_CreateToggleButtons();
    LiveRC_ManageParams_ToggleMenu();
    LiveRC_ManageParams_HideSomeTabs();
    LiveRC_SetVerticalResizeZone(document.getElementById("LiveRC_ParamMenuAnchor"),
                         lrcGetElementsByClass("LiveRC_ParamMenuPart",document.getElementById("LiveRC_ParamMenu"),"div"),
                         document.getElementById("LiveRC_ParamMenu")
                        );
    lrcInitTableHeight();
};


window.LiveRC_ManageParams_HideSomeTabs = function(){
  for(var tab in lstParamMenuTabs){
    if(lrcMakeParamMenuTabs(tab) === false){
      var Fieldset = document.getElementById("LiveRC_OptionsContent_"+tab);
      if(Fieldset) Fieldset.style.display = "none";
      var Input = document.getElementById("LiveRC_OptionsContentInput_"+tab);
      if(Input) Input.style.display = "none";
    }
    if(LiveRC_Config["AlwaysShownTabs"].indexOf(tab)!=-1){
      var LI = document.getElementById("LI_"+tab);
      if(LI){
        var Inputs = LI.getElementsByTagName('input');
        for(var a=0,l=Inputs.length;a<l;a++){
          if(Inputs[a].type == "checkbox") Inputs[a].disabled = "disabled";
        }
      }
    }
  }
  var InputsP = document.getElementById("ToggleButtons");
  if(InputsP){
    var Inputs = InputsP.getElementsByTagName('input');
    var index = 0;
    var Input = Inputs[index];
    while(Input && Input.style && Input.style.display == "none"){
      index++;
      Input = Inputs[index];
    }
    if(Input && index !== 0) LiveRC_ManageParams_ToggleMenu(Input);
  }
};

window.LiveRC_ManageParams_CreateLiFromParam = function(ThisVariable){
  var ThisVariable_Desc = ThisVariable["Desc"];
  var ThisVariable_Name = ThisVariable["Name"];
  var ThisVariable_AddButton = ThisVariable["AddButton"];
  var ThisVariable_ValueType = ThisVariable["ValueType"];
  var ThisVariable_OldValue = ThisVariable["OldValue"];
  var ThisVariable_DefaultValue = ThisVariable["DefaultValue"];
  var LetOneItem = (typeof(ThisVariable["LetOneItem"])==="boolean" && ThisVariable["LetOneItem"]===false ? false : true);
  var P = document.createElement('li');
  lrcaddCustomizableClasses(P, "ParamMenuLi");
  lrcAddClass(P, "RealParamMenuLi");
  var addtitle = true;
  var thisvartitle = ThisVariable_Desc;
  for(var d=0,s=10;d<s;d++){ if(thisvartitle.indexOf("Desc"+d)!=-1) addtitle = false; }
  if(addtitle){
    P.title = thisvartitle;
    P.id = "LI_"+ThisVariable_Name;
  }
  var HiddenInput = document.createElement('input');
  HiddenInput.type = "hidden";
  HiddenInput.name = "variable_index";
  HiddenInput.value = ThisVariable_Name;
  P.appendChild(HiddenInput);
  var AddButton = ThisVariable_AddButton;
  if(ThisVariable_ValueType!='object'){
    var ValueSpan = LiveRC_ManageParams_CreateNewParamSpan(ThisVariable_OldValue, ThisVariable_ValueType, ThisVariable_Name, ThisVariable_Desc);
    if(ObjIsDifferent(ThisVariable_OldValue, ThisVariable_DefaultValue))
      lrcAddClass(P, "ParamMenuLiCustom");
    P.appendChild(ValueSpan);
  }else{
    for(var VarIndex in ThisVariable_OldValue){
      var VariableType = Realtypeof(ThisVariable_OldValue[VarIndex]);
      if(["boolean","number","string","regexp"].indexOf(VariableType)==-1) continue;
      var ValueSpan = LiveRC_ManageParams_CreateNewParamSpan(ThisVariable_OldValue[VarIndex], VariableType, VarIndex, VarIndex, true);
      if(Realtypeof(ThisVariable_DefaultValue)==="undefined" || ObjIsDifferent(ThisVariable_OldValue[VarIndex], ThisVariable_DefaultValue[VarIndex]))
        lrcAddClass(ValueSpan, "ParamMenuLiCustom");
      P.appendChild(ValueSpan);
      P.appendChild(document.createTextNode(" "));
    }
    if(AddButton) P.appendChild(LiveRC_ManageParams_AddDeleteParamLineLink(LetOneItem));
  }
  return P;
};

// Ajouter une nouvelle ligne

window.LiveRC_ManageParams_AddNewParam = function(Id, Vars, LetOne){
    var LetOneItem = (typeof(LetOne)==="boolean" && LetOne===false ? false : true);
    var Link = document.getElementById('AddParam_'+Id);
    if(!Link) return;
    var Variable = LiveRC_Config["LiveRCcustomParams"][Id];
    var ThisVariableName = 0;
    var Li = Link.parentNode;
    PreviousLi = Li.previousSibling;
    if(PreviousLi){
        var PreviousLiHidden = PreviousLi.getElementsByTagName('input')[0];
        if(PreviousLiHidden){
            var PreviousLiHiddenValue = PreviousLiHidden.value;
            if(typeof(parseInt(PreviousLiHiddenValue))==="number") ThisVariableName = (parseInt(PreviousLiHiddenValue) + 1);
        }
    }
    var P = document.createElement('li');
    lrcaddCustomizableClasses(P, "ParamMenuLi");
    lrcAddClass(P, "RealParamMenuLi");
    lrcAddClass(P, "ParamMenuLiCustom");
    var HiddenInput = document.createElement('input');
    HiddenInput.type = "hidden";
    HiddenInput.name = "variable_index";
    HiddenInput.value = ThisVariableName;
    P.appendChild(HiddenInput);
    for(var iName in Vars){
        var ValueSpan = LiveRC_ManageParams_CreateNewParamSpan("", Vars[iName], iName, iName, true);
        P.appendChild(ValueSpan);
        P.appendChild(document.createTextNode(" "));
    }
    P.appendChild(LiveRC_ManageParams_AddDeleteParamLineLink(LetOneItem));
    Li.parentNode.insertBefore(P, Li);
};

window.LiveRC_ManageParams_CreateNewParamSpan = function(VarValue, VariableType, VarIndex, Desc, LabelFirst){
  Desc = ( Desc ? Desc : VarIndex);
  var ValueSpan = document.createElement('span');
  lrcAddClass(ValueSpan, "ParamMenuLiElement");
  lrcAddClass(ValueSpan, "ParamMenuLiElement_"+VariableType);
  if(["boolean","number","string","regexp"].indexOf(VariableType)!=-1){
    var Input = document.createElement('input');
    Input.name = VarIndex;
    if(VariableType=="boolean"){
      Input.type = "checkbox";
      if(VarValue) Input.checked = "checked";
    }else{
      Input.type = "text";
      if(VariableType=="string" || VariableType == "regexp") Input.size = 35;
      if(VariableType=="number") Input.size = 4;
      Input.setAttribute("style", "padding:2px;margin:0");
      if(VariableType=="regexp"){
        Input.value = VarValue.toString();
      }else if(VariableType=="string"){
        Input.value = lrcEscapeStrSpecialChars(VarValue);
      }else{
        Input.value = VarValue;
      }
    }
    var Label = document.createElement('label');
    Label.setAttribute('for', VarIndex);
    Label.innerHTML = Desc;
    if(LabelFirst){
      ValueSpan.appendChild(Label);
      ValueSpan.appendChild(document.createTextNode(":"));
      ValueSpan.appendChild(Input);
    }else{
      ValueSpan.appendChild(Input);
      ValueSpan.appendChild(document.createTextNode(" "));
      ValueSpan.appendChild(Label);
    }
  }
  return ValueSpan;
};

// Bouton de suppression de ligne (paramètres)

window.LiveRC_ManageParams_AddDeleteParamLineLink = function(LetOne){
    var Link = document.createElement('a');
    Link.innerHTML = lrcMakeText("DeleteParamLineButton_Text");
    Link.title = lrcMakeText("DeleteParamLineButton_Title");
    Link.href = "javascript:;";
    Link.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this, LetOne); };
    return Link;
};

// Bouton de suppression de ligne (utilisateur suivi/masqué)

window.LiveRC_ManageParams_AddDeleteUserLink = function(){
    var Link = document.createElement('a');
    Link.innerHTML = lrcMakeText("DeleteUserButton_Text");
    Link.title = lrcMakeText("DeleteUserButton_Title");
    Link.href = "javascript:;";
    Link.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this, false); };
    return Link;
};

// Bouton de suppression de ligne (page masquée)

window.LiveRC_ManageParams_AddDeletePageLink = function(){
    var Link = document.createElement('a');
    Link.innerHTML = lrcMakeText("DeletePageButton_Text");
    Link.title = lrcMakeText("DeletePageButton_Title");
    Link.href = "javascript:;";
    Link.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this, false); };
    return Link;
};

// Suppression d'une ligne

window.LiveRC_ManageParams_DeleteThisParam = function(Link, LetOneLine){
    var Line = Link.parentNode;
    var UL = Line.parentNode;
    var LineNumber = lrcGetElementsByClass("ParamMenuLi", UL, "li").length;
    if(LetOneLine && LineNumber==1) return;
    Line.parentNode.removeChild(Line);
    return false;
};

// Création boutons d’action ( Valider / RAZ )

window.LiveRC_ManageParams_CreateActionButtons = function(){
    var ActionP = document.createElement('p');
    ActionP.className = 'ActionButtons';
    var OKInput = document.createElement('input');
    OKInput.type = "button";
    OKInput.value = lrcMakeText("OK");
    OKInput.onclick = function(){ LiveRC_ManageParams_CheckMenu(this); return false;};
    OKInput.onselect = function(){ LiveRC_ManageParams_CheckMenu(this); return false;};
    ActionP.appendChild(OKInput);
    var RAZInput = document.createElement('input');
    RAZInput.type = "button";
    RAZInput.value = lrcMakeText("RAZ");
    RAZInput.onclick = function(){ LiveRC_ManageParams_RAZParams(this); return false;};
    RAZInput.onselect = function(){ LiveRC_ManageParams_RAZParams(this); return false;};
    ActionP.appendChild(RAZInput);
    var CancelInput = document.createElement('input');
    CancelInput.type = "button";
    CancelInput.value = lrcMakeText("Cancel");
    CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    ActionP.appendChild(CancelInput);
    return ActionP;
};

// Création des onglets

window.LiveRC_ManageParams_CreateToggleButtons = function(){
    var Form = document.getElementById("LiveRC_ParamMenuForm");
    var P = document.createElement('p');
    P.id = "ToggleButtons";
    var Fieldsets = Form.getElementsByTagName('fieldset');
    for(var a=0,l=Fieldsets.length;a<l;a++){
        var Id = ""+Fieldsets[a].id.split("LiveRC_OptionsContent_").join("");
        var Input = document.createElement('input');
        Input.id = "LiveRC_OptionsContentInput_"+Id;
        Input.type = "button";
        Input.value = lrcMakeParamDescription(Id+"_short");
        Input.title = lrcMakeParamDescription(Id);
        Input.onclick = function(){ LiveRC_ManageParams_ToggleMenu(this); return false;};
        Input.onselect = function(){ LiveRC_ManageParams_ToggleMenu(this); return false;};
        P.appendChild(Input);
    }
    var NSMessages = getNamespaceInfoFromPage(LiveRC_Config["SiteConfigPage"]);
    if( LiveRC_Config["SiteConfigPage"].indexOf(".js") != -1
        &&
        ( ( NSMessages==8 && lrcUserHasRight("editinterface")
          )
          ||
          ( NSMessages==2 && ( lrcUserHasRight("edituserjs")
                               ||
                               LiveRC_Config["SiteConfigPage"].indexOf(mw.config.get('wgUserName')) !=- 1
                             )
          )
        )
      ){
        var MSInput = document.createElement('input');
        MSInput.type = "button";
        MSInput.id = "MWConfigSaveButton";
        MSInput.value = lrcMakeText("MWSiteInfoLegend");
        MSInput.title = lrcMakeText("UPDATEMESSAGES");
        MSInput.onclick = function(){ LiveRC_GetSiteInfos(true, this); return false;};
        MSInput.onselect = function(){ LiveRC_GetSiteInfos(true, this); return false;};
        P.appendChild(MSInput);
    }
    Form.parentNode.insertBefore( P, Form);
    LiveRC_Config["Timeout"]["ManageParams"] = setTimeout("LiveRC_ManageParams_SetMenuHeights()", 500);
};

// Gestion des onglets

window.LiveRC_ManageParams_ToggleMenu = function(Input){
    var Id = false;
    if(Input) Id = Input.id.split("LiveRC_OptionsContentInput_").join("LiveRC_OptionsContent_");
    var Form = document.getElementById("LiveRC_ParamMenuForm");
    var Onglets = document.getElementById("ToggleButtons").getElementsByTagName('input');
    var Fieldsets = lrcGetElementsByClass("LiveRC_ParamMenuFieldset",Form,"fieldset");
    for(var a=0,l=Fieldsets.length;a<l;a++){
        if(!Onglets[a]) continue;
        if(Id){
            Onglets[a].style.fontWeight = ((Id == Fieldsets[a].id)? "bold" : "");
            Fieldsets[a].style.display = ((Id == Fieldsets[a].id)? "" : "none");
        }else{
            Onglets[a].style.fontWeight = ((a==0)? "bold" : "");
            Fieldsets[a].style.display = ((a==0)? "" : "none");
        }
    }
};

// Égalisation de la hauteur des menus
window.LiveRC_ManageParams_SetMenuHeights = function(){
  var Menu = document.getElementById("LiveRC_ParamMenu");
  if(!Menu) return;
  var HeightFound = false;
  var FieldSets = Menu.getElementsByTagName('fieldset');
  for(var b=0,m=FieldSets.length;b<m;b++){
    if(FieldSets[b].style.display == "none") continue;
    var MenuPart =  lrcGetElementsByClass("LiveRC_ParamMenuPart",FieldSets[b],'div')[0];
    if(!MenuPart) continue;
    var StyleHeight = MenuPart.style.height;
    if(StyleHeight) HeightFound = StyleHeight;
  }
  if(HeightFound){
    var MenuParts = lrcGetElementsByClass("LiveRC_ParamMenuPart",Menu,'div');
    for(var a=0,l=MenuParts.length;a<l;a++) MenuParts[a].style.height = HeightFound;
  }
  clearTimeout(LiveRC_Config["Timeout"]["ManageParams"]);
  LiveRC_Config["Timeout"]["ManageParams"] = setTimeout("LiveRC_ManageParams_SetMenuHeights()", 500);
};

// Création d'un sous-menu

window.LiveRC_ManageParams_CreateNewListMenu = function(menuname, buttons, columns){
    var Form = document.getElementById("LiveRC_ParamMenuForm");
    if(!Form || !menuname) return;
    var NewListFieldset = document.createElement('fieldset');
    NewListFieldset.id = "LiveRC_OptionsContent_"+menuname;
    NewListFieldset.className = "LiveRC_ParamMenuFieldset";
    var NewListLegend = document.createElement('legend');
    NewListLegend.appendChild(document.createTextNode(lrcMakeParamDescription(menuname)));
    NewListFieldset.appendChild(NewListLegend);
    if(buttons) NewListFieldset.appendChild(buttons);
    var NewListDiv = document.createElement('div');
    NewListDiv.className = "LiveRC_ParamMenuPart";
    var NewListUl = document.createElement('ul');
    NewListUl.id = "LiveRC_OptionsContent_"+menuname+"ListUL";
    if(typeof(columns)=="number")
      NewListUl.setAttribute("style", "-moz-column-count:"+columns+";-webkit-column-count:"+columns+";column-count:"+columns+";");
    NewListDiv.appendChild(NewListUl);
    NewListFieldset.appendChild(NewListDiv);
    Form.appendChild(NewListFieldset);
    return NewListUl;
};

/*
Modifications spéciales du menu de paramétrage[modifier le code]
 */

// Déplacer les options « Afficher le journal XXX » (listes de suivi spéciales)

window.LiveRC_ManageParams_MoveFollowListsOptions = function(){
  var FollowOption = document.getElementById("LI_LiveRCFollowDisplayed");
  if(!FollowOption) return;
  var Target = FollowOption.nextSibling;
  for(var a=0,l=LiveRC_Config["SpecialLogList"].length;a<l;a++){
    var Li = document.getElementById("LI_Display"+LiveRC_Config["SpecialLogList"][a]);
    if(Li){
      Li.parentNode.removeChild(Li);
      Target.parentNode.insertBefore(Li, Target);
    }
  }
};

// Déplacer les options « Case "XXX" » (journaux)

window.LiveRC_ManageParams_MoveLogOptions = function(){
  var LogOption = document.getElementById("LI_Log");
  if(!LogOption) return;
  var Target = LogOption.nextSibling;
  for(var id in LiveRC_Config["LogNames"]){
    var Li = document.getElementById("LI_Log_"+id);
    if(Li){
      Li.parentNode.removeChild(Li);
      Target.parentNode.insertBefore(Li, Target);
    }
  }
};

// Déplacer les options « Case Espace de noms : XXX »

window.LiveRC_ManageParams_MoveNamespaceOptions = function(){
  var NSOption = document.getElementById("LI_NS");
  if(!NSOption) return;
  var Target = NSOption.nextSibling;
  for(var id in LiveRC_Config["MediawikiNamespaces"]){
    var Li = document.getElementById("LI_NS_"+id);
    if(Li){
      Li.parentNode.removeChild(Li);
      Target.parentNode.insertBefore(Li, Target);
    }
  }
};

// Déplacer les options « Balise "XXX" »

window.LiveRC_ManageParams_MoveTagsOptions = function(){
  var TagsOption = document.getElementById("LI_Tags");
  if(!TagsOption) return;
  var Target = TagsOption.nextSibling;
  for(var tagname in LiveRC_Config["MediawikiTags"]){
    var Li = document.getElementById("LI_Tags_"+tagname);
    if(Li){
      Li.parentNode.removeChild(Li);
      Target.parentNode.insertBefore(Li, Target);
    }
  }
};

// Déplacer les options « Utilisateur "XXX" »

window.LiveRC_ManageParams_MoveUsersOptions = function(){
  var TagsOption = document.getElementById("LI_User_AUTOPATROLLED");
  if(!TagsOption) return;
  var Target = TagsOption.nextSibling;
  for(var group in LiveRC_Config["UserGroupList"]){
    var Li = document.getElementById("LI_UserG_"+group.toUpperCase());
    if(Li){
      Li.parentNode.removeChild(Li);
      Target.parentNode.insertBefore(Li, Target);
    }
  }
};

// Masque les extensions que l'utilisateur ne peut pas utiliser

window.LiveRC_ManageParams_RemoveSomeExtensions = function(){
  if(LiveRC_Config["GlobalFill_OnlyDefault"]) return;
  var ExtTab = document.getElementById("LiveRC_OptionsContent_lrcExtensions");
  if(!ExtTab) return;
  var Lis = ExtTab.getElementsByTagName('li');
  var ExtToHide = LiveRC_GetExtensionsToHide();
  for(var a=0,l=Lis.length;a<l;a++){
    var ThisLi = Lis[a];
    if(!lrcHasClass(ThisLi, "ParamMenuLi")) continue;
    var InputName = ThisLi.getElementsByTagName('input')[1];
    if(!InputName) continue;
    var ExtName = InputName.value;
    if(!ExtName) continue;
    var Hide = (ExtToHide.indexOf(ExtName)!==-1);
    if(Hide) ThisLi.style.display = "none";
  }
};

// Transformer certaines <input> en <select> pour limiter les choix possibles

window.LiveRC_ManageParams_TransformInputToSelect = function(){
  var InputsToTransform = [];
// ======= lrcParams =======
// ["Language"]-----------------
  var Langs = [];
  for(var a=0,l=LiveRC_Config["SupportedLanguages"].length;a<l;a++){
    var langcode = LiveRC_Config["SupportedLanguages"][a];
    var newLang = {};
    newLang.value = langcode;
    newLang.text = LiveRC_Config["MediawikiLanguages"][langcode];
    Langs[Langs.length] = newLang;
  }
  InputsToTransform["Language"] = Langs;
// ----------------- ["TZ"]
  var TimeZones = [];
  for(var a=1,l=48;a<l;a++){
    var hour = (a-24);
    var ThisValue = (hour>0 ? "+":"")+TwoDigitsForNumber(hour)+":00";
    var newTZ = {};
    newTZ.value = ThisValue;
    newTZ.text = ThisValue;
    TimeZones[TimeZones.length] = newTZ;
  }
  InputsToTransform["TZ"] = TimeZones;
  LiveRC_ManageParams_CheckInputsToTransform(InputsToTransform);
// ======= lrcIcons =======
  InputsToTransform = [];
  var node = document.getElementById('LiveRC_OptionsContent_lrcIcons');
// ----------------- ["XXX"]["type"]
  var IconTypeOptions = [{value:"-1",text:"no"},{value:"0",text:"img"},{value:"1",text:"sup"},{value:"2",text:"sub"}];
  InputsToTransform["type"] = IconTypeOptions;
  LiveRC_ManageParams_CheckInputsToTransform(InputsToTransform, node);
};

window.LiveRC_ManageParams_CheckInputsToTransform = function(InputsToTransform, node){
  var remainingInputs = 0
  for(var InputName in InputsToTransform){
    remainingInputs++
    var Li = document.getElementById("LI_"+InputName);
    if(Li){
      var ThisInputToTransform = [];
      ThisInputToTransform[InputName] = InputsToTransform[InputName];
      delete InputsToTransform[InputName];
      LiveRC_ManageParams_CheckInputsToTransformInThisNode(ThisInputToTransform, Li);
      remainingInputs--;
    }
  }
  if(remainingInputs>0) LiveRC_ManageParams_CheckInputsToTransformInThisNode(InputsToTransform, node);
};

window.LiveRC_ManageParams_CheckInputsToTransformInThisNode = function(InputsToTransform, node){
  if(!node) node = document.getElementById("LiveRC_ParamMenuForm");
  if(!node) return;
  var Inputs = node.getElementsByTagName('input');
  for(var a=0,l=Inputs.length;a<l;a++){
    var Input = Inputs[a];
    if(Input && Input.type && Input.type=="text" && Input.name && InputsToTransform[Input.name])
    LiveRC_ManageParams_TransformThisInputToSelect(Input, InputsToTransform[Input.name]);
  }
};

window.LiveRC_ManageParams_TransformThisInputToSelect = function(Input, SuggestionsArray){
  if(!Input) return;
  var DefaultValue = Input.value;
  var Select = document.createElement('select');
  Select.name = Input.name;
  for(var a=0,l=SuggestionsArray.length;a<l;a++){
    var Suggestion = SuggestionsArray[a];
    var opt = document.createElement('option');
    opt.value = Suggestion.value;
    if(Suggestion.value === DefaultValue || Suggestion.value === parseInt(DefaultValue) ){
      opt.selected = "selected";
      opt.style.fontWeight = "bold";
    }
    opt.innerHTML = (Suggestion.text ? Suggestion.text : '');
    Select.appendChild(opt);
  }
  Select.style.width = Input.offsetWidth + "px";
  Input.parentNode.insertBefore(Select, Input);
  Input.parentNode.removeChild(Input);
};
/*
Modifications spéciales de l'onglet des icônes[modifier le code]
 */

// Ajoute une description dans l'onglet des icones ainsi qu'un aperçu

window.LiveRC_ManageParams_AddIconsDescriptions = function(){
  var IconFieldset = document.getElementById("LiveRC_OptionsContent_lrcIcons");
  if(!IconFieldset) return;
  var IconLis = IconFieldset.getElementsByTagName('li');
  for(var a=0,l=IconLis.length;a<l;a++){
    LiveRC_ManageParams_AddIconDescription(IconLis[a]);
  }
};

window.LiveRC_ManageParams_AddIconDescription = function(IconLi){
  var IconName = IconLi.getElementsByTagName('input')[0];
  if(!IconName) return;
  IconName = IconName.value;
  var Label = document.createElement('label');
  lrcAddClass(Label, "lrcIcons_Label");
  var UpdateLink = '<a id="IconTestLink_'+IconName+'" '
                 + 'title="'+lrcMakeText("IconTestUpdate_TIP")+'" '
                 + 'href="javascript:;" '
                 + 'onclick="lrcMakeCustomIcon(this); return false;" '
                 + '>'+lrcMakeText("IconTestUpdate_SHORT")+'</a>'
  Label.innerHTML = ' = <span id="IconTest_'+IconName+'">'+lrcMakeIcon(IconName)+'</span> <sup>'+UpdateLink+'</sup> : ' + lrcMakeParamDescription(IconName);
  IconLi.appendChild(document.createTextNode(" "));
  IconLi.appendChild(Label);
  if(typeof(lrcIcons[IconName])==="undefined"){
    IconLi.appendChild(document.createTextNode(" "));
    IconLi.appendChild(LiveRC_ManageParams_AddDeleteParamLineLink());
  }
};

window.lrcMakeCustomIcon = function(Link){
  if(!Link) return;
  var IconName = Link.id.split("IconTestLink_").join("");
  var ImageSpan = document.getElementById("IconTest_"+IconName);
  var IconLi = document.getElementById("LI_"+IconName);
  if(!ImageSpan || !IconLi ) return;
  var Icon = {};
  var Elements = [];
  var InputList = IconLi.getElementsByTagName('input');
  var SelectList = IconLi.getElementsByTagName('select');
  for(var a=0,l=InputList.length;a<l;a++) Elements.push(InputList[a]);
  for(var a=0,l=SelectList.length;a<l;a++) Elements.push(SelectList[a]);
  for(var a=1,l=Elements.length;a<l;a++){
    var Input = Elements[a];
    Icon[Input.name] = Input.value;
  }
  var Title_Alt = ( typeof(lrcMakeText(IconName+"_Title"))==="string" ? lrcMakeText(IconName+"_Title") : "$1" );
  var SRC = (Icon.src ? lrcMakeParam("CommonsURL")+Icon.src : "");
  var width = (Icon.width ? Icon.width : 14);
  var height = (Icon.height ? Icon.height : width);
  Icon.height = height;
  var HTML = ''
  if(Icon.type == "sup_img" || Icon.type == "1"){ Icon.type = 1; HTML += '<sup>'; }
  if(Icon.type == "sub_img" || Icon.type == "2"){ Icon.type = 2; HTML += '<sub>'; }
  if(Icon.type == "img") Icon.type = 0;
  HTML += '<img id="'+IconName+'" '
        + 'src="'+SRC+'" '
        + 'width="'+width+'" '
        + 'height="'+height+'" '
        + 'title="'+Title_Alt+'" '
        + 'alt="'+Title_Alt+'" />'
  if(Icon.type == 1) HTML += '</sup>';
  if(Icon.type == 2) HTML += '</sub>';
  if(Icon.type == -1) HTML = '';
  ImageSpan.innerHTML = HTML;
};

window.LiveRC_ManageParams_AddNewIcon_CreateAddButton = function(){
  var Fieldset = document.getElementById("LiveRC_OptionsContent_lrcIcons");
  if(!Fieldset) return;
  var VariableUl = Fieldset.getElementsByTagName('ul')[0];
  if(!VariableUl) return;
  var P = document.createElement('li');
  var func = 'LiveRC_ManageParams_AddNewIcon_CreateForm(this);'
  P.innerHTML = '<a id="AddParam_lrcIcons" href="javascript:;" onClick="'+func+'" '
              + 'title="'+lrcMakeText("AddParamLineButton_Title")+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
  VariableUl.appendChild(P);
};

window.LiveRC_ManageParams_AddNewIcon_CreateForm = function(Link){
  var ParentLi = Link.parentNode;
  var Li = document.createElement('li');
  lrcaddCustomizableClasses(Li, "ParamMenuLi");
  var IDLabel = document.createElement('label');
  IDLabel.setAttribute('for', "id");
  IDLabel.innerHTML = lrcMakeText("CreateNewIcon_ID");
  Li.appendChild(IDLabel);
  var IDInput = document.createElement('input');
  IDInput.type = "text";
  IDInput.value = "";
  IDInput.name = "id";
  Li.appendChild(IDInput);
  Li.appendChild(document.createTextNode(" "));
  var TextLabel = document.createElement('label');
  TextLabel.setAttribute('for', "tooltip");
  TextLabel.innerHTML = lrcMakeText("CreateNewIcon_title")+" ("+lrcMakeParam("Language")+")";
  Li.appendChild(TextLabel);
  var TextInput = document.createElement('input');
  TextInput.type = "text";
  TextInput.value = "";
  TextInput.name = "tooltip";
  Li.appendChild(TextInput);
  Li.appendChild(document.createTextNode(" "));
  var OKInput = document.createElement('input');
  OKInput.type = "button";
  OKInput.value = lrcMakeText("OK");
  OKInput.onclick = function(){ LiveRC_ManageParams_AddNewIcon_CheckForm(this); return false;};
  OKInput.onselect = function(){ LiveRC_ManageParams_AddNewIcon_CheckForm(this); return false;};
  Li.appendChild(OKInput);
  var CancelInput = document.createElement('input');
  CancelInput.type = "button";
  CancelInput.value = lrcMakeText("Cancel");
  CancelInput.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this); return false;};
  CancelInput.onselect = function(){ LiveRC_ManageParams_DeleteThisParam(this); return false;};
  Li.appendChild(CancelInput);
  ParentLi.parentNode.insertBefore(Li, ParentLi);
};

window.LiveRC_ManageParams_AddNewIcon_CheckForm = function(OKInput){
  var Li = OKInput.parentNode;
  var Inputs = Li.getElementsByTagName('input');
  var CheckedParams = [];
  for(var a=0,l=Inputs.length;a<l;a++){
    var Input = Inputs[a];
    if(Input.type != "text") continue;
    var InputName = Input.name;
    var InputValue = Input.value;
    var Label = Input.previousSibling.innerHTML;
    if(!InputValue){
      LiveRC_alert(lrcMakeText("CreateNewIcon_InputEmpty").split("$1").join("<b>"+Label+"</b>"));
      return;
    }
    CheckedParams[InputName] = InputValue;
  }
  var ID = CheckedParams["id"];
  var Tooltip = CheckedParams["tooltip"];
  var Desc = lrcMakeText("CreateNewIcon_DescTemplate").split("$1").join(Tooltip);
  var Form = document.getElementById("LiveRC_ParamMenuForm");
  if(!Form) return;
  var ExistingLi = getElementWithId("LI_"+ID, 'li', Form);
  var ExistingLiBis = getElementWithId("LI_Desc"+ID, 'li', Form);
  if(ExistingLi || ExistingLiBis){
      LiveRC_alert(lrcMakeText("CreateNewText_IDExists").split("$1").join(ID));
      return;
  }
  var RunFonctionWithExistingTitle = function(){
    LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedParamDesc", ("Desc"+ID), lrcMakeText(ID+"_Title"));
    LiveRC_ManageParams_AddNewText_AddNewIconLi(ID);
    Li.parentNode.removeChild(Li);
  };
  var RunFonctionWithNewTitle = function(){
    LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedParamDesc", ("Desc"+ID+"_Title"), Desc);
    LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedParamDesc", ("Desc"+ID), Tooltip);
    LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedTexts", (ID+"_Title"), Tooltip);
    LiveRC_ManageParams_AddNewText_AddNewIconLi(ID);
    Li.parentNode.removeChild(Li);
  };
  var ExistingLiTer = getElementWithId("LI_"+ID+"_Title", 'li', Form);
  if(ExistingLiTer){
    var ConfirmText = '<ul>'+lrcMakeText("CreateNewIcon_TitleExists").split("$1").join("<li>"+lrcMakeText(ID+"_Title")+"</li>")+"</ul>";
    LiveRC_confirm(ConfirmText, RunFonctionWithExistingTitle);
  }else{
    RunFonctionWithNewTitle();
  }
};

window.LiveRC_ManageParams_AddNewText_AddNewIconLi = function(ID){
  Custom_lrcIcons[ID] = {"type":0,"src":"thumb/0/00/LiveRC-anim.gif/14px-LiveRC-anim.gif","width":14,"height":14};
  var FakeIconArray = [];
  FakeIconArray[ID] = {"type":1,"src":"","width":1,"height":1};
  LiveRC_ManageParams_Fill(FakeIconArray, "lrcIcons", false);
  var IconLi = LiveRC_ManageParams_CreateLiFromParam(LiveRC_Config["LiveRCcustomParams"]["lrcIcons"][ID]);
  var IconFieldset = document.getElementById('LiveRC_OptionsContent_lrcIcons');
  var AllLis = IconFieldset.getElementsByTagName('li');
  var TheLi = false;
  for(var a=0,l=AllLis.length;a<l;a++){
    var ThisLi = AllLis[a];
    if(lrcHasClass(ThisLi, "RealParamMenuLi")) TheLi = ThisLi;
  }
  if(TheLi){
    TheLi.parentNode.insertBefore(IconLi, TheLi.nextSibling);
    var IconTypeOptions = [{value:"-1",text:"no"},{value:"0",text:"img"},{value:"1",text:"sup"},{value:"2",text:"sub"}];
    var InputToTransform = [];
    InputToTransform["type"] = IconTypeOptions;
    LiveRC_ManageParams_CheckInputsToTransformInThisNode(InputToTransform, IconLi);
    LiveRC_ManageParams_AddIconDescription(IconLi);
  }
};

/*
Modifications spéciales des onglets de textes[modifier le code]
 */

//  Ajoute des boutons pour switcher entre les traductions dans les variables textuelles + descriptions

window.LiveRC_ManageParams_AddTextTranslationsLangToggleAndDescriptions = function(){
  var Variables = ["lrcTranslatedTexts", "lrcTranslatedParamDesc"];
  for(var v=0,vlen=Variables.length;v<vlen;v++){
    var Variable = Variables[v];
    var Fieldset = document.getElementById("LiveRC_OptionsContent_"+Variable);
    if(!Fieldset) return;
    var Lis = Fieldset.getElementsByTagName('li');
    for(var a=0,l=Lis.length;a<l;a++){
      LiveRC_ManageParams_AddTextTranslationsAndDescription(Lis[a], Variable);
    }
    var ActionsButtons = lrcGetElementsByClass("ActionButtons", Fieldset, "p")[0];
    if(ActionsButtons){
      var Span = document.createElement('span');
      lrcAddClass(Span, "LangToggleButtons");
      var SelectedInputIndex = 0;
      for(var a=0,l=LiveRC_Config["SupportedLanguages"].length;a<l;a++){
        var lang = LiveRC_Config["SupportedLanguages"][a];
        var Display = ((LiveRC_Config["AvailableLanguages"].indexOf(lang)!=-1) ? '' : 'display:none;');
        var Button = document.createElement('input');
        Button.className = "LangToggleButton_" + Variable;
        Button.type = "button";
        Button.value = lang;
        Button.title = LiveRC_Config["MediawikiLanguages"][lang];
        Button.onclick = function(){ LiveRC_ManageParams_ToggleTextTranslations(this); };
        Button.onselect = function(){ LiveRC_ManageParams_ToggleTextTranslations(this); };
        Span.appendChild(Button);
        if(lang == lrcMakeParam("Language")){
          SelectedInputIndex = a;
          Button.setAttribute("style", "font-weight:bold;padding:0;color:darkGreen;text-decoration:underline;");
        }else{
          Button.setAttribute("style", "font-weight:bold;padding:0;color:darkGreen;"+Display);
        }
      }
      ActionsButtons.appendChild(document.createTextNode(" • • • "));
      ActionsButtons.appendChild(Span);
      var Inputs = Span.getElementsByTagName('input');
      for(var a=0,l=Inputs.length;a<l;a++){
        if(a!=SelectedInputIndex) LiveRC_ManageParams_ToggleTextTranslations(Inputs[a]);
      }
    }
  }
};

window.LiveRC_ManageParams_AddTextTranslationsAndDescription = function(Li, Variable){
  var varName = Li.getElementsByTagName('input')[0];
  if(varName){
    varName = varName.value;
    var Label = document.createElement('label');
    lrcAddClass(Label, "Texts_Label");
    Label.innerHTML = " = " + lrcMakeParamDescription(varName);
    Li.appendChild(document.createTextNode(" "));
    Li.appendChild(Label);
    try{
      var CustomText;
      eval('CustomText = lrcEscapeStr('+Variable+'['+lrcEscapeStr(varName)+']);');
      if(typeof(CustomText)==="undefined"){
        Li.appendChild(document.createTextNode(" "));
        Li.appendChild(LiveRC_ManageParams_AddDeleteParamLineLink());
      }
   }catch(e){
      lrcDisplayDebug("Error on LiveRC_ManageParams_AddTextTranslationsAndDescription : " + Variable +" "+varName, false, true); // ###
   };
  }
};

window.LiveRC_ManageParams_ToggleTextTranslations = function(input){
  if(!input) return;
  var Lang = input.value;
  if(Lang == lrcMakeParam("Language")) return;
  var Variable = input.className.split("LangToggleButton_").join("");
  var Fieldset = document.getElementById("LiveRC_OptionsContent_"+Variable);
  if(!Fieldset) return;
  var Display = "";
  if(input.style.color == "red"){
    input.style.color = "darkGreen";
  }else{
    input.style.color = "red";
    Display = "none";
  }
  var Inputs = Fieldset.getElementsByTagName("input");
  for(var i=0,ilen=Inputs.length;i<ilen;i++){
    var ThisInput = Inputs[i];
    if(ThisInput.type != "text") continue;
    var InputName = ThisInput.name;
    if(InputName != Lang) continue;
    if(LiveRC_Config["SupportedLanguages"].indexOf(InputName)==-1) continue;
    var Span = ThisInput.parentNode;
    while(Span && !lrcHasClass(Span,"ParamMenuLiElement")){ Span = Span.parentNode; if(!Span) break; }
    if(!Span || !lrcHasClass(Span,"ParamMenuLiElement")) continue;
    Span.style.display = Display;
  }
};

window.LiveRC_ManageParams_AddNewText_CreateAddButton = function(){
  var Fieldset = document.getElementById("LiveRC_OptionsContent_lrcTranslatedTexts");
  if(!Fieldset) return;
  var VariableUl = Fieldset.getElementsByTagName('ul')[0];
  if(!VariableUl) return;
  var P = document.createElement('li');
  var func = 'LiveRC_ManageParams_AddNewText_CreateForm(this);'
  P.innerHTML = '<a id="AddParam_lrcTranslatedTexts" href="javascript:;" onClick="'+func+'" '
              + 'title="'+lrcMakeText("AddParamLineButton_Title")+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
  VariableUl.appendChild(P);
};

window.LiveRC_ManageParams_AddNewText_CreateForm = function(Link){
  var ParentLi = Link.parentNode;
  var Li = document.createElement('li');
  lrcaddCustomizableClasses(Li, "ParamMenuLi");

  var IDLabel = document.createElement('label');
  IDLabel.setAttribute('for', "id");
  IDLabel.innerHTML = lrcMakeText("CreateNewText_ID")+" ";
  Li.appendChild(IDLabel);
  var IDInput = document.createElement('input');
  IDInput.type = "text";
  IDInput.value = "";
  IDInput.name = "id";
  Li.appendChild(IDInput);
  Li.appendChild(document.createTextNode(" "));

  var TextLabel = document.createElement('label');
  TextLabel.setAttribute('for', "text");
  TextLabel.innerHTML = lrcMakeText("CreateNewText_text")+" ("+lrcMakeParam("Language")+") ";
  Li.appendChild(TextLabel);
  var TextInput = document.createElement('input');
  TextInput.type = "text";
  TextInput.value = "";
  TextInput.name = "text";
  Li.appendChild(TextInput);
  Li.appendChild(document.createTextNode(" "));

  var DescLabel = document.createElement('label');
  DescLabel.setAttribute('for', "desc");
  DescLabel.innerHTML = lrcMakeText("CreateNewText_desc")+" ("+lrcMakeParam("Language")+") ";
  Li.appendChild(DescLabel);
  var DescInput = document.createElement('input');
  DescInput.type = "text";
  DescInput.value = "";
  DescInput.name = "desc";
  Li.appendChild(DescInput);
  Li.appendChild(document.createTextNode(" "));

  var OKInput = document.createElement('input');
  OKInput.type = "button";
  OKInput.value = lrcMakeText("OK");
  OKInput.onclick = function(){ LiveRC_ManageParams_AddNewText_CheckForm(this); return false;};
  OKInput.onselect = function(){ LiveRC_ManageParams_AddNewText_CheckForm(this); return false;};
  Li.appendChild(OKInput);
  var CancelInput = document.createElement('input');
  CancelInput.type = "button";
  CancelInput.value = lrcMakeText("Cancel");
  CancelInput.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this); return false;};
  CancelInput.onselect = function(){ LiveRC_ManageParams_DeleteThisParam(this); return false;};
  Li.appendChild(CancelInput);
  ParentLi.parentNode.insertBefore(Li, ParentLi);
};

window.LiveRC_ManageParams_AddNewText_CheckForm = function(OKInput){
  var Li = OKInput.parentNode;
  var Inputs = Li.getElementsByTagName('input');
  var CheckedParams = [];

  for(var a=0,l=Inputs.length;a<l;a++){
    var Input = Inputs[a];
    if(Input.type != "text") continue;
    var InputName = Input.name;
    var InputValue = Input.value;
    var Label = Input.previousSibling.innerHTML;
    if(!InputValue){
      LiveRC_alert(lrcMakeText("CreateNewText_InputEmpty").split("$1").join("<b>"+Label+"</b>"));
      return;
    }
    CheckedParams[InputName] = InputValue;
  }
  var ID = CheckedParams["id"];
  var Text = CheckedParams["text"];
  var Desc = CheckedParams["desc"];
  var Form = document.getElementById("LiveRC_ParamMenuForm");
  if(!Form) return;
  var ExistingLi = getElementWithId("LI_"+ID, 'li', Form);
  var ExistingLiBis = getElementWithId("LI_Desc"+ID, 'li', Form);
  if(ExistingLi || ExistingLiBis){
      LiveRC_alert(lrcMakeText("CreateNewText_IDExists").split("$1").join(ID));
      return;
  }
  LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedParamDesc", ("Desc"+ID), Desc);
  LiveRC_ManageParams_AddNewText_AddNewTextLi("lrcTranslatedTexts", ID, Text);
  Li.parentNode.removeChild(Li);
};

window.LiveRC_ManageParams_AddNewText_AddNewTextLi = function(Variable, ID, Text){
  var TextArray = {};
  TextArray[ID] = [];
  var FakeArray = {};
  FakeArray[ID] = [];
  var ExplodedArray = [];
  var FakeExplodedArray = [];
  for(var a=0,l=LiveRC_Config["AvailableLanguages"].length;a<l;a++){
    var Lang = LiveRC_Config["AvailableLanguages"][a];
    TextArray[ID][Lang] = Text;
    FakeArray[ID][Lang] = "";
    ExplodedArray.push(lrcEscapeStrHTML(Lang)+':'+lrcEscapeStrHTML(Text));
    FakeExplodedArray.push(lrcEscapeStrHTML(Lang)+':'+'""');
  }
  eval( "Custom_"+Variable+'[\"'+ID+'\"] = {'+ExplodedArray.join(",")+'};');
  eval( Variable+'[\"'+ID+'\"] = {'+FakeExplodedArray.join(",")+'};');
  LiveRC_ManageParams_Fill(FakeArray, Variable, false);
  var TextLi = LiveRC_ManageParams_CreateLiFromParam(LiveRC_Config["LiveRCcustomParams"][Variable][ID]);

  var TextFieldset = document.getElementById('LiveRC_OptionsContent_'+Variable);
  var AllLis = TextFieldset.getElementsByTagName('li');
  var TheLi = false;
  for(var a=0,l=AllLis.length;a<l;a++){
    var ThisLi = AllLis[a];
    if(lrcHasClass(ThisLi, "RealParamMenuLi")) TheLi = ThisLi;
  }
  if(TheLi){
    TheLi.parentNode.insertBefore(TextLi, TheLi.nextSibling);
    LiveRC_ManageParams_UpdateTranslationToggleStates(Variable, TextLi);
    LiveRC_ManageParams_AddTextTranslationsAndDescription(TextLi, Variable);
  }
};

window.LiveRC_ManageParams_UpdateTranslationToggleStates = function(VariableName, Li){
  var Fieldset = document.getElementById("LiveRC_OptionsContent_"+VariableName);
  if(!Fieldset) return;
  var ToggleSates = LiveRC_ManageParams_UpdateTranslationToggleStates_GetLangStates(Fieldset);
  if(!ToggleSates) return;
  var Spans =  lrcGetElementsByClass("ParamMenuLiElement", Li, "span");
  for(var a=0,l=Spans.length;a<l;a++){
    var Label = Spans[a].getElementsByTagName('label')[0];
    if(!Label) continue;
    var SpanLang = Label.innerHTML;
    if(ToggleSates[SpanLang] === true) Spans[a].style.display = "none";
  }
};

window.LiveRC_ManageParams_UpdateTranslationToggleStates_GetLangStates = function(Fieldset){
  if(!Fieldset) return false;
  var LangButtons = lrcGetElementsByClass("LangToggleButtons", Fieldset, "span")[0];
  if(!LangButtons) return false;
  var ToggleStates = [];
  var Inputs = LangButtons.getElementsByTagName('input');
  for(var a=0,l=Inputs.length;a<l;a++){
    ToggleStates[Inputs[a].value] = (Inputs[a].style.color == "red");
  }
  return ToggleStates;
};

/*
Onglet de gestion des contacts[modifier le code]
 */

// Création du menu des contacts

window.LiveRC_ManageParams_AddContactListMenu = function(){
    var ContactListUl = document.getElementById("LiveRC_OptionsContent_ContactListLegendListUL");
    if(!ContactListUl) ContactListUl = LiveRC_ManageParams_CreateNewListMenu("ContactListLegend", LiveRC_ManageParams_CreateContactButtons(), 3);
    if(!ContactListUl) return;
    while(ContactListUl.firstChild){ ContactListUl.removeChild(ContactListUl.firstChild); }
    var count = 0;
    for (var user in LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"]) {
        if(!LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][user]) continue;
        count++;
        var P = document.createElement('li');
        lrcaddCustomizableClasses(P, "ParamMenuLi");
        var Link = lrcGetUserLink(user, false, "contact");
        P.appendChild(Link);
        var RealLink = Link.getElementsByTagName('a')[0];
        RealLink.title = user;
        RealLink.innerHTML = user;
        P.appendChild(document.createTextNode(" "));
        P.appendChild(LiveRC_ManageParams_AddDeleteUserLink());
        ContactListUl.appendChild(P);
    }
    if(count<1 && !LiveRC_Config["ListLoaded"]["Watchlist"]){
        var P = document.createElement('li');
        lrcAddClass(P, "error");
        P.style.textAlign = "center";
        P.innerHTML = lrcMakeText("WatchlistNotLoaded");
        ContactListUl.appendChild(P);
    }
};

// Création boutons

window.LiveRC_ManageParams_CreateContactButtons = function(){
    var Paragraphe = document.createElement('p');
    Paragraphe.className = 'ActionButtons';
    var InputAdd = document.createElement('input');
    InputAdd.type = "button";
    InputAdd.value = lrcMakeText("ADDCONTACT");
    InputAdd.onclick = function(){ LiveRC_ManageParams_AddNewContact(); };
    InputAdd.onselect = function(){ LiveRC_ManageParams_AddNewContact(); };
    Paragraphe.appendChild(InputAdd);
    var InputOK = document.createElement('input');
    InputOK.type = "button";
    InputOK.value = lrcMakeText("OK");
    InputOK.onclick = function(){ LiveRC_ManageParams_CheckContactListMenu(); };
    InputOK.onselect = function(){ LiveRC_ManageParams_CheckContactListMenu(); };
    Paragraphe.appendChild(InputOK);
    var CancelInput = document.createElement('input');
    CancelInput.type = "button";
    CancelInput.value = lrcMakeText("Cancel");
    CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    Paragraphe.appendChild(CancelInput);
    return Paragraphe;
};

// Ajout d'un contact

window.LiveRC_ManageParams_AddNewContact = function(Name){
    var Ul  = document.getElementById("LiveRC_OptionsContent_ContactListLegendListUL");
    if(!Ul) return;
    var P = document.createElement('li');
    lrcaddCustomizableClasses(P, "ParamMenuLi");
    var Span = document.createElement('span');
    var Input = document.createElement('input');
    Input.type = "text";
    Input.value = (Name ? Name : "");
    Span.appendChild(Input);
    var InputOK = document.createElement('input');
    InputOK.type = "button";
    InputOK.value = lrcMakeText("OK");
    InputOK.onclick = function(){ LiveRC_ManageParams_AddThisContact(this); };
    InputOK.onselect = function(){ LiveRC_ManageParams_AddThisContact(this); };
    Span.appendChild(InputOK);
    P.appendChild(Span);
    P.appendChild(document.createTextNode(" "));
    P.appendChild(LiveRC_ManageParams_AddDeleteUserLink());
    Ul.appendChild(P);
    LiveRC_Suggest_AddUserSuggestion({
        "InputNode"       : Input,
        "ListDown"        : true
    });
    Input.focus();
};

// Ajout d'un contact (validation)

window.LiveRC_ManageParams_AddThisContact = function(OK){
    if(!OK) return;
    var Li = OK.parentNode.parentNode;
    if(!Li) return;
    var UserInput = Li.getElementsByTagName('input')[0];
    if(!UserInput) return;
    var user = UserInput.value;
    if(!user) return;
    Li.removeChild(Li.getElementsByTagName('span')[0]);
    var Link = lrcGetUserLink(user, false, "contact");
    Li.insertBefore(Link, Li.firstChild);
    var RealLink = Link.getElementsByTagName('a')[0];
    RealLink.title = user;
    RealLink.innerHTML = user;
};

// Vérification du menu des contacts

window.LiveRC_ManageParams_CheckContactListMenu = function(){
    var Menu = document.getElementById("LiveRC_OptionsContent_ContactListLegendListUL");
    if(!Menu) return;
    var Contacts = lrcGetElementsByClass("contact", Menu, "a");
    var ContactList = [];
    for(var a=0,l=Contacts.length;a<l;a++){
        var userName = Contacts[a].title;
        ContactList.push(userName);
        if(!LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"][userName]){
            LiveRC_WatchUser(userName , true);
        }
    }
    for(var user in LiveRC_Config["SpecialLogListConfig"]["liveContact"]["Values"]){
        if(ContactList.indexOf(user)==-1){
            LiveRC_WatchUser(user, false);
        }
    }
};
/*
Onglet de gestion des utilisateurs masqués[modifier le code]
 */

// Création du menu des utilisateurs masqués

window.LiveRC_ManageParams_AddHiddenListMenu = function(){
    var HiddenListUl = document.getElementById("LiveRC_OptionsContent_HiddenListLegendListUL");
    if(!HiddenListUl) HiddenListUl = LiveRC_ManageParams_CreateNewListMenu("HiddenListLegend", LiveRC_ManageParams_CreateHiddenButtons(), 3);
    if(!HiddenListUl) return;
    while(HiddenListUl.firstChild){ HiddenListUl.removeChild(HiddenListUl.firstChild); }
    var count = 0;
    for (var user in LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"]) {
        if(!LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][user]) continue;
        count++;
        var P = document.createElement('li');
        lrcaddCustomizableClasses(P, "ParamMenuLi");
        var Link = lrcGetUserLink(user, false, "hiddenuser");
        P.appendChild(Link);
        var RealLink = Link.getElementsByTagName('a')[0];
        RealLink.title = user;
        RealLink.innerHTML = user;
        P.appendChild(document.createTextNode(" "));
        P.appendChild(LiveRC_ManageParams_AddDeleteUserLink());
        HiddenListUl.appendChild(P);
    }
    if(count<1 && !LiveRC_Config["ListLoaded"]["Watchlist"]){
        var P = document.createElement('li');
        lrcAddClass(P, "error");
        P.style.textAlign = "center";
        P.innerHTML = lrcMakeText("WatchlistNotLoaded");
        HiddenListUl.appendChild(P);
    }
};

// Création boutons

window.LiveRC_ManageParams_CreateHiddenButtons = function(){
    var Paragraphe = document.createElement('p');
    Paragraphe.className = 'ActionButtons';
    var InputAdd = document.createElement('input');
    InputAdd.type = "button";
    InputAdd.value = lrcMakeText("ADDHIDDEN");
    InputAdd.onclick = function(){ LiveRC_ManageParams_AddNewHidden(); };
    InputAdd.onselect = function(){ LiveRC_ManageParams_AddNewHidden(); };
    Paragraphe.appendChild(InputAdd);
    var InputOK = document.createElement('input');
    InputOK.type = "button";
    InputOK.value = lrcMakeText("OK");
    InputOK.onclick = function(){ LiveRC_ManageParams_CheckHiddenListMenu(); };
    InputOK.onselect = function(){ LiveRC_ManageParams_CheckHiddenListMenu(); };
    Paragraphe.appendChild(InputOK);
    var CancelInput = document.createElement('input');
    CancelInput.type = "button";
    CancelInput.value = lrcMakeText("Cancel");
    CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    Paragraphe.appendChild(CancelInput);
    return Paragraphe;
};

// Ajout d'un utilisateur masqué

window.LiveRC_ManageParams_AddNewHidden = function(Name){
    var Ul  = document.getElementById("LiveRC_OptionsContent_HiddenListLegendListUL");
    if(!Ul) return;
    var P = document.createElement('li');
    lrcaddCustomizableClasses(P, "ParamMenuLi");
    var Span = document.createElement('span');
    var Input = document.createElement('input');
    Input.type = "text";
    Input.value = (Name ? Name : "");
    Span.appendChild(Input);
    var InputOK = document.createElement('input');
    InputOK.type = "button";
    InputOK.value = lrcMakeText("OK");
    InputOK.onclick = function(){ LiveRC_ManageParams_AddThisHidden(this); };
    InputOK.onselect = function(){ LiveRC_ManageParams_AddThisHidden(this); };
    Span.appendChild(InputOK);
    P.appendChild(Span);
    P.appendChild(document.createTextNode(" "));
    P.appendChild(LiveRC_ManageParams_AddDeleteUserLink());
    Ul.appendChild(P);
    LiveRC_Suggest_AddUserSuggestion({
        "InputNode"       : Input,
        "ListDown"        : true
    });
    Input.focus();
};

// Ajout d'un utilisateur masqué (validation)

window.LiveRC_ManageParams_AddThisHidden = function(OK){
    if(!OK) return;
    var Li = OK.parentNode.parentNode;
    if(!Li) return;
    var UserInput = Li.getElementsByTagName('input')[0];
    if(!UserInput) return;
    var user = UserInput.value;
    if(!user) return;
    Li.removeChild(Li.getElementsByTagName('span')[0]);
    var Link = lrcGetUserLink(user, false, "hiddenuser");
    Li.insertBefore(Link, Li.firstChild);
    var RealLink = Link.getElementsByTagName('a')[0];
    RealLink.title = user;
    RealLink.innerHTML = user;
};

// Vérification du menu des utilisateurs masqués

window.LiveRC_ManageParams_CheckHiddenListMenu = function(){
    var Menu = document.getElementById("LiveRC_OptionsContent_HiddenListLegendListUL");
    if(!Menu) return;
    var Hiddens = lrcGetElementsByClass("hiddenuser", Menu, "a");
    var HiddenList = [];
    for(var a=0,l=Hiddens.length;a<l;a++){
        var userName = Hiddens[a].title;
        HiddenList.push(userName);
        if(!LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"][userName]){
            LiveRC_HideUser(userName , true);
        }
    }
    for(var user in LiveRC_Config["SpecialLogListConfig"]["liveHidden"]["Values"]){
        if(HiddenList.indexOf(user)==-1){
            LiveRC_HideUser(user, false);
        }
    }
};

/*
Onglet de gestion des pages masquées[modifier le code]
 */

// Création du menu des pages masquées

window.LiveRC_ManageParams_AddHiddenPagesListMenu = function(){
    var HiddenListUl = document.getElementById("LiveRC_OptionsContent_HiddenPagesListLegendListUL");
    if(!HiddenListUl) HiddenListUl = LiveRC_ManageParams_CreateNewListMenu("HiddenPagesListLegend", LiveRC_ManageParams_CreateHiddenPagesButtons(), 3);
    if(!HiddenListUl) return;
    while(HiddenListUl.firstChild){ HiddenListUl.removeChild(HiddenListUl.firstChild); }
    var count = 0;
    for (var title in LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"]) {
        if(!LiveRC_Config["SpecialLogListConfig"]["liveHiddenPages"]["Values"][title]) continue;
        count++;
        var P = document.createElement('li');
        lrcaddCustomizableClasses(P, "ParamMenuLi");
        var Link = lrcGetPageLink({title:title});
        P.appendChild(Link);
        P.appendChild(document.createTextNode(" "));
        P.appendChild(LiveRC_ManageParams_AddDeletePageLink());
        HiddenListUl.appendChild(P);
    }
    if(count<1 && !LiveRC_Config["ListLoaded"]["Watchlist"]){
        var P = document.createElement('li');
        lrcAddClass(P, "error");
        P.style.textAlign = "center";
        P.innerHTML = lrcMakeText("WatchlistNotLoaded");
        HiddenListUl.appendChild(P);
    }
};

// Création boutons

window.LiveRC_ManageParams_CreateHiddenPagesButtons = function(){
    var Paragraphe = document.createElement('p');
    Paragraphe.className = 'ActionButtons';
    var InputAdd = document.createElement('input');
    InputAdd.type = "button";
    InputAdd.value = lrcMakeText("ADDHIDDENPAGE");
    InputAdd.onclick = function(){ LiveRC_ManageParams_AddNewHiddenPage(); };
    InputAdd.onselect = function(){ LiveRC_ManageParams_AddNewHiddenPage(); };
    Paragraphe.appendChild(InputAdd);
    var InputOK = document.createElement('input');
    InputOK.type = "button";
    InputOK.value = lrcMakeText("OK");
    InputOK.onclick = function(){ LiveRC_ManageParams_CheckHiddenPageListMenu(); };
    InputOK.onselect = function(){ LiveRC_ManageParams_CheckHiddenPageListMenu(); };
    Paragraphe.appendChild(InputOK);
    var CancelInput = document.createElement('input');
    CancelInput.type = "button";
    CancelInput.value = lrcMakeText("Cancel");
    CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(this); return false;};
    Paragraphe.appendChild(CancelInput);
    return Paragraphe;
};

// Ajout d'une page masquée

window.LiveRC_ManageParams_AddNewHiddenPage = function(Name){
    var Ul  = document.getElementById("LiveRC_OptionsContent_HiddenPagesListLegendListUL");
    if<