Utilisateur:Dereckson/LiveRC.js
Apparence
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5./*
==LiveWP==
* Documentation : [[:fr:User:EDUCA33E/LiveRC/Documentation]]
* Author : [[:fr:User:EDUCA33E]]
* Dev & enhancements :
** [[:fr:User:TiChou]],
** [[:pl:User:Leafnode]],
** [[:it:User:Jalo]],
** [[:fr:User:Nakor]],
** [[:fr:User:Arkanosis]],
** [[:pl:User:Nux]],
** [[:fr:User:Argos42]],
** [[:fr:User:Orlodrim]],
** [[:fr:User:Dr Brains]]
{{Catégorisation JS|LiveRC}}
=== Variables globales ===
<source lang="javascript"> */
if (mw.config.get('wgTitle') == "Dereckson/LiveRC" && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")) {
var LiveRC_Version = "0.4.5c";
/* </source>
==== Variables d'état (pour test sur rc.state) ====
<source lang=javascript> */
var IP = 1;
var BOT = 2 << 0;
var SYSOP = 2 << 1;
var NEW = 2 << 2;
var MINOR = 2 << 3;
var NEWNS = 2 << 4;
var RENAMED = 2 << 5;
var PATROLLED = 2 << 6;
var REVERT = 2 << 7;
var BLANKING = 2 << 8;
var REPLACED = 2 << 9;
var REDIRECT = 2 << 10;
var CATEGORIZED = 2 << 11;
var LOCK = 2 << 12;
var FULLLOCK = 2 << 13;
var HOMONYMIE = 2 << 14;
var ADQ = 2 << 15;
var BA = 2 << 16;
var APDQ = 2 << 17;
var COPYRIGHT = 2 << 18;
var PAS = 2 << 19;
var STUB = 2 << 20;
var UPLOAD = 2 << 21;
var NEWUSER = 2 << 22;
var BLOCK = 2 << 23;
var DELETE = 2 << 24;
var MOVE = 2 << 25;
var PROTECT = 2 << 26;
var PATROL = 2 << 27;
var ABFILTER = 2 << 28;
var TAG = 2 << 29;
var REVIEW = 2 << 30;
// Comments test table (regexp format);
// ////////////////////////////////////
var commenttests = [
{ state: BLANKING , regex: /^Résumé automatique : blanchiment|^[Bb]lanchi/ },
{ state: REPLACED , regex: /^Résumé automatique : contenu remplacé par/ },
{ state: REVERT , regex: /(LiveRC : )?Révocation |([Bb]ot : )?[Aa]nnulation des modifications|([Bb]ot : )?[Rr]évocation de |^(Undid|Revert to( the)?) revision|^(Undoing|Reverted( \d+)?) edit|^r(e)?v(ert(ing|ed)?)?\b|LiveRC : Suppression immédiate/ }
];
// Categories test table (regexp format);
var categoriestests = [
{ state: LOCK , regex: 'Page (semi-protégée|en semi-protection longue)' },
{ state: FULLLOCK , regex: 'Page protégée' },
{ state: ADQ , regex: 'Article de qualité( contesté)?' },
{ state: BA , regex: 'Bon article' },
{ state: APDQ , regex: 'Article potentiellement (bon|de qualité)' },
{ state: STUB , regex: 'Wikipédia:ébauche' },
{ state: COPYRIGHT , regex: 'Article soupçonné de travail sous copyright' },
{ state: PAS , regex: 'Page proposée à la suppression' }
];
/* </source>
==== Variables globales ====
<source lang=javascript> */
var lrcParams = {
"PreviewHeight" : '250px', // LiveRC default preview window height;
"HistoryHeight" : '250px', // LiveRC default preview history window height;
"GoogleHeight" : '250px', // LiveRC default google search window height;
"TchatHeight" : '150px', // LiveRC default tchat window height;
"TZ" : '', // Default time zone (+02:00, 02:00, -0200, -05:45, ...)
"RCLimit" : 30, // LiveRC default RC list size;
"Refresh" : 10, // Refresh delay
"GoogleSearchLimit" : 100, // Answer for Google search
"ArticleLengthLimit" : 0, // Limit of the article name length in RC
"UserLengthLimit" : 0, // Limit of the user name length in RC
"AutoCloseDiff" : false, // LiveRC default Diff behaviour;
"WLAllChanges" : true, // Always show changes for pages in the watchlist
"BoldComments" : false, // Bold text for diff comments
"RvMinorEdit" : false, // Mark reverts as minor edits
"LoadIPCat" : true,
"BypassWatchdefault" : true, // Do not automatically add edited pages to the watchlist, even if this preference is set
"HideUselessElements" : true, // Hide useless elements
"InvertUpdate" : false, // Add new RC lines at the bottom
"KeepAllLines" : false, // Do not remove automatically lines
"DisplayDebug" : false // Show debug window
}
// LiveRC default values for option menu
var lrcOptionMenuValues = {
"Stop" : false, // change to true to stop recent changes update by default
"Diff" : false, // change to true to select small diff by default
"Preview" : false, // change to true to show preview window by default (disabled)
"Tchat" : false, // change to true to show tchat by default
"Lists" : false, // change to true to show lists by default
"RC" : true, // change to true to show recent changes by default
"Log" : false, // change to true to show logs by default
"Filter" : false, // change to true to show filters by default
"RCType" : "IPNEW", // default value for user filter : "RESTMODE", "IPONLY", "IPNEW", "ALLUSERS" or "ALLNBOTS"
"RCns" : 999 // default value for namespace filter : false or namespace number
}
/* </source>
==== Textes ====
<source lang=javascript> */
// Wiki specific translation;
// /////////////////////
var lang_category = 'Catégorie:';
var lang_main_namespace = 'Articles';
var lang_sandbox = "Wikipédia:Bac à sable";
// Menu translation;
// /////////////////
var lang_menu = {
PAUSE : "Pause",
PREVIEW : "Prévisualiser",
LISTS : "Listes",
LOWDIFF : "Diff réduit",
RCLABEL : "RC",
NOBOTS : "Sans Bots",
RESTMODE : "Suivis",
IPONLY : "IP seules",
IPNEW : "IP+débutants",
ALLUSERS : "Tous",
ALLNBOTS : "Tous+bots",
NAMESP : "Espace",
XTIMES : "fois",
UNDORC : "Défaire",
REVERT : "Révoquer",
REASON : "Motif",
AVERTS : "Avertir",
EMPTY : "Blanchir",
LOGSHOW : "Journaux",
ABSHOW : "Filtres",
NEXTDIFF : "Suivant",
TCHAT : "Tchat"
};
var lang_tooltips = {
// main menu
HIDE_ALL: "Supprimer toutes les lignes",
HIDE_REVIEWED: "Supprimer les lignes des modifications visualisées",
HIDE_REVERTS: "Supprimer les lignes d'annulation",
HIDE_NEW: "Supprimer les lignes de création de page",
HIDE_BLANKING: "Supprimer les lignes de blanchiment",
HIDE_THIS: "Supprimer cette ligne",
// links in rows
DIFF_TIP: "Différence",
DIFF_SHORT: "Diff",
HIST_TIP: "Historique",
HIST_SHORT: "H",
EDIT_TIP: "Modifier",
EDIT_SHORT: "M",
MOVE_TIP: "Renommer",
MOVE_SHORT: "R",
DEL_TIP: "Supprimer",
DEL_SHORT: "S",
PROTECT_TIP: "Protéger",
PROTECT_SHORT: "P",
SUBJECT_TIP: "Page",
SUBJECT_SHORT: "P",
TALK_TIP: "Discussion",
TALK_SHORT: "D",
CONTRIB_TIP: "Contributions",
CONTRIB_SHORT: "C",
BLOCK_TIP: "Bloquer",
BLOCK_SHORT: "B",
USER_HIDE_TIP: "Ignorer l'utilisateur",
USER_HIDE_SHORT: "H",
NEWSECTION_TIP: "Nouvelle discussion",
NEWSECTION_SHORT: "+",
DELETEDCONTRIB_TIP: "Contributions supprimées",
DELETEDCONTRIB_SHORT: "+",
REVISIONDELETE_TIP: "Masquer la révision",
REVISIONDELETE_SHORT: "Masquer",
WHATLINKSHERE_TIP: "Pages liées à",
WHATLINKSHERE_SHORT: "↩",
// other
WORKING: "Traitement en cours...",
LAST_SITUATION: "Dernière situation",
GOOGLE_TIP: "Rechercher sur Google",
GOOGLE_SHORT: "Google",
GOOGLE_CLOSE_TIP: "Fermer la fenêtre Google",
GOOGLE_CLOSE_SHORT: "Fermer"
}
var lang_messages = {
NEW_VERSION: ' <span class="error">Vous utilisez la version $1 de LiveRC, qui est obsolète. Veuillez recharger le cache de votre navigateur pour utiliser la dernière version.</span>',
SAME_EDITOR: 'éditeur précédent identique',
WARNING: 'Message',
ON_ARTICLE: 'sur',
SANDBOX: 'attention, cette page est dédiée aux tests',
NOEXIST: '<center><span class="error">Cette page n\'existe pas.</span> $1Créer ?$2</center>',
FILTER: 'Déclenchement du filtre',
WATCHLISTON:'ajout sur watchlist',
WATCHLISTOFF:'retrait de watchlist',
REVISIONDELETEOK: "Visibilité des versions mise à jour avec succès.",
SPEEDDELETION: 'Suppression immédiate',
BLOCKED: 'bloqué',
RESUMESTART: '[[WP:LRC|LiveRC]] : ',
BLOCKAVERTO: 'Avertissement blocage',
BLOCKTEMPLATE: 'Blocage'
};
/* </source>
==== Blanchiment, révocation et avertissement ====
<source lang=javascript> */
// Avertissement
var lstAvert = [
{ template: "Test :)" , string: "Test :)" , hasPage: false },
{ template: "Test 0" , string: "Test 0" , hasPage: false },
{ template: "Test 1" , string: "Test 1" , hasPage: false },
{ template: "Test 2" , string: "Test 2" , hasPage: false },
{ template: "Test 3" , string: "Test 3" , hasPage: false },
{ template: "Vandalisme" , string: "Vandal" , hasPage: true },
{ template: "Spammeur" , string: "Spam" , hasPage: true },
{ template: "Motivation modif" , string: "Résumé" , hasPage: true },
{ template: "Signature" , string: "Signature" , hasPage: false },
{ template: "Bienvenue copyright" , string: "Copyright" , hasPage: false },
{ template: "Vandalisme cracra" , string: "Cracra" , hasPage: false },
{ template: "Bienvenue promo" , string: "Promo" , hasPage: false },
{ template: "Bienvenue hébergement", string: "Page Perso" , hasPage: false },
{ template: "Bug Skype" , string: "Bug Skype" , hasPage: false },
{ template: "Bienvenue" , string: "Bienvenue" , hasPage: false },
{ template: "Bienvenue IP" , string: "Bienvenue IP", hasPage: false }
];
// Blanchiment
var 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
var 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" }
];
/* </source>
==== Catégories ====
<source lang=javascript> */
// user categories for highlighting
var watchCategories = [
{ category: "Catégorie:Adresse IP scolaire", image: "ScolarIP" },
{ category: "Catégorie:Adresse IP partagée", image: "SharedIP" },
{ category: "Catégorie:Utilisateur enfreignant un copyright", image: "CopyrightUser" }
];
/* </source>
==== Icônes ====
<source lang=javascript> */
// Default icons
var lrcIcon = new Array();
lrcIcon["Nocat"] = '<sup style="color:crimson">(cat ?)</sup>';
lrcIcon["NbRevoc"] = '<sup style="color:red">($1 révoc <a href="javascript:;" onClick="removeRevoc($2)">-</a>)</sup>';
lrcIcon["Tag"] = '<br /><span style="color: red; font-weight: bold;">Tag : $1$2</span>';
lrcIcon["Homon"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/7/72/Disambig.svg/16px-Disambig.svg.png" '
+ 'width="16px" title="Homonymie" alt="Homonymie" />';
lrcIcon["Stub"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/a/a6/Construction_cone.png/12px-Construction_cone.png" '
+ 'width="12px" title="Ébauche" alt="Ébauche" />';
lrcIcon["FullLock"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/4/48/Padlock-red.svg/16px-Padlock-red.svg.png" '
+ 'width="16px" title="Article protégé" alt="Article protégé"/>';
lrcIcon["Lock"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/e/e0/Padlock-gold.svg/16px-Padlock-gold.svg.png" '
+ 'width="16px" title="Article semi-protégé" alt="Article semi-protégé"/>';
lrcIcon["Copyright"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" '
+ 'width="16px" title="Article soupçonné d\'enfreindre un copyright" alt="Copyright" />';
lrcIcon["PaS"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b6/Cestino_pieno_architetto_01.svg/11px-Cestino_pieno_architetto_01.svg.png" '
+ 'height="11px" title="En PàS" alt="PaS" />';
lrcIcon["AdQ"] = '<sup><img '
+ 'src="/media/wikipedia/commons/thumb/c/c7/Fairytale_bookmark_gold.png/10px-Fairytale_bookmark_gold.png" '
+ 'width="10px" title="Article de qualité" alt="Adq" /></sup>';
lrcIcon["BA"] = '<sup><img '
+ 'src="/media/wikipedia/commons/thumb/8/8a/Fairytale_bookmark_silver_light.png/10px-Fairytale_bookmark_silver_light.png" '
+ 'width="10px" title="Bon article" alt="Bon article" /></sup>';
lrcIcon["APDQ"] = '<sup><img '
+ 'src="/media/wikipedia/commons/thumb/9/9a/Fairytale_bookmark_light.png/10px-Fairytale_bookmark_light.png" '
+ 'width="10px" title="Article potentiellement de qualité" alt="Article potentiellement de qualité" />';
lrcIcon["Move"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/0/0e/Forward.png/16px-Forward.png" '
+ 'width="16px" title="Renommage" alt="Renommage" />';
lrcIcon["Redirect"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b5/Redirectltr.png/20px-Redirectltr.png" '
+ 'width="20px" title="Redirection" alt="Redirect" />';
lrcIcon["Upload"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/4/47/Gartoon-Gnome-dev-floppy.png/16px-Gartoon-Gnome-dev-floppy.png" '
+ 'width="16px" title="Upload" alt="Upload" />';
lrcIcon["NewUser"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png" '
+ 'width="16px" title="Nouvel utilisateur" alt="Nouvel utilisateur" />';
lrcIcon["Block"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/6/64/Crystal_Clear_action_lock3.png/16px-Crystal_Clear_action_lock3.png" '
+ 'width="16px" title="Blocage" alt="Blocage" />';
lrcIcon["Delete"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/e/ef/Editcut.png/16px-Editcut.png" '
+ 'width="16px" title="Suppression" alt="Suppression" />';
lrcIcon["Protect"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/7/72/Crystal_Clear_app_agent.png/16px-Crystal_Clear_app_agent.png" '
+ 'width="16px" title="Protection" alt="Protection" />';
lrcIcon["Bot"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/2/2a/Nuvola_apps_kservices.png/16px-Nuvola_apps_kservices.png" '
+ 'width="16px" title="Bot" alt="Bot" />';
lrcIcon["Sysop"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/2/2c/Broom_icon.svg/16px-Broom_icon.svg.png" '
+ 'width="16px" title="Administrateur" alt="Administrateur" />';
lrcIcon["Revert"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/2/2c/Nuvola_actions_undo.png/16px-Nuvola_actions_undo.png" '
+ 'width="16px" title="Revert" alt="Revert" />';
lrcIcon["TOR"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/6/6e/Dialog-warning.svg/16px-Dialog-warning.svg.png" '
+ 'width="16px" title="TOR" alt="TOR" />';
lrcIcon["Blocked"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b8/Modern_clock_chris_kemps_01_with_Octagon-warning.svg/16px-Modern_clock_chris_kemps_01_with_Octagon-warning.svg.png"'
+ ' title="Utilisateur récemment bloqué" width="16px" alt="Bloqué" />';
lrcIcon["Replaced"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/9/95/Categorie_III.svg/10px-Categorie_III.svg.png" '
+ 'width="10px" title="Warning" alt="Warning"/>';
lrcIcon["SharedIP"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b7/WLM_logo.svg/16px-WLM_logo.svg.png" '
+ 'width="16px" title="Adresse IP partagée" alt="IP partagée"/>';
lrcIcon["ScolarIP"] = '<img '
+ 'src=/media/wikipedia/commons/thumb/9/98/Crystal_kdmconfig.png/16px-Crystal_kdmconfig.png '
+ 'width="16px" title="Adresse IP scolaire" alt="IP scolaire"/>';
lrcIcon["CopyrightUser"] = '<img '
+ 'src="/media/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" '
+ 'width="16px" title="Utilisateur enfreignant un copyright" alt="Utilisateur copieur"/>';
/* </source>
==== Gestion des paramètres ====
<source lang=javascript> */
// Textes
var lrcManageParamsText = {
"ButtonText": '<img src="/media/wikipedia/commons/thumb/8/8e/Icon_tools.svg/20px-Icon_tools.svg.png" width="20" height="20" alt="Paramètres" />',
"ButtonTitle": "Modifier les paramètres",
"LegendTitle": 'Modifier les paramètres <sup><a href="/wiki/Utilisateur:EDUCA33E/LiveRC/Documentation#LiveRC_params_.2F_Param.C3.A9trer_son_LiveRC" target="_blank" title="Aide">?</a></sup>',
"LiStyle": "border:1px solid silver;background-color:#E8E8FF;margin:0.2em;padding:0.1em;",
"VariableLegend": "Variables",
"ExtensionLegend": "Extensions",
"OK": "Valider",
"Cancel": "Fermer",
"RAZ": "Valeurs par défaut",
"Continue": "Continuer ?",
"Comment": "Personnalisation pour LiveRC",
"EditRunning": "Édition de la page <b>$1</b> en cours<span style=\"text-decoration:blind;\">…</span>",
"SaveRunning": "Sauvegarde de la page <b>$1</b> en cours<span style=\"text-decoration:blind;\">…</span>",
"SaveDone": "Sauvegarde de la page <b>$1</b> effectuée.",
"SaveRefresh": '<span class="error">La prise en compte des nouvelles valeurs nécessite la mise à jour du cache du navigateur.</span>'
}
var LiveRC_ParamComment = "//END PARAMS\n";
var LiveRC_ExtensionSetupComment = "//EXTENSIONS SETUP : ";
var LiveRC_Params = new Array();
// Définitions
var lrcManageParams_Desc = {
// Menu de paramétrage
'DesclrcParams': new Array('Paramètres', 'Paramètres'),
'DesclrcOptionMenuValues': new Array('Options par défaut du menu de commande', 'Options'),
'DesclstBlank': new Array('Résumés de blanchiment', 'Blanchiment'),
'DesclrcRevertMessages': new Array('Résumés de révocation', 'Révocation'),
'DesclstAvert': new Array('Modèles d\'avertissement', 'Avertissement'),
'DesclrcIcon': new Array('Icônes', 'Icônes'),
'Desclang_menu': new Array('Textes du menu de commande', 'Textes 1'),
'Desclang_tooltips': new Array('Textes des liens', 'Textes 2'),
'Desclang_messages': new Array('Textes de divers messages', 'Textes 3'),
'DesclrcManageParamsText': new Array('Textes du menu de gestion des options', 'Textes 4'),
'DesclrcManageParams_Desc': new Array('Descriptions des variables', 'Textes 5'),
'DescExtensionsLegend': new Array('Extensions installées', 'Extensions'),
// Paramètres
'DescPreviewHeight': new Array('Hauteur de la fenêtre de prévisualisation', 'Fenêtre de prévisualisation'),
'DescHistoryHeight': new Array('Hauteur de l\'historique de prévisualisation', 'Fenêtre historique'),
'DescGoogleHeight': new Array('Hauteur de la fenêtre google', 'Fenêtre Google'),
'DescTchatHeight': new Array('Hauteur de la fenêtre de tchat', 'Fenêtre tchat'),
'DescTZ': new Array('Fuseau horaire', 'Fuseau horaire'),
'DescRCLimit': new Array('Limite de lignes RC', 'Limite de lignes RC'),
'DescRefresh': new Array('Délai de rafraichissement', 'Délai de rafraichissement'),
'DescGoogleSearchLimit': new Array('Limite de résultats Google', 'Limite de résultats Google'),
'DescArticleLengthLimit': new Array('Limite de longueur nom de page', 'Limite de longueur nom de page'),
'DescUserLengthLimit': new Array('Limite de longueur nom d\'utilisateur', 'Limite de longueur nom d\'utilisateur'),
'DescAutoCloseDiff': new Array('Supprimer une ligne après visualisation du diff', '?2'),
'DescWLAllChanges': new Array('Montrer les changements faits dans la liste de suivi', 'Liste de suivi'),
'DescBoldComments': new Array('Commentaires de modif en gras', 'Commentaires de modif en gras'),
'DescRvMinorEdit': new Array('Marquer les révocations comme mineures', 'Marquer les révocations comme mineures'),
'DescLoadIPCat': new Array('Charger les catégories d\'utilisateurs', 'Charger les catégories d\'utilisateurs'),
'DescBypassWatchdefault': new Array('Ne pas ajouter automatiquement les pages modifiées à la liste de suivi', 'Ne pas ajouter automatiquement les pages modifiées à la liste de suivi'),
'DescHideUselessElements': new Array('Cacher les éléments inutiles de la page', 'Cacher les éléments inutiles de la page'),
'DescInvertUpdate': new Array('Inverser le sens d\'apparition des RC', 'Inverser le sens d\'apparition des RC'),
'DescKeepAllLines': new Array('Conserver toutes les lignes RC', 'Conserver toutes les lignes RC'),
'DescDisplayDebug': new Array('Afficher le panneau de débogage', 'Débogage'),
// Options
'DescStop': new Array('Case "Pause"', 'Case "Pause"'),
'DescDiff': new Array('Case "Diff réduit"', 'Case "Diff réduit"'),
'DescPreview': new Array('Case "Prévisualiser"', 'Case "Prévisualiser"'),
'DescTchat': new Array('Case "Tchat"', 'Case "Tchat"'),
'DescLists': new Array('Case "Listes"', 'Case "Listes"'),
'DescRC': new Array('Case "RC"', 'Case "RC"'),
'DescLog': new Array('Case "Journaux"', 'Case "Journaux"'),
'DescFilter': new Array('Case "Filtres"', 'Case "Filtres"'),
'DescRCType': new Array('Sélecteur "Utilisateurs"', 'Sélecteur "Utilisateurs"'),
'DescRCns': new Array('Sélecteur "Espaces"', 'Sélecteur "Espaces"'),
// Icônes
"DescNocat": new Array("Page sans catégorie", "Sans catégorie"),
"DescNbRevoc": new Array("Nombre de révocations", "Nombre de révocations"),
"DescTag": new Array("Déclenchement de filtre", "Filtre"),
"DescStub": new Array("Ébauche", "Ébauche"),
"DescHomon": new Array("Homonymie", "Homonymie"),
"DescFullLock": new Array("Article protégé", "Article protégé"),
"DescLock": new Array("Article semi-protégé", "Article semi-protégé"),
"DescCopyright": new Array("Article soupçonné d\'enfreindre un copyright", "Copyright"),
"DescPaS": new Array("En PàS", "PaS"),
"DescAdQ": new Array("Article de qualité", "Adq"),
"DescBA": new Array("Bon article", "Bon article"),
"DescAPDQ": new Array("Article potentiellement de qualité", "Article potentiellement de qualité"),
"DescMove": new Array("Renommage", "Renommage"),
"DescRedirect": new Array("Redirection", "Redirect"),
"DescUpload": new Array("Upload", "Upload"),
"DescNewUser": new Array("Nouvel utilisateur", "Nouvel utilisateur"),
"DescBlock": new Array("Blocage", "Blocage"),
"DescDelete": new Array("Suppression", "Suppression"),
"DescProtect": new Array("Protection", "Protection"),
"DescBot": new Array("Bot", "Bot"),
"DescSysop": new Array("Administrateur", "Administrateur"),
"DescRevert": new Array("Revert", "Revert"),
"DescTOR": new Array("TOR", "TOR"),
"DescBlocked": new Array("Utilisateur récemment bloqué", "Bloqué"),
"DescReplaced": new Array("Warning", "Warning"),
"DescSharedIP": new Array("Adresse IP partagée", "IP partagée"),
"DescScolarIP": new Array("Adresse IP scolaire", "IP scolaire"),
"DescCopyrightUser": new Array("Utilisateur enfreignant un copyright", "Utilisateur copieur"),
// Textes 1
"DescPAUSE": new Array("Pause", "Pause"),
"DescPREVIEW": new Array("Prévisualiser", "Prévisualiser"),
"DescLISTS": new Array("Listes", "Listes"),
"DescLOWDIFF": new Array("Diff réduit", "Diff réduit"),
"DescRCLABEL": new Array("RC", "RC"),
"DescNOBOTS": new Array("Sans Bots", "Sans Bots"),
"DescRESTMODE": new Array("Suivis", "Suivis"),
"DescIPONLY": new Array("IP seules", "IP seules"),
"DescIPNEW": new Array("IP+débutants", "IP+débutants"),
"DescALLUSERS": new Array("Tous", "Tous"),
"DescALLNBOTS": new Array("Tous+bots", "Tous+bots"),
"DescNAMESP": new Array("Espace", "Espace"),
"DescXTIMES": new Array("fois", "fois"),
"DescUNDORC": new Array("Défaire", "Défaire"),
"DescREVERT": new Array("Révoquer", "Révoquer"),
"DescREASON": new Array("Motif", "Motif"),
"DescAVERTS": new Array("Avertir", "Avertir"),
"DescEMPTY": new Array("Blanchir", "Blanchir"),
"DescLOGSHOW": new Array("Journaux", "Journaux"),
"DescABSHOW": new Array("Filtres", "Filtres"),
"DescNEXTDIFF": new Array("Suivant", "Suivant"),
"DescTCHAT": new Array("Tchat", "Tchat"),
// Textes 2
"DescHIDE_ALL":new Array("Tooltip du lien pour supprimer toutes les lignes", "Tooltip du lien pour supprimer toutes les lignes"),
"DescHIDE_REVIEWED":new Array("Tooltip du lien pour supprimer les lignes des modifications visualisées", "Tooltip du lien pour supprimer les lignes des modifications visualisées"),
"DescHIDE_REVERTS":new Array("Tooltip du lien pour supprimer les lignes d'annulation", "Tooltip du lien pour supprimer les lignes d'annulation"),
"DescHIDE_NEW":new Array("Tooltip du lien pour supprimer les lignes de création de page", "Tooltip du lien pour supprimer les lignes de création de page"),
"DescHIDE_BLANKING":new Array("Tooltip du lien pour supprimer les lignes de blanchiment", "Tooltip du lien pour supprimer les lignes de blanchiment"),
"DescHIDE_THIS":new Array("Tooltip du lien pour supprimer cette ligne", "Tooltip du lien pour supprimer cette ligne"),
"DescDIFF_TIP":new Array("Tooltip du lien vers le diff", "Tooltip du lien vers le diff"),
"DescDIFF_SHORT":new Array("Texte du lien vers le diff", "Texte du lien vers le diff"),
"DescHIST_TIP":new Array("Tooltip du lien vers l'historique", "Tooltip du lien vers l'historique"),
"DescHIST_SHORT":new Array("Texte du lien vers l'historique", "Texte du lien vers l'historique"),
"DescEDIT_TIP":new Array("Tooltip du lien pour éditer", "Tooltip du lien pour éditer"),
"DescEDIT_SHORT":new Array("Texte du lien pour éditer", "Texte du lien pour éditer"),
"DescMOVE_TIP":new Array("Tooltip du lien pour renommer", "Tooltip du lien pour renommer"),
"DescMOVE_SHORT":new Array("Texte du lien pour renommer", "Texte du lien pour renommer"),
"DescDEL_TIP":new Array("Tooltip du lien pour supprimer", "Tooltip du lien pour supprimer"),
"DescDEL_SHORT":new Array("Texte du lien pour supprimer", "Texte du lien pour supprimer"),
"DescPROTECT_TIP":new Array("Tooltip du lien pour protéger", "Tooltip du lien pour protéger"),
"DescPROTECT_SHORT":new Array("Texte du lien pour protéger", "Texte du lien pour protéger"),
"DescSUBJECT_TIP":new Array("Tooltip du lien vers l'article", "Tooltip du lien vers l'article"),
"DescSUBJECT_SHORT":new Array("Texte du lien vers l'article", "Texte du lien vers l'article"),
"DescTALK_TIP":new Array("Tooltip du lien vers la page de discussion", "Tooltip du lien vers la page de discussion"),
"DescTALK_SHORT":new Array("Texte du lien vers la page de discussion", "Texte du lien vers la page de discussion"),
"DescCONTRIB_TIP":new Array("Tooltip du lien vers les contributions", "Tooltip du lien vers les contributions"),
"DescCONTRIB_SHORT":new Array("Texte du lien vers les contributions", "Texte du lien vers les contributions"),
"DescBLOCK_TIP":new Array("Tooltip du lien pour bloquer", "Tooltip du lien pour bloquer"),
"DescBLOCK_SHORT":new Array("Texte du lien pour bloquer", "Texte du lien pour bloquer"),
"DescUSER_HIDE_TIP":new Array("Tooltip du lien pour ignorer un utilisateur", "Tooltip du lien pour ignorer un utilisateur"),
"DescUSER_HIDE_SHORT":new Array("Texte du lien pour ignorer un utilisateur", "Texte du lien pour ignorer un utilisateur"),
"DescNEWSECTION_TIP":new Array("Tooltip du lien pour éditer une nouvelle section", "Tooltip du lien pour éditer une nouvelle section"),
"DescNEWSECTION_SHORT":new Array("Texte du lien pour éditer une nouvelle section", "Texte du lien pour éditer une nouvelle section"),
"DescDELETEDCONTRIB_TIP":new Array("Tooltip du lien vers les contributions supprimées", "Tooltip du lien vers les contributions supprimées"),
"DescDELETEDCONTRIB_SHORT":new Array("Texte du lien vers les contributions supprimées", "Texte du lien vers les contributions supprimées"),
"DescREVISIONDELETE_TIP":new Array("Tooltip du lien pour masquer une révision", "Tooltip du lien pour masquer une révision"),
"DescREVISIONDELETE_SHORT":new Array("Texte du lien pour masquer une révision", "Texte du lien pour masquer une révision"),
"DescWHATLINKSHERE_TIP":new Array("Tooltip du lien vers les pages liées", "Pages liées tooltip"),
"DescWHATLINKSHERE_SHORT":new Array("Texte du lien vers les pages liées", "Pages liées texte"),
"DescWORKING":new Array("Message \"Traitement en cours...\"", "Message \"Traitement en cours...\""),
"DescLAST_SITUATION":new Array("Message \"Dernière situation\"", "Message \"Dernière situation\""),
"DescGOOGLE_TIP":new Array("Tooltip du lien vers Google", "Tooltip du lien vers Google"),
"DescGOOGLE_SHORT":new Array("Texte du lien vers Google", "Texte du lien vers Google"),
"DescGOOGLE_CLOSE_TIP":new Array("Tooltip du lien pour fermer Google", "Tooltip du lien pour fermer Google"),
"DescGOOGLE_CLOSE_SHORT":new Array("Texte du lien pour fermer Google", "Texte du lien pour fermer Google"),
// Textes 3
"DescNEW_VERSION":new Array("Nouvelle version disponible", "Nouvelle version disponible"),
"DescSAME_EDITOR":new Array("Message \"éditeur précédent identique\"", "Message \"éditeur précédent identique\""),
"DescWARNING":new Array("Résumé de modif avertissement", "Résumé de modif avertissement"),
"DescON_ARTICLE":new Array("Mot \"sur\"", "Mot \"sur\""),
"DescSANDBOX":new Array("Message sur la bac à sable", "Message sur la bac à sable"),
"DescNOEXIST":new Array("Texte de remplacement pour page inexistante", "Texte de remplacement pour page inexistante"),
"DescFILTER":new Array("Message de déclenchement d'un filtre", "Message de déclenchement d'un filtre"),
"DescWATCHLISTON":new Array("Message \"Ajout à la liste de suivi\"", "Message \"Ajout à la liste de suivi\""),
"DescWATCHLISTOFF":new Array("Message \"Retrait de la liste de suivi\"", "Message \"Retrait de la liste de suivi\""),
"DescREVISIONDELETEOK":new Array("Message après masquage réussi", "Message après masquage réussi"),
"DescSPEEDDELETION":new Array("Résumé de modif blanchiment", "Résumé de modif blanchiment"),
"DescBLOCKED":new Array("Mot \"bloqué\"", "Mot \"bloqué\""),
"DescRESUMESTART":new Array("Début des résumés de modif", "Début des résumés de modif"),
"DescBLOCKAVERTO":new Array("Résumé de modif avertissement blocage", "Résumé de modif avertissement blocage"),
"DescBLOCKTEMPLATE":new Array("Modèle pour avertissement blocage", "Modèle pour avertissement blocage"),
// Textes 4
"DescButtonText":new Array("Bouton d'ouverture du menu", "Bouton d'ouverture du menu"),
"DescButtonTitle":new Array("Tooltip du bouton d'ouverture du menu", "Tooltip du bouton d'ouverture du menu"),
"DescLegendTitle":new Array("Légende du menu", "Légende du menu"),
"DescLiStyle":new Array("Style des lignes", "Style des lignes"),
"DescVariableLegend":new Array("Commentaire \"Variables\" dans le js", "Commentaire \"Variables\" dans le js"),
"DescExtensionLegend":new Array("Commentaire \"Extensions\" dans le js", "Commentaire \"Extensions\" dans le js"),
"DescOK":new Array("Bouton de validation", "Bouton de validation"),
"DescCancel":new Array("Bouton d'annulation", "Bouton d'annulation"),
"DescRAZ":new Array("Bouton de remise à zéro", "Bouton de remise à zéro"),
"DescContinue":new Array("Pop-up de confirmation", "Pop-up de confirmation"),
"DescComment":new Array("Résumé de modification", "Résumé de modification"),
"DescEditRunning":new Array("Phrase \"Édition en cours\"", "Phrase \"Édition en cours\""),
"DescSaveRunning":new Array("Phrase \"Sauvegarde en cours\"", "Phrase \"Sauvegarde en cours\""),
"DescSaveDone":new Array("Phrase \"Sauvegarde effectuée\"", "Phrase \"Sauvegarde effectuée\""),
"DescSaveRefresh":new Array("Phrase \"Rafraichir le cache\"", "Phrase \"Rafraichir le cache\"")
};
/* </source>
==== Autres variables personnalisables ====
<source lang=javascript> */
// Preview title-bar template
var PreviewBarTemplate = '<table width="100%" class="creator"><tr>'
+ '<td align="left" style="vertical-align:middle">$1</td>'
+ '<td align="right" style="vertical-align:middle">$2</td>'
+ '</tr><tr>'
+ '<td align="left" style="vertical-align:middle"><small>$3</small></td>'
+ '<td align="right" style="vertical-align:middle"><small>$4</small></td>'
+ '</tr></table>';
var lrcTchatChannel = "#LiveRC-fr-wp";
/* </source>
==== Variables non personnalisables ====
<source lang=javascript> */
// Extensions
var lrcExtensions = [
{
"name":"UserWarningsExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Orlodrim/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."
},
{
"name":"LinkOnIconExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Orlodrim/LinkOnIconExtension.js",
"desc":"Lie les icônes PàS, AdQ, BA et copyvio aux pages de discussion associées."
},
{
"name":"FullScreenExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/FullScreenExtension.js",
"desc":"Ajoute un bouton dans la barre d’outils LiveRC pour passer en mode plein écran ou normal."
},
{
"name":"PreviewSizeExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/PreviewSizeExtension.js",
"desc":"Ajoute trois boutons dans la barre d’outils LiveRC pour modifier la taille de la fenêtre de prévisualisation."
},
{
"name":"EditCharactersExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/EditCharactersExtension.js",
"desc":"Améliore la fenêtre de modification avec les fonctions standards du Common.js (toolbar et caractères spéciaux)."
},
{
"name":"RunCommonJS",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/RunCommonJS.js",
"desc":"Améliore le prévisualisation avec des fonctions du Common.js (boîtes déroulantes, palettes, {{Images}}, etc...)"
}
];
// POST params, for liveEdit(), liveMove(), liveDelete(), liveProtect() and liveBlock()
// true/false means : param must be encoded.
var lrcPOSTParams = new Array();
lrcPOSTParams["Edit"] = {"wpTextbox1": true, "wpSummary": true, "wpWatchthis": false, "wpMinoredit": false, "wpSection": true, "wpStarttime": true, "wpEdittime": true};
lrcPOSTParams["Move"] = {"wpNewTitle": true, "wpOldTitle": true, "wpReason": true, "watch": false, "wpMovetalk": false, "wpMovesubpages" : false, "wpLeaveRedirect" : false, "wpEditToken": true, "wpConfirm": false};
lrcPOSTParams["Delete"] = {"wpDeleteReasonList": true, "wpReason": true, "wpWatch": false, "wpEditToken": true};
lrcPOSTParams["Protect"] = {"mwProtect-level-edit": true, "wpProtectExpirySelection-edit": true, "mwProtect-expiry-edit": true, "mwProtectUnchained": false, "mwProtect-level-move": true, "wpProtectExpirySelection-move": true, "mwProtect-expiry-move": true, "mwProtect-cascade": false, "wpProtectReasonSelection": true, "mwProtect-reason": true, "mwProtectWatch": false, "wpEditToken": true};
lrcPOSTParams["Block"] = {"wpBlockAddress": true, "wpBlockExpiry": true, "mw-bi-other": true, "wpBlockReasonList": true, "mw-bi-reason": true, "wpAnonOnly": false, "wpCreateAccount": false, "wpEnableAutoblock": false, "wpEmailBan": false,"wpWatchUser": false,"wpAllowUsertalk": false, "wpEditToken": true};
lrcPOSTParams["Revisiondelete"] = {"wpHidePrimary": false, "wpHideComment": false, "wpHideUser": false, "wpRevDeleteReasonList": true, "wpReason": true, "wpEditToken": true,"target": true,"type": false, "ids": false};
// Getting user params
// FIXME: works fine in Mozilla and Opera, does not work in Chrome and Safari
importScript('User:'+mw.config.get('wgUserName')+'/LiveRCparam.js');
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = 'http://pl.wikipedia.org/skins-1.5/common/diff.css?90';
cssNode.media = 'screen';
cssNode.title = 'dynamicLoadedSheet';
document.getElementsByTagName("head")[0].appendChild(cssNode);
document.write('<script type="text/javascript" src="http://pl.wikipedia.org/skins-1.5/common/diff.js?90"></script>');
document.write('<script type="text/javascript" src="http://bits.wikimedia.org/skins-1.5/common/edit.js?283-19"></script>');
var lastrcid=0,lastfilterid=0,lastlogid=0,lastrctimestamp=1,lastletimestamp=1,lastafltimestamp=1; // Timestamp d'initialisation;
// Découpage de l'URL et de ses parametres;
var _GET = new Array();
var _uri = location.href;
var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");
var _temp_get_arr_1 = new Array();
for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
_temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
_GET[decodeURIComponent(_temp_get_arr_1[0])] = decodeURIComponent(_temp_get_arr_1[1]);
}
delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;
var lstSysop = new Array(); // Sysop list;
var lstContact = new Array(); // Contact list;
var lstContact2 = new Array(); // Contact list;
var lstRevoc = new Array(); // Reverted list;
var lstHidden = new Array(); // Hidden users list;
var lstBlocks = new Array();
var lstUserCat = new Array();
var lrcHomonTemplates = new Array(); // Homon templates
// User rights & apilimit
var lrcUserRights = new Array();
var lrcAPIlimit = 499;
// Is user Sysop;
var lrcAdmin = (mw.config.get('wgUserGroups').indexOf("sysop") != -1);
// Mediawiki messages
var lrcMediawikiMessages = new Array();
// Watchlist;
var lstSuivi = new Array();
var lstSuiviHH = new Array();
var nextFreeID = 0;
var nextDiffNum = 0;
var lrcTimer;
//History
var lrcHistory = {"Type":new Array(), "Params":new Array(), "URL":new Array(), "Text":new Array() };
var lrcHistoryIndex = -1;
var lrcHistoryIsOld = false;
// Hooks;
var lrcHooks = {
"AfterOptions" : new Array(),
"AfterPreviewDiff" : new Array(),
"AfterPreviewArticle" : new Array(),
"AfterPreviewHistory" : new Array(),
"AfterPreviewContribs" : new Array(),
"AfterPreviewDeletedContribs" : new Array(),
"AfterPreviewLog" : new Array(),
"AfterPreviewFilter" : new Array(),
"AfterPreviewEdit" : new Array(),
"AfterPreviewMove" : new Array(),
"AfterPreviewProtect" : new Array(),
"AfterPreviewDelete" : new Array(),
"AfterPreviewBlock" : new Array(),
"AfterPreviewRevisiondelete" : new Array(),
"AfterPreviewWhatlinkshere" : new Array(),
"AfterFillParamPanel" : new Array(),
"BeforeRC" : new Array(),
"AfterRC" : new Array()
};
// Variables obsolètes, conservées pour compatibilité avec anciennes personnalisations
var lang_log = new Array();
var lrcManageParamsDesc = new Array()
}
/* </source>
=== Fonctions utilitaires ===
==== Ajax & Parser ====
<source lang="javascript"> */
var wpajax = {
http: function(bundle) {
// 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
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
}
}
}
if (xmlhttp) {
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 xmlhttp;
},
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);
} else {
// A activer en debug mode ?
// alert(xmlhttp.status+xmlhttp.responseText);
}
}
};
// Parser
if (window.DOMParser) var gml_xmlparser = new DOMParser();
function gml_XMLParse(string) {
if (window.DOMParser) {
return gml_xmlparser.parseFromString(string, "text/xml");
} else if (window.ActiveXObject) {
var gml_xmldoc = new ActiveXObject("Microsoft.XMLDOM");
gml_xmldoc.async = "false";
gml_xmldoc.validateOnParse = false;
ret = gml_xmldoc.loadXML(string);
if (!ret)
return null;
return gml_xmldoc.documentElement;
}
return null;
}
/* </source>
==== Hook functions ====
<source lang="javascript"> */
function LiveRC_AddHook(Type, func){
if(typeof(func)==="function" && lrcHooks[Type]) lrcHooks[Type].push(func);
}
function LiveRC_RunHooks(Type, Params){
var HookResult = true;
if(typeof(lrcHooks[Type])!='undefined'){
for(var a=0,l=lrcHooks[Type].length;a<l;a++){
var ThisHookResult = lrcHooks[Type][a](Params);
if(ThisHookResult===false) HookResult = false;
}
}
return HookResult;
}
/* </source>
==== History functions ====
<source lang="javascript"> */
function lrcGetAllHistory(){
var HistoryDiv = document.getElementById("LiveRC_History");
if(HistoryDiv){
HistoryDiv.parentNode.removeChild(HistoryDiv);
return;
}
var HistoryArray = new Array();
for(var a=0,l=lrcHistory["Type"].length;a<l;a++){
var Type = lrcHistory["Type"][a];
var Params = lrcHistory["Params"][a];
var URL = lrcHistory["URL"][a];
var Text = lrcHistory["Text"][a];
var Onclick = "lrcGetHistory("+a+"); lrcCloseHistory(); return false;";
var Link = '<li>'+Type+' : <a href="'+URL+'" onClick="'+Onclick+'">'+Text+'</a></li>';
if(HistoryArray.indexOf(Link)==-1) HistoryArray.push(Link);
}
var DivContainer = document.createElement('div');
DivContainer.id = "LiveRC_History";
DivContainer.setAttribute("style", "height:"+lrcParams["HistoryHeight"]+";overflow-y:auto;background-color:#F0F0FF;border:1px solid silver;text-align:left;font-size:80%;");
var Ol = document.createElement('ol');
Ol.setAttribute("style", "-moz-column-count:3;-webkit-column-count:3;column-count:3");
Ol.innerHTML = HistoryArray.join("");
DivContainer.appendChild(Ol);
var Preview = document.getElementById('livePreview');
Preview.parentNode.insertBefore(DivContainer, Preview);
}
function lrcCloseHistory(){
var HistoryDiv = document.getElementById("LiveRC_History");
if(HistoryDiv) HistoryDiv.parentNode.removeChild(HistoryDiv);
}
function lrcAddToHistory(Type, Params, URL, Text){
lrcCloseHistory();
lrcHistory["Type"].push(Type);
lrcHistory["Params"].push(Params);
lrcHistory["URL"].push(URL);
lrcHistory["Text"].push(Text);
}
function lrcGetHistory(index){
lrcHistoryIsOld = true;
var Type = lrcHistory["Type"][index];
var Params = lrcHistory["Params"][index];
var FuntionToEval = Type + "(" + Params.join(", ") + ");";
//alert(FuntionToEval);
eval(FuntionToEval);
lrcHistory["Type"].pop();
lrcHistory["Params"].pop();
lrcHistory["URL"].pop();
lrcHistory["Text"].pop();
lrcHistoryIndex = index;
}
function buildHistoryPanel(){
if(!lrcHistoryIsOld) lrcHistoryIndex = (lrcHistory["Type"].length-1);
var PreviousDisabled = ((lrcHistoryIndex>0) ? '' : ' disabled="disabled" ' );
var NextDisabled = ((lrcHistoryIndex<(lrcHistory["Type"].length-1)) ? '' : ' disabled="disabled" ' );
var PreviousLink = '<input style="padding:0" type="button" value="⇦" ' + PreviousDisabled
+ 'onclick="lrcGetHistory('+(lrcHistoryIndex-1)+');" onselect="lrcGetHistory(-1);" />';
var ShowHistoryLink = '<input style="padding:0" type="button" value="?" '
+ 'onclick="lrcGetAllHistory();" onselect="lrcGetAllHistory();" />';
var NextLink = '<input style="padding:0" type="button" value="⇨" '+NextDisabled
+ ' onclick="lrcGetHistory('+(lrcHistoryIndex+1)+');" onselect="lrcGetHistory(1);" />';
lrcHistoryIsOld = false;
return PreviousLink + ShowHistoryLink + NextLink + ' ';
}
/* </source>
==== Watch functions ====
<source lang="javascript"> */
function updateWatchFromCookie() {
var s = "; " + document.cookie + ";";
var i = s.indexOf("; lrcWatch=") + 11;
if (i < 11) return;
s = decodeURIComponent(s.substr(i, s.indexOf(";", i) - i));
if (s == "") return;
document.cookie = "lrcWatch=; path=/;";
addWatch(s.substr(1), s[0] == '1' ? true : false, null);
}
function addWatch(uname, add, td2id) {
var item = lstContact2[uname];
var page = 'LiveRCWatch:' + uname;
if (!item && add) {
lstContact2[uname] = {ts: 0, fromjs: false};
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&action=watch' });
} else if (item && !add) {
if (item.fromjs) {
var page ='User:'+mw.config.get('wgUserName')+'/LiveRCparam.js'
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&action=edit',
onSuccess: addWatchToParam, page: page, uname:uname,add:add});
}
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&action=unwatch' });
delete lstContact2[uname];
}
if (td2id == null) return;
var td2 = document.getElementById(td2id);
if (add) {
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
} else {
td2.style.backgroundColor = "white";
}
}
function addWatchToParam(xmlreq, data){
var page=data.page;
var message=data.message
var parser = new DOMParser();
var doc = parser.parseFromString(xmlreq.responseText, 'application/xhtml+xml');
var inputs = doc.getElementById('editform').getElementsByTagName('input');
var editform = new Array();
for (i=0; i<inputs.length; i++) {
editform[inputs[i].name] = inputs[i].value;
}
var wpTextbox1;
if(data.add)
wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value + 'lstContact.push(\''+data.uname+'\');');
else
wpTextbox1 = encodeURIComponent(doc.getElementById('wpTextbox1').value.
replace("\nlstContact.push('"+data.uname+"');", "").
replace('\nlstContact.push("'+data.uname+'");', ""));
var wpStarttime = encodeURIComponent(editform['wpStarttime']);
var wpEdittime = encodeURIComponent(editform['wpEdittime']);
var wpEditToken = encodeURIComponent(editform['wpEditToken']);
var wpWatchthis = lrcComputeWatchParam(doc);
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + page + '&action=submit',
method: "POST", headers: headers,
data: 'wpSave=1&wpTextbox1='+wpTextbox1+'&wpStarttime=' + wpStarttime + '&wpEdittime=' + wpEdittime + wpWatchthis
+ '&wpEditToken=' + wpEditToken + '&wpSummary=[[WP:LRC|LiveRC]],%20'+((data.add)?lang_messages.WATCHLISTON:lang_messages.WATCHLISTOFF)});
}
/* </source>
==== buildPreviewBar ====
===== Simple =====
<source lang="javascript"> */
function buildBlanckPreviewBar(Text, History){
var Template = PreviewBarTemplate;
Template = Template.split('$1').join((History ? buildHistoryPanel() : "") + Text);
Template = Template.split('$2').join(" ");
Template = Template.split('$3').join(" ");
Template = Template.split('$4').join(" ");
var TabContainer = document.getElementById("livePreviewTitle");
if(TabContainer) TabContainer.innerHTML = Template;
}
/* </source>
===== Complex =====
<source lang="javascript"> */
function buildPreviewBar(Args){
var Mode = Args["Mode"];
var URL = Args["Url"];
var Page = Args["Page"];
var User1 = Args["User1"];
var User2 = Args["User2"];
var oldid = Args["Oldid"];
var Previous = Args["Previous"];
var Next = Args["Next"];
// $1 : case haut-gauche
var TabsHautGauche = buildHistoryPanel()
+ '<b><a href="'+URL+'" target="_new">'+Page+'</a></b>'
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Delete"||Mode=="Protect"||Mode=="Edit"||Mode=="Revisiondelete"){
TabsHautGauche += ' • '
+ '<small><a href="'+lrcGetUglyPageURL('Special:Whatlinkshere/'+Page) + '" '
+ 'onClick="liveWhatlinkshere('+lrcEscapeStr(Page)+'); return false;" '
+ 'title="'+lang_tooltips.WHATLINKSHERE_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.WHATLINKSHERE_SHORT+'</a></small>';
}
TabsHautGauche += ' • '
+ '<small><a href="http://www.google.'+mw.config.get('wgContentLanguage')+'/search?q=%22'+Page.replace(/ /g, "+")+'%22" '
+ 'onClick="liveGoogleSearch('+lrcEscapeStr(Page)+'); return false;" '
+ 'title="'+lang_tooltips.GOOGLE_TIP+'">['+lang_tooltips.GOOGLE_SHORT+']</a></small>';
if(Mode=="Revisiondelete" && Args["RevisiondeleteOK"]){
TabsHautGauche += ' <small>'+lang_messages.REVISIONDELETEOK+'</small>';
}
// $2 : case haut-droite
var TabsHautDroite = "";
if(Mode=="Diff" && lrcUserHasRight("deleterevision")){
TabsHautDroite = buildRevisiondeleteBar(Page);
}
if(Mode=="Diff" && Previous){
TabsHautDroite += '<small><a id="previousDiffLink" href="'+Previous["url"]+'" '
+ 'onClick="liveDiff('+lrcEscapeStr(Page)+',\'prev\',\''+Previous["oldid"]+'\'); return false;" '
+ 'title="'+Previous["title"]+'">'+Previous["text"]+'</a></small>';
}
if(Mode=="Diff" && Next){
if(Previous) TabsHautDroite += '<small> | </small>';
TabsHautDroite += '<small><a id="nextDiffLink" href="'+Next["url"]+'" '
+ 'onClick="liveDiff('+lrcEscapeStr(Page)+',\'next\',\''+Next["oldid"]+'\'); return false;" '
+ 'title="'+Next["title"]+'">'+Next["text"]+'</a></small>';
}
// $3 : case bas-gauche
var TabsBasGauche = buildPreviewNormalTabs(Args);
// $4 : case bas-droite
var TabsBasDroite = buildPreviewSpecialTabs(Args);
// Affichage
var Template = PreviewBarTemplate;
Template = Template.split('$1').join(TabsHautGauche);
Template = Template.split('$2').join(TabsHautDroite);
Template = Template.split('$3').join(TabsBasGauche);
Template = Template.split('$4').join(TabsBasDroite);
var TabContainer = document.getElementById("livePreviewTitle");
if(TabContainer) TabContainer.innerHTML = Template;
LiveRC_RevertMessagesExtension_Init();
}
/* </source>
====== Normal ======
<source lang="javascript"> */
function buildPreviewNormalTabs(Args){
var Mode = Args["Mode"];
var URL = Args["Url"];
var Page = Args["Page"];
var User1 = Args["User1"];
var User2 = Args["User2"];
var oldid = Args["Oldid"];
var Next = Args["Next"];
var ParamOldid = (Next && oldid ? "&oldid="+oldid : "");
var PageNamespaceNumber = getNamespaceInfoFromPage(Page);
var PageName = getNamespaceInfoFromPage(Page, "PageName");
var escTitle = lrcEscapeStr(Page);
var escUser = false;
var User = User2;
if(!User) User = User1;
if(!User){
if(PageNamespaceNumber==2 ||PageNamespaceNumber==3){
User = PageName.replace(/\/.*/g, "");
}
}
if(User) escUser = lrcEscapeStr(User);
var Tabs = new Array();
// Other Page /////////////////////////////////
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Delete"||Mode=="Protect"||Mode=="Edit"||Mode=="Revisiondelete"){
if(PageNamespaceNumber%2==0){
var OtherPageText = lang_tooltips.TALK_TIP;
var OtherPageNamespaceNumber = (PageNamespaceNumber+1);
}else{
var OtherPageText = lang_tooltips.SUBJECT_TIP;
var OtherPageNamespaceNumber = (PageNamespaceNumber-1);
}
var OtherPageName = (OtherPageNamespaceNumber == 0 ? PageName : mw.config.get('wgFormattedNamespaces')[OtherPageNamespaceNumber]+":"+PageName);
Tabs["OtherPage"] = '<a href="'+lrcGetPageURL(OtherPageName)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(OtherPageName)+'); return false;" '
+ 'title="'+OtherPageName+'" '
+ '>'+OtherPageText+'</a>';
}else if(Mode=="Contrib"||Mode=="DeletedContrib"||Mode=="Block"){
var OtherPageName = mw.config.get('wgFormattedNamespaces')[3]+":"+User;
Tabs["OtherPage"] = '<a href="'+lrcGetPageURL(OtherPageName)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(OtherPageName)+'); return false;" '
+ 'title="'+OtherPageName+'" '
+ '>'+lang_tooltips.TALK_TIP+'</a>';
}
// Edit /////////////////////////////////
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Move"||Mode=="Delete"||Mode=="Protect"||Mode=="Revisiondelete"){
Tabs["Edit"] = '<a href="'+lrcGetUglyPageURL(Page,'&action=edit'+ParamOldid) + '" '
+ 'onClick="liveEdit('+escTitle+', \''+ParamOldid+'\'); return false;" '
+ 'title="'+lang_tooltips.EDIT_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.EDIT_TIP+'</a>';
}
// New Section /////////////////////////////////
if(PageNamespaceNumber%2!=0){
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Move"||Mode=="Delete"||Mode=="Protect"||Mode=="Edit"||Mode=="Revisiondelete"){
Tabs["NewSection"] = '<a href="'+lrcGetUglyPageURL(Page,'&action=edit§ion=new') + '" '
+ 'onClick="liveEdit('+escTitle+',\'§ion=new\'); return false;" '
+ 'title="'+lang_tooltips.NEWSECTION_TIP+'" '
+ '>'+lang_tooltips.NEWSECTION_TIP+'</a>';
}
}
// Hist /////////////////////////////////
if(Mode=="Article"||Mode=="Diff"||Mode=="Edit"||Mode=="Move"||Mode=="Delete"||Mode=="Protect"||Mode=="Revisiondelete"){
Tabs["Hist"] = '<a href="'+lrcGetUglyPageURL(Page,'&action=history') + '" '
+ 'onClick="liveHist('+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.HIST_TIP+'" '
+ '>'+lang_tooltips.HIST_TIP+'</a>';
}
// Move /////////////////////////////////
if(lrcUserHasRight("move")){
if(Mode=="Article"||Mode=="Diff"||Mode=="Edit"||Mode=="Hist"||Mode=="Delete"||Mode=="Protect"||Mode=="Revisiondelete"){
Tabs["Move"] = '<a href="'+lrcGetPageURL('Special:Movepage/'+Page) + '" '
+ 'onClick="liveMove('+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.MOVE_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.MOVE_TIP+'</a>';
}
}
// Contrib /////////////////////////////////
if(escUser){
if(Mode=="Block"||Mode=="DeletedContrib"){
Tabs["Contrib"] = '<a href="'+lrcGetPageURL('Special:Contributions/' + User)+'" '
+ 'onClick="liveContrib('+escUser+'); return false;" '
+ 'title="'+lang_tooltips.CONTRIB_TIP+'" '
+ '>'+lang_tooltips.CONTRIB_TIP+'</a>';
}
}
// DeletedContrib /////////////////////////////////
if(lrcUserHasRight("deletedhistory") && escUser){
if(Mode=="Block"||Mode=="Contrib"){
Tabs["DeletedContrib"] = '<a href="'+lrcGetPageURL('Special:DeletedContributions/'+User)+'" '
+ 'onClick="liveDeletedContrib('+escUser+'); return false;" '
+ 'title="'+lang_tooltips.DELETEDCONTRIB_TIP+'" '
+ '>'+lang_tooltips.DELETEDCONTRIB_TIP+'</a>';
}
}
// Delete /////////////////////////////////
if(lrcUserHasRight("delete")){
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Move"||Mode=="Protect"||Mode=="Edit"||Mode=="Revisiondelete"){
Tabs["Delete"] = '<a href="'+lrcGetUglyPageURL(Page,'&action=delete') + '" '
+ 'onClick="liveDelete('+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.DEL_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.DEL_TIP+'</a>';
}
}
// Protect /////////////////////////////////
if(lrcUserHasRight("protect")){
if(Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Move"||Mode=="Delete"||Mode=="Edit"||Mode=="Revisiondelete"){
Tabs["Protect"] = '<a href="'+lrcGetUglyPageURL(Page,'&action=protect') + '" '
+ 'onClick="liveProtect('+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.PROTECT_TIP+' « '+Page+' »" '
+ '>' +lang_tooltips.PROTECT_TIP+'</a>';
}
}
// Block /////////////////////////////////
if(lrcUserHasRight("block") && escUser){
if(Mode=="Contrib"||Mode=="DeletedContrib"){
Tabs["Block"] = '<a href="'+lrcGetPageURL('Special:Blockip/'+User)+'" '
+ 'onClick="liveBlock('+escUser+'); return false;" '
+ 'title="'+lang_tooltips.BLOCK_TIP+' « '+User+' »" '
+ '>'+lang_tooltips.BLOCK_TIP+'</a>';
}else if(Mode=="Article" && (PageNamespaceNumber==2 ||PageNamespaceNumber==3)){
var ThisUser = PageName.replace(/\/.*/g, "");
Tabs["Block"] = '<a href="'+lrcGetPageURL('Special:Blockip/'+ThisUser)+'" '
+ 'onClick="liveBlock('+lrcEscapeStr(ThisUser)+'); return false;" '
+ 'title="'+lang_tooltips.BLOCK_TIP+' « '+ThisUser+' »" '
+ '>'+lang_tooltips.BLOCK_TIP+'</a>';
}
}
var AllTabs = new Array();
for(var Tab in Tabs){
if(Tabs[Tab] != "") AllTabs.push(Tabs[Tab]);
}
AllTabs = AllTabs.join(" | ");
if(AllTabs=="") AllTabs = " ";
return AllTabs;
}
/* </source>
====== Special ======
<source lang="javascript"> */
function buildPreviewSpecialTabs(Args){
if(!lrcUserHasRight("autopatrol")) return " ";
var Mode = Args["Mode"];
var Page = Args["Page"];
var User1 = Args["User1"];
var User2 = Args["User2"];
var oldid = Args["Oldid"];
var patrolledDiff = Args["patrolledDiff"];
var Next = Args["Next"];
var SpecialTabs = "";
if(Mode=="Diff") {
if(!Next){
SpecialTabs += buildLiveUndo(Page, oldid, User1, User2);
}
SpecialTabs += (SpecialTabs==="" ? "" : ' • ') + buildLiveAverto(Page, User2, true);
}else if(Mode=="Article"){
SpecialTabs += buildLiveBlank(Page);
var User = Args["User1"];
var HasPageParam = true;
var PageNamespaceNumber = getNamespaceInfoFromPage(Page);
var PageName = getNamespaceInfoFromPage(Page, "PageName");
if(PageNamespaceNumber==2||PageNamespaceNumber==3){
User = PageName.replace(/\/.*/g,"");
HasPageParam = false;
}
if(User) SpecialTabs += (SpecialTabs==="" ? "" : ' • ') + buildLiveAverto(Page, User, HasPageParam);
}else if(Mode=="Contrib"||Mode=="DeletedContrib"){
if(lrcUserHasRight("autopatrol")) SpecialTabs += buildLiveAverto(Page, User1, false);
}
if(SpecialTabs==="") SpecialTabs = " ";
return SpecialTabs;
}
/* </source>
==== liveGoogleSearch ====
<source lang="javascript"> */
function liveGoogleSearch(PageName){
var OldGoogle = document.getElementById("lrcGoogleDiv");
if(OldGoogle) return;
var PreviewWindow = document.getElementById("livePreviewTitle");
if(!PreviewWindow) return;
var DivGoogle = document.createElement('div');
DivGoogle.id = "lrcGoogleDiv";
DivGoogle.setAttribute("style", "background-color:#F0F0FF;border:1px solid grey;width:99.8%;");
PreviewWindow.parentNode.insertBefore(DivGoogle, PreviewWindow);
var Titlebar = document.createElement('div');
Titlebar.setAttribute("style", "background-color:#F0F0FF;border:1px solid grey;padding:0.5em;");
Titlebar.innerHTML = '<b>' + lang_tooltips.GOOGLE_TIP + ' : « ' + PageName + ' »'
+ ' '
+ '<small>'
+ '<a href="javascript:;" title="'+lang_tooltips.GOOGLE_CLOSE_TIP+'" '
+ 'onClick="closeGoogleSearch()">['
+ lang_tooltips.GOOGLE_CLOSE_SHORT+']</a>'
+ '</small></b>';
DivGoogle.appendChild(Titlebar);
var Iframe = document.createElement('iframe');
Iframe.src = 'http://www.google.'+mw.config.get('wgContentLanguage')+'/search?q=%22'+PageName.replace(/ /g, "+")+'%22&num='+lrcParams["GoogleSearchLimit"];
Iframe.width = "99.8%";
Iframe.height = lrcParams["GoogleHeight"];
Iframe.setAttribute("style", "margin-left:3px");
DivGoogle.appendChild(Iframe);
}
function closeGoogleSearch(){
var GoogleDiv = document.getElementById("lrcGoogleDiv");
if(GoogleDiv) GoogleDiv.parentNode.removeChild(GoogleDiv);
}
/* </source>
==== liveTchat ====
<source lang="javascript"> */
function buildTchatWindow(){
var OldTchat = document.getElementById("liveTchat");
if(OldTchat) return;
var lvPreviewTitle = document.getElementById('livePreviewFoot');
if(!lvPreviewTitle) return;
var DivTchat = document.createElement('div');
DivTchat.id = "liveTchat";
DivTchat.setAttribute("style", "display:none;background-color:#F0F0FF;border:1px solid grey;width:99.8%;");
lvPreviewTitle.parentNode.insertBefore(DivTchat, lvPreviewTitle);
var Iframe = document.createElement('iframe');
Iframe.src = "http://webchat.freenode.net/?channels="+lrcTchatChannel+"&nick="+encodeURIComponent(mw.config.get('wgUserName').replace(/ /, "_"));
Iframe.width = "99.8%";
Iframe.height = lrcParams["TchatHeight"];
Iframe.setAttribute("style", "margin-left:3px");
DivTchat.appendChild(Iframe);
}
/* </source>
==== Fonctions automatiques ====
===== Blanchiment =====
<source lang="javascript"> */
function buildLiveBlank(Page){
if(!Page) return "";
var optBlank = "";
var optl = lstBlank.length;
for (j=0; j<optl; j++) {
optBlank += '<option value="' + lstBlank[j].resume + '" title="' + lstBlank[j].resume + '">' + lstBlank[j].tooltip + '</option>';
}
var BlankBar = '[<a id="LiveBlankLink" href="javascript:;" title="'+lang_menu.EMPTY+' « '+Page+' »" '
+ 'onClick="getLiveBlank('+lrcEscapeStr(Page)+');">'+lang_menu.EMPTY+'</a>] : '
+ '<select id="LiveBlankReason">' + optBlank + '</select>';
return BlankBar;
}
function getLiveBlank(page){
var BlankSelect = document.getElementById("LiveBlankReason");
if(!BlankSelect) return;
BlankSelect.disabled = "disabled";
var message = BlankSelect.value;
lrcDisableLink("LiveBlankLink");
blankPage(page, message);
}
function blankPage(page, message){
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+page.replace(/&/g, "%26"),
onSuccess: postBlankPage, page: page, message: message});
}
function postBlankPage(xmlreq, data){
var page=data.page;
var message=data.message;
var EditParam = new Array();
var ObjetXML = xmlreq.responseXML;
var Isprotected = false;
var PR = ObjetXML.getElementsByTagName("pr");
for(var a=0,l=PR.length;a<l;a++){
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && mw.config.get('wgUserGroups').indexOf(Level)==-1) Isprotected = true;
}
if(Isprotected){
alert('Page protégée');
return;
}
var Page = ObjetXML.getElementsByTagName("page")[0];
EditParam["token"] = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam["text"] = "";
EditParam["summary"] = encodeURIComponent(lang_messages.RESUMESTART+lang_messages.SPEEDDELETION+' ; ' + message);
EditParam["title"] = encodeURIComponent(page);
EditParam["watchlist"] = "preferences";
if(lrcParams["BypassWatchdefault"]) EditParam["watchlist"] = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam[Param]);
}
Params = Params.join("&");
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params});
}
/* </source>
===== Révocation =====
<source lang="javascript"> */
function buildLiveUndo(Page, oldid, User1, User2){
if(!Page || !oldid || !User1 || !User2 ) return "";
var specialNotice = "";
var rollbackButton = "";
if (User1 == User2) {
specialNotice = "<b style='color:red'>[" + lang_messages.SAME_EDITOR + "]</b> ";
rollbackButton = '[<a id="LiveRollbackLink" '
+ 'href="javascript:;" title="'+lang_menu.REVERT+' « '+User2+' » ('+Page+')" '
+ 'onClick="lrcUndo(' + lrcEscapeStr(Page) + ',' + lrcEscapeStr(User2) +');">'
+ lang_menu.REVERT + '</a>] • '
}
if (Page == lang_sandbox) {
specialNotice = "<b style='color:red'>[" + lang_messages.SANDBOX + "]</b> ";
}
var UndoBar = specialNotice + rollbackButton
+ '[<a id="LiveUndoLink" href="javascript:;" title="'+lang_menu.UNDORC+' « '+User2+' » ('+Page+')" '
+ 'onClick="lrcUndo(' + lrcEscapeStr(Page) + ',' + lrcEscapeStr(User2) +',' + oldid + ');">'
+ lang_menu.UNDORC + '</a>] • '
+ lang_menu.REASON+' : <input id="LiveRevertMessage" value="" />';
return UndoBar;
}
function LiveRC_RevertMessagesExtension_Init(){
var RevertInput = document.getElementById("LiveRevertMessage");
if(!RevertInput) return;
var Opt = '<option selected="selected" onClick="LiveRC_RevertMessagesExtension_Update()" value=""> </option>';
for(var a=0,l=lrcRevertMessages.length;a<l;a++){
Opt += '<option value="'+lrcRevertMessages[a].resume+'" '
+ 'onClick="LiveRC_RevertMessagesExtension_Update()" '
+ 'name="'+a+'">'+lrcRevertMessages[a].text+'</option>';
}
var Select = document.createElement('select');
Select.id = "LiveRevertMessage_List";
Select.innerHTML = Opt;
Select.style.display = "none";
Select.style.position = "relative" ;
Select.style.width = RevertInput.offsetWidth + "px" ;
Select.style.top = parseInt(RevertInput.offsetHeight) + "px";
Select.style.marginBottom = "-" + (20 + parseInt(RevertInput.offsetHeight)) + "px" ;
Select.style.marginLeft = "-"+RevertInput.offsetWidth+"px" ;
RevertInput.parentNode.insertBefore(Select, RevertInput.nextSibling);
Select.onkeyup = LiveRC_RevertMessagesExtension_KeyPress;
RevertInput.onmouseover = LiveRC_RevertMessagesExtension_Toggle;
RevertInput.onfocus = LiveRC_RevertMessagesExtension_Toggle;
}
function LiveRC_RevertMessagesExtension_Toggle(){
var RevertSelect = document.getElementById("LiveRevertMessage_List");
if(!RevertSelect) return;
if(RevertSelect.style.display == "none"){
RevertSelect.style.display = "inline";
}else{
RevertSelect.style.display = "none";
}
}
function LiveRC_RevertMessagesExtension_KeyPress(e){
if (!e) var e = window.event;
if (e.keyCode != 13) return;
LiveRC_RevertMessagesExtension_Update();
}
function LiveRC_RevertMessagesExtension_Update(){
var RevertInput = document.getElementById("LiveRevertMessage");
var RevertSelect = document.getElementById("LiveRevertMessage_List");
if(!RevertInput || !RevertSelect) return;
var InputValue = RevertInput.value;
if(InputValue!="") RevertInput.value += " ; ";
var Options = RevertSelect.getElementsByTagName('option');
for(var a=0,l=Options.length;a<l;a++){
if(!Options[a].selected) continue;
RevertInput.value = Options[a].value;
RevertInput.focus();
return;
}
}
function lrcUndo(title, user, oldid) {
lrcDisableLink('LiveUndoLink');
lrcDisableLink('LiveRollbackLink');
var summary = document.getElementById('LiveRevertMessage').value;
var requestHistory = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml'
+ '&action=query&prop=revisions|info&rvlimit=10'
+ '&rvprop=user|ids&intoken=edit&titles=' + encodeURIComponent(title);
wpajax.http({url: requestHistory, onSuccess: lrcUndoCB, title: title,
user: user, oldid: oldid, summary: summary});
}
function lrcUndoCB(xmlreq, data) {
var page = xmlreq.responseXML.getElementsByTagName('page')[0];
var token = page.getAttribute('edittoken');
var lst = xmlreq.responseXML.getElementsByTagName('revisions')[0].childNodes;
var user = data.user ? data.user : lst[0].getAttribute('user');
var curid = lst[0].getAttribute('revid');
var i;
for (i = 0; i < lst.length && lst[i].getAttribute('user') == user
&& lst[i].getAttribute('revid') != data.oldid; i++) {}
if (i == 0 || i == lst.length) return;
var oldUser = lst[i].getAttribute('user');
var oldid = lst[i].getAttribute('revid');
var summary = lang_messages.RESUMESTART+lrcMediawikiMessages["revertpage"];
summary = summary.split("$1").join(oldUser);
summary = summary.split("$2").join(user);
if (data.summary) summary += ' ; ' + data.summary;
var minorEdit = lrcParams["RvMinorEdit"] ? '&minor=1' : '';
var watchParam = lrcParams["BypassWatchdefault"] ? '&watchlist=nochange' : '&watchlist=preferences';
var requestEditData = 'title=' + encodeURIComponent(data.title)
+ '&token=' + encodeURIComponent(token)
+ '&summary=' + encodeURIComponent(summary)
+ '&undo=' + curid + '&undoafter=' + oldid + watchParam + minorEdit
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers, data: requestEditData});
}
/* </source>
===== Avertissement =====
<source lang="javascript"> */
function buildLiveAverto(Page, User, WithPage){
if(!Page || !User) return "";
var optAvert = "";
var optl = lstAvert.length;
for (j=0; j<optl; j++) {
optAvert += '<option value="'+lstAvert[j].template;
if(lstAvert[j].hasPage && WithPage) optAvert += '|1='+Page.replace(/\"/g, "");
optAvert += '">'+lstAvert[j].string+'</option>';
}
var AvertoBar = '[<a id="LiveAvertoLink" href="javascript:;" title="'+lang_menu.AVERTS+' « '+User+' »" '
+ 'onClick="getLiveAverto('+lrcEscapeStr(User)+');">'+lang_menu.AVERTS+'</a>] : '
+ '<select id="averto">' + optAvert + '</select>';
return AvertoBar;
}
function getLiveAverto(user) {
lrcDisableLink('LiveAvertoLink');
var link = document.getElementById('LiveAvertoLink');
document.getElementById('averto').disabled = true;
var message = document.getElementById('averto').value;
var summary = message.split("|1=").join("|");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+mw.config.get('wgFormattedNamespaces')[3]+":"+user.replace(/&/g, "%26"),
onSuccess: postLiveAverto,
user: user, message: message, summary:summary });
}
function postLiveAverto(xmlreq, data) {
var user = data.user;
var message = data.message;
var Summary = data.summary;
var EditParam = new Array();
var ObjetXML = xmlreq.responseXML;
var Isprotected = false;
var PR = ObjetXML.getElementsByTagName("pr");
for(var a=0,l=PR.length;a<l;a++){
var Type = PR[a].getAttribute("type");
var Level = PR[a].getAttribute("level");
if(Type=="edit" && mw.config.get('wgUserGroups').indexOf(Level)==-1) Isprotected = true;
}
if(Isprotected){
alert('Page protégée');
return;
}
var Page = ObjetXML.getElementsByTagName("page")[0];
EditParam["token"] = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam["appendtext"] = encodeURIComponent('\n\n{{subst:' + message + '}} ~~~~\n');
EditParam["summary"] = encodeURIComponent(lang_messages.RESUMESTART + lang_messages.WARNING + ' ' + Summary.replace(new RegExp(/\|(.*)/),
' ' + lang_messages.ON_ARTICLE + ' [[$1]]') + ' !');
//EditParam["recreate"] = 1;
EditParam["title"] = mw.config.get('wgFormattedNamespaces')[3]+":"+encodeURIComponent(user);
EditParam["watchlist"] = "preferences";
if(lrcParams["BypassWatchdefault"]) EditParam["watchlist"] = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam[Param]);
}
Params = Params.join("&");
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
data: Params});
}
/* </source>
==== Module de gestion des variables ====
<source lang=javascript> */
// Récupération oldid de la page de paramétrage
function LiveRC_ManageParams_GetOldParamsOldid(RequeteOldid){
var Oldid = "cur";
var ObjetXML = RequeteOldid.responseXML;
if(ObjetXML){
var LastRevision = ObjetXML.getElementsByTagName('rev')[0];
if(LastRevision){
Oldid = LastRevision.getAttribute('revid');
}
}
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=User:' + encodeURIComponent(mw.config.get('wgUserName')) + '/LiveRCparam.js&action=raw&oldid=' + Oldid, onSuccess:LiveRC_ManageParams_GetOldParams });
}
// Récupération de la page de paramétrage
function LiveRC_ManageParams_GetOldParams(Req){
var Response = Req.responseText;
if(Response=="") return;
var ResponseLines = Response.split('\n');
for(var line = 0,linelength=ResponseLines.length;line<linelength;line++){
var ThisLine = ResponseLines[line];
if(ThisLine.indexOf(LiveRC_ExtensionSetupComment)!=-1){
for(var a=0,l=lrcExtensions.length;a<l;a++){
if(ThisLine.indexOf("|"+lrcExtensions[a]["name"]+"|")!=-1){
lrcExtensions[a]["Installed"] = true;
}
}
}
}
}
function LiveRC_ManageParams_Fill(OptionArray, ArrayName, AddButton){
LiveRC_Params[ArrayName] = new Array();
for(var Param in OptionArray){
var ParamName = Param;
var ParamOldValue = OptionArray[Param];
var ParamType = typeof(ParamOldValue); // 'number', 'string', 'boolean', 'object'
if(ParamType == 'number' || ParamType == 'string' || ParamType == 'boolean' || ParamType == 'object'){
var NewArray = {
"Type" : "Variable",
"Name" : ParamName,
"Desc" : LiveRC_ManageParams_Translate(ParamName, 0),
"ValueType" : ParamType,
"OldValue" : ParamOldValue,
"AddButton" : (AddButton ? true : false)
}
if(LiveRC_Params[ArrayName].indexOf(NewArray)==-1) LiveRC_Params[ArrayName].push(NewArray);
}
}
}
// Ouverture du menu
function LiveRC_ManageParams_OpenMenu(){
var OldMenu = document.getElementById("LiveRC_ParamMenu");
if(OldMenu){
LiveRC_ManageParams_CloseMenu();
return;
}
var OptionBar = document.getElementById("livePreviewFoot");
if(!OptionBar) return;
LiveRC_ManageParams_Fill(lrcParams, "lrcParams");
LiveRC_ManageParams_Fill(lrcOptionMenuValues, "lrcOptionMenuValues");
LiveRC_ManageParams_Fill(lstBlank, "lstBlank", true);
LiveRC_ManageParams_Fill(lrcRevertMessages, "lrcRevertMessages", true);
LiveRC_ManageParams_Fill(lstAvert, "lstAvert", true);
LiveRC_ManageParams_Fill(lrcIcon, "lrcIcon");
LiveRC_ManageParams_Fill(lang_menu, "lang_menu");
LiveRC_ManageParams_Fill(lang_tooltips, "lang_tooltips");
LiveRC_ManageParams_Fill(lang_messages, "lang_messages");
LiveRC_ManageParams_Fill(lrcManageParamsText, "lrcManageParamsText");
LiveRC_ManageParams_Fill(lrcManageParams_Desc, "lrcManageParams_Desc");
LiveRC_RunHooks("AfterFillParamPanel");
var Menu = document.createElement('div');
Menu.id = "LiveRC_ParamMenu";
Menu.setAttribute("style", "width:99.8%;border:1px solid gray;background-color:#F0F0FF;");
Menu.appendChild(LiveRC_ManageParams_CreateActionButtons());
var GlobalFieldset = document.createElement('fieldset');
GlobalFieldset.setAttribute("style", "margin:0.2em;");
var GlobalLegend = document.createElement('legend');
GlobalLegend.innerHTML = lrcManageParamsText["LegendTitle"];
GlobalFieldset.appendChild(GlobalLegend);
var Form = document.createElement('form');
Form.id = "LiveRC_ParamMenuForm";
for(var ThisVariableIndex in LiveRC_Params){
var ArrayVariable = LiveRC_Params[ThisVariableIndex];
var VariableFieldset = document.createElement('fieldset');
VariableFieldset.id = "LiveRC_ParamMenu_"+ThisVariableIndex;
VariableFieldset.setAttribute("style", "text-align:left;");
var VariableLegend = document.createElement('legend');
VariableLegend.appendChild(document.createTextNode(LiveRC_ManageParams_Translate(ThisVariableIndex, 0)));
VariableFieldset.appendChild(VariableLegend);
var VariableUl = document.createElement('ul');
var Columns = "";
if(!ArrayVariable[0]) continue;
if(ArrayVariable[0]["ValueType"]!='object') Columns ="-moz-column-count:2;-webkit-column-count:2;column-count:2;";
VariableUl.setAttribute("style", "list-style:none;list-image:none;margin:0;"+Columns);
VariableFieldset.appendChild(VariableUl);
for(var a=0,l=ArrayVariable.length;a<l;a++){
var ThisVariable = ArrayVariable[a];
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText["LiStyle"]);
var AddButton = ThisVariable["AddButton"];
if(ThisVariable["ValueType"]!='object'){
var Input = document.createElement('input');
Input.id = ThisVariable["Name"];
Input.name = ThisVariable["Name"];
if(ThisVariable["ValueType"]=="boolean"){
Input.type = "checkbox";
if(ThisVariable["OldValue"]) Input.checked = "checked";
}else{
Input.type = "text";
Input.size = 30;
Input.setAttribute("style", "padding:2px;margin:0");
Input.value = ThisVariable["OldValue"];
}
var Label = document.createElement('label');
Label.setAttribute('for', ThisVariable["Name"]);
Label.innerHTML = ThisVariable["Desc"];
P.appendChild(Input);
P.appendChild(document.createTextNode(" "));
P.appendChild(Label);
}else{
for(var VarIndex in ThisVariable["OldValue"]){
var Input = document.createElement('input');
Input.id = VarIndex;
Input.name = VarIndex;
if(typeof(ThisVariable["OldValue"][VarIndex])=="boolean"){
Input.type = "checkbox";
if(ThisVariable["OldValue"][VarIndex]) Input.checked = "checked";
}else{
Input.type = "text";
if(typeof(ThisVariable["OldValue"][VarIndex])=="string") Input.size = 40;
if(typeof(ThisVariable["OldValue"][VarIndex])=="number") Input.size = 15;
Input.setAttribute("style", "padding:2px;margin:0");
Input.value = ThisVariable["OldValue"][VarIndex];
}
var Label = document.createElement('label');
Label.setAttribute('for', VarIndex);
Label.innerHTML = VarIndex;
P.appendChild(Label);
P.appendChild(document.createTextNode(":"));
P.appendChild(Input);
P.appendChild(document.createTextNode(" "));
}
if(AddButton) P.appendChild(LiveRC_ManageParams_AddDeleteLink());
}
VariableUl.appendChild(P);
}
if(AddButton){
var P = document.createElement('li');
var Types = new Array()
for(var VarIndex in ThisVariable["OldValue"]){
Types.push(lrcEscapeStr(VarIndex)+":"+lrcEscapeStr(typeof(ThisVariable["OldValue"][VarIndex])));
}
P.innerHTML = '<a id="AddParam_'+ThisVariableIndex+'" href="javascript:LiveRC_ManageParams_AddNewParam('+lrcEscapeStr(ThisVariableIndex)+', {'+Types.join(",")+'});" >(+)</a>';
VariableUl.appendChild(P);
}
Form.appendChild(VariableFieldset);
}
GlobalFieldset.appendChild(Form);
Menu.appendChild(GlobalFieldset);
OptionBar.parentNode.insertBefore(Menu, OptionBar.nextSibling);
LiveRC_ManageParams_AddExtensionsMenu();
LiveRC_ManageParams_CreateToggleButtons();
LiveRC_ManageParams_ToggleMenu();
}
function LiveRC_ManageParams_AddExtensionsMenu(){
var Form = document.getElementById("LiveRC_ParamMenuForm");
if(!Form) return;
var ExtensionFieldset = document.createElement('fieldset');
ExtensionFieldset.id = "LiveRC_ParamMenu_ExtensionsLegend";
var ExtensionLegend = document.createElement('legend');
ExtensionLegend.appendChild(document.createTextNode(LiveRC_ManageParams_Translate("ExtensionsLegend", 0)));
ExtensionFieldset.appendChild(ExtensionLegend);
var ExtensionUl = document.createElement('ul');
ExtensionUl.setAttribute("style", "list-style:none;list-image:none;margin:0;");
ExtensionFieldset.appendChild(ExtensionUl);
for(var a=0,l=lrcExtensions.length;a<l;a++){
var ThisExtension = lrcExtensions[a];
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText["LiStyle"]);
var Input = document.createElement('input');
Input.id = ThisExtension["name"];
Input.name = ThisExtension["name"];
Input.type = "checkbox";
if(ThisExtension["Installed"] && ThisExtension["Installed"]==true) Input.checked = "checked";
var Label = document.createElement('label');
Label.setAttribute('for', ThisExtension["name"]);
Label.innerHTML = '<a href="'+ThisExtension["url"] + '" target="_blank" >'+ThisExtension["name"]+'</a> : ' +ThisExtension["desc"];
P.appendChild(Input);
P.appendChild(document.createTextNode(" "));
P.appendChild(Label);
ExtensionUl.appendChild(P);
}
Form.appendChild(ExtensionFieldset);
}
function LiveRC_ManageParams_Translate(Text, Index){
if(!Index) Index == 0;
for(var Vars in lrcManageParams_Desc){
if(" Desc"+Text == " "+Vars) return lrcManageParams_Desc[Vars][Index];
}
return ("<"+Text+">").htmlize();
}
//
function LiveRC_ManageParams_AddNewParam(Id, Vars){
var Link = document.getElementById('AddParam_'+Id);
if(!Link) return;
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText["LiStyle"]);
for(var iName in Vars){
var Label = document.createElement('label');
Label.setAttribute('for', iName);
Label.innerHTML = iName;
var Input = document.createElement('input');
Input.id = iName;
Input.name = iName;
if(Vars[iName]=="boolean"){
Input.type = "checkbox";
}else{
Input.type = "text";
Input.size = 40;
Input.setAttribute("style", "padding:2px;margin:0");
Input.value = "";
}
P.appendChild(Label);
P.appendChild(document.createTextNode(":"));
P.appendChild(Input);
P.appendChild(document.createTextNode(" "));
}
P.appendChild(LiveRC_ManageParams_AddDeleteLink());
var Li = Link.parentNode;
Li.parentNode.insertBefore(P, Li);
}
function LiveRC_ManageParams_AddDeleteLink(){
var Link = document.createElement('a');
Link.innerHTML = ('(–)');
Link.href = "javascript:;"
Link.onclick = function(){ LiveRC_ManageParams_DeleteThisParam(this); }
return Link;
}
function LiveRC_ManageParams_DeleteThisParam(Link){
var Line = Link.parentNode;
Line.parentNode.removeChild(Line);
}
// Création boutons d’action ( Valider / Annuler / RAZ )
function LiveRC_ManageParams_CreateActionButtons(){
var ActionP = document.createElement('p');
var Center = document.createElement('center');
var OKInput = document.createElement('input');
OKInput.type = "button";
OKInput.value = lrcManageParamsText["OK"];
OKInput.onclick = function(){ LiveRC_ManageParams_CheckMenu(); }
OKInput.onselect = function(){ LiveRC_ManageParams_CheckMenu(); }
Center.appendChild(OKInput);
var CancelInput = document.createElement('input');
CancelInput.type = "button";
CancelInput.value = lrcManageParamsText["Cancel"];
CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(); }
CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(); }
Center.appendChild(CancelInput);
var RAZInput = document.createElement('input');
RAZInput.type = "button";
RAZInput.value = lrcManageParamsText["RAZ"];
RAZInput.onclick = function(){ LiveRC_ManageParams_RAZParams(); }
RAZInput.onselect = function(){ LiveRC_ManageParams_RAZParams(); }
Center.appendChild(RAZInput);
ActionP.appendChild(Center);
return ActionP;
}
function LiveRC_ManageParams_CreateToggleButtons(){
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_ParamMenu_").join("");
var Input = document.createElement('input');
Input.id = "LiveRC_ParamMenuInput_"+Id;
Input.type = "button";
Input.setAttribute("style", "padding:0;");
Input.value = LiveRC_ManageParams_Translate(Id, 1);
Input.onclick = function(){ LiveRC_ManageParams_ToggleMenu(this); };
Input.onselect = function(){ LiveRC_ManageParams_ToggleMenu(this); };
P.appendChild(Input);
}
Form.parentNode.insertBefore( P, Form);
}
function LiveRC_ManageParams_ToggleMenu(Input){
var Id = false;
if(Input) Id = Input.id.split("LiveRC_ParamMenuInput_").join("LiveRC_ParamMenu_");
var Form = document.getElementById("LiveRC_ParamMenuForm");
var Onglets = document.getElementById("ToggleButtons").getElementsByTagName('input');
var Fieldsets = Form.getElementsByTagName('fieldset');
for(var a=0,l=Fieldsets.length;a<l;a++){
if(Id){
Onglets[a].setAttribute("style", ((Id == Fieldsets[a].id)? "font-weight:bold;padding:0;" : "padding:0;") );
Fieldsets[a].style.display = ((Id == Fieldsets[a].id)? "" : "none");
}else{
Onglets[a].setAttribute("style", ((a==0)? "font-weight:bold;padding:0;" : "padding:0;") );
Fieldsets[a].style.display = ((a==0)? "" : "none");
}
}
}
// Fermeture du menu
function LiveRC_ManageParams_CloseMenu(){
var Menu = document.getElementById("LiveRC_ParamMenu");
if(Menu) Menu.parentNode.removeChild(Menu);
}
// Vérification du menu
function LiveRC_ManageParams_CheckMenu(){
var Menu = document.getElementById("LiveRC_ParamMenu");
if(!Menu) return;
// Variables
var FieldSets = Menu.getElementsByTagName('fieldset');
for(var b=0,m=FieldSets.length;b<m;b++){
var ArrayName = FieldSets[b].id.split("LiveRC_ParamMenu_").join("");
if(!LiveRC_Params[ArrayName]) continue;
var Lis = FieldSets[b].getElementsByTagName('li');
var Type = Lis[0].getElementsByTagName('input').length;
for(var a=0,l=Lis.length;a<l;a++){
var Inputs = Lis[a].getElementsByTagName('input');
if(Inputs.length==0) continue;
if(Type>1){ // ------------------------- object
if(typeof(LiveRC_Params[ArrayName][a])=='undefined'){
LiveRC_Params[ArrayName][a] = new Array();
}
var NewValue = new Array();
for(var i=0,il=Inputs.length;i<il;i++){
var Input = Inputs[i];
var iName = Input.name;
var iValue;
if(Input.type=="checkbox"){
iValue = (Input.checked ? "true" : "false");
}else{
iValue = lrcEscapeStrHTML(Input.value);
}
NewValue.push(lrcEscapeStr(iName)+":"+iValue);
}
LiveRC_Params[ArrayName][a]["NewValue"] = "{ "+NewValue.join(", ")+" }";
}else{ // ------------------------- boolean, number, text
var Input = Inputs[0];
if(!Input) continue;
var InputName = Input.name;
var InputType = Input.type;
var InputId = Input.id;
if(InputName){
if(InputType=="text"){
for(var i=0,j=LiveRC_Params[ArrayName].length;i<j;i++){
if(LiveRC_Params[ArrayName][i]["Name"] != InputName) continue;
if(LiveRC_Params[ArrayName][i]["ValueType"] == "string") LiveRC_Params[ArrayName][i]["NewValue"] = lrcEscapeStrHTML(Input.value);
if(LiveRC_Params[ArrayName][i]["ValueType"] == "number") LiveRC_Params[ArrayName][i]["NewValue"] = parseInt(Input.value);
}
}
if(InputType=="checkbox"){
for(var i=0,j=LiveRC_Params[ArrayName].length;i<j;i++){
if(LiveRC_Params[ArrayName][i]["Name"] != InputName) continue;
LiveRC_Params[ArrayName][i]["NewValue"] = (Input.checked ? "true" : "false");
}
}
}
}
}
}
// Extensions
var ExtensionsFieldset = document.getElementById("LiveRC_ParamMenu_ExtensionsLegend");
var Inputs = ExtensionsFieldset.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
var iName = Inputs[a].name;
if(Inputs[a].checked){
for(var b=0,m=lrcExtensions.length;b<m;b++){
var ExtName = lrcExtensions[b]["name"];
if(ExtName==iName) lrcExtensions[b]["ToInstall"] = true;
}
}
}
LiveRC_ManageParams_CreateNewParamPage();
}
// Création nouveau script (≠RAZ)
function LiveRC_ManageParams_CreateNewParamPage(){
var ParamPage = "// "+lrcManageParamsText["Comment"]+ "\n";
var Variables = "\n/* ** "+lrcManageParamsText["VariableLegend"] + " ** */\n\n";
for(var ArrayName in LiveRC_Params){
var ThisArray = LiveRC_Params[ArrayName];
Variables += " // "+ LiveRC_ManageParams_Translate(ArrayName, 0) +"\n";
if(ThisArray[0]["Name"] === 0 || ThisArray[0]["Name"] === "0" ){
var AllValues = new Array()
for(var i=0,j=ThisArray.length;i<j;i++){
if(typeof(ThisArray[i]["NewValue"])!="undefined") AllValues.push("\n "+ThisArray[i]["NewValue"]);
}
Variables += ArrayName + " = [" + AllValues.join(", ") + "\n];\n";
}else{
for(var i=0,j=ThisArray.length;i<j;i++){
Variables += ArrayName +"[\""+ThisArray[i]["Name"]+"\"] = "+ThisArray[i]["NewValue"] + ";\n";
}
}
Variables += "\n";
}
//alert(Variables); return;
try{ eval(Variables); }catch(e){ }
ParamPage += Variables;
var Extensions = "\n/* ** "+lrcManageParamsText["ExtensionLegend"] + " ** */\n\n"
+ LiveRC_ExtensionSetupComment;
var ExtensionList = "";
for(var ArrayName in lrcExtensions){
var ThisArray = lrcExtensions[ArrayName];
if(ThisArray["ToInstall"] === true){
Extensions += " |"+ThisArray["name"]+"|";
ExtensionList += "// "+ThisArray["name"]+ " : "+ThisArray["desc"]+"\n"
+ "importScriptURI('"+ThisArray["url"]+"&action=raw&ctype=text/javascript');\n"
}
}
Extensions += "\n\n"+ExtensionList;
ParamPage += Extensions;
LiveRC_ManageParams_UpdateParams(ParamPage);
}
// Création nouveau script (RAZ)
function LiveRC_ManageParams_RAZParams(){
var ParamPage = "// "+lrcManageParamsText["Comment"]+ "\n";
LiveRC_ManageParams_UpdateParams(ParamPage);
}
// Édition et sauvegarde du script
function LiveRC_ManageParams_UpdateParams(NewPage){
NewPage = NewPage + "\n" + LiveRC_ParamComment;
var Menu = document.getElementById("LiveRC_ParamMenuForm");
var P = document.getElementById("LiveRC_ParamMenuRunning");
if(!P){
P = document.createElement('p');
P.id = "LiveRC_ParamMenuRunning";
Menu.insertBefore(P,Menu.firstChild);
}
if(P) P.innerHTML = lrcManageParamsText["EditRunning"].split("$1").join(mw.config.get('wgFormattedNamespaces')[2]+":"+mw.config.get('wgUserName')+"/LiveRCparam.js");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+mw.config.get('wgFormattedNamespaces')[2]+':' + mw.config.get('wgUserName').replace(/&/g, "26") + '/LiveRCparam.js&action=edit',
onSuccess: LiveRC_ManageParams_SaveParams, param:NewPage});
}
function LiveRC_ManageParams_SaveParams(Req, data){
var NewPage = data.param;
var Temp = document.createElement('div');
Temp.id = "TempDiv";
Temp.style.display = "none";
document.body.insertBefore(Temp, document.body.firstChild);
Temp.innerHTML = Req.responseText;
var Textarea = getElementWithId("wpTextbox1", 'textarea', Temp);
var OldText = Textarea.value;
var NewText = "\n"+OldText;
if(OldText.indexOf(LiveRC_ParamComment)!=-1){
NewText = OldText.substring((OldText.indexOf(LiveRC_ParamComment)+LiveRC_ParamComment.length), OldText.length);
}
Textarea.value = NewPage+NewText;
getElementWithId("wpSummary", 'input', Temp).value = lang_messages.RESUMESTART + lrcManageParamsText["Comment"];
var P = document.getElementById("LiveRC_ParamMenuRunning");
if(P) P.innerHTML += "<br />"
+ lrcManageParamsText["SaveRunning"].split("$1").join(mw.config.get('wgFormattedNamespaces')[2]+":"+mw.config.get('wgUserName')+"/LiveRCparam.js");
var Editform = getElementWithId("editform", 'form', Temp);
var action = Editform.action;
var params = new Array();
var Params = getFormParams(Editform);
for(var Param in Params){
params.push(Param+"="+encodeURIComponent(Params[Param]));
}
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST", headers: headers,
onSuccess:LiveRC_ManageParams_SaveParamsDone,
data: params.join("&")
});
if(Temp) Temp.parentNode.removeChild(Temp);
}
function LiveRC_ManageParams_SaveParamsDone(Req){
var P = document.getElementById("LiveRC_ParamMenuRunning");
if(P) P.innerHTML += "<br />"
+ lrcManageParamsText["SaveDone"].split("$1").join(mw.config.get('wgFormattedNamespaces')[2]+":"+ mw.config.get('wgUserName')+"/LiveRCparam.js" )
+ "<br/>" + lrcManageParamsText["SaveRefresh"];
}
/* </source>
==== Miscellaneous ====
<source lang="javascript"> */
function getElementWithId( elementId , elementTagName , elementParentNode ){
if(!elementParentNode) elementParentNode = document;
if (elementParentNode.getElementById) return elementParentNode.getElementById(elementId);
var TheElement = false;
var Elements = elementParentNode.getElementsByTagName(elementTagName);
var elementcount = 0;
while(elementcount<Elements.length){
var Id = Elements[elementcount].getAttribute('id');
if(Id){
if(Id==elementId){
TheElement = Elements[elementcount];
break;
}
}
elementcount++
}
if (! TheElement) return null;
return TheElement;
}
function showHideObj(parent, fils) {
var ofils = document.getElementById( fils );
if (parent.checked)
ofils.style.display="";
else
ofils.style.display="none";
}
function lrcDisplayDebug(text){
var DebugDiv = document.getElementById("debug");
var DebugUl = document.getElementById("debug_ul");
var DebugLogo = document.getElementById("debug_Logo");
var Logo = document.getElementById("lrcLogo");
var AnimatedLogo = document.getElementById("lrcAnimatedLogo");
if(!text || text == ""){
if(Logo && AnimatedLogo){
Logo.style.display = "";
AnimatedLogo.style.display = "none";
}
if(!lrcParams["DisplayDebug"]) return;
if(DebugDiv) DebugDiv.style.display = "none";
if(DebugUl) DebugUl.innerHTML = "";
}else{
if(Logo && AnimatedLogo){
Logo.style.display = "none";
AnimatedLogo.style.display = "";
}
if(!lrcParams["DisplayDebug"]) return;
if(DebugDiv) DebugDiv.style.display = "block";
if(DebugUl) DebugUl.innerHTML += '<li>' + text + '</li>';
}
}
function generateNewID() {
nextFreeID++;
return "idauto" + nextFreeID;
}
function canRevertUser(user) {
return user == mw.config.get('wgUserName') || user == 'Salebot';
}
// HTMLize
String.prototype.htmlize = function() {
var chars = new Array('&','<','>','"');
var entities = new Array('amp','lt','gt','quot');
var string = this;
for (var i=0; i<chars.length; i++) {
var regex = new RegExp(chars[i], "g");
string = string.replace(regex, '&' + entities[i] + ';');
}
return string;
}
function lrcGetPageURL(page) {
return mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(encodeURI(page));
}
function lrcGetUglyPageURL(page, params) {
return mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURI(page)+ (params ? params : "");
}
function lrcGetUserLink(user) {
var regexpIP = /^\d{1,3}\.\d{1,3}.\d{1,3}.\d{1,3}$/;
var prefix = mw.config.get('wgFormattedNamespaces')[2]+":";
var LiveFunction = "liveArticle("+lrcEscapeStr(prefix+user)+");";
if (regexpIP.exec(user)) {
prefix = "Special:Contributions/";
LiveFunction = "liveContrib("+lrcEscapeStr(user)+");";
}
var link = '<a class="lrc_EditorLink" '
+ 'href="' + lrcGetPageURL(prefix + user) + '" '
+ 'onClick="'+LiveFunction+' return false;" '
+ '>' + lrcStripString(user, lrcParams["UserLengthLimit"]) + '</a>';
return link;
}
/* Returns s such that, when a piece of js code containing s is inserted in the
property innerHTML of an element, the evaluation of s is the string str. */
function lrcEscapeStr(str) {
return "'" + (""+str).replace(/\\/g, '\\\\').replace(/'/g, '\\\'').htmlize() + "'";
}
function lrcEscapeStrHTML(str) {
return "'" + (""+str).replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + "'";
}
function lrcComputeWatchParam(doc) {
var result;
if (lrcParams["BypassWatchdefault"]) {
result = doc.getElementById('ca-unwatch');
}
else {
result = doc.getElementById('wpWatchthis').checked;
}
return result ? "&wpWatchthis=1" : "";
}
function lrcStripString(string, limit){
if(!limit || string.length<limit) return string;
return string.substring(0, limit) + "…";
}
function lrcDisableLink(id) {
var lnk = document.getElementById(id);
if (!lnk) return;
lnk.href = "javascript:;";
lnk.style.color = "silver";
lnk.style.cursor = "default";
lnk.style.textDecoration = "none";
}
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
for (i = 0, j = 0; i < elsLen; i++) {
if (pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function tsToHhMm(timestamp) {
var tz;
var match;
if (lrcParams["TZ"]) {
var regex = new RegExp(/^([-+])?(\d?\d):?(\d\d)$/);
match = regex.exec(lrcParams["TZ"]);
if (!match) {
//livercError(lang_error.TZ);
return 'xx:xx';
}
tz = match[2]*60 + match[3]*1;
tz = match[1] == '-' ? -tz : tz;
} else {
var now = new Date();
tz = -now.getTimezoneOffset();
}
var regex = new RegExp(/^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/);
match = regex.exec(timestamp);
if (!match) {
//livercError(lang_error.timestamp);
return 'xx:xx';
}
var tt = (match[1]*60 + match[2]*1 + tz + 1440) % 1440;
var mm = tt % 60;
var hh = (tt - mm) / 60 % 24;
return hh + ':' + (mm < 10 ? '0' : '') + mm;
}
function lrcGetArgFromURL(URL, Arg){
if(!URL || !Arg) return false;
try{
var Args = decodeURIComponent(URL).split("&");
for(var a=0,l=Args.length;a<l;a++){
if(Args[a].indexOf(Arg+"=")!=-1) return Args[a].split("=")[1];
}
}catch(e){
return false;
}
return false;
}
function getNamespaceInfoFromPage(Page, ToReturn){
if(!ToReturn) ToReturn = false;
var NamespaceNumber = 0;
var NamespaceName = "";
var PageName = Page;
var Found = false;
for(var NS in mw.config.get('wgFormattedNamespaces')){
if(Found) continue;
var ThisNamespaceName = mw.config.get('wgFormattedNamespaces')[NS];
if(ThisNamespaceName==="") continue;
var NamespaceNameRegExp = new RegExp("^"+ThisNamespaceName+":", "ig");
var Matches = Page.match(NamespaceNameRegExp);
if(Matches!=null && Matches.length == 1){
NamespaceNumber = parseInt(NS);
NamespaceName = ThisNamespaceName;
PageName = Page.replace(NamespaceNameRegExp, "");
Found = true;
}
}
if(ToReturn==="NamespaceName") return NamespaceName;
if(ToReturn==="PageName") return PageName;
return NamespaceNumber;
}
function getFormFromThisInput(Input){
//if(!Input) return null;
var Element = Input.parentNode;
while(Element){
if(Element.tagName && Element.tagName.toLowerCase() == 'form') return Element;
Element = Element.parentNode;
}
return null
}
function getFormParams(Form){
var Params = new Array();
var Tags = new Array("textarea", "select", "input");
for(var a=0,l=Tags.length;a<l;a++){
var Elements = Form.getElementsByTagName(Tags[a]);
for(var b=0,m=Elements.length;b<m;b++){
var Element = Elements[b];
var ElName = Element.name;
var ElValue = Element.value;
var ElType = Element.type;
if(Tags[a].toLowerCase()=='input' && (ElType == "checkbox" || ElType == "radio") && Element.checked){
Params[ElName] = ElValue;
}else if(Tags[a].toLowerCase()=='input' && (ElType == "text" || ElType == "hidden") ){
Params[ElName] = ElValue;
}else if(Tags[a].toLowerCase()!='input'){
Params[ElName] = ElValue;
}
}
}
return Params;
}
function updatePreviewWindowAttributes(){
var LP = document.getElementById( 'livePreview' );
if(!LP) return;
LP.style.height = lrcParams["PreviewHeight"];
LP.scrollTop = 0;
}
function updateRCTypeSelect(){
var RCTypeSelector = document.getElementById("showUsers")
var RCTypeOptions = RCTypeSelector.getElementsByTagName('option');
var OptionsSet = false;
for(var a=0,l=RCTypeOptions.length;a<l;a++){
if(RCTypeOptions[a].value == lrcOptionMenuValues.RCType) RCTypeOptions[a].selected = "selected";
}
if(!OptionsSet){
lrcOptionMenuValues.RCType == "ALLUSERS"
if(lrcUserHasRight("autopatrol")) lrcOptionMenuValues.RCType == "IPNEW";
RCTypeSelector = lrcOptionMenuValues.RCType;
}
}
function updateNSSelect(){
var Select = document.getElementById("showNS0");
var OptionsNS = Select.getElementsByTagName('option');
for(var a=0,l=OptionsNS.length;a<l;a++){
if(OptionsNS[a].value === lrcOptionMenuValues.RCns || parseInt(OptionsNS[a].value) === lrcOptionMenuValues.RCns){
Select.value = lrcOptionMenuValues.RCns;
}
}
}
/* </source>
=== Fonctions d'initialisation ===
==== addOnloadHook ====
<source lang="javascript"> */
addOnloadHook(function () {
if (mw.config.get('wgTitle') == "Dereckson/LiveRC" && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")) {
// Check LiveRC version
var VersionContainer = document.getElementById("currentVersion");
if(VersionContainer){
if(VersionContainer.innerHTML != LiveRC_Version){
VersionContainer.parentNode.innerHTML += '<br/>'+lang_messages.NEW_VERSION.split("$1").join(LiveRC_Version);
}else{
VersionContainer.innerHTML = '<span style="color:green;font-weight:bold">'+LiveRC_Version+'</span>';
}
}
// Hide elements
if(lrcParams["HideUselessElements"]){
var ElementsToHide = new Array("top", "topbar", "siteSub", "sitesub", "contentSub", "subtitle", "RealTitleBanner", "RealTitle", "p-cactions", "left-navigation", "right-navigation", "subpages", "footer" );
for(var a=0,l=ElementsToHide.length;a<l;a++){
var Element = new Array(document.getElementById(ElementsToHide[a]));
if(Element[0] == null) Element = getElementsByClass(ElementsToHide[a]);
if (Element[0] != null){
for(var b=0,c=Element.length;b<c;b++){
Element[b].setAttribute("style", "display:none");
}
}
}
}
// Set preview height
updatePreviewWindowAttributes();
// Update icons
for(var Icon in lrcIcon){
var IconContainer = document.getElementById("lrcIcon_"+Icon);
if(!IconContainer) continue;
IconContainer.innerHTML = lrcIcon[Icon];
}
// Set Contact list
var _len = lstContact.length;
lstContact2 = new Array();
for (var _i=0; _i<_len; _i++)
lstContact2[lstContact[_i]] = {ts: 0, fromjs: true};
// Start
lrcDisplayDebug("Get extensions");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=revisions&rvlimit=1&rvprop=ids&titles=User:'+encodeURIComponent(mw.config.get('wgUserName')) + "/LiveRCparam.js",
onSuccess: LiveRC_ManageParams_GetOldParamsOldid});
lrcDisplayDebug("Get user rights");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=userinfo&uiprop=rights&format=xml',
onSuccess: getRights});
}
// Add LiveRC link in left panel
var RCLi = document.getElementById("n-recentchanges");
if(RCLi){
var LiveRCLi = document.createElement('li');
LiveRCLi.id = 'n-liveRC';
var LiveRCLink = document.createElement('a');
LiveRCLink.title = 'LiveRC';
LiveRCLink.href = lrcGetPageURL('User:EDUCA33E/LiveRC');
LiveRCLink.appendChild(document.createTextNode('LiveRC'));
LiveRCLi.appendChild(LiveRCLink);
RCLi.parentNode.insertBefore(LiveRCLi,RCLi.nextSibling);
}
});
/* </source>
==== getRights ====
<source lang="javascript"> */
function getRights(xmlreq, data) {
var api = xmlreq.responseXML;
if (api.firstChild.nodeName == "error") return;
var rights = api.getElementsByTagName('query')[0].getElementsByTagName('userinfo')[0].getElementsByTagName('rights')[0].getElementsByTagName('r');
var len = rights.length;
var i;
var id,right;
for (i=0; i<len; i++) {
right = rights[i].textContent;
// Handle IE
if (!right) right = rights[i].text;
if(right) lrcUserRights.push(right);
}
if(lrcUserHasRight("apihighlimits")) lrcAPIlimit = 4999;
loadBlocks();
lrcDisplayDebug("Get system messages");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=allmessages&format=xml',
onSuccess: getAllmessages});
}
function lrcUserHasRight(Right){
return (lrcUserRights.indexOf(Right)!=-1);
}
/* </source>
==== getAllmessages ====
<source lang="javascript"> */
function getAllmessages(xmlreq, data){
var api = xmlreq.responseXML;
if (api.firstChild.nodeName == "error") return;
var messages = api.getElementsByTagName('message');
for(var a=0,l=messages.length;a<l;a++){
var MessageName = messages[a].getAttribute('name');
var MessageValue = (messages[a].firstChild ? messages[a].firstChild.nodeValue : "");
lrcMediawikiMessages[MessageName] = MessageValue;
}
getDisambiguationTemplates();
buildControlBar();
}
/* </source>
==== getDisambiguationTemplates ====
<source lang="javascript"> */
function getDisambiguationTemplates(){
lrcDisplayDebug("Get disambiguation templates")
var DisambiguationPage = lrcMediawikiMessages["disambiguationspage"];
var Reg = new RegExp("\\[\\[[^\\]]+\\]\\]", "g");
var AllLinks = DisambiguationPage.match(Reg);
if(AllLinks==null) return;
for(var a=0,l=AllLinks.length;a<l;a++){
var ThisLink = AllLinks[a].split("[[").join("").split("]]").join("");
if(getNamespaceInfoFromPage(ThisLink)!=10) continue;
lrcHomonTemplates.push(ThisLink);
}
}
/* </source>
==== buildControlBar ====
<source lang="javascript"> */
function buildControlBar(){
lrcDisplayDebug("Create control bar");
var showIPNEWopt = "";
if (lrcUserHasRight("autopatrol")) {
showIPNEWopt = '<option value="IPNEW">' + lang_menu.IPNEW + '</option>'
}
var lvPreviewFoot = document.getElementById( 'livePreviewFoot' );
lvPreviewFoot.innerHTML = ''
+ '<a href="javascript:;" onClick="supprLigne(\'*\');" '
+ 'style="color: red; font-weight: bold;" title="'+lang_tooltips.HIDE_ALL+'">X</a>'
+ ' | '
+ '<a href="javascript:;" onClick="supprLigne(\'d\');" '
+ 'style="color: rgb(255, 235, 71); font-weight: bold;" title="'+lang_tooltips.HIDE_REVIEWED+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'r\');" '
+ 'style="color: rgb(255, 99, 83); font-weight: bold;" title="'+lang_tooltips.HIDE_REVERTS+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'n\');" '
+ 'style="color: rgb(178, 243, 113); font-weight: bold;" title="'+lang_tooltips.HIDE_NEW+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'c\');" '
+ 'style="color: white; font-weight: bold;" title="'+lang_tooltips.HIDE_BLANKING+'">X</a>'
+ ' • '
+ '<input id="btnNext" type="button" onclick="goNext();" '
+ 'value="' + lang_menu.NEXTDIFF + '" style="padding:0;" />'
+ ' • '
+ '<input id="stopLive" type="checkbox" value="true" '+(lrcOptionMenuValues.Stop ? 'checked="checked"':'')+'/>'
+ '<label for="stopLive">' + lang_menu.PAUSE + '</label>'
+ ' • '
+ '<input id="showDiffR" type="checkbox" '+(lrcOptionMenuValues.Diff ? 'checked="checked"':'')+'/>'
+ '<label for="showDiffR">'+ lang_menu.LOWDIFF + '</label>'
+ ' • '
+ '<input id="shidPrev" style="display:none;" type="checkbox" '
+ 'onclick="showHideObj(this, \'divLivePreview\');" />'
// + '<label for="shidPrev">' + lang_menu.PREVIEW + '</label>'
// + ' • '
+ '<input id="showTchat" type="checkbox" '+(lrcOptionMenuValues.Tchat ? 'checked="checked"':'')+' '
+ 'onclick="showHideObj(this, \'liveTchat\');" />'
+ '<label for="showTchat">'+ lang_menu.TCHAT + '</label>'
+ ' • '
+ '<input id="shidList" type="checkbox" '+(lrcOptionMenuValues.Lists ? 'checked="checked"':'')+' '
+ 'onclick="showHideObj(this, \'liveFollow\');" />'
+ '<label for="shidList">' + lang_menu.LISTS + '</label>'
+ ' • '
+ '<input id="showRC" type="checkbox" '+(lrcOptionMenuValues.RC ? 'checked="checked"':'')+' />'
+ '<label for="showRC">' + lang_menu.RCLABEL + ' </label>'
+ '<input id="showLog" type="checkbox" '+(lrcOptionMenuValues.Log ? 'checked="checked"':'')+'/>'
+ '<label for="showLog">' + lang_menu.LOGSHOW + ' </label>'
+ '<input id="showFilter" type="checkbox" '+(lrcOptionMenuValues.Filter ? 'checked="checked"':'')+'/>'
+ '<label for="showFilter">' + lang_menu.ABSHOW + '</label>'
+ ' • '
+ '<select id="showUsers">'
+'<option value="RESTMODE">' + lang_menu.RESTMODE + '</option>'
+ '<option value="IPONLY">' + lang_menu.IPONLY + '</option>'
+ showIPNEWopt
+ '<option value="ALLUSERS">' + lang_menu.ALLUSERS + '</option>'
+ '<option value="ALLNBOTS">' + lang_menu.ALLNBOTS + '</option>'
+ '</select>'
+ ' • '
+ '<span id="selectNS" ></span>'
+ ' • '
+ '<a id="ManageParamsToggleLink" title="'+lrcManageParamsText["ButtonTitle"]+'" '
+ 'href="javascript:;" onClick="LiveRC_ManageParams_OpenMenu();">'
+ lrcManageParamsText["ButtonText"]+'</a>';
buildTchatWindow();
// Apply options
showHideObj(document.getElementById("shidList"), 'liveFollow');
showHideObj(document.getElementById("showTchat"), 'liveTchat');
// if(lrcOptionMenuValues.Preview) showHideObj(document.getElementById("shidPrev"), 'divLivePreview');
updatePreviewWindowAttributes();
updateRCTypeSelect();
LiveRC_RunHooks("AfterOptions");
liveNS();
}
/* </source>
==== LiveNS ====
<source lang="javascript"> */
function liveNS() {
lrcDisplayDebug("Get namespaces names");
if(typeof(mw.config.get('wgFormattedNamespaces'))!="undefined"){
var ns;
var options = "";
var lstNs = new Array();
for (var id in mw.config.get('wgFormattedNamespaces')) {
ns = mw.config.get('wgFormattedNamespaces')[id];
if (id < 0) continue;
if (id == 0) ns = lang_main_namespace;
options += '<option value="' + id + '">' + ns + '</option>';
lstNs.push(id);
}
options = '<option value="' + lstNs.join('|') + '">*</option>' + options;
document.getElementById('selectNS').innerHTML = '<label for="showNS0">'+lang_menu.NAMESP+' </label><select id="showNS0">' + options + '</select>';
updateNSSelect();
liveSysop();
}else{
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml',
onSuccess: getNS, message: "Pobieranie nazw przestrzeni" });
}
}
function getNS(xmlreq, data) {
var api = xmlreq.responseXML;
if (api.firstChild.nodeName == "error") return;
var nss = api.getElementsByTagName('query')[0].getElementsByTagName('namespaces')[0].getElementsByTagName('ns');
var len = nss.length;
var i;
var id,ns;
var options = "";
var lstNs = new Array();
var lstNsName = new Array();
for (i=0; i<len; i++) {
id = nss[i].getAttribute('id');
ns = nss[i].textContent;
// Handle IE
if (!ns) ns = nss[i].text;
if (id < 0) continue;
lstNsName.push(ns);
lstNs.push(id);
if (id == 0) ns = lang_main_namespace;
options += '<option value="' + id + '">' + ns + '</option>';
}
if(typeof(mw.config.get('wgFormattedNamespaces'))=="undefined"){
mw.config.get('wgFormattedNamespaces') = new Array();
for(var a=0,l=lstNs.length;a<l;a++){
mw.config.get('wgFormattedNamespaces')[lstNs[a]] = lstNsName[a];
}
}
options = '<option value="' + lstNs.join('|') + '">*</option>' + options;
document.getElementById('selectNS').innerHTML = '<label for="showNS0">'+lang_menu.NAMESP+' </label><select id="showNS0">' + options + '</select>';
updateNSSelect();
liveSysop();
}
/* </source>
==== LiveSysop ====
<source lang="javascript"> */
function liveSysop() {
lrcDisplayDebug("Get sysop names");
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=allusers&augroup=sysop&aulimit=' +lrcAPIlimit +'&format=xml', onSuccess: getSysop, message: "Traitement en cours...\n\n" });
}
function getSysop(xmlreq, data) {
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
if (api.firstChild.nodeName == "error") return;
var rcs = api.getElementsByTagName('query')[0].getElementsByTagName('allusers')[0].getElementsByTagName('u');
leni=rcs.length;
for (i=leni-1; i>=0; i--) {
lstSysop.push(rcs[i].getAttribute('name'));
}
liveWatch();
}
/* </source>
==== LiveWatch ====
<source lang="javascript"> */
function liveWatch() {
lrcDisplayDebug("Get watchlist");
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=watchlistraw&wrlimit=' +lrcAPIlimit +'&format=xml',
onSuccess: getWatch, message: "Traitement en cours..." });
}
function getWatch(xmlreq, data) {
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
var clPrefix = 'LiveRCWatch:';
if (api.firstChild.nodeName == "error") return;
var rcs = api.getElementsByTagName('watchlistraw')[0].getElementsByTagName('wr');
leni=rcs.length;
for (i=0; i<leni; i++) {
var article = rcs[i].getAttribute('title');
if (article.substr(0, clPrefix.length) == clPrefix) {
var userName = article.substr(clPrefix.length);
if (!lstContact2[userName])
lstContact2[userName] = {ts: 0, fromjs: false};
} else {
lstSuivi.push(rcs[i].getAttribute('title'));
lstSuiviHH.push("--:--");
}
}
var wc1=api.getElementsByTagName('query-continue')[0];
if (wc1){
var wrcontinue=wc1.getElementsByTagName('watchlistraw')[0].getAttribute('wrcontinue');
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=watchlistraw&wrlimit=' +lrcAPIlimit +'&format=xml&wrcontinue=' + wrcontinue, onSuccess: getWatch, message: "Traitement en cours..." });
}
else
liveRC();
}
/* </source>
==== loadBlocks ====
<source lang="javascript"> */
function loadBlocks() {
lrcDisplayDebug("Get blocked users");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=logevents&letype=block&lelimit=' + lrcAPIlimit + '&format=xml',
onSuccess: readBlocks, minCount: 1000});
}
function readBlocks(xmlreq, data) {
var logevents = xmlreq.responseXML.getElementsByTagName('logevents')[0];
if (typeof(logevents) == 'undefined') return;
lst = logevents.childNodes;
for (var i = 0; i < lst.length; i++) {
if (lst[i].getAttribute('action') == 'block') {
var user = lst[i].getAttribute('title');
if (user != null) {
user = user.substr(user.indexOf(':') + 1);
lstBlocks[user] = 1;
}
}
}
if (data.minCount > lrcAPIlimit) {
var lestart = xmlreq.responseXML.getElementsByTagName('query-continue')[0].firstChild.getAttribute('lestart');
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=logevents&letype=block&lelimit=' + lrcAPIlimit + '&lestart='
+ lestart + '&format=xml', onSuccess: readBlocks, minCount: data.minCount - lrcAPIlimit});
} else if (lrcParams["LoadIPCat"]) {
loadUsersInCats(watchCategories);
}
}
/* </source>
==== UserInCat ====
<source lang="javascript"> */
function loadUsersInCats(watchCategories) {
lrcDisplayDebug("Get category members");
for (var i = 0 ; i < watchCategories.length; i++) {
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=categorymembers&cmlimit='
+ lrcAPIlimit + '&cmtitle=' + watchCategories[i].category.replace(/&/g, "%26"),
onSuccess: fillUserCat, wcIndex: i,
category:watchCategories[i].category});
}
}
function fillUserCat(xmlreq,data) {
var cats = xmlreq.responseXML.getElementsByTagName('cm');
for (var a = 0; a < cats.length; a++) {
var ns = parseInt(cats[a].getAttribute('ns'));
if (ns == 3) {
var title = cats[a].getAttribute('title').split(mw.config.get('wgFormattedNamespaces')[3]+":").join("");
lstUserCat[title] = data.wcIndex;
}
}
var cmcontinue="";
if (xmlreq.responseXML.getElementsByTagName('query-continue')[0]) {
cmcontinue = xmlreq.responseXML.getElementsByTagName('query-continue')[0].getElementsByTagName('categorymembers')[0].getAttribute('cmcontinue');
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=categorymembers&cmlimit='
+ lrcAPIlimit + '&cmtitle=' + data.category.replace(/&/g, "%26") + '&cmcontinue=' + cmcontinue.replace(/&/g, "%26"),
onSuccess: fillUserCat, wcIndex: data.wcIndex, category:data.category});
}
}
/* </source>
=== Fonctions de mise à jour des modifications récentes ===
==== liveRC ====
<source lang="javascript"> */
function liveRC() {
updateWatchFromCookie();
if (document.getElementById('stopLive').checked){
lrcDisplayDebug("");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",1000);
return;
}
lrcDisplayDebug("Get RC");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",(lrcParams["Refresh"]+5)*1000);
var HookResult = LiveRC_RunHooks("BeforeRC");
if(!HookResult) return;
var rcns = document.getElementById('showNS0').value;
if (rcns == null) return;
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?action=query&list=recentchanges|logevents|abuselog&rcnamespace=' + rcns
+ '&rcprop=user|comment|parsedcomment|flags|timestamp|title|ids|sizes|tags' + (lrcUserHasRight("autopatrol") ? '|patrolled' : '')
+ (document.getElementById("showUsers").value != "ALLNBOTS" ? '&rcshow=!bot' : '')
+ '&rcend=' + lastrctimestamp + '&rclimit=' + lrcParams["RCLimit"]
+ '&leend=' + lastletimestamp + '&lelimit=' + lrcParams["RCLimit"]
+ '&aflend=' + lastafltimestamp + '&afllimit=' + lrcParams["RCLimit"]
+ '&format=xml',
onSuccess: getRC, message: lang_tooltips.WORKING });
}
function getRC(xmlreq, data) {
if (document.getElementById('stopLive').checked){
lrcDisplayDebug("");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",1000);
return;
}
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
if (api.firstChild.nodeName == "error") return;
var rcs = api.getElementsByTagName('query')[0].getElementsByTagName('recentchanges')[0].getElementsByTagName('rc');
var i,j,leni,lenj,rc;
leni=rcs.length;
for (i=leni-1; i>=0; i--) {
// Using rcid as revid can be 0 (e.g. when moving a page)
if (rcs[i].getAttribute('rcid') <= lastrcid) continue;
rc = new Object();
rc.state = 0;
lenj = rcs[i].attributes.length;
for (j=0; j<lenj; j++) {
switch(rcs[i].attributes[j].name) {
case 'anon':
rc.state += IP;
break;
case 'bot':
rc.state += BOT;
break;
case 'new':
rc.state += NEW;
break;
case 'minor':
rc.state += MINOR;
break;
case 'new_ns':
rc.state += NEWNS;
break;
case 'new_title':
rc.state += RENAMED;
break;
case 'patrolled':
rc.state += PATROLLED;
break;
case 'type':
break;
default:
rc[rcs[i].attributes[j].name] = rcs[i].attributes[j].value;
break;
}
}
var tags = rcs[i].getElementsByTagName('tags')[0].getElementsByTagName('tag');
if (tags.length) {
rc.state += TAG;
rc.tags = tags;
}
if (typeof(rc.comment) != "undefined") {
lenj = commenttests.length;
for (j=0; j<lenj; j++)
if (new RegExp(commenttests[j].regex).test(rc.comment))
rc.state += commenttests[j].state;
}
if (rc.newlen == 0) rc.state += BLANKING;
if (lstSysop.indexOf(rc.user) != -1)
rc.state += SYSOP;
var mitigating = (rc.state & REVERT)
|| (rc.state & BLANKING)
|| (rc.state & REPLACED)
|| (rc.state & TAG)
|| lstContact2[rc.user]
|| (lstRevoc[rc.user])
|| (rc.user == mw.config.get('wgUserName'))
|| (lrcParams["WLAllChanges"] && lstSuivi.indexOf(rc.title) != -1);
if (!mitigating) {
if (document.getElementById("showUsers").value == "RESTMODE") continue;
if (document.getElementById("showUsers").value == "IPONLY"
&& !(rc.state & IP)) continue;
if (document.getElementById("showUsers").value == "IPNEW"
&& (rc.state & PATROLLED)) continue;
}
if ((typeof(rc.logtype) != "undefined")
&& rc.logtype == "newuser") continue;
if (lstHidden[rc.user]) continue;
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?titles=' + encodeURIComponent(rc.title) + '&action=query&prop=categories|templates&cllimit='+lrcAPIlimit+'&tllimit='+lrcAPIlimit+'&redirects&format=xml',
onSuccess: getRedirCat, rc: rc });
}
// Log
var logs = api.getElementsByTagName('query')[0].getElementsByTagName('logevents')[0].getElementsByTagName('item');
var i,j,leni,lenj,log;
leni=logs.length;
for (i=leni-1; i>=0; i--) {
if (logs[i].getAttribute('logid') <= lastlogid) continue;
log = new Object();
log.state = 0;
lenj = logs[i].attributes.length;
for (j=0; j<lenj; j++) {
if (logs[i].attributes[j].name == 'type')
{
switch(logs[i].attributes[j].value) {
case 'patrol':
// I "Segna come verificata" non li cago
log.state += PATROL;
break;
case 'newusers':
log.state += NEWUSER;
break;
case 'upload':
log.state += UPLOAD;
break;
case 'block':
log.state += BLOCK;
if (logs[i].firstChild)
log.duration = logs[i].firstChild.attributes[1].value;
break;
case 'delete':
log.state += DELETE;
break;
case 'move':
log.state += MOVE;
if (logs[i].firstChild)
log.new_title = logs[i].firstChild.attributes[1].value;
case 'protect':
log.state += PROTECT;
break;
case 'review':
log.state += REVIEW;
break;
default:
break;
}
}
else
log[logs[i].attributes[j].name] = logs[i].attributes[j].value;
//Set a dummy revid to prevent deletion
log.revid=log.logid;
}
if (typeof(log.comment) != "undefined") {
lenj = commenttests.length;
for (j=0; j<lenj; j++)
if (new RegExp(commenttests[j].regex).test(log.comment))
log.state += commenttests[j].state;
}
if (lstSysop.indexOf(log.user) != -1)
log.state += SYSOP;
if (!(log.state & REVIEW))
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?titles=' + encodeURIComponent(log.title) + '&action=query&prop=categories|templates&cllimit='+lrcAPIlimit+'&tllimit='+lrcAPIlimit+'&redirects&format=xml',
onSuccess: getRedirCat2, log: log });
}
// Filters
var filters = api.getElementsByTagName('query')[0].getElementsByTagName('abuselog')[0].getElementsByTagName('item');
var i,j,leni,lenj,filter;
leni=filters.length;
for (i=leni-1; i>=0; i--) {
if (filters[i].getAttribute('id') <= lastfilterid) continue;
filter = new Object();
filter.state = ABFILTER;
lenj = filters[i].attributes.length;
for (j=0; j<lenj; j++) {
filter[filters[i].attributes[j].name] = filters[i].attributes[j].value;
}
//Set a dummy revid to prevent deletion
filter.revid = filter.id
// Get filter description
//Set a dummy revid to prevent deletion
filter.revid = filter.id
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&list=abusefilters&abflimit=1&format=xml&abfstartid=' + filter.filter_id,
onSuccess: getFilterTitle, filter: filter });
}
lastrcid = rcs[0].getAttribute('rcid');
lastlogid = logs[0].getAttribute('logid');
lastfilterid = filters[0].getAttribute('id');
lastrctimestamp = rcs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
lastletimestamp = logs[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
lastafltimestamp = filters[0].getAttribute('timestamp').replace(new RegExp(/\D/g), "");
document.getElementById('tsInit').innerHTML = lang_tooltips.LAST_SITUATION + " : " + lastrctimestamp ;
lrcDisplayDebug("");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",lrcParams["Refresh"]*1000);
}
/* </source>
==== getRedirCat ====
<source lang="javascript"> */
function getRedirCat(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
var yurik = xmlreq.responseXML.getElementsByTagName('api')[0];
if (yurik.firstChild.nodeName == "error") return;
var rc = data.rc;
var pageid = rc.pageid;
var revid = rc.revid;
var state = rc.state;
var page = yurik.getElementsByTagName('pages')[0].getElementsByTagName('page')[0];
if (page.getElementsByTagName('redirect').length) {
state |= REDIRECT;
if (page.getElementsByTagName('redirect')[0].getElementsByTagName('to').length)
rc.redirect = page.getElementsByTagName('redirect')[0].getElementsByTagName('to')[0].textContent;
}
if (page.getElementsByTagName('categories').length) {
state |= CATEGORIZED;
var categories = page.getElementsByTagName('categories')[0].getElementsByTagName('cl');
var i,j;
var leni = categories.length;
var lenj = categoriestests.length;
for (i=0; i<leni; i++)
for (j=0; j<lenj; j++)
if (new RegExp(lang_category+categoriestests[j].regex, "i").test(categories[i].getAttribute('title')))
state |= categoriestests[j].state;
}
if (page.getElementsByTagName('templates').length) {
var templates = page.getElementsByTagName('templates')[0].getElementsByTagName('tl');
var i,j;
var leni = templates.length;
var lenj = templates.length;
for (i=0; i<leni; i++)
for (j=0; j<lenj; j++){
var Title = templates[i].getAttribute('title');
if(lrcHomonTemplates.indexOf(Title)!=-1) state |= HOMONYMIE;
}
}
rc.state = state;
getRevision(rc);
}
function getRedirCat2(xmlreq, data) {
if (document.getElementById('stopLive').checked) return;
var api = xmlreq.responseXML.getElementsByTagName('api')[0];
if (api.firstChild.nodeName == "error") return;
var log = data.log;
var pageid = log.pageid;
var revid = log.revid;
var state = log.state;
var query = api.getElementsByTagName('query')[0];
if (query.getElementsByTagName('redirects').length) {
state |= REDIRECT;
if (query.getElementsByTagName('redirects')[0].getElementsByTagName('r').length)
log.redirect = query.getElementsByTagName('redirects')[0].getElementsByTagName('r')[0].getAttribute('to');
}
if (query.getElementsByTagName('categories').length) {
state |= CATEGORIZED;
var categories = query.getElementsByTagName('categories')[0].getElementsByTagName('cl');
var i,j;
var leni = categories.length;
var lenj = categoriestests.length;
for (i=0; i<leni; i++)
for (j=0; j<lenj; j++)
if (new RegExp(lang_category+categoriestests[j].regex, "i").test(categories[i].getAttribute('title')))
state |= categoriestests[j].state;
}
if (query.getElementsByTagName('templates').length) {
var templates = query.getElementsByTagName('templates')[0].getElementsByTagName('tl');
var i,j;
var leni = templates.length;
var lenj = templates.length;
for (i=0; i<leni; i++)
for (j=0; j<lenj; j++){
var Title = templates[i].getAttribute('title');
if(lrcHomonTemplates.indexOf(Title)!=-1) state |= HOMONYMIE;
}
}
log.state = state;
getRevision(log);
}
/* </source>
==== getFilterTitle ====
<source lang="javascript"> */
function getFilterTitle(xmlreq, data) {
var filter = data.filter;
var xmlinfo = xmlreq.responseXML.getElementsByTagName('api')[0];
if (xmlinfo.firstChild.nodeName == "error") return;
filter.comment = lang_messages.FILTER+' '
filter.comment += xmlinfo.getElementsByTagName('abusefilters')[0].getElementsByTagName('filter')[0].getAttribute('id');
filter.comment += ': ';
filter.comment += xmlinfo.getElementsByTagName('abusefilters')[0].getElementsByTagName('filter')[0].getAttribute('description');
filter.comment += ' (action: '+ filter.result + ')';
getRevision(filter);
}
/* </source>
==== getRevision ====
<source lang="javascript"> */
function getRevision(rc) {
if (document.getElementById('stopLive').checked) return;
var title = rc.title;
var pageid = rc.pageid;
var revid = rc.revid;
var oldid = rc.old_revid;
var user = rc.user;
var comment = (rc.comment ? rc.comment : "");
var parsedcomment = (rc.parsedcomment ? rc.parsedcomment : "");
var timestamp = rc.timestamp;
var ns = rc.ns;
var state = rc.state;
var oldsize = rc.oldlen
var newsize = rc.newlen
var sizediff = newsize - oldsize;
var match;
var escTitle = lrcEscapeStr(title);
var escUser = lrcEscapeStr(user);
// INITIALISATION LIGNE RC //
var tr1 = document.createElement('tr');
var th0 = document.createElement('th');
var th1 = document.createElement('th');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
var td4 = document.createElement('td');
// SUPPR. LIGNE //
th0.innerHTML = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\');" style="color:red" title="'+lang_tooltips.HIDE_THIS+'">X</a>';
// ARTICLE //
var arti = "", artiStyle = "";
var preArti = "", postArti = "";
var diff = "";
var diffClose = "";
if (lrcParams["AutoCloseDiff"] == 1)
diffClose='supprLigne(\''+pageid+'_'+revid+'\');';
if (state & NEW) {
diff = '<a class="lrc_PreviewLink" '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveArticle('+escTitle+','+escUser+');'+diffClose+' return false;" '
+ 'style="color:green">New</a>';
}else if (state & UPLOAD){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=upload&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'upload\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color:darkslateblue">Log</a>';
}else if (state & NEWUSER){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=newusers&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'newusers\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color:lime">Log</a>';
}else if (state & BLOCK){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=block&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'block\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color:darkgoldenrod">Log</a>';
}else if (state & DELETE){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=delete&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'delete\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color: saddlebrown">Log</a>';
}else if (state & MOVE){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=move&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'move\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color:black">Log</a>';
}else if (state & PROTECT){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:Log', '&type=protect&user=&page='+encodeURIComponent(title))+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveLog(\'protect\',{page:'+escTitle+'});'+diffClose+' return false;" '
+ 'style="color: darkslategray">Log</a>';
}else if (state & ABFILTER){
diff = '<a '
+ 'href="'+lrcGetUglyPageURL('Special:AbuseLog', '&details='+revid)+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveFilter('+revid+');'+diffClose+' return false;" '
+ 'style="color: darkslategray">Filt</a>';
}else{ // simple edit
diff = '<a class="lrc_PreviewLink" '
+ 'href="'+lrcGetUglyPageURL(title, '&diff='+revid+'&oldid='+oldid+'&unhide=1')+'" '
+ 'onClick="changeLigne(\''+pageid+'_'+revid+'\');liveDiff('+escTitle+','+revid+','+oldid+');'+diffClose+' return false;" '
+ 'style="color:orange" title="'+lang_tooltips.DIFF_TIP+'">'+lang_tooltips.DIFF_SHORT+'</a>'
}
var hist = '';
var edit = '';
var admin = '';
// Don't show link for log rows
if (!(state & UPLOAD) &&
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & PATROL) &&
!(state & MOVE) &&
!(state & ABFILTER))
{
hist = '<a '
+ 'href="'+lrcGetUglyPageURL(title,'&action=history') + '" '
+ 'onClick="liveHist('+escTitle+'); return false;" '
+ 'style="color:darkorange;" title="'+lang_tooltips.HIST_TIP+'">'+lang_tooltips.HIST_SHORT+'</a>';
edit = '<a '
+ 'href="'+lrcGetUglyPageURL(title,'&action=edit') + '" '
+ 'onClick="liveEdit('+escTitle+'); return false;" '
+ 'style="color:tomato" title="'+lang_tooltips.EDIT_TIP+'">'+lang_tooltips.EDIT_SHORT+'</a>';
if (lrcUserHasRight("delete")) {
admin += ' • <a '
+ 'href="'+lrcGetUglyPageURL(title,'&action=delete') + '" '
+ 'onClick="liveDelete('+escTitle+'); return false;" '
+ 'style="color:orangered;" title="'+lang_tooltips.DEL_TIP+'">'+lang_tooltips.DEL_SHORT+'</a>';
}
if (lrcUserHasRight("protect")) {
admin += ' • <a '
+ 'href="'+lrcGetUglyPageURL(title,'&action=protect') + '" '
+ 'onClick="liveProtect('+escTitle+'); return false;" '
+ 'style="color:coral;" title="'+lang_tooltips.PROTECT_TIP+'">'+lang_tooltips.PROTECT_SHORT+'</a>';
}
}
// Disambig / Homonymie ? ;
///////////////////////////
if (ns == 0 && state & HOMONYMIE) {
artiStyle = 'color: darkorange; font-weight: bold; font-style: italic;';
preArti += lrcIcon["Homon"] + ' ';
}
// Stub / Ébauche ? ;
///////////////////////////
if (state & STUB) {
preArti += lrcIcon["Stub"] + ' ';
}
// Page protégée ? ;
////////////////////
if (state & FULLLOCK)
preArti += lrcIcon["FullLock"]+' ';
if (state & LOCK)
preArti += lrcIcon["Lock"]+' ';
// Copyright ? ;
//////////
if (state & COPYRIGHT)
preArti += lrcIcon["Copyright"]+' ';
// PaS ? ;
//////////////////
if (state & PAS)
preArti += lrcIcon["PaS"]+' ';
// Adq ? ;
//////////
if (state & ADQ)
postArti += lrcIcon["AdQ"];
// Bon article ? ;
//////////////////
if (state & BA)
postArti += lrcIcon["BA"];
// Article potentiellement de qualité ? ;
/////////////////////////////////////////
if (state & APDQ)
postArti += lrcIcon["APDQ"];
// Article catégorisé ? ;
/////////////////////////
var isCategorized = "";
if (!(state & REDIRECT)
&& !(state & HOMONYMIE)
&& ns == 0
&& !(state & CATEGORIZED))
postArti += lrcIcon["Nocat"];
// Redirect, Log, or simple edit ? ;
//////////////////
var dlbClick = 'onDblClick="window.open(' + lrcEscapeStr(lrcGetPageURL(title)) + ');"'
if (state & MOVE) {
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
postArti += ' '+lrcIcon["Move"];
postArti += ' <a '
+ 'href="'+lrcGetPageURL(rc.new_title)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(rc.new_title)+','+escUser+'); return false;"'
+ '>'+lrcStripString(rc.new_title, lrcParams["ArticleLengthLimit"])+'</a>';
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ 'class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else if (state & REDIRECT) {
artiStyle = 'color: green; font-weight: bold; font-style: italic;';
postArti += ' '+lrcIcon["Redirect"];
postArti += ' <a '
+ 'href="'+lrcGetPageURL(rc.redirect)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(rc.redirect)+','+escUser+');" '
+ '>'+lrcStripString(rc.redirect, lrcParams["ArticleLengthLimit"])+'</a>';
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ 'class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
} else if (state & UPLOAD) {
postArti += ' '+lrcIcon["Upload"];
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else if (state & NEWUSER) {
postArti += ' '+lrcIcon["NewUser"];
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else if (state & BLOCK) {
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
postArti += ' '+lrcIcon["Block"];
postArti += ' <a '
+ 'href="'+lrcGetUglyPageURL('Special:Log','&type=block&user=&page='+encodeURIComponent(rc.title))+'" '
+ 'onClick="liveLog(\'block\',{page:'+lrcEscapeStr(rc.title)+'}); return false;" '
+ '>('+rc.duration+')</a>';
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ 'class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else if (state & DELETE) {
postArti += ' '+lrcIcon["Delete"];
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else if (state & PROTECT) {
postArti += ' '+lrcIcon["Protect"];
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}else {
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams["ArticleLengthLimit"])+'</a>';
}
th1.innerHTML = '<small>' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + admin + ' • </small>'
+ preArti + arti + postArti;
th1.className="creator-title";
th1.style.textAlign="left";
th1.style.border="1px";
th1.style.width="40%";
// EDITOR //
////////////
var td2id = generateNewID();
var discut = '<a '
+ 'href="'+lrcGetPageURL(mw.config.get('wgFormattedNamespaces')[3]+':'+user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')[3]+':'+user)+'); return false;" '
+ 'style="color:seagreen" title="'+lang_tooltips.TALK_TIP+'">'+lang_tooltips.TALK_SHORT+'</a>';
var contrib = '<a '
+ 'href="'+lrcGetPageURL('Special:Contributions/'+user)+'" '
+ 'onClick="liveContrib('+escUser+'); return false;" '
+ 'style="color:#43CD80" title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
if (lrcUserHasRight("deletedhistory")) {
contrib += '<a '
+ 'href="'+lrcGetPageURL('Special:DeletedContributions/'+user)+'" '
+ 'onClick="liveDeletedContrib('+escUser+'); return false;" '
+ 'style="color:#43CD80" title="'+lang_tooltips.DELETEDCONTRIB_TIP+'">'+lang_tooltips.DELETEDCONTRIB_SHORT+'</a>';
}
var uwatch;
if (lstContact2[user]) {
uwatch = '<a href="javascript:;" onClick="addWatch('+escUser+',false,\'' + td2id + '\');" style="color:black" title="'+"Ne plus surveiller"+'">'+'X'+'</a>';
} else {
uwatch = '<a href="javascript:;" onClick="addWatch('+escUser+',true,\'' + td2id + '\');" style="color:#AAAA00" title="'+"Surveiller"+'">'+'W'+'</a>';
}
var editor = "", preEditor = "";
// Reverted ? ;
/////////////////
if (state & REVERT)
preEditor += lrcIcon["Revert"]+' ';
// Bot ? ;
//////////
if (state & BOT)
preEditor += lrcIcon["Bot"]+' ';
// Sysop ? ;
////////////
if (state & SYSOP)
preEditor += lrcIcon["Sysop"]+' ';
// TOR potentiel / AOL
var isTOR = new RegExp(/172\.\d+\.\d+\.\d+/);
if (isTOR.test(user))
preEditor += lrcIcon["TOR"]+' ';
if (typeof(lstUserCat[user]) != 'undefined') {
preEditor += lrcIcon[watchCategories[lstUserCat[user]].image]+' ';
}
if (typeof(lstBlocks[user]) != 'undefined' && user != mw.config.get('wgUserName')) {
preEditor += lrcIcon["Blocked"]+' ';
}
editor = lrcGetUserLink(user);
var uadmin = '';
if (lrcUserHasRight("block")) {
uadmin = ' • <a '
+ 'href="'+lrcGetPageURL('Special:Blockip/' + user)+'" '
+ 'onClick="liveBlock('+escUser+'); return false;" '
+ 'style="color:seagreen" title="'+lang_tooltips.BLOCK_TIP+'">'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var uhide = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\'); hideUser('+ escUser +');" style="color:grey" title="'+lang_tooltips.USER_HIDE_TIP+'">'+lang_tooltips.USER_HIDE_SHORT+'</a>';
td2.innerHTML = '<small>' + discut + ' • ' + contrib + ' • ' + uhide + ' • ' +uwatch+ uadmin + ' • </small>'
+ preEditor + editor;
td2.className="creator-name";
td2.style.border = "1px";
td2.style.width = "20%";
td2.id = td2id;
if (lstRevoc[user]) {
td2.style.border = "2px solid red";
td2.innerHTML += lrcIcon["NbRevoc"].split("$1").join(lstRevoc[user].nb).split("$2").join(escUser);
}
// COMMENT //
var wcomment = "";
if( (state & ABFILTER) || (state & UPLOAD) || (state & NEWUSER) || (state & BLOCK) || (state & DELETE) || (state & MOVE) || (state & PROTECT) ){
wcomment = comment.htmlize();
var regex1 = new RegExp(/\[\[(([^\]\|]*)(.*?))\]\]/g);
wcomment = wcomment.replace(regex1, '<a href="'+mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=$2&redirect=no" >$1</a>');
var regex2 = new RegExp(/\>[^\]\|<]*\|([^\]\|<]*)</g);
wcomment = wcomment.replace(regex2, ">$1<");
}else{
wcomment = parsedcomment;
}
if (lrcParams["BoldComments"]) wcomment = '<b>' + wcomment + '</b>';
// Abusefilter tag ? ;
/////////////////
if (state & TAG) {
var TagTemplate = lrcIcon["Tag"];
TagTemplate = TagTemplate.split("$1").join(rc.tags[0].firstChild.nodeValue);
var TagList = "";
for (var tagId = 1; tagId < rc.tags.length; ++tagId)
TagList += ' | ' + rc.tags[tagId].firstChild.nodeValue;
TagTemplate = TagTemplate.split("$2").join(TagList);
wcomment += TagTemplate;
td3.style.border = "2px solid red";
} else {
td3.style.border = "1px";
td3.style.width = "40%";
}
td3.innerHTML = "<small>" + wcomment + "</small>";
var CommentLinks = td3.getElementsByTagName('a');
for(var a=0,l=CommentLinks.length;a<l;a++){
var Target = CommentLinks[a].title.replace(lrcMediawikiMessages["red-link-title"].split("$1").join(""), "");
if(!Target || Target === "") Target = CommentLinks[a].innerHTML;
if(CommentLinks[a].className && CommentLinks[a].className == "new"){
CommentLinks[a].setAttribute("onClick", "liveEdit("+lrcEscapeStr(Target)+", '&redlink=1'); return false;");
}else{
if(Target.indexOf(mw.config.get('wgFormattedNamespaces')[-1]+":"+lrcMediawikiMessages["mycontris"]+"/")==0){
Target = CommentLinks[a].innerHTML;
CommentLinks[a].setAttribute("onClick", "liveContrib("+lrcEscapeStr(Target)+"); return false;");
}else{
CommentLinks[a].setAttribute("onClick", "liveArticle("+lrcEscapeStr(Target)+"); return false;");
}
}
}
if (state & PATROLLED) {
td2.style.backgroundColor = "#e3e3f1";
td3.style.backgroundColor = "#e3e3f1";
td4.style.backgroundColor = "#e3e3f1";
}
if (state & ABFILTER) {
th0.style.backgroundColor = "#FFBE60";
th1.style.backgroundColor = "#FFBE60";
td2.style.backgroundColor = "#FFBE60";
td3.style.backgroundColor = "#FFBE60";
td4.style.backgroundColor = "#FFBE60";
}
if (state & UPLOAD) {
th0.style.backgroundColor = "#D1CAFA";
th1.style.backgroundColor = "#D1CAFA";
td2.style.backgroundColor = "#D1CAFA";
td3.style.backgroundColor = "#D1CAFA";
td4.style.backgroundColor = "#D1CAFA";
tr1.style.border = "1px solid darkslateblue";
}
if (state & NEWUSER) {
th0.style.backgroundColor = "#C6FF6D";
th1.style.backgroundColor = "#C6FF6D";
td2.style.backgroundColor = "#C6FF6D";
td3.style.backgroundColor = "#C6FF6D";
td4.style.backgroundColor = "#C6FF6D";
tr1.style.border = "1px solid lime";
}
if (state & BLOCK) {
th0.style.backgroundColor = "#EECC84";
th1.style.backgroundColor = "#EECC84";
td2.style.backgroundColor = "#EECC84";
td3.style.backgroundColor = "#EECC84";
td4.style.backgroundColor = "#EECC84";
tr1.style.border = "1px solid darkgoldenrod";
}
if (state & DELETE) {
th0.style.backgroundColor = "#E7CAA7";
th1.style.backgroundColor = "#E7CAA7";
td2.style.backgroundColor = "#E7CAA7";
td3.style.backgroundColor = "#E7CAA7";
td4.style.backgroundColor = "#E7CAA7";
tr1.style.border = "1px solid saddlebrown";
}
if (state & MOVE) {
th0.style.backgroundColor = "#FDC5FF";
th1.style.backgroundColor = "#FDC5FF";
td2.style.backgroundColor = "#FDC5FF";
td3.style.backgroundColor = "#FDC5FF";
td4.style.backgroundColor = "#FDC5FF";
tr1.style.border = "1px solid magenta";
}
if (state & PROTECT) {
th0.style.backgroundColor = "#B2BCC6";
th1.style.backgroundColor = "#B2BCC6";
td2.style.backgroundColor = "#B2BCC6";
td3.style.backgroundColor = "#B2BCC6";
td4.style.backgroundColor = "#B2BCC6";
tr1.style.border = "1px solid darkslategray";
}
if (state & REVERT) {
th0.style.backgroundColor = "#FFE4E1";
th1.style.backgroundColor = "#FFE4E1";
td2.style.backgroundColor = "#FFE4E1";
td3.style.backgroundColor = "#FFE4E1";
td4.style.backgroundColor = "#FFE4E1";
tr1.style.border = "1px solid crimson";
}
if (state & BLANKING || newsize == 0) {
th0.style.backgroundColor = "white";
th1.style.backgroundColor = "white";
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
td4.style.backgroundColor = "white";
tr1.style.border = "2px double crimson";
}
if (state & NEW) {
th0.style.backgroundColor = "#e2f2d2";
th1.style.backgroundColor = "#e2f2d2";
td2.style.backgroundColor = "#e2f2d2";
td3.style.backgroundColor = "#e2f2d2";
td4.style.backgroundColor = "#e2f2d2";
tr1.style.border = "1px solid green";
}
if (state & IP) {
td2.style.backgroundColor = "white";
td3.style.backgroundColor = "white";
td4.style.backgroundColor = "white";
}
if (isTOR.test(user))
td2.style.backgroundColor = "pink";
if (state & REPLACED) {
th0.style.backgroundColor = "pink";
th1.style.backgroundColor = "pink";
td2.style.backgroundColor = "pink";
td3.style.backgroundColor = "pink";
td4.style.backgroundColor = "pink";
td4.innerHTML = lrcIcon["Replaced"];
tr1.style.border = "2px solid crimson";
}
// CONTACT LIST //
//////////////////
if (lstContact2[user]) {
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
} else if (user == mw.config.get('wgUserName')) {
td2.style.border = "2px solid #A0B0E0";
td2.style.backgroundColor = "#F0F8FF";
}
// DELTA SIZE //
// delta de modif ;
///////////////////
if(""+sizediff != "NaN") {
var txtdiff = "";
if (sizediff < 0)
txtdiff = '<sub class="mw-plusminus-neg">'+sizediff+'</sub>';
else if (sizediff == 0)
txtdiff = '<small class="mw-plusminus-null">='+sizediff+'</small>';
else
txtdiff = '<sup class="mw-plusminus-pos">+'+sizediff+'</sup>';
td4.innerHTML += txtdiff;
td4.style.border = "1px";
td4.style.textAlign = "right";
}
// ASSEMBLAGE LIGNE //
tr1.appendChild(th0);
tr1.appendChild(th1);
tr1.appendChild(td2);
tr1.appendChild(td3);
tr1.appendChild(td4);
tr1.id = pageid+"_"+revid;
var tab = document.getElementById( 'tabRC' );
// IE automatically inserts a TBODY that we have to take care of
if (tab.firstChild && (tab.firstChild.nodeName == "TBODY")) tab=tab.firstChild;
var elold = document.getElementById(pageid+"_"+oldid);
if(lrcParams["KeepAllLines"]){ // NO LIMIT
if(lrcParams["InvertUpdate"]){ // Insert in first position
tab.appendChild(tr1);
}else{ // Insert in last position
if (tab.firstChild != null)
tab.insertBefore(tr1, tab.firstChild);
else
tab.appendChild(tr1);
}
lrcUpdateRCTableLength(); // Update Table length
}else{ // LIMIT
if(lrcParams["InvertUpdate"]){ // Insert in first position
tab.appendChild(tr1);
if (elold == null) {
if (tab.childNodes.length > lrcParams["RCLimit"]) {
var idt = tab.firstChild.id;
supprLigne(idt);
}
} else {
supprLigne(pageid+"_"+oldid);
}
}else{ // Insert in last position
if (tab.firstChild != null)
tab.insertBefore(tr1, tab.firstChild);
else
tab.appendChild(tr1);
if (elold == null) {
if (tab.childNodes.length > lrcParams["RCLimit"]) {
var idt = tab.lastChild.id;
supprLigne(idt);
}
} else {
supprLigne(pageid+"_"+oldid);
}
}
}
// Don't show RC if checkbox is not checked
if ((!document.getElementById('showRC').checked) &&
(!(state & UPLOAD) &&
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & MOVE) &&
!(state & ABFILTER)))
supprLigne(pageid+"_"+revid);
if (state & PATROL)
supprLigne(pageid+"_"+revid);
// Don't show Log if checkbox is not checked
if ((!document.getElementById('showLog').checked) &&
((state & UPLOAD) ||
(state & NEWUSER) ||
(state & BLOCK) ||
(state & DELETE) ||
(state & PROTECT) ||
(state & MOVE)))
supprLigne(pageid+"_"+revid);
// Don't show Filter if checkbox is not checked
if ((!document.getElementById('showFilter').checked) &&
(state & ABFILTER))
supprLigne(pageid+"_"+revid);
// MISE A JOUR LISTE "Liste de suivi" //
var spos = lstSuivi.indexOf(title);
if(spos != -1) {
th0.style.border = "2px solid gold";
th0.style.backgroundColor = "yellow";
th1.style.border = "2px solid gold";
th1.style.backgroundColor = "yellow";
lstSuiviHH[spos] = tsToHhMm(timestamp);
var tempsAr = new Array();
var len = lstSuivi.length;
for (var n = 0; n < len; n++) {
if(lstSuiviHH[n] == "--:--") continue;
var cstilde = lrcEscapeStr(lstSuivi[n]);
var sdiff = '<a '
+ 'href="'+mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+encodeURIComponent(lstSuivi[n])+'&diff=cur&oldid=prev&unhide=1" '
+ 'onClick="liveDiff('+cstilde+',\'cur\',\'prev\'); return false;" '
+ 'style="color:orange">Diff</a>';
var shist = '<a '
+ 'href="'+mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+encodeURIComponent(lstSuivi[n])+'&action=history" '
+ 'onClick="liveHist('+cstilde+'); return false;" '
+ 'style="color:darkorange">H</a>';
var sarti = '<a '
+ 'href="'+lrcGetPageURL(lstSuivi[n])+'" '
+ 'onClick="liveArticle('+cstilde+'); return false;"'
+ '>'+lstSuivi[n]+'</a>';
var sotherns = getNamespaceInfoFromPage(lstSuivi[n]);
var sotherpn = getNamespaceInfoFromPage(lstSuivi[n], "PageName");
if(sotherns%2==0){
var sotherText = lang_tooltips.TALK_SHORT;
var sothernsnumber = (sotherns+1);
}else{
var sotherText = lang_tooltips.SUBJECT_SHORT;
var sothernsnumber = (sotherns-1);
}
var sothername = (sothernsnumber == 0 ? sotherpn : mw.config.get('wgFormattedNamespaces')[sothernsnumber]+":"+sotherpn);
var stalk = '<a style="color: seagreen;" '
+ 'href="'+lrcGetPageURL(sothername)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(sothername)+'); return false;"'
+ '>'+sotherText+'</a>';
var ligne='<small>' + lstSuiviHH[n] + ' • ' + sdiff + ' • ' + shist + ' • ' + stalk + ' • </small>' + sarti + '<br />';
tempsAr.push(ligne);
}
tempsAr.sort();
len = tempsAr.length;
var lvSuivi = document.getElementById( 'liveSuivi' );
lvSuivi.innerHTML = "";
for (var n=len-1; n >= 0; n--)
lvSuivi.innerHTML = lvSuivi.innerHTML + tempsAr[n];
}
if (lstContact2[user]) {
lstContact2[user].ts = timestamp;
updateFollowContact();
}
if (state & REVERT) {
var regex = new RegExp(/\[\[Sp[ée]cial:Contributions\/([^\]\|]+)/);
match = regex.exec(comment);
if (!match) {
var regex2 = new RegExp(/\[\[Specjalna:Wkład\/([^\]\|]+)/);
match = regex2.exec(comment);
}
if (match) {
var userR = match[1];
if (userR != user && userR != mw.config.get('wgUserName')) {
if (!lstRevoc[userR]) lstRevoc[userR] = { ts: 0, nb: 0 };
lstRevoc[userR].ts = timestamp;
lstRevoc[userR].nb += 1;
updateFollowRevoc();
}
}
}
LiveRC_RunHooks("AfterRC", {id:tr1.id, rc:rc});
}
/* </source>
==== lrcUpdateRCTableLength ====
<source lang="javascript"> */
function lrcUpdateRCTableLength(){
var DivTable = document.getElementById("divTabRC");
var tab = document.getElementById("tabRC");
if(!DivTable || !tab ) return;
if (tab.getElementsByTagName('tr').length > lrcParams["RCLimit"]) {
var Height = (lrcParams["RCLimit"] * Math.floor(tab.offsetHeight / tab.getElementsByTagName('tr').length));
DivTable.setAttribute("style", "height:"+Height+"px;overflow-y:auto;border: 1px solid gray;padding:1px");
}else{
DivTable.setAttribute("style", "");
}
}
/* </source>
==== goNext ====
<source lang="javascript"> */
function goNext() {
//Argos
var tab = document.getElementById('tabRC');
// IE automatically inserts a TBODY that we have to take care of
if (tab.firstChild && (tab.firstChild.nodeName == "TBODY")) tab=tab.firstChild;
var lines = tab.getElementsByTagName('tr');
var length = (lines.length - 1);
for (var j = length; j >= 0; j--) {
var i = (lrcParams["InvertUpdate"]?(length - j):j);
var thisline = lines[i];
var bgColor = thisline.firstChild.style.backgroundColor;
if (bgColor != 'rgb(255, 250, 205)' && bgColor != '#fffacd') {
var Links = thisline.getElementsByTagName('a');
for (var a=0,l=Links.length;a<l;a++) {
if (Links[a].className && Links[a].className == "lrc_PreviewLink") {
var code = Links[a].getAttribute("onclick");
var ReturnRegExp = new RegExp("return[ ]+false[ ]*;");
code = code.replace(ReturnRegExp, "");
eval(code);
return;
}
}
}
}
}
/* </source>
==== supprLigne ====
<source lang="javascript"> */
function supprLigne(quelLigne) {
var i,len;
var tab = document.getElementById('tabRC');
// IE automatically inserts a TBODY that we have to take care of
if (tab.firstChild && (tab.firstChild.nodeName == "TBODY")) tab=tab.firstChild;
var els = new Array();
if (quelLigne == '*')
els = tab.getElementsByTagName('tr');
else if (quelLigne == 'd') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 250, 205)')
els.push(_els[i]);
} else if (quelLigne == 'r') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(255, 228, 225)')
els.push(_els[i]);
} else if (quelLigne == 'n') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'rgb(226, 242, 210)')
els.push(_els[i]);
} else if (quelLigne == 'c') {
var _els = tab.getElementsByTagName('tr');
len = _els.length;
for (i=len-1; i>=0; i--)
if (_els[i].firstChild.style.backgroundColor == 'white')
els.push(_els[i]);
} else
els.push(document.getElementById(quelLigne));
len = els.length;
for (i=len-1; i>=0; i--){
if (els[i] != null) tab.removeChild(els[i]);
}
lrcUpdateRCTableLength();
}
/* </source>
==== changeLigne ====
<source lang="javascript"> */
function changeLigne(quelLigne) {
var el = document.getElementById(quelLigne);
var els1 = el.getElementsByTagName('th');
var els2 = el.getElementsByTagName('td');
var len = els1.length;
for (var i=len-1; i>=0; i--)
if (els1[i] != null)
els1[i].style.backgroundColor = "#FFFACD";
var len = els2.length;
for (var i=len-1; i>=0; i--)
if (els2[i] != null)
els2[i].style.backgroundColor = "#FFFFE0";
}
/* </source>
==== Fonctions de mise à jour des listes ====
===== updateHidden =====
<source lang="javascript"> */
function updateHidden() {
var tempAr = new Array();
for (var user in lstHidden) {
var utilde = lrcEscapeStr(user);
var uremove = '<a href="javascript:;" onClick="unhideUser('+utilde+');" style="color:grey">-</a>';
var udiscut = '<a '
+ 'href="'+lrcGetPageURL(mw.config.get('wgFormattedNamespaces')[3]+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')[3]+':'+user)+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.TALK_TIP+'">'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a '
+ 'href=href="'+lrcGetPageURL('Special:Contributions/'+user)+'" '
+ 'onClick="liveContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
var udeletedcontrib = '';
var uadmin = '';
if (lrcAdmin == true) {
udeletedcontrib = '<a '
+ 'href="'+lrcGetPageURL('Special:DeletedContributions/'+user)+'" '
+ 'onClick="liveDeletedContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.DELETEDCONTRIB_TIP+'">'+lang_tooltips.DELETEDCONTRIB_SHORT+'</a>';
uadmin = ' • <a '
+ 'href="'+lrcGetPageURL('Special:Blockip/' + user)+'" '
+ 'onClick="liveBlock('+utilde+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.BLOCK_TIP+'">'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = lrcGetUserLink(user);
var ligne = '<span id="hidden-' + user + '"><small>' + uremove + ' • ' + udiscut + ' • ' + ucontrib + udeletedcontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
tempAr.push(ligne);
}
tempAr.sort();
var lvHidden = document.getElementById('liveHidden');
lvHidden.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvHidden.innerHTML += tempAr[n];
}
function hideUser(name) {
lstHidden[name] = true;
updateHidden();
}
function unhideUser(name) {
delete lstHidden[name];
updateHidden();
}
/* </source>
===== updateFollowContact =====
<source lang="javascript"> */
function updateFollowContact() {
var tempAr = new Array();
for (var user in lstContact2) {
var timestamp = lstContact2[user].ts;
if (timestamp == 0) continue;
var utilde = lrcEscapeStr(user);
var udiscut = '<a '
+ 'href="'+lrcGetPageURL(mw.config.get('wgFormattedNamespaces')[3]+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')[3]+':'+user)+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.TALK_TIP+'">'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a '
+ 'href=href="'+lrcGetPageURL('Special:Contributions/'+user)+'" '
+ 'onClick="liveContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
var udeletedcontrib = '';
var uadmin = '';
if (lrcAdmin == true) {
udeletedcontrib = '<a '
+ 'href="'+lrcGetPageURL('Special:DeletedContributions/'+user)+'" '
+ 'onClick="liveDeletedContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.DELETEDCONTRIB_TIP+'">'+lang_tooltips.DELETEDCONTRIB_SHORT+'</a>';
uadmin = ' • <a '
+ 'href="'+lrcGetPageURL('Special:Blockip/' + user)+'" '
+ 'onClick="liveBlock('+utilde+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.BLOCK_TIP+'">'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = lrcGetUserLink(user);
var ligne = '<span id="contact-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + udiscut + ' • ' + ucontrib+ udeletedcontrib + uadmin + ' • </small>' + ueditor + '</span><br />';
tempAr.push(ligne);
}
tempAr.sort();
var lvContact = document.getElementById('liveContact');
lvContact.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvContact.innerHTML += tempAr[n];
}
/* </source>
===== updateFollowRevoc =====
<source lang="javascript"> */
function updateFollowRevoc() {
var tempAr = new Array();
for (var user in lstRevoc) {
var timestamp = lstRevoc[user].ts;
var utilde = lrcEscapeStr(user);
var uremove = '<a href="javascript:;" onClick="removeRevoc('+utilde+');" style="color:grey">-</a>';
var udiscut = '<a '
+ 'href="'+lrcGetPageURL(mw.config.get('wgFormattedNamespaces')[3]+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')[3]+':'+user)+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.TALK_TIP+'">'+lang_tooltips.TALK_SHORT+'</a>';
var ucontrib = '<a '
+ 'href=href="'+lrcGetPageURL('Special:Contributions/'+user)+'" '
+ 'onClick="liveContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.CONTRIB_TIP+'">'+lang_tooltips.CONTRIB_SHORT+'</a>';
var udeletedcontrib = '';
var uadmin = '';
if (lrcAdmin == true) {
udeletedcontrib = '<a '
+ 'href="'+lrcGetPageURL('Special:DeletedContributions/'+user)+'" '
+ 'onClick="liveDeletedContrib('+utilde+'); return false;" '
+ 'style="color:#43CD80" '
+ 'title="'+lang_tooltips.DELETEDCONTRIB_TIP+'">'+lang_tooltips.DELETEDCONTRIB_SHORT+'</a>';
uadmin = ' • <a '
+ 'href="'+lrcGetPageURL('Special:Blockip/' + user)+'" '
+ 'onClick="liveBlock('+utilde+'); return false;" '
+ 'style="color:seagreen" '
+ 'title="'+lang_tooltips.BLOCK_TIP+'">'+lang_tooltips.BLOCK_SHORT+'</a>';
}
var ueditor = lrcGetUserLink(user);
var ligne = '<span id="revoc-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + uremove + ' • ' + udiscut + ' • ' + ucontrib + udeletedcontrib + uadmin + ' • </small>' + ueditor + ' (' + lstRevoc[user].nb + ' '+lang_menu.XTIMES+')</span><br />';
tempAr.push(ligne);
}
tempAr.sort();
var lvRevoc = document.getElementById('liveRevoc');
lvRevoc.innerHTML = "";
var len = tempAr.length;
for (var n=len-1; n>=0; n--)
lvRevoc.innerHTML += tempAr[n];
}
function removeRevoc(name) {
delete lstRevoc[name];
updateFollowRevoc();
}
/* </source>
=== Fonctions de prévisualisation ===
==== LiveDiff ====
<source lang="javascript"> */
var lrcPatrolLnk;
var lrcPatrolLnkHref = "";
function lrcAfterPatrolEdit(xmlreq, data) {
lrcPatrolLnk.innerHTML = "Modification relue";
}
function lrcPatrolEdit() {
var oldLink = lrcPatrolLnkHref;
if(lrcPatrolLnkHref == "") return;
lrcPatrolLnkHref = "";
lrcPatrolLnk.style.color = "silver";
lrcPatrolLnk.style.cursor = "default";
lrcPatrolLnk.style.textDecoration = "none";
wpajax.http({ url: oldLink, onSuccess: lrcAfterPatrolEdit});
}
function lrcReplacePatrolLink(Node) {
var x = getElementsByClass('patrollink',Node,null)[0];
if (x == null) return false;
lrcPatrolLnk = x.getElementsByTagName('a')[0];
lrcPatrolLnkHref = lrcPatrolLnk.href;
lrcPatrolLnk.href = "javascript:;";
lrcPatrolLnk.style.color = "darkgreen";
lrcPatrolLnk.onclick = lrcPatrolEdit;
return true;
}
function liveDiff(page, id, oldid) {
nextDiffNum++;
lrcAddToHistory("liveDiff", new Array(lrcEscapeStr(page), lrcEscapeStr(id), lrcEscapeStr(oldid)), mw.config.get('wgServer')+mw.config.get('wgScript')+'?title='+encodeURIComponent(page)+'&diff='+id+'&oldid='+oldid+'&unhide=1', page + " : diff="+id+' oldid='+oldid);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Diff : <span style='color:red'>"+page+"</span>...</b>");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+encodeURIComponent(page)+'&diffonly=1&unhide=1&diff='+id+'&oldid='+oldid,
onSuccess: getDiff, mpage: page, mid: id, moldid:oldid,
diffNum: nextDiffNum});
}
function getDiff(xmlreq, data) {
// Cancel if the user has clicked on another link after this one
if (nextDiffNum != data.diffNum) return;
// temporary fix for incorrect HTML code
var text = xmlreq.responseText;
var newtext = text.replace(/ <span class=\"mw-revdelundel-link/g, " <span class=\"mw-revdelundel-link");
var doc = gml_XMLParse(newtext);
var page=data.mpage;
var oldid=data.moldid;
var id=data.mid;
var bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
var lD = getElementsByClass('diff',bC,null);
var upage = lrcEscapeStr(page);
if (lD[0] == null) {
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
}
else {
if (document.getElementById('showDiffR').checked) {
var avantEl = getElementsByClass('diff-deletedline',bC,null);
var apresEl = getElementsByClass('diff-addedline',bC,null);
var rollback = getElementsByClass('mw-rollback-link',bC,null);
var revisiondelete = getElementsByClass('mw-revdelundel-link',bC,null);
var patrol = getElementsByClass('patrollink',bC,null);
var rl = "";
if (rollback[0] != null){
rl += '<span class="mw-rollback-link">'+ rollback[0].innerHTML + '</span> ';
}
if (revisiondelete[0] != null){
rl += lang_tooltips.REVISIONDELETE_SHORT + ' :';
for(var a=0,l=revisiondelete.length;a<l;a++){
var rdl = revisiondelete[a].getElementsByTagName('a')[0];
var Page = lrcGetArgFromURL(rdl.href, "target");
var Id = lrcGetArgFromURL(rdl.href, "ids");
var rdlLink = '<a '
+ 'href="'+mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Revisiondelete&type=revision&target='+encodeURIComponent(Page)+'&ids='+Id+'" '
+ 'onClick="liveRevisiondelete('+lrcEscapeStr(Page)+','+Id+'); return false;" '
+ 'title="'+lang_tooltips.REVISIONDELETE_TIP+' '+Id+'">'+Id+'</a>'
rl += ' <span class="mw-revdelundel-link">'+rdlLink+'</span> ';
}
}
if (patrol[0] != null){
rl += ' <span class="patrollink">'+ patrol[0].innerHTML + '</span>';
}
if(rl!="") rl += "<br />";
var avant = "";
var apres = "";
var lav = avantEl.length;
var lap = apresEl.length;
for(var n=0; n < lav ; n++)
avant = avant + avantEl[n].innerHTML + "<br />";
for(var n=0; n < lap ; n++)
apres = apres + apresEl[n].innerHTML + "<br />";
LP.innerHTML = rl+"<table width='100%'><tr><td width='50%' class='diff-deletedline' style='vertical-align:top'>"+
avant+"</td><td class='diff-addedline' style='vertical-align:top'>"+apres+"</td></tr></table>";
}
else {
LP.innerHTML = "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>"+lD[0].innerHTML+"</table>";
}
}
var notPatrolled = lrcReplacePatrolLink(LP);
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
if (typeof (setupTooltips) != 'undefined') {
setupTooltips(dLP, false, true);
}
// Get username of submitter
var user1 = getElementWithId('mw-diff-otitle2', 'div', doc);
if (user1 != null) {
var usertmp=user1.innerHTML;
if (!usertmp) usertmp=user1.firstChild.firstChild.xml;
// user1 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a> \(<a(.*)/g), "$2");
user1 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\((.*)\)/g), "$2");
user1 = user1.replace(new RegExp(/(.*)<(.*)>/g), "$1");
}
var user2 = getElementWithId('mw-diff-ntitle2', 'div', doc);
if (user2 != null) {
var usertmp=user2.innerHTML;
if (!usertmp) usertmp=user2.firstChild.firstChild.xml;
// user2 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a> \(<a(.*)/g), "$2");
user2 = usertmp.replace(new RegExp(/<a (.*)>(.*)<\/a>(.*)\(<a(.*)/g), "$2");
}
var Previous = false;
var asPreviousDiff = getElementWithId('differences-prevlink', 'a', doc);
if(asPreviousDiff !=null){
var PreviousOldid = lrcGetArgFromURL(asPreviousDiff.href, "oldid");
if(PreviousOldid){
Previous = {
"url" : asPreviousDiff.href,
"text" : asPreviousDiff.innerHTML,
"title" : (asPreviousDiff.title ? asPreviousDiff.title : ""),
"oldid" : PreviousOldid
}
}
}
var Next = false;
var asNextDiff = getElementWithId('differences-nextlink', 'a', doc);
if (asNextDiff != null){
var NextOldid = lrcGetArgFromURL(asNextDiff.href, "oldid");
if(NextOldid){
Next = {
"url" : asNextDiff.href,
"text" : asNextDiff.innerHTML,
"title" : (asNextDiff.title ? asNextDiff.title : ""),
"oldid" : NextOldid
}
}
}
buildPreviewBar({
"Mode" : "Diff",
"Url" : lrcGetPageURL(page),
"Page" : page,
"User1" : user1,
"User2" : user2,
"Oldid" : oldid,
"Previous" : Previous,
"Next" : Next,
"patrolledDiff": !notPatrolled
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewDiff");
}
/* </source>
==== LiveHist ====
<source lang="javascript"> */
function liveHist(page, Params) {
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Hist : <span style='color:red'>"+page+"</span>...</b>");
var URL = lrcGetUglyPageURL(page, '&action=history');
if(!Params){
lrcAddToHistory("liveHist",
new Array(lrcEscapeStr(page)),
URL,
page
);
}else{
var HistoryParams = new Array();
for(var param in Params){
if(Params[param]){
if(param!="title" && param!="action"){
HistoryParams.push(param+":"+lrcEscapeStr(Params[param]));
URL += "&"+param+"="+encodeURIComponent(Params[param]);
}
}
}
lrcAddToHistory("liveHist",
new Array(lrcEscapeStr(page), "{"+HistoryParams.join(",")+"}"),
URL,
page + " : " + HistoryParams.join(" ")
);
}
wpajax.http({url:URL, onSuccess: getHist, message: page });
}
function getHist(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var c=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildPreviewBar({
"Mode" : "Hist",
"Url" : lrcGetUglyPageURL(c, '&action=history'),
"Page" : c,
"User1" : ""
});
modifyHistInput();
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewHistory");
}
function modifyHistInput(){
var LP = document.getElementById( 'livePreview' );
var SearchForm = getElementWithId('mw-history-searchform', 'form', LP);
var SInputs = SearchForm.getElementsByTagName('input');
for(var a=0,l=SInputs.length;a<l;a++){
if(SInputs[a].type && SInputs[a].type === "submit"){
var Input = SInputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processHistSearch(this)}
NewInput.onselect = function(){ processHistSearch(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.parentNode.removeChild(Input);
}
}
var CompareForm = getElementWithId('mw-history-compare', 'form', LP);
var CInputs = CompareForm.getElementsByTagName('input');
for(var a=0,l=CInputs.length;a<l;a++){
if(CInputs[a].type && CInputs[a].type === "submit"){
var Input = CInputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processHistCompare(this)}
NewInput.onselect = function(){ processHistCompare(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.parentNode.removeChild(Input);
}
}
}
function processHistSearch(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params["title"];
liveHist(page, Params);
}
function processHistCompare(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params["title"];
var diff = Params["diff"];
var oldid = Params["oldid"];
liveDiff(page, diff, oldid);
}
/* </source>
==== LiveArticle ====
<source lang="javascript"> */
function liveArticle(page, user) {
lrcAddToHistory("liveArticle", new Array(lrcEscapeStr(page), (user ? lrcEscapeStr(user):lrcEscapeStr(""))), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&redirect=no', page + (user ? " NewPage : User:"+user :""));
buildBlanckPreviewBar("<b style='text-decoration: blink;'><span style='color:red'>"+page+"</span>...</b>");
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(page) + '&redirect=no',
onSuccess: getArticle,
onFailure: getArticle, /* The return code might be 404 if the page has been deleted. */
page: page, user:user });
}
function getArticle(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var c=data.page;
var User=data.user;
var Url = data.url;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
if (bC == null) {
var CreateLink = '<a '
+ 'href="'+mw.config.get('wgServer') +mw.config.get('wgScript')+'?title='+encodeURIComponent(c)+'&action=edit&redlink=1" '
+ 'onClick="liveEdit('+lrcEscapeStr(c)+', \'&redlink=1\'); return false;";>';
LP.innerHTML = lang_messages.NOEXIST.split("$1").join(CreateLink).split("$2").join('</a>');
} else {
LP.innerHTML = bC.innerHTML;
}
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildPreviewBar({
"Mode" : "Article",
"Url" : lrcGetPageURL(c),
"Page" : c,
"User1" : (User ? User : false)
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewArticle");
}
/* </source>
==== LiveContrib ====
<source lang="javascript"> */
function liveContrib(user, Params) {
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Contributions : <span style='color:red'>"+user+"</span>...</b>");
if(!Params){
var URL = lrcGetPageURL('Special:Contributions/'+user);
lrcAddToHistory("liveContrib",
new Array(lrcEscapeStr(user)),
URL,
user
);
}else{
var URL = lrcGetUglyPageURL('Special:Contributions')+"&contribs=user&target="+encodeURIComponent(user);
var HistoryParams = new Array();
for(var param in Params){
if(Params[param]){
URL += "&"+param+"="+encodeURIComponent(Params[param]);
if(param!="target") HistoryParams.push(param+":"+lrcEscapeStr(Params[param]));
}
}
lrcAddToHistory("liveContrib",
new Array(lrcEscapeStr(user), "{"+HistoryParams.join(",")+"}"),
URL,
user + " : " + HistoryParams.join(" ")
);
}
wpajax.http({url:URL, onSuccess: getContrib, message: user });
}
function getContrib(xmlreq, data) {
var doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var user=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildPreviewBar({
"Mode" : "Contrib",
"Url" : lrcGetPageURL("Special:Contributions/" + user),
"Page" : "Special:Contributions/"+user,
"User1" : user
});
modifyContribInput();
LiveRC_RunHooks("AfterPreviewContribs");
}
function modifyContribInput(){
var LP = document.getElementById( 'livePreview' );
var Form = LP.getElementsByTagName('form')[0];
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs[a].type && Inputs[a].type === "submit"){
var Input = Inputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processContrib(this)}
NewInput.onselect = function(){ processContrib(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
}
updatePreviewWindowAttributes();
}
function processContrib(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var user = Params["target"];
liveContrib(user, Params);
}
/* </source>
==== LiveDeletedContrib ====
<source lang="javascript"> */
function liveDeletedContrib(user, Params) {
buildBlanckPreviewBar("<b style='text-decoration: blink;'>DeletedContributions : <span style='color:red'>"+user+"</span>...</b>");
if(!Params){
var URL = lrcGetPageURL('Special:DeletedContributions/'+user);
lrcAddToHistory("liveDeletedContrib",
new Array(lrcEscapeStr(user)),
URL,
user
);
}else{
var URL = lrcGetUglyPageURL('Special:DeletedContributions')+"&target="+encodeURIComponent(user);
var HistoryParams = new Array();
for(var param in Params){
if(Params[param]){
URL += "&"+param+"="+encodeURIComponent(Params[param]);
if(param!="target") HistoryParams.push(param+":"+lrcEscapeStr(Params[param]));
}
}
lrcAddToHistory("liveDeletedContrib",
new Array(lrcEscapeStr(user), "{"+HistoryParams.join(",")+"}"),
URL,
user + " : " + HistoryParams.join(" ")
);
}
wpajax.http({url:URL, onSuccess: getDeletedContrib, message: user });
}
function getDeletedContrib(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var user=data.message;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildPreviewBar({
"Mode" : "DeletedContrib",
"Url" : lrcGetPageURL("Special:DeletedContributions/" + user),
"Page" : "Special:DeletedContributions/"+user,
"User1" : user
});
modifyDeletedContribInput();
LiveRC_RunHooks("AfterPreviewDeletedContribs");
}
function modifyDeletedContribInput(){
var LP = document.getElementById( 'livePreview' );
var Form = LP.getElementsByTagName('form')[0];
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs[a].type && Inputs[a].type === "submit"){
var Input = Inputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processDeletedContrib(this)}
NewInput.onselect = function(){ processDeletedContrib(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
}
updatePreviewWindowAttributes();
}
function processDeletedContrib(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var user = Params["target"];
liveDeletedContrib(user, Params);
}
/* </source>
==== LiveLog ====
<source lang="javascript"> */
// (:it:User:Jalo)
function liveLog(action , params) {
var titolo = getLogTitle(action);
var URLParams = "";
var HistoryParams = new Array();
for(var param in params){
if(params[param]){
URLParams += "&"+ param + "=" + encodeURIComponent(params[param]);
HistoryParams.push(param + ":" + lrcEscapeStr(""+params[param]));
}
}
lrcAddToHistory("liveLog", new Array(lrcEscapeStr(action), "{"+HistoryParams.join(",")+"}"), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&type=' + action + URLParams, titolo + " : " + HistoryParams.join(", "));
buildBlanckPreviewBar("<b style='text-decoration: blink;'><span style='color:red'>"+titolo+"</span>...</b>");
wpajax.http({url:mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Log&type=' + action + URLParams, onSuccess: getLog, page:params["page"] , user:params["user"] });
}
function getLogTitle(action){
var lrcLogNames = {
'upload':'uploadlogpage',
'newusers':'newuserlogpage',
'block':'blocklogpage',
'delete':'dellogpage',
'move':'movelogpage',
'protect':'protectlogpage',
'patrol':'review-logpage',
'gblblock':'globalblocking-logpage',
'renameuser':'renameuserlogpage',
'import':'importlogpage',
'globalauth':'centralauth-log-name',
'gblrights':'centralauth-rightslog-name',
'abusefilter':'abusefilter-log-name',
'merge':'mergelog',
'rights':'rightslog'
}
for(var Action in lrcLogNames){
if(action == Action) return lrcMediawikiMessages[lrcLogNames[Action]];
}
return lrcMediawikiMessages["log"];
}
function getLog(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var c = data.page;
var pref = "Page : ";
if(!c){
c=data.user;
pref = "User : ";
}
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildBlanckPreviewBar('<b><a href="'+lrcGetPageURL(c)+'" target="_new">'+pref+c+'</a></b>', true);
modifyLogInput();
LiveRC_RunHooks("AfterPreviewLog");
}
function modifyLogInput(){
var LP = document.getElementById( 'livePreview' );
var Form = LP.getElementsByTagName('form')[0];
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs[a].type && Inputs[a].type === "submit"){
var Input = Inputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processLog(this)}
NewInput.onselect = function(){ processLog(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
}
updatePreviewWindowAttributes();
}
function processLog(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var action = Params["type"];
var page = Params["page"];
var user = Params["user"];
liveLog(action, {page:page,user:user});
}
/* </source>
==== LiveFilter ====
<source lang=javascript> */
function liveFilter(id) {
lrcAddToHistory("liveFilter", new Array(lrcEscapeStr(id)), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:AbuseLog&details='+id, "detail : "+id);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Filter: <span style='color:red'></span>...</b>");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:AbuseLog&details='+id,
onSuccess: getFilter, mid: id});
}
function getFilter(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildBlanckPreviewBar('<b><a href="'+mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=Special:AbuseLog&details='+data.mid+'" target="_new">Détails</a></b> id = '+data.mid, true);
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewFilter");
}
/* </source>
==== LiveDelete ====
<source lang="javascript"> */
function liveDelete(Title){
lrcAddToHistory("liveDelete", new Array(lrcEscapeStr(Title)), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title + '&action=delete', Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Suppr : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title.replace(/&/g, "%26") + '&action=delete',
onSuccess: getDelete, title:Title});
}
function getDelete(xmlreq, data){
var c = data.title;
var Temp = gml_XMLParse(xmlreq.responseText);
var bC = getElementWithId("deleteconfirm", 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = "";
PreviewWindow.appendChild(bC);
var PreviewDiv = document.getElementById( 'divLivePreview' );
if (PreviewDiv.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
PreviewDiv.style.display = "inline";
}
var Input = document.getElementById("wpConfirmB");
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_wpConfirmB";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processDelete()}
NewInput.onselect = function(){ processDelete()}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
buildPreviewBar({
"Mode" : "Delete",
"Url" : lrcGetPageURL(c),
"Page" : c,
"User1" : ""
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewDelete");
}
function processDelete(){
var Params = '';
for(var param in lrcPOSTParams["Delete"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Delete"][param] ? encodeURIComponent(Element.value) : Element.value);
}
}
}
var action = document.getElementById("deleteconfirm").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneDelete
});
}
function doneDelete(ajaxDelete){
var Temp = gml_XMLParse(ajaxDelete.responseText);
var NotDone = getElementWithId('deleteconfirm', 'form', Temp);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
}
/* </source>
==== LiveProtect ====
<source lang="javascript"> */
function liveProtect(Title){
lrcAddToHistory("liveProtect", new Array(lrcEscapeStr(Title)), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title + '&action=protect', Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Protect : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title.replace(/&/g, "%26") + '&action=protect',
onSuccess: getProtect, title:Title});
}
function getProtect(xmlreq, data){
var c = data.title;
var Temp = gml_XMLParse(xmlreq.responseText);
var ProtectionForm = getElementWithId("mw-Protect-Form", 'form', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = "";
PreviewWindow.appendChild(ProtectionForm);
var PreviewDiv = document.getElementById( 'divLivePreview' );
if (PreviewDiv.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
PreviewDiv.style.display = "inline";
}
buildPreviewBar({
"Mode" : "Protect",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(c) + '&action=protect',
"Page" : c,
"User1" : ""
});
modifyProtectform();
}
function modifyProtectform(){
var Input = document.getElementById("mw-Protect-submit");
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_mw-Protect-submit";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processProtect()}
NewInput.onselect = function(){ processProtect()}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
var Cascade = document.getElementById('mwProtect-cascade');
if(Cascade) Cascade.checked = false;
var PreviewWindow = document.getElementById("livePreview");
var ProtectEditSelect = getElementWithId("mwProtect-level-edit", 'select', PreviewWindow);
ProtectEditSelect.onchange = function(){ modifyProtectformUpdate(this); };
var ProtectMoveSelect = getElementWithId("mwProtect-level-move", 'select', PreviewWindow);
ProtectMoveSelect.onchange = function(){ modifyProtectformUpdate(this); };
var ProtectSet = getElementWithId("mwProtectSet", "table", PreviewWindow);
var Target = ProtectSet.getElementsByTagName('tr')[0].nextSibling;
var UnchainedInput = document.createElement('input');
UnchainedInput.id = "mwProtectUnchained";
UnchainedInput.type = "checkbox";
UnchainedInput.onclick = function(){ ProtectUnchainedToggle(); };
var UnchainedLabel = document.createElement('label');
UnchainedLabel.setAttribute("for", "mwProtectUnchained");
UnchainedLabel.innerHTML = lrcMediawikiMessages["protect-unchain-permissions"];
var UnchainedTr = document.createElement('tr');
var UnchainedTd = document.createElement('td');
UnchainedTd.appendChild(UnchainedInput);
UnchainedTd.appendChild(UnchainedLabel);
UnchainedTr.appendChild(UnchainedTd);
Target.parentNode.insertBefore(UnchainedTr, Target);
ProtectUnchainedToggle();
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewProtect");
}
function ProtectUnchainedToggle(){
var PreviewWindow = document.getElementById("livePreview");
var ProtectUnchainedInput = getElementWithId("mwProtectUnchained", 'input', PreviewWindow);
var ProtectMoveSelect = getElementWithId("mwProtect-level-move", 'select', PreviewWindow);
if(ProtectUnchainedInput.checked){
ProtectMoveSelect.disabled = false;
}else{
ProtectMoveSelect.disabled = "disabled";
}
}
function modifyProtectformUpdate(Select){
var PreviewWindow = document.getElementById("livePreview");
var ProtectEditSelect = getElementWithId("mwProtect-level-edit", 'select', PreviewWindow);
var ProtectMoveSelect = getElementWithId("mwProtect-level-move", 'select', PreviewWindow);
var ProtectUnchainedInput = getElementWithId("mwProtectUnchained", 'input', PreviewWindow);
if(!ProtectEditSelect ||!ProtectMoveSelect || !ProtectUnchainedInput ) return;
if(ProtectUnchainedInput.checked) return;
var Value = Select.value;
ProtectEditSelect.value = Value;
ProtectMoveSelect.value = Value;
}
function processProtect(){
var Params = '';
for(var param in lrcPOSTParams["Protect"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Protect"][param] ? encodeURIComponent(Element.value) : Element.value);
}
}
}
var action = document.getElementById("mw-Protect-Form").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneProtect
});
}
function doneProtect(ajaxProtect){
var Temp = gml_XMLParse(ajaxProtect.responseText);
var NotDone = getElementWithId('mw-Protect-Form', 'form', Temp);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
}
/* </source>
==== LiveBlock ====
<source lang="javascript"> */
function liveBlock(UserName){
lrcAddToHistory("liveBlock", new Array(lrcEscapeStr(UserName)), lrcGetPageURL('Special:Blockip/' + UserName), UserName);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Block : <span style='color:red'>"+UserName+"</span>...</b>");
wpajax.http({url: lrcGetPageURL('Special:Blockip/' + UserName) ,
onSuccess: getBlock, user:UserName});
}
function getBlock(xmlreq, data){
var c = data.user;
var Temp = gml_XMLParse(xmlreq.responseText);
var bC = getElementWithId("blockip", 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = "";
PreviewWindow.appendChild(bC);
var PreviewDiv = document.getElementById( 'divLivePreview' );
if (PreviewDiv.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
PreviewDiv.style.display = "inline";
}
var Input = document.getElementsByName("wpBlock")[0];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_wpBlock";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processBlock()}
NewInput.onselect = function(){ processBlock()}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
buildPreviewBar({
"Mode" : "Block",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Blockip/' + encodeURIComponent(c),
"Page" : c,
"User1" : c
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewBlock");
}
function processBlock(){
var Params = '';
var user = "";
var duration = "";
for(var param in lrcPOSTParams["Block"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Block"][param] ? encodeURIComponent(Element.value) : Element.value);
if(Element.name=="wpBlockAddress") user = Element.value;
if(Element.name=="wpBlockExpiry") duration = Element.value;
if(Element.name=="wpBlockOther" && Element.value!="") duration = Element.value;
}
}
}
var action = document.getElementById("blockip").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneBlock,
user:user,
duration:duration
});
}
function doneBlock(ajaxBlock, data){
var Temp = gml_XMLParse(ajaxBlock.responseText);
var NotDone = getElementWithId('deleteconfirm', 'form', Temp);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
var user = data.user;
var duration = data.duration;
if(user && duration ){
var Bar = PreviewBarTemplate;
var UserLink = '<b>'+lrcGetUserLink(user)+' '+lang_messages.BLOCKED+'</b>';
var BlockAverto = ' <small>'
+ '<a id="BlockAvertoLink" href="javascript:;" '
+ 'onClick="doBlockAverto('+lrcEscapeStr(user)+');" title="'+lang_menu.AVERTS+' « '+user+' »">'+lang_menu.AVERTS+'</a> : '
+ '<input id="BlockAvertoParam" type="text" value="'+lang_messages.BLOCKTEMPLATE+'|'+duration+'" />'
+ '</small>';
Bar = Bar.split('$1').join(UserLink);
Bar = Bar.split('$2').join(" ");
Bar = Bar.split('$3').join(" ");
Bar = Bar.split('$4').join(BlockAverto);
var TabContainer = document.getElementById("livePreviewTitle");
if(TabContainer) TabContainer.innerHTML = Bar;
}
}
function doBlockAverto(user){
var message = document.getElementById("BlockAvertoParam").value;
var summary = lang_messages.BLOCKAVERTO;
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+mw.config.get('wgFormattedNamespaces')[3]+":"+user.replace(/&/g, "%26"),
onSuccess: postLiveAverto,
user: user, message: message, summary:summary });
}
/* </source>
==== LiveEdit ====
<source lang="javascript"> */
function liveEdit(Title, Param){
lrcAddToHistory("liveEdit", new Array(lrcEscapeStr(Title), (Param?lrcEscapeStr(""+Param):'\'\'')), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title + '&action=edit' + (Param ? Param : ""), Title + (Param ? ' Param="'+Param+'"' : ""));
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Edit : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + Title.replace(/&/g, "%26") + '&action=edit' + (Param ? Param : ""),
onSuccess: getEdit, title:Title});
}
function getEdit(xmlreq, data){
var c = data.title;
var Temp = gml_XMLParse(xmlreq.responseText);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = "";
PreviewWindow.appendChild(bC);
var PreviewDiv = document.getElementById( 'divLivePreview' );
if (PreviewDiv.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
PreviewDiv.style.display = "inline";
}
buildPreviewBar({
"Mode" : "Edit",
"Url" : mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(c) + '&action=edit',
"Page" : c,
"User1" : ""
});
modifyEditform(bC);
}
function modifyEditform(Editform){
var inputs = new Array("wpSave", "wpPreview", "wpDiff");
for(var a=0,l=inputs.length;a<l;a++){
var Input = document.getElementById(inputs[a]);
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_" + Input.id;
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processEdit(this)}
NewInput.onselect = function(){ processEdit(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
currentFocused = document.getElementById("wpTextbox1"); // Do not change variable name : used by insertTags()
currentFocused.rows = 10;
try{
var ToolbarButtons = document.getElementById('toolbar').getElementsByTagName('script')[0].innerHTML;
eval(ToolbarButtons);
mwSetupToolbar();
}catch(e){ }
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewEdit");
}
function processEdit(Input){
var Params = '';
for(var param in lrcPOSTParams["Edit"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Edit"][param] ? encodeURIComponent(Element.value) : Element.value);
}
}
}
var Type = Input.id.replace(/.*_/g, "");
if(Type == "wpSave"){
Params += "&wpEditToken="+encodeURIComponent(document.getElementsByName("wpEditToken")[0].value);
}else{
Params += "&"+Type+"=1";
}
var action = document.getElementById("editform").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneEdit,
type:Type
});
}
function doneEdit(ajaxEdit, data){
var Type = data.type;
var Temp = gml_XMLParse(ajaxEdit.responseText);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML ="";
PreviewWindow.innerHTML = bC.innerHTML;
if(getElementWithId("editform", 'form', PreviewWindow)){
modifyEditform();
if(Type=="wpDiff") getElementWithId('wikiPreview', 'div', PreviewWindow).style.display = "";
}else if(Type == "wpSave"){
PreviewWindow.className = "";
}
}
/* </source>
==== LiveMove ====
<source lang="javascript"> */
function liveMove(Title){
lrcAddToHistory("liveMove", new Array(lrcEscapeStr(Title)), lrcGetPageURL("Special:Movepage/"+ Title), Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Move : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgArticlePath').split("$1").join("Special:Movepage/") + Title.replace(/&/g, "%26"),
onSuccess: getMove, title:Title});
}
function getMove(xmlreq, data){
var c = data.title;
var Temp = gml_XMLParse(xmlreq.responseText);
var bC = getElementWithId("movepage", 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = "";
PreviewWindow.appendChild(bC);
var PreviewDiv = document.getElementById( 'divLivePreview' );
if (PreviewDiv.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
PreviewDiv.style.display = "inline";
}
var MoveSubmit = false;
var Inputs = bC.getElementsByTagName("input");
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs[a].name && Inputs[a].name == "wpMove") MoveSubmit = Inputs[a];
}
if(MoveSubmit){
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_wpMove";
NewInput.name = "Live_wpMove";
NewInput.value = MoveSubmit.value + " (live)";
NewInput.onclick = function(){ processMove()}
NewInput.onselect = function(){ processMove()}
MoveSubmit.parentNode.insertBefore(NewInput, MoveSubmit);
MoveSubmit.style.display = "none";
}
buildPreviewBar({
"Mode" : "Move",
"Url" : lrcGetPageURL('Special:Movepage/'+ c),
"Page" : c,
"User1" : ""
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewMove");
}
function processMove(){
var Params = '';
for(var param in lrcPOSTParams["Move"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Move"][param] ? encodeURIComponent(Element.value) : Element.value);
}
}
}
var action = document.getElementById("movepage").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneMove
});
}
function doneMove(ajaxEdit, Type){
var Temp = gml_XMLParse(ajaxEdit.responseText);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
var PreviewWindow = document.getElementById("livePreview");
var MoveForm = getElementWithId("movepage", 'form', PreviewWindow)
if(MoveForm){
var OldTitle = document.getElementsByName("wpOldTitle")[0].value;
getMove(ajaxEdit, OldTitle);
}else{
PreviewWindow.innerHTML = bC.innerHTML;
}
}
/* </source>
==== LiveRevisiondelete ====
<source lang="javascript"> */
function buildRevisiondeleteBar(Page){
var PreviewDiv = document.getElementById( 'livePreview' );
if(!PreviewDiv) return "";
var HideSpans = getElementsByClass("mw-revdelundel-link", PreviewDiv, "span");
var HideLinks = new Array();
for(var a=0,l=HideSpans.length;a<l;a++){
var Link = HideSpans[a].getElementsByTagName('a')[0];
var Id = lrcGetArgFromURL(Link.href, "ids");
var HideLink = '<a href="'+mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Revisiondelete&type=revision&target='+encodeURIComponent(Page)+'&ids='+Id+'" '
+ 'onClick="liveRevisiondelete('+lrcEscapeStr(Page)+','+Id+'); return false;" '
+ 'title="'+lang_tooltips.REVISIONDELETE_TIP+' '+Id+'">'+Id+'</a>';
HideLinks.push(HideLink);
}
if(HideLinks.length==0) return "";
var RevisiondeleteTabs = '<small>'
+ lang_tooltips.REVISIONDELETE_SHORT
+ ' : '
+ HideLinks.join(' | ')
+ '</small>'
+ ' • ';
return RevisiondeleteTabs;
}
function liveRevisiondelete(Page,Id){
lrcAddToHistory("liveRevisionDelete", new Array(Page, Id), mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Revisiondelete&type=revision&target='+encodeURIComponent(Page)+'&ids='+Id, Page + " id="+Id);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Revision delete : <span style='color:red'>"+Page+" id="+Id+"</span>...</b>")
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:Revisiondelete&type=revision&target='+encodeURIComponent(Page)+'&ids='+Id,
onSuccess: getRevisiondelete, mpage: Page, mid: Id});
}
function getRevisiondelete(xmlreq, data){
var doc = gml_XMLParse(xmlreq.responseText);
var c = data.mpage;
var oldid = data.mid;
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var PreviewDiv = document.getElementById( 'livePreview' );
PreviewDiv.innerHTML = bC.innerHTML;
if (PreviewDiv.innerHTML == "undefined") PreviewDiv.innerHTML = bC.xml;
buildPreviewBar({
"Mode" : "Revisiondelete",
"Url" : lrcGetPageURL(c),
"Page" : c,
"Oldid" : oldid,
"User1" : "",
"User2" : "",
"patrolledDiff": true
});
getRevisiondelete_ModifyInputs();
}
function getRevisiondelete_ModifyInputs(){
var Form = document.getElementById("mw-revdel-form-revisions");
if(!Form) return;
var Input = document.getElementsByName("wpSubmit")[0];
if(Input){
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_Revisiondelete";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processRevisiondelete()}
NewInput.onselect = function(){ processRevisiondelete()}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewRevisiondelete");
}
function processRevisiondelete(){
var Params = '';
for(var param in lrcPOSTParams["Revisiondelete"]){
var Element = document.getElementById(param);
if(!Element) Element = document.getElementsByName(param)[0];
if(Element){
if(!(Element.tagName && Element.tagName.toLowerCase()=='input' && Element.type == 'checkbox' && !Element.checked)){
Params += "&"+Element.name + "=" + (lrcPOSTParams["Revisiondelete"][param] ? encodeURIComponent(Element.value) : Element.value);
}
}
}
var Page = decodeURIComponent(lrcGetArgFromURL(Params, "target"));
var Id = lrcGetArgFromURL(Params, "ids");
var action = document.getElementById("mw-revdel-form-revisions").action;
var headers = new Array();
headers['Content-Type'] = 'application/x-www-form-urlencoded';
Params = Params+"&wpSubmit=1";
if(!Params) return;
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Revision delete : <span style='color:red'>"+Page+" id="+Id+"</span>...</b>")
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: Params,
onSuccess:doneRevisiondelete,
mpage:Page,
mid:Id
});
}
function doneRevisiondelete(wpajax, data){
var Page = data.mpage;
var Id = data.mid;
var Temp = gml_XMLParse(wpajax.responseText);
var bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
buildPreviewBar({
"Mode" : "Revisiondelete",
"Url" : lrcGetPageURL(Page),
"Page" : Page,
"Oldid" : Id,
"User1" : "",
"User2" : "",
"patrolledDiff" : true,
"RevisiondeleteOK": true
});
getRevisiondelete_ModifyInputs();
}
/* </source>
==== LiveWhatLinkshere ====
<source lang="javascript"> */
function liveWhatlinkshere(page , params) {
var URLParams = "";
var HistoryParams = new Array();
for(var param in params){
if(params[param]){
URLParams += "&"+ param + "=" + encodeURIComponent(params[param]);
HistoryParams.push(param + ":" + lrcEscapeStr(""+params[param]));
}
}
lrcAddToHistory("liveWhatlinkshere", new Array(lrcEscapeStr(page), "{"+HistoryParams.join(",")+"}"),
lrcGetUglyPageURL('Special:Whatlinkshere/'+page, URLParams), page + " : " + HistoryParams.join(", "));
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Whatlinkshere <span style='color:red'>"+page+"</span>...</b>");
wpajax.http({url:lrcGetUglyPageURL('Special:Whatlinkshere/'+page, URLParams), onSuccess: getWhatlinkshere, page:page });
}
function getWhatlinkshere(xmlreq, data) {
doc = gml_XMLParse(xmlreq.responseText);
bC = getElementWithId('bodyContent', 'div', doc);
if (bC == null) bC = getElementWithId('article', 'div', doc);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', doc);
var c = data.page;
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
LP.innerHTML = bC.innerHTML;
if (LP.innerHTML == "undefined") LP.innerHTML = bC.xml;
if (dLP.style.display == "none") {
var elcb = document.getElementById( 'shidPrev' );
elcb.checked="true";
dLP.style.display = "inline";
}
buildBlanckPreviewBar('<b><a href="'+lrcGetPageURL(c)+'" target="_new">'+c+'</a></b>', true);
modifyWhatlinkshereInput(data.url);
LiveRC_RunHooks("AfterPreviewWhatlinkshere");
}
function modifyWhatlinkshereInput(url){
var LP = document.getElementById( 'livePreview' );
var Form = LP.getElementsByTagName('form')[0];
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs[a].type && Inputs[a].type === "submit"){
var Input = Inputs[a];
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processWhatlinkshere(this)}
NewInput.onselect = function(){ processWhatlinkshere(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
}
var NewFiltersContainer = document.createElement('p');
Form.getElementsByTagName('fieldset')[0].appendChild(NewFiltersContainer);
var FilterFieldset = LP.getElementsByTagName('fieldset')[1];
if(FilterFieldset){
var FilterLegend = FilterFieldset.getElementsByTagName('legend')[0];
NewFiltersContainer.appendChild(document.createTextNode(lrcMediawikiMessages["whatlinkshere-filters"]+' : '));
FilterLegend.parentNode.removeChild(FilterLegend);
var params = {
"hidetrans" : "whatlinkshere-hidetrans" ,
"hidelinks" : "whatlinkshere-hidelinks" ,
"hideredirs" : "whatlinkshere-hideredirs" ,
"hideimages" : "whatlinkshere-hideimages"
};
for(var param in params){
var ThisParam = param;
var ThisParamChecked = ( (lrcGetArgFromURL(url, ThisParam) === '1') ? true : false );
var NewInput = document.createElement('input');
NewInput.type = "checkbox";
NewInput.id = ThisParam;
NewInput.name = ThisParam;
NewInput.value = 1;
if(ThisParamChecked) NewInput.checked = "checked";
var NewLabel = document.createElement('label')
NewLabel.setAttribute('for', ThisParam);
NewLabel.innerHTML = lrcMediawikiMessages[params[param]].split("$1").join(lrcMediawikiMessages["hide"]);
NewFiltersContainer.appendChild(NewInput);
NewFiltersContainer.appendChild(NewLabel);
NewFiltersContainer.appendChild(document.createTextNode(" • "));
}
FilterFieldset.parentNode.removeChild(FilterFieldset);
}
updatePreviewWindowAttributes(NewLabel);
}
function processWhatlinkshere(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params["target"];
liveWhatlinkshere(page, Params);
}
/* </source> */