/*
==LiveWP==
* Documentation : ]
* Author : ]
* Dev & enhancements :
** ],
** ],
** ],
** ],
** ],
** ],
** ],
** ],
** ]
{{Catégorisation JS|LiveRC}}
=== Variables globales ===
<source lang="javascript"> */
if(typeof(LiveRC_PageTitle)=="undefined") LiveRC_PageTitle = "Utilisateur:Althiphika/LiveRC";
if(typeof(LiveRC_MessagesPage)=="undefined") LiveRC_MessagesPage = "MediaWiki:Gadget-LiveRCMessages.js";
var LiveRC_Version = "0.4.7b";
if (mw.config.get('wgPageName') == LiveRC_PageTitle && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")) {
/* </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 PORTAIL = 2 << 21;
var UPLOAD = 2 << 22;
var NEWUSER = 2 << 23;
var BLOCK = 2 << 24;
var DELETE = 2 << 25;
var MOVE = 2 << 26;
var PROTECT = 2 << 27;
var PATROL = 2 << 28;
var ABFILTER = 2 << 29;
var TAG = 2 << 30;
var REVIEW = 2 << 31;
// Comments test table (regexp format);
// ////////////////////////////////////
var commenttests = [
{ state: BLANKING , regex: /^Résumé automatique : blanchiment|^lanchi/ },
{ state: REPLACED , regex: /^Résumé automatique : contenu remplacé par/ },
{ state: REVERT , regex: /(LiveRC : )?Révocation |(ot : )?nnulation des modifications|(ot : )?é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
"LoadWatchlist" : true, // Load articles and users on watchlist (expensive at startup)
"LoadIPCat" : true, // Load categories on the users' talk pages and blocks log (expensive at startup)
"LoadCatAndTemplates" : true, // Load categories and templates on modified articles (very expensive)
"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
"PreloadLines" : true // Preload lines when using 'Next' button
}
// 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",
AWARDS : "Récompenser",
AVERTS : "Avertir",
EMPTY : "Blanchir",
TAG : "Bandeau",
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: "↩",
WATCH_TIP: "Suivre",
WATCH_SHORT: "S",
UNWATCH_TIP: "Ne plus suivre",
UNWATCH_SHORT: "<s>S</s>",
ASKSYSOP_SHORT: "Demande sysop",
ASKSYSOP_TIP: "Demander une action à un administrateur",
// other
WORKING: "Traitement en cours...",
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: '] : ',
BLOCKAVERTO: 'Avertissement blocage',
BLOCKTEMPLATE: 'Blocage',
UPDATEMESSAGES: 'Mise à jour des messages système',
CLOCKTITLE: 'Afficher/Masquer l\'horloge'
};
/* </source>
==== Blanchiment, révocation et avertissement ====
<source lang=javascript> */
// Récompense
var lstAward = [
{ template: "Récompense/Attitude" , string: "Attitude" , hasPage: false },
{ template: "Récompense/Apprentissage" , string: "Apprentissage" , hasPage: false },
{ template: "Récompense/Maintenance" , string: "Maintenance" , hasPage: false },
{ template: "Récompense/Merci" , string: "Merci" , hasPage: false },
{ template: "Récompense/Neutralisation", string: "Neutralisation", hasPage: false },
{ template: "Récompense/Orthographe" , string: "Orthographe" , hasPage: false },
{ template: "Récompense/Sources" , string: "Sources" , hasPage: false },
];
// 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: "]" },
{tooltip: "CAA" , resume: "]" },
{tooltip: "non encyclo" , resume: "]" },
{tooltip: "BaS" , resume: "bac à sable" },
{tooltip: "vandalisme" , resume: "vandalisme" }
];
// Révocation
var lrcRevertMessages = [
{ resume: "]" , text: "Bac à sable" },
{ resume: "]" , text: "Vandalisme" },
{ resume: "Retrait d'information non sourcée" , text: "Non-sourcé" },
{ resume: "Traduction automatique" , text: "Trad auto" }
];
// Bandeaux
var lstTag = [
{ template: "Admissibilité à vérifier" , string: "admissibilité" , withDate: true },
{ template: "Copie à vérifier" , string: "copyvio" , withDate: false },
{ template: "À sourcer" , string: "à sourcer" , withDate: true },
{ template: "À wikifier" , string: "à wikifier" , withDate: true },
{ template: "Promotionnel" , string: "promotionnel" , withDate: false },
{ template: "Travail inédit" , string: "TI" , withDate: false }
];
/* </source>
==== Requête aux administrateurs ====
<source lang=javascript> */
var lstAskForSysop = [
{ userright:"delete",
text:"Suppression",
page:"Wikipédia:Demande de suppression immédiate",
template:"Wikipédia:LiveRC/Modèles/Demande de suppression",
parampage:true,
paramuser:false,
reasonsdropdownname:"deletereason-dropdown"
},
{ userright:"protect",
text:"Protection",
page:"Wikipédia:Demande de protection de page",
template:"Wikipédia:LiveRC/Modèles/Demande de protection",
parampage:true,
paramuser:false,
reasonsdropdownname:"protect-dropdown"
},
{ userright:"block",
text:"Blocage",
page:"Wikipédia:Vandalisme en cours",
template:"Wikipédia:LiveRC/Modèles/Demande de blocage",
parampage:false,
paramuser:true,
reasonsdropdownname:"ipbreason-dropdown"
}
];
/* </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 = '<sup style="color:crimson">(cat ?)</sup>';
lrcIcon = '<sup style="color:crimson">(portail ?)</sup>';
lrcIcon = '<sup style="color:red">($1 révoc <a href="javascript:;" onClick="removeRevoc($2)" title="Remettre le compteur de révocations à zéro">-</a>)</sup>';
lrcIcon = '<br /><span style="color: red; font-weight: bold;">Tag : $1$2</span>';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/Disambig.svg/16px-Disambig.svg.png" '
+ 'width="16px" title="Homonymie" alt="Homonymie" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Construction_cone.png/12px-Construction_cone.png" '
+ 'width="12px" title="Ébauche" alt="Ébauche" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Padlock-red.svg/16px-Padlock-red.svg.png" '
+ 'width="16px" title="Article protégé" alt="Article protégé"/>';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/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 = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Copyright.svg/16px-Copyright.svg.png" '
+ 'width="16px" title="Article soupçonné d\'enfreindre un copyright" alt="Copyright" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/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 = '<sup><img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Fairytale_bookmark_gold.png/10px-Fairytale_bookmark_gold.png" '
+ 'width="10px" title="Article de qualité" alt="Adq" /></sup>';
lrcIcon = '<sup><img '
+ 'src="http://upload.wikimedia.org/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 = '<sup><img '
+ 'src="http://upload.wikimedia.org/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 = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Forward.png/16px-Forward.png" '
+ 'width="16px" title="Renommage" alt="Renommage" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Redirectltr.png/20px-Redirectltr.png" '
+ 'width="20px" title="Redirection" alt="Redirect" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Gartoon-Gnome-dev-floppy.png/16px-Gartoon-Gnome-dev-floppy.png" '
+ 'width="16px" title="Upload" alt="Upload" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Crystal_personal.png/16px-Crystal_personal.png" '
+ 'width="16px" title="Nouvel utilisateur" alt="Nouvel utilisateur" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/64/Crystal_Clear_action_lock3.png/16px-Crystal_Clear_action_lock3.png" '
+ 'width="16px" title="Blocage" alt="Blocage" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/Editcut.png/16px-Editcut.png" '
+ 'width="16px" title="Suppression" alt="Suppression" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/72/Crystal_Clear_app_agent.png/16px-Crystal_Clear_app_agent.png" '
+ 'width="16px" title="Protection" alt="Protection" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/Nuvola_apps_kservices.png/16px-Nuvola_apps_kservices.png" '
+ 'width="16px" title="Bot" alt="Bot" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/16px-Broom_icon.svg.png" '
+ 'width="16px" title="Administrateur" alt="Administrateur" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Nuvola_actions_undo.png/16px-Nuvola_actions_undo.png" '
+ 'width="16px" title="Revert" alt="Revert" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Dialog-warning.svg/16px-Dialog-warning.svg.png" '
+ 'width="16px" title="TOR" alt="TOR" />';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/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 = '<img '
+ 'src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Categorie_III.svg/10px-Categorie_III.svg.png" '
+ 'width="10px" title="Warning" alt="Warning"/>';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/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 = '<img '
+ 'src=http://upload.wikimedia.org/wikipedia/commons/thumb/9/98/Crystal_kdmconfig.png/16px-Crystal_kdmconfig.png '
+ 'width="16px" title="Adresse IP scolaire" alt="IP scolaire"/>';
lrcIcon = '<img '
+ 'src="http://upload.wikimedia.org/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="http://upload.wikimedia.org/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 target="_blank" href="http://fr.wikipedia.orghttps://wikines.com/fr/Wikipédia: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",
"MessagesLegend" : "Messages système",
"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'),
'DesclstAward': new Array('Modèles de récompenses', 'Récompenses'),
'DesclstTag': new Array('Modèles de bandeaux', 'Bandeaux'),
'DesclstAskForSysop' : new Array('Modèles de requête aux administrateurs', 'Requêtes sysop'),
'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'),
'DescContactListLegend': new Array('Liste des contacts', 'Contacts'),
'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'),
'DescLoadWatchlist': new Array('Charger la liste des articles et utilisateurs suivis (coûteux au démarrage)', 'Charger la liste des articles et utilisateurs suivis (coûteux au démarrage)'),
'DescLoadIPCat': new Array('Charger les catégories d\'utilisateurs et le journal des blocages (coûteux au démarrage)', 'Charger les catégories d\'utilisateurs et le journal des blocages (coûteux au démarrage)'),
'DescLoadCatAndTemplates': new Array('Charger les catégories et modèles des articles (très coûteux)', 'Charger les catégories et modèles des articles (très coûteux)'),
'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'),
'DescPreloadLines': new Array('Préchargement des diff', 'Préchargement des diff'),
// 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"),
"DescNoportal": new Array("Sans bandeau de portail", "Sans portail"),
"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"),
"DescAWARDS": new Array("Récompenser", "Récompenser"),
"DescAVERTS": new Array("Avertir", "Avertir"),
"DescEMPTY": new Array("Blanchir", "Blanchir"),
"DescTAG": new Array("Bandeau", "Bandeau"),
"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"),
"DescASKSYSOP_TIP":new Array("Tooltip du lien pour les demandes sysop", "Demande sysop tooltip"),
"DescASKSYSOP_SHORT":new Array("Texte du lien pour les demandes sysop", "Demande sysop 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 le bac à sable", "Message sur le 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"),
"DescUPDATEMESSAGES":new Array("Résumé de modif mise à jour des messages système", "Résumé de modif mise à jour des messages système"),
// 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"),
"DescMessagesLegend":new Array("Commentaire \"Messages système\" dans le js", "Commentaire \"Messages système\" 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>';
// Tchat
var lrcTchatChannel = "#wikipedia-fr-liverc";
// 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":"MostModifiedPagesExtension",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/MostModifiedPagesExtension.js",
"desc":"Ajoute une icône aux pages ayant été modifiées par au moins <code>X</code> utilisateurs différents durant la dernière heure (<code>X</code> est personnalisable, 5 par défaut)."
},
{
"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...)"
},
{
"name":"HotCatsMulti",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/HotCatsMulti.js",
"desc":"Permet d'ajouter/modifier/retirer une ou plusieurs catégories lors de la prévisualisation d'un article"
},
{
"name":"BandeauPortail",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/BandeauPortail.js",
"desc":"Permet d'ajouter/modifier/retirer un ou plusieurs bandeau de portail lors de la prévisualisation d'un article"
},
{
"name":"OnlyWatchlist",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/Watchlist.js",
"desc":"Permet de ne surveiller que les pages de la liste de suivi"
},
{
"name":"CategoryRC",
"url":"http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dr Brains/LiveRC/CategoryRCExtension.js",
"desc":"Permet de ne surveiller que les pages appartenant à une ou plusieur catégories"
}
];
var lrcNeededMessages = new Array("abusefilter-log-name",
"abusefilter-action-block",
"abusefilter-action-blockautopromote",
"abusefilter-action-degroup",
"abusefilter-action-disallow",
"abusefilter-action-rangeblock",
"abusefilter-action-tag",
"abusefilter-action-throttle",
"abusefilter-action-warn",
"blocklogpage",
"centralauth-log-name",
"centralauth-rightslog-name",
"deletereason-dropdown",
"dellogpage",
"disambiguationspage",
"globalblocking-logpage",
"hide",
"importlogpage",
"ipbreason-dropdown",
"log",
"mergelog",
"movelogpage",
"mycontris",
"newuserlogpage",
"protect-dropdown",
"protect-unchain-permissions",
"protectlogpage",
"red-link-title",
"renameuserlogpage",
"revertpage",
"review-logpage",
"rightslog",
"uploadlogpage",
"whatlinkshere-filters",
"whatlinkshere-hideimages",
"whatlinkshere-hidelinks",
"whatlinkshere-hideredirs",
"whatlinkshere-hidetrans"
);
/* </source>
==== Variables non personnalisables ====
<source lang=javascript> */
var lastrcid=0,lastfilterid=0,lastlogid=0,lastrctimestamp=1,lastletimestamp=1,lastfiltertimestamp=1; // Timestamp d'initialisation;
var nextFreeID = 0, nextDiffNum = 0, lrcAllLinesSeen = true;
var lstSysop = new Array(); // Sysop 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
var lrcLines = new Object();
// 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();
// RC timer
var lrcTimer;
var LiveRC_RequestError = 0;
//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(),
"AfterCreateParamPanel" : new Array(),
"BeforeRC" : new Array(),
"AfterRC" : new Array()
};
// Getting stylesheet
importStylesheetURI('http://pl.wikipedia.org/skins-1.5/common/diff.css?90&action=raw&ctype=text/css');
importStylesheetURI('http://fr.wikipedia.org/w/index.php?title=User:EDUCA33E/LiveRC.css&action=raw&ctype=text/css');
// Getting javascript
mw.loader.load('//pl.wikipedia.org/skins-1.5/common/diff.js?90&action=raw&ctype=text/javascript');
mw.loader.load('//bits.wikimedia.org/skins-1.5/common/edit.js?283-19&action=raw&ctype=text/javascript');
// Getting system messages
importScript(LiveRC_MessagesPage);
// Getting user params
importScript('User:'+mw.config.get('wgUserName')+'/LiveRCparam.js');
// Variables obsolètes, conservées pour compatibilité avec anciennes personnalisations
var lang_log = new Array();
var lrcManageParamsDesc = new Array()
var lrcManageParamsDesc = new Array()
var lrcHotCatsVariables = new Array()
var lrcHotCatsText = new Array()
}
/* </source>
=== Fonctions utilitaires ===
==== Ajax ====
<source lang="javascript"> */
var wpajax = {
initReq: function() {
var xmlhttp;
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttp = false
}
}
}
return xmlhttp;
},
/* preloadReq.state
0 : no request
1 : pending request
2 : pending request, the result will be used with preloadReq.bundle
(preloadReq is locked until the request is complete)
3 : completed request */
preloadReq: {url: null, xmlhttp: null, bundle: null, state: 0},
preload: function(url) {
if (!lrcParams) return;
var plr = wpajax.preloadReq;
if (plr.state == 2) return 0;
var xmlhttp = wpajax.initReq();
if (!xmlhttp) return 0;
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState != 4
|| !((plr.state == 1 || plr.state == 2) && plr.url == url)) return;
var oldState = plr.state;
plr.xmlhttp = xmlhttp;
plr.state = 3;
if (oldState == 2)
wpajax.httpComplete(xmlhttp, plr.bundle);
};
plr.state = 1;
plr.url = url;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
return 1;
},
// mandatory: bundle.url
// optional: bundle.async
// optional: bundle.method
// optional: bundle.headers
// optional: bundle.data
// optional: bundle.onSuccess (xmlhttprequest, bundle)
// optional: bundle.onFailure (xmlhttprequest, bundle)
// optional: bundle.otherStuff OK too, passed to onSuccess and onFailure
http: function(bundle) {
var plr = wpajax.preloadReq;
if (!(bundle.method || bundle.headers || bundle.async == false || bundle.data)
&& (plr.state == 1 || plr.state == 3) && plr.url == bundle.url) {
if (plr.state == 1) {
plr.state = 2;
plr.bundle = bundle;
} else {
wpajax.httpComplete(plr.xmlhttp, bundle);
}
return 2;
}
var xmlhttp = wpajax.initReq();
if (!xmlhttp) return 0;
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4)
wpajax.httpComplete(xmlhttp, bundle);
};
xmlhttp.open(bundle.method ? bundle.method : "GET", bundle.url, bundle.async == false ? false : true);
if (bundle.headers) {
for (var field in bundle.headers)
try {
xmlhttp.setRequestHeader(field, bundle.headers);
} catch(err) {
//Argos42 : pour rendre LiveRC fonctionnel sur chrome
}
}
xmlhttp.send(bundle.data ? bundle.data : null);
return 1;
},
httpComplete: function(xmlhttp, bundle) {
if (xmlhttp.status == 200 || xmlhttp.status == 302) {
if (bundle.onSuccess)
bundle.onSuccess(xmlhttp, bundle);
} else if (bundle.onFailure) {
bundle.onFailure(xmlhttp, bundle);
}
}
};
/* </source>
==== Hook functions ====
<source lang="javascript"> */
function LiveRC_AddHook(Type, func){
if(typeof(func)==="function" && lrcHooks) lrcHooks.push(func);
}
function LiveRC_RunHooks(Type, Params){
var HookResult = true;
if(typeof(lrcHooks)!='undefined'){
for(var a=0,l=lrcHooks.length;a<l;a++){
var ThisHookResult = lrcHooks(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.length;a<l;a++){
var Type = lrcHistory;
var Params = lrcHistory;
var URL = lrcHistory;
var Text = lrcHistory;
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+";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.push(Type);
lrcHistory.push(Params);
lrcHistory.push(URL);
lrcHistory.push(Text);
}
function lrcGetHistory(index){
lrcHistoryIsOld = true;
var Type = lrcHistory;
var Params = lrcHistory;
var FuntionToEval = Type + "(" + Params.join(", ") + ");";
//alert(FuntionToEval);
eval(FuntionToEval);
lrcHistory.pop();
lrcHistory.pop();
lrcHistory.pop();
lrcHistory.pop();
lrcHistoryIndex = index;
}
function buildHistoryPanel(){
if(!lrcHistoryIsOld) lrcHistoryIndex = (lrcHistory.length-1);
var PreviousDisabled = ((lrcHistoryIndex>0) ? '' : ' disabled="disabled" ' );
var NextDisabled = ((lrcHistoryIndex<(lrcHistory.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 LiveWatchInitButton(Req, data) {
var Li = document.getElementById('n-liveRC');
if(!Li) return;
lstContact2 = new Array();
var api = Req.responseXML.getElementsByTagName('api');
if (api.firstChild.nodeName == "error") return;
var watched = false;
var rcs = api.getElementsByTagName('watchlistraw').getElementsByTagName('wr');
watched = (rcs.length > 0 && rcs.getAttribute('title') == 'LiveRCWatch:' + mw.config.get('wgTitle'));
lstContact2 = watched;
var Links = '<span class="watchedLink" ' + (watched ? '' : 'style="display:none;"') + '> - <a '
+ ' href="javascript:;" '
+ ' onclick="addWatch('+lrcEscapeStrHTML(mw.config.get('wgTitle'))+', false); lrcToggleWatchLink(this); return false;"'
+ ' title="Ne plus suivre ce contributeur dans LiveRC">UW</a></span>'
+ '<span class="watchedLink" ' + (watched ? 'style="display:none;"' : '' ) + '> - <a '
+ ' href="javascript:;" '
+ ' onclick="addWatch('+lrcEscapeStrHTML(mw.config.get('wgTitle'))+', true); lrcToggleWatchLink(this); return false;"'
+ ' title="Suivre ce contributeur dans LiveRC">W</a></span>';
Li.innerHTML += Links;
}
function lrcToggleWatchLink(WatchLink){
var Li = WatchLink.parentNode.parentNode;
var Spans = getElementsByClass("watchedLink", Li, "span");
for(var a=0,l=Spans.length;a<l;a++){
if(Spans.style.display == "none"){
Spans.style.display = "";
}else{
Spans.style.display = "none";
}
}
}
function addWatch(uname, add, td2id) {
var item = lstContact2;
var page = 'LiveRCWatch:' + uname;
if (!item && add) {
lstContact2 = {ts: 0, fromjs: false};
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=watch&title=' + encodeURIComponent(page) });
} else if (item && !add) {
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=watch&unwatch=1&title=' + encodeURIComponent(page) });
delete lstContact2;
}
if (td2id == null) return;
var td2 = document.getElementById(td2id);
if (add && td2) { // TODO : utiliser des classes
td2.style.border = "2px solid gold";
td2.style.backgroundColor = "yellow";
} else if(td2){
td2.style.backgroundColor = "white";
}
}
function LiveWatchArticle(Link, LinkType, page){
var LinkText, LinkTitle, Action = "watch";
if(Link.innerHTML == lang_tooltips.WATCH_TIP || Link.innerHTML == lang_tooltips.WATCH_SHORT) {
Action = "unwatch";
if(!lstSuivi) lstSuivi = "--:--";
LinkText = (LinkType ? lang_tooltips.UNWATCH_TIP : lang_tooltips.UNWATCH_SHORT);
LinkTitle = lang_tooltips.UNWATCH_TIP +" « "+page+" »";
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=watch&title=' + encodeURIComponent(page) });
} else {
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=watch&unwatch=1&title=' + encodeURIComponent(page) });
LinkText = (LinkType ? lang_tooltips.WATCH_TIP : lang_tooltips.WATCH_SHORT);
LinkTitle = lang_tooltips.WATCH_TIP +" « "+page+" »";
if(lstSuivi) delete lstSuivi;
}
Link.title = LinkTitle;
Link.innerHTML = LinkText;
Link.href = Link.href.replace(/&action=.*/, "&action="+Action);
}
/* </source>
==== buildPreviewBar ====
===== Simple =====
<source lang="javascript"> */
function buildBlanckPreviewBar(Text, History, TextHD, TextBG, TextBD){
var Template = PreviewBarTemplate;
Template = Template.split('$1').join((History ? buildHistoryPanel() : "") + Text);
Template = Template.split('$2').join((TextHD ? TextHD : " "));
Template = Template.split('$3').join((TextBG ? TextBG : " "));
Template = Template.split('$4').join((TextBD ? TextBD : " "));
var TabContainer = document.getElementById("livePreviewTitle");
if(TabContainer) TabContainer.innerHTML = Template;
}
/* </source>
===== Complex =====
<source lang="javascript"> */
function buildPreviewBar(Args){
var Mode = Args;
var URL = Args;
var Page = Args;
var User1 = Args;
var User2 = Args;
var oldid = Args;
var Previous = Args;
var Next = Args;
// $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 target="_blank" 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+'"></a></small>';
if(Mode=="Revisiondelete" && Args){
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+'" '
+ 'onClick="liveDiff('+lrcEscapeStr(Page)+',\'prev\',\''+Previous+'\'); return false;" '
+ 'title="'+Previous+'">'+Previous+'</a></small>';
}
if(Mode=="Diff" && Next){
if(Previous) TabsHautDroite += '<small> | </small>';
TabsHautDroite += '<small><a id="nextDiffLink" href="'+Next+'" '
+ 'onClick="liveDiff('+lrcEscapeStr(Page)+',\'next\',\''+Next+'\'); return false;" '
+ 'title="'+Next+'">'+Next+'</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;
var URL = Args;
var Page = Args;
var User1 = Args;
var User2 = Args;
var oldid = Args;
var Next = Args;
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=="Move"||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')+":"+PageName);
Tabs = '<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')+":"+User;
Tabs = '<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 = '<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 = '<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 = '<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 = '<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 = '<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 = '<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 = '<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 = '<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 = '<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 = '<a href="'+lrcGetPageURL('Special:Blockip/'+ThisUser)+'" '
+ 'onClick="liveBlock('+lrcEscapeStr(ThisUser)+'); return false;" '
+ 'title="'+lang_tooltips.BLOCK_TIP+' « '+ThisUser+' »" '
+ '>'+lang_tooltips.BLOCK_TIP+'</a>';
}
}
// (Un)Watch /////////////////////////////////
if(PageNamespaceNumber>-1 && (Mode=="Article"||Mode=="Diff"||Mode=="Hist"||Mode=="Edit"||Mode=="Move"||Mode=="Delete"||Mode=="Protect"||Mode=="Revisiondelete")){
if(lstSuivi){
Tabs = '<a href="'+lrcGetUglyPageURL(Page,'&action=unwatch') + '" '
+ 'onClick="LiveWatchArticle(this, 1, '+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.UNWATCH_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.UNWATCH_TIP+'</a>';
}else{
Tabs = '<a href="'+lrcGetUglyPageURL(Page,'&action=watch') + '" '
+ 'onClick="LiveWatchArticle(this, 1, '+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.WATCH_TIP+' « '+Page+' »" '
+ '>'+lang_tooltips.WATCH_TIP+'</a>';
}
}
// Ask for sysop /////////////////////////////////
if(lrcUserHasRight("autopatrol")) Tabs = buildAskForSysop(Page, User);
var AllTabs = new Array();
for(var Tab in Tabs){
if(typeof(Tabs)=="string" && Tabs !="") AllTabs.push(Tabs);
}
AllTabs = AllTabs.join(" | ");
if(AllTabs=="") AllTabs = " ";
return AllTabs;
}
/* </source>
====== Special ======
<source lang="javascript"> */
function buildPreviewSpecialTabs(Args){
if(!lrcUserHasRight("autopatrol")) return " ";
var Mode = Args;
var Page = Args;
var User1 = Args;
var User2 = Args;
var oldid = Args;
var patrolledDiff = Args;
var Next = Args;
var SpecialTabs = "";
if(Mode=="Diff") {
if(!Next){
SpecialTabs += buildLiveUndo(Page, oldid, User1, User2);
}
SpecialTabs += (SpecialTabs==="" ? "" : ' • ') + buildLiveAverto(Page, User2, true) + ' • ' + buildLiveAwarto(Page, User2, true);
}else if(Mode=="Article"){
SpecialTabs += buildLiveTag(Page) + ' • ' + buildLiveBlank(Page);
var User = Args;
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 += ' • ' + buildLiveAverto(Page, User, HasPageParam) + ' • ' + buildLiveAwarto(Page, User, HasPageParam);
}else if(Mode=="Contrib"||Mode=="DeletedContrib"){
if(lrcUserHasRight("autopatrol")) SpecialTabs += buildLiveAverto(Page, User1, false) += buildLiveAwarto(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;
Iframe.width = "99.8%";
Iframe.height = lrcParams;
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;
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.resume + '" title="' + lstBlank.resume + '">' + lstBlank.tooltip + '</option>';
}
var BlankBar = '[<a id="LiveBlankLink" href="javascript:;" title="'+lang_menu.EMPTY+' « '+Page+' »" '
+ 'onClick="getLiveBlank('+lrcEscapeStr(Page)+'); return false;">'+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");
lrcDisableLink("LiveBlankReason");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(page),
onSuccess: postBlankPage,
page: page,
message: message
});
return false;
}
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.getAttribute("type");
var Level = PR.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");
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = "";
EditParam = encodeURIComponent(lang_messages.RESUMESTART+lang_messages.SPEEDDELETION+' ; ' + message);
EditParam = encodeURIComponent(page);
EditParam = "preferences";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = '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>
===== Bandeaux =====
<source lang="javascript"> */
function buildLiveTag(Page){
if(!Page) return "";
var optTag = "";
var optl = lstTag.length;
for (j=0; j<optl; j++) {
optTag += '<option value="' + lstTag.template + '" title="' + lstTag.template + '">' + lstTag.string + '</option>';
}
var TagBar = '[<a id="LiveTagLink" href="javascript:;" title="'+lang_menu.TAG+'" '
+ 'onClick="getLiveTag('+lrcEscapeStr(Page)+'); return false;">'+lang_menu.TAG+'</a>] : '
+ '<select id="LiveTagReason">' + optTag + '</select>';
return TagBar;
}
function getLiveTag(page){
var TagSelect = document.getElementById("LiveTagReason");
if(!TagSelect) return;
var message = TagSelect.value;
lrcDisableLink("LiveTagLink");
lrcDisableLink("LiveTagReason");
tagPage(page, message);
}
function tagPage(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='+encodeURIComponent(page),
onSuccess: postTagPage,
page: page,
message: message});
return false;
}
function postTagPage(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.getAttribute("type");
var Level = PR.getAttribute("level");
if(Type=="edit" && mw.config.get('wgUserGroups').indexOf(Level)==-1) Isprotected = true;
}
if(Isprotected){
alert('Page protégée');
return;
}
var ThisDate = "";
for(var Tag in lstTag){
if(lstTag.template == message && lstTag.withDate){
var Months = new Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
var Now = new Date();
var Year = Now.getYear();
if(Year < 2000) Year = Year + 1900;
var Month = Months;
ThisDate = "|date="+Month+" "+Year;
}
}
var Page = ObjetXML.getElementsByTagName("page");
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = encodeURIComponent("{{"+message+ThisDate+"}}\n");
EditParam = encodeURIComponent(lang_messages.RESUMESTART + lang_messages.WARNING + ' ' + message);
EditParam = encodeURIComponent(page);
EditParam = "preferences";
EditParam = "1";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = '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'></b> ";
rollbackButton = '[<a id="LiveRollbackLink" '
+ 'href="javascript:;" title="'+lang_menu.REVERT+' « '+User2+' » ('+Page+')" '
+ 'onClick="lrcUndo(' + lrcEscapeStr(Page) + ',' + lrcEscapeStr(User2) +'); return false;">'
+ lang_menu.REVERT + '</a>] • '
}
if (Page == lang_sandbox) {
specialNotice = "<b style='color:red'></b> ";
}
var UndoBar = specialNotice + rollbackButton
+ '[<a id="LiveUndoLink" href="javascript:;" title="'+lang_menu.UNDORC+' « '+User2+' » ('+Page+')" '
+ 'onClick="lrcUndo(' + lrcEscapeStr(Page) + ',' + lrcEscapeStr(User2) +',' + oldid + '); return false;">'
+ 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.resume+'" '
+ 'onClick="LiveRC_RevertMessagesExtension_Update()" '
+ 'name="'+a+'">'+lrcRevertMessages.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;
Select.onchange = LiveRC_RevertMessagesExtension_Update;
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.selected) continue;
RevertInput.value = Options.value;
RevertInput.focus();
return;
}
}
function lrcUndo(title, user, oldid) {
lrcDisableLink('LiveUndoLink');
lrcDisableLink('LiveRollbackLink');
lrcDisableLink('LiveRevertMessage');
lrcDisableLink('LiveRevertMessage_List');
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});
return false;
}
function lrcUndoCB(xmlreq, data) {
var page = xmlreq.responseXML.getElementsByTagName('page');
var token = page.getAttribute('edittoken');
var lst = xmlreq.responseXML.getElementsByTagName('revisions').childNodes;
var user = data.user ? data.user : lst.getAttribute('user');
var curid = lst.getAttribute('revid');
var i;
for (i = 0; i < lst.length && lst.getAttribute('user') == user
&& lst.getAttribute('revid') != data.oldid; i++) {}
if (i == 0 || i == lst.length) return;
var oldUser = lst.getAttribute('user');
var oldid = lst.getAttribute('revid');
var summary = lang_messages.RESUMESTART+lrcMediawikiMessages;
summary = summary.split("$1").join(oldUser);
summary = summary.split("$2").join(user);
if (data.summary) summary += ' ; ' + data.summary;
var minorEdit = lrcParams ? '&minor=1' : '';
var watchParam = lrcParams ? '&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 = '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.template;
if(lstAvert.hasPage && WithPage) optAvert += '|1='+Page.replace(/\"/g, "");
optAvert += '">'+lstAvert.string+'</option>';
}
var AvertoBar = '[<a id="LiveAvertoLink" href="javascript:;" title="'+lang_menu.AVERTS+' « '+User+' »" '
+ 'onClick="getLiveAverto('+lrcEscapeStr(User)+'); return false;">'+lang_menu.AVERTS+'</a>] : '
+ '<select id="averto">' + optAvert + '</select>';
return AvertoBar;
}
function getLiveAverto(user) {
lrcDisableLink('LiveAvertoLink');
lrcDisableLink('averto');
var link = document.getElementById('LiveAvertoLink');
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')+":"+user.replace(/&/g, "%26"),
onSuccess: postLiveAverto,
user: user, message: message, summary:summary });
return false;
}
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.getAttribute("type");
var Level = PR.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");
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = encodeURIComponent('\n\n{{subst:' + message + '}} ~~~~\n');
EditParam = encodeURIComponent(lang_messages.RESUMESTART + lang_messages.WARNING + ' ' + Summary.replace(new RegExp(/\|(.*)/),
' ' + lang_messages.ON_ARTICLE + ' ]') + ' !');
//EditParam = 1;
EditParam = mw.config.get('wgFormattedNamespaces')+":"+encodeURIComponent(user);
EditParam = "preferences";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = '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écompenses =====
<source lang="javascript"> */
function buildLiveAwarto(Page, User, WithPage){
if(!Page || !User) return "";
var optAward = "";
var optl = lstAward.length;
for (j=0; j<optl; j++) {
optAward += '<option value="'+lstAward.template;
if(lstAward.hasPage && WithPage) optAward += '|1='+Page.replace(/\"/g, "");
optAward += '">'+lstAward.string+'</option>';
}
var AwartoBar = '[<a id="LiveAwartoLink" href="javascript:;" title="'+lang_menu.AWARDS+' « '+User+' »" '
+ 'onClick="getLiveAwarto('+lrcEscapeStr(User)+'); return false;">'+lang_menu.AWARDS+'</a>] : '
+ '<select id="awarto">' + optAward + '</select>';
return AwartoBar;
}
function getLiveAwarto(user) {
lrcDisableLink('LiveAwartoLink');
lrcDisableLink('awarto');
var link = document.getElementById('LiveAwartoLink');
var message = document.getElementById('awarto').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')+":"+user.replace(/&/g, "%26"),
onSuccess: postLiveAwarto,
user: user, message: message, summary:summary });
return false;
}
function postLiveAwarto(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.getAttribute("type");
var Level = PR.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");
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = encodeURIComponent('\n\n{{subst:' + message + '}}<small>Après avoir pris connaissance de ce bandeaux, vous pouvez le copier sur ]. Encore bravo pour vos actions.</small> ~~~~\n');
EditParam = encodeURIComponent(lang_messages.RESUMESTART + lang_messages.WARNING + ' ' + Summary.replace(new RegExp(/\|(.*)/),
' ' + lang_messages.ON_ARTICLE + ' ]') + ' !');
//EditParam = 1;
EditParam = mw.config.get('wgFormattedNamespaces')+":"+encodeURIComponent(user);
EditParam = "preferences";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = '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>
===== Demande aux administrateurs =====
<source lang="javascript"> */
function buildAskForSysopCreateReasons(){
for(var Ask in lstAskForSysop){
var ThisAsk = lstAskForSysop
var Type = ThisAsk.userright;
var DropType = ThisAsk.userright;
ThisAsk.reasons = new Array();
var Drop = lrcMediawikiMessages;
if(!Drop) continue;
var Drop = Drop.split("**");
for(var a=0,l=Drop.length;a<l;a++){
var ThisReason = Drop;
if(ThisReason.indexOf("*")!=-1) continue;
ThisAsk.reasons.push(ThisReason);
}
}
}
function buildAskForSysop(Page, User){
var optAskSysop = new Array('<option id="null" value="" title=""></option>');
var optl = lstAskForSysop.length;
for (j=0; j<optl; j++) {
if((lstAskForSysop.parampage && Page) || (lstAskForSysop.paramuser && User)){
if(lrcUserHasRight(lstAskForSysop.userright)) continue;
var NewValue = lstAskForSysop.template;
if(lstAskForSysop.parampage && Page) NewValue += '|page='+Page.replace(/\"/g, '\\"');
if(lstAskForSysop.paramuser && User) NewValue += '|user='+User.replace(/\"/g, '\\"');
var NewOption = '<option id="'+lstAskForSysop.userright+'" value="'+NewValue+'" title="{{'+NewValue+'}}" '
+ '>'+lstAskForSysop.text+'</option>';
optAskSysop.push(NewOption);
}
}
if(optAskSysop.length===1) return "";
var AskForSysopBar = '<a id="LiveAskForSysop" href="javascript:;" '
+ 'title="' + lang_tooltips.ASKSYSOP_TIP + ' " '
+ 'onClick="liveAskForSysop('+lrcEscapeStr(User)+');">'+
lang_tooltips.ASKSYSOP_SHORT+'</a> : '
+ '<select id="AskForSysop" onchange="buildAskForSysopGetReason()">' + optAskSysop.join("") + '</select>';
return AskForSysopBar;
}
function buildAskForSysopGetReason(){
var OldDropDown = document.getElementById("AskForSysopReasons");
if(OldDropDown) OldDropDown.parentNode.removeChild(OldDropDown);
var Select = document.getElementById("AskForSysop");
if(!Select) return;
var Options = Select.getElementsByTagName('option');
for(var a=0,l=Options.length;a<l;a++){
if(!Options.selected) continue;
var ID = Options.id;
if(!ID || ID==="null") continue;
for(var Ask in lstAskForSysop){
var Type = lstAskForSysop.userright;
if(Type!=ID) continue;
var Reasons = lstAskForSysop.reasons;
if(!Reasons || Reasons.length===0) continue;
var NewSelect = document.createElement('select');
NewSelect.id = "AskForSysopReasons";
NewSelect.setAttribute("style", "width:100px");
var Opt = document.createElement('option');
Opt.value = "";
Opt.innerHTML = "";
NewSelect.appendChild(Opt);
for(var b=0,m=Reasons.length;b<m;b++){
var Opt = document.createElement('option');
Opt.value = Reasons;
Opt.innerHTML = Reasons;
NewSelect.appendChild(Opt);
}
Select.parentNode.insertBefore(NewSelect, Select.nextSibling);
}
}
}
function liveAskForSysop() {
var GotOption = false;
var GotOptionParams = false
var GotReason = false;
var Select = document.getElementById('AskForSysop');
var Options = Select.getElementsByTagName('option');
for(var a=0,l=Options.length;a<l;a++){
var Option = Options;
if(Option.selected && !GotOption){
GotOption = Option;
var ID = GotOption.id;
for(var Ask in lstAskForSysop){
var Type = lstAskForSysop.userright;
if(Type!=ID) continue;
GotOptionParams = lstAskForSysop;
}
}
}
var message = GotOption.value;
var summary = message;
var ReasonsSelect = document.getElementById('AskForSysopReasons');
var ReasonsOptions = ReasonsSelect.getElementsByTagName('option');
for(var a=0,l=ReasonsOptions.length;a<l;a++){
var ReasonsOption = ReasonsOptions;
if(ReasonsOption.selected){
GotReason = ReasonsOption.value;
}
}
if(!GotOption || !GotOptionParams || !GotReason) return;
lrcDisableLink('LiveAskForSysop');
lrcDisableLink('AskForSysop');
lrcDisableLink('AskForSysopReasons');
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(GotOptionParams.page)
wpajax.http({ url : URL,
onSuccess : postAskForSysop,
message : message,
summary : summary,
page : GotOptionParams.page,
reason : GotReason
});
return false;
}
function postAskForSysop(xmlreq, data) {
var page = data.page;
var message = data.message;
var summary = data.summary;
var reason = data.reason;
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.getAttribute("type");
var Level = PR.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");
var EditParam = new Array();
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = encodeURIComponent('\n\n{{subst:' + message + '|raison='+reason+'}}\n');
EditParam = encodeURIComponent("");
EditParam = encodeURIComponent(page);
//EditParam = encodeURIComponent("Utilisateur:EDUCA33E/LiveRC/Modèles/Test");
EditParam = "preferences";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = '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 ObjetXML = RequeteOldid.responseXML;
if (ObjetXML){
var LastRevision = ObjetXML.getElementsByTagName('rev');
if (LastRevision){
var 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;
if(ThisLine.indexOf(LiveRC_ExtensionSetupComment)!=-1){
for(var a=0,l=lrcExtensions.length;a<l;a++){
if(ThisLine.indexOf("|"+lrcExtensions+"|")!=-1){
lrcExtensions = true;
}
}
}
}
}
function LiveRC_ManageParams_Fill(OptionArray, ArrayName, AddButton){
LiveRC_Params = new Array();
for(var Param in OptionArray){
var ParamName = Param;
var ParamOldValue = OptionArray;
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.indexOf(NewArray)==-1) LiveRC_Params.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(lstAward, "lstAward", true);
LiveRC_ManageParams_Fill(lstTag, "lstTag", 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;
GlobalFieldset.appendChild(GlobalLegend);
var Form = document.createElement('form');
Form.id = "LiveRC_ParamMenuForm";
for(var ThisVariableIndex in LiveRC_Params){
var ArrayVariable = LiveRC_Params;
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) continue;
if(ArrayVariable!='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;
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText);
var AddButton = ThisVariable;
if(ThisVariable!='object'){
var Input = document.createElement('input');
Input.id = ThisVariable;
Input.name = ThisVariable;
if(ThisVariable=="boolean"){
Input.type = "checkbox";
if(ThisVariable) Input.checked = "checked";
}else{
Input.type = "text";
Input.size = 30;
Input.setAttribute("style", "padding:2px;margin:0");
Input.value = ThisVariable;
}
var Label = document.createElement('label');
Label.setAttribute('for', ThisVariable);
Label.innerHTML = ThisVariable;
P.appendChild(Input);
P.appendChild(document.createTextNode(" "));
P.appendChild(Label);
}else{
for(var VarIndex in ThisVariable){
var VariableType = typeof(ThisVariable);
if(VariableType!="boolean" && VariableType!="number" && VariableType!="string") continue;
var Input = document.createElement('input');
Input.id = VarIndex;
Input.name = VarIndex;
if(VariableType=="boolean"){
Input.type = "checkbox";
if(ThisVariable) Input.checked = "checked";
}else{
Input.type = "text";
if(VariableType=="string") Input.size = 40;
if(VariableType=="number") Input.size = 15;
Input.setAttribute("style", "padding:2px;margin:0");
Input.value = ThisVariable;
}
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){
Types.push(lrcEscapeStr(VarIndex)+":"+lrcEscapeStr(typeof(ThisVariable)));
}
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_RunHooks("AfterCreateParamPanel");
LiveRC_ManageParams_AddContactListMenu();
LiveRC_ManageParams_AddExtensionsMenu();
LiveRC_ManageParams_CreateToggleButtons();
LiveRC_ManageParams_ToggleMenu();
}
function LiveRC_ManageParams_AddContactListMenu(){
var Form = document.getElementById("LiveRC_ParamMenuForm");
if(!Form) return;
var ContactListFieldset = document.createElement('fieldset');
ContactListFieldset.id = "LiveRC_ParamMenu_ContactListLegend";
var ContactListLegend = document.createElement('legend');
ContactListLegend.appendChild(document.createTextNode(LiveRC_ManageParams_Translate("ContactListLegend", 0)));
ContactListFieldset.appendChild(ContactListLegend);
var ContactListUl = document.createElement('ul');
ContactListUl.setAttribute("style", "list-style:none;list-image:none;margin:0;-moz-column-count:3;-webkit-column-count:3;column-count:3;");
ContactListFieldset.appendChild(ContactListUl);
for (var user in lstContact2) {
if(!lstContact2) continue;
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText);
var Link = document.createElement('a');
Link.className = "contact";
Link.title = user;
Link.innerHTML = user;
Link.href= "javascript:liveArticle("+lrcEscapeStr(user)+");";
P.appendChild(Link);
P.appendChild(document.createTextNode(" "));
P.appendChild(LiveRC_ManageParams_AddDeleteLink());
ContactListUl.appendChild(P);
}
var P = document.createElement('li');
P.innerHTML = '<a id="AddParam_Contact" href="javascript:LiveRC_ManageParams_AddNewContact();" >(+)</a>';
ContactListUl.appendChild(P);
var Paragraphe = document.createElement('p');
Paragraphe.setAttribute('style', 'text-align:center;');
var InputOK = document.createElement('input');
InputOK.type = "button";
InputOK.value = "OK";
InputOK.onclick = function(){ LiveRC_ManageParams_CheckContactListMenu(); };
InputOK.onselect = function(){ LiveRC_ManageParams_CheckContactListMenu(); };
Paragraphe.appendChild(InputOK);
ContactListFieldset.appendChild(Paragraphe);
Form.appendChild(ContactListFieldset);
}
function LiveRC_ManageParams_AddNewContact(){
var Link = document.getElementById("AddParam_Contact");
if(!Link) return;
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText);
var Span = document.createElement('span')
var Input = document.createElement('input');
Input.type = "text";
Input.value = "";
Span.appendChild(Input);
Input.onkeyup = function(){
LiveRC_ManageParams_AddNewContact_GetSuggestions(this);
}
var Select = document.createElement('select');
Select.setAttribute('style', 'display:none;')
Span.appendChild(Select);
var InputOK = document.createElement('input');
InputOK.type = "button";
InputOK.value = "OK";
InputOK.onclick = function(){ LiveRC_ManageParams_AddThisContact(this); };
InputOK.onselect = function(){ LiveRC_ManageParams_AddThisContact(this); };
Span.appendChild(InputOK);
P.appendChild(Span);
P.appendChild(document.createTextNode(" "));
P.appendChild(LiveRC_ManageParams_AddDeleteLink());
var Li = Link.parentNode;
Li.parentNode.insertBefore(P, Li);
Input.focus();
}
function LiveRC_ManageParams_AddNewContact_GetSuggestions(Input){
if(!Input) return;
var Select = Input.nextSibling;
if(!Select) return;
var User = Input.value;
if(!User) return;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ "/api.php?format=xml&action=query&list=allusers"
+ "&auprefix=" + encodeURIComponent(User)
+ "&aulimit=10";
wpajax.http({ url : URL,
onSuccess : LiveRC_ManageParams_AddNewContact_ShowSuggestions,
user : User,
input : Input,
select : Select
});
}
var lrcLiveRC_ManageParams_AddNewContact_ShowSuggestions_ZIndex = 10;
function LiveRC_ManageParams_AddNewContact_ShowSuggestions(Req, data){
var TailleListe = 5;
var xml = Req.responseXML ;
var Select = data.select;
var Input = data.input;
var User = data.user;
if ( xml == null || !Select || !Input || !User ) return ;
var titles = new Array () ;
var pages = xml.getElementsByTagName("u") ;
for(var i=0;i<pages.length;i++){
var s = pages.getAttribute("name");
if(titles.indexOf(s)==-1) titles.push(s);
}
var suggestion = titles;
if(titles.length==0 || suggestion===Input.value){
Select.style.display = "none" ;
return;
}
if(titles.length<TailleListe) TailleListe = titles.length;
Select.style.display = "inline" ;
Select.size = TailleListe ;
Select.style.align = "left" ;
Select.style.zIndex = lrcLiveRC_ManageParams_AddNewContact_ShowSuggestions_ZIndex++ ;
Select.style.position = "relative" ;
Select.style.width = Input.offsetWidth + "px" ;
Select.style.height = (TailleListe * 20) + "px" ;
while(Select.firstChild) Select.removeChild(Select.firstChild);
for ( var i = 0 ; i < titles.length ; i++ ) {
var opt = document.createElement("option");
var ot = document.createTextNode(titles);
opt.appendChild(ot) ;
opt.value = titles;
Select.appendChild(opt) ;
}
Select.style.marginTop = "-" + (TailleListe * 20) + "px" ;
Select.style.marginLeft = "-" + Input.offsetWidth + "px" ;
Select.onkeyup = lrcLiveRC_ManageParams_AddNewContact_ReplaceSuggestionsKeyPress;
Select.onclick = lrcLiveRC_ManageParams_AddNewContact_ReplaceSuggestions;
if(suggestion.indexOf(Input.value)==0){
var CurrentValueLength = Input.value.length;
Input.value = suggestion;
if (Input.createTextRange) {
var ra = Input.createTextRange();
ra.moveStart("character", CurrentValueLength);
ra.moveEnd("character", suggestion.length);
ra.select();
} else if( Input.setSelectionRange ) {
Input.setSelectionRange( CurrentValueLength, suggestion.length );
} else {
Input.selectionStart = CurrentValueLength;
Input.selectionEnd = suggestion.length ;
}
}
}
function lrcLiveRC_ManageParams_AddNewContact_ReplaceSuggestionsKeyPress(e){
if (!e) var e = window.event;
if (e.keyCode != 13) return;
lrcLiveRC_ManageParams_AddNewContact_ReplaceSuggestions();
}
function lrcLiveRC_ManageParams_AddNewContact_ReplaceSuggestions(){
var Select = this;
if(!Select) return;
var Input = Select.previousSibling;
if(!Input) return;
var Options = Select.getElementsByTagName('option');
for(var a=0;a<Options.length;a++){
if(Options.selected){
Input.value = Options.value;
Input.focus();
LiveRC_ManageParams_AddNewContact_GetSuggestions(Input);
return;
}
}
}
function LiveRC_ManageParams_AddThisContact(OK){
if(!OK) return;
var Li = OK.parentNode.parentNode;
if(!Li) return;
var UserInput = Li.getElementsByTagName('input')
if(!UserInput) return;
var User = UserInput.value;
if(!User) return;
Li.removeChild(Li.getElementsByTagName('span'));
var Link = document.createElement('a');
Link.className = "contact";
Link.title = User;
Link.innerHTML = User;
Link.href= "javascript:liveArticle("+lrcEscapeStr(User)+");";
Li.insertBefore(Link, Li.firstChild);
}
function LiveRC_ManageParams_CheckContactListMenu(){
var Menu = document.getElementById("LiveRC_ParamMenu_ContactListLegend");
if(!Menu) return;
var Contacts = getElementsByClass("contact", Menu, "a");
var ContactList = new Array();
for(var a=0,l=Contacts.length;a<l;a++){
var userName = Contacts.title;
ContactList.push(userName);
if(!lstContact2){
addWatch(userName , true);
}
}
for(var user in lstContact2){
if(ContactList.indexOf(user)==-1){
addWatch(user, false);
}
}
}
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;
var P = document.createElement('li');
P.setAttribute("style", lrcManageParamsText);
var Input = document.createElement('input');
Input.id = ThisExtension;
Input.name = ThisExtension;
Input.type = "checkbox";
if(ThisExtension && ThisExtension==true) Input.checked = "checked";
var Label = document.createElement('label');
Label.setAttribute('for', ThisExtension);
Label.innerHTML = '<a href="'+ThisExtension + '" target="_blank" >'+ThisExtension+'</a> : ' +ThisExtension;
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;
}
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);
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=="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);
return false;
}
// 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;
OKInput.onclick = function(){ LiveRC_ManageParams_CheckMenu(this); return false;}
OKInput.onselect = function(){ LiveRC_ManageParams_CheckMenu(this); return false;}
Center.appendChild(OKInput);
var CancelInput = document.createElement('input');
CancelInput.type = "button";
CancelInput.value = lrcManageParamsText;
CancelInput.onclick = function(){ LiveRC_ManageParams_CloseMenu(this); return false;}
CancelInput.onselect = function(){ LiveRC_ManageParams_CloseMenu(this); return false;}
Center.appendChild(CancelInput);
var RAZInput = document.createElement('input');
RAZInput.type = "button";
RAZInput.value = lrcManageParamsText;
RAZInput.onclick = function(){ LiveRC_ManageParams_RAZParams(this); return false;}
RAZInput.onselect = function(){ LiveRC_ManageParams_RAZParams(this); return false;}
Center.appendChild(RAZInput);
if(lrcUserHasRight("edituserjs")){
var MSInput = document.createElement('input');
MSInput.type = "button";
MSInput.setAttribute("style", "margin-left:0.5em");
MSInput.value = lrcManageParamsText;
MSInput.onclick = function(){ LiveMessages(true); return false;}
MSInput.onselect = function(){ LiveMessages(true); return false;}
Center.appendChild(MSInput);
}
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.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); return false;};
Input.onselect = function(){ LiveRC_ManageParams_ToggleMenu(this); return false;};
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.setAttribute("style", ((Id == Fieldsets.id)? "font-weight:bold;padding:0;" : "padding:0;") );
Fieldsets.style.display = ((Id == Fieldsets.id)? "" : "none");
}else{
Onglets.setAttribute("style", ((a==0)? "font-weight:bold;padding:0;" : "padding:0;") );
Fieldsets.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(Input){
var Menu = document.getElementById("LiveRC_ParamMenu");
if(!Menu) return;
lrcDisableLink(Input);
// Variables
var FieldSets = Menu.getElementsByTagName('fieldset');
for(var b=0,m=FieldSets.length;b<m;b++){
var ArrayName = FieldSets.id.split("LiveRC_ParamMenu_").join("");
if(!LiveRC_Params) continue;
var Lis = FieldSets.getElementsByTagName('li');
var Type = Lis.getElementsByTagName('input').length;
for(var a=0,l=Lis.length;a<l;a++){
var Inputs = Lis.getElementsByTagName('input');
if(Inputs.length==0) continue;
if(Type>1){ // ------------------------- object
if(typeof(LiveRC_Params)=='undefined'){
LiveRC_Params = new Array();
}
var NewValue = new Array();
for(var i=0,il=Inputs.length;i<il;i++){
var Input = Inputs;
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 = "{ "+NewValue.join(", ")+" }";
}else{ // ------------------------- boolean, number, text
var Input = Inputs;
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.length;i<j;i++){
if(LiveRC_Params != InputName) continue;
if(LiveRC_Params == "string") LiveRC_Params = lrcEscapeStrHTML(Input.value);
if(LiveRC_Params == "number") LiveRC_Params = parseInt(Input.value);
}
}
if(InputType=="checkbox"){
for(var i=0,j=LiveRC_Params.length;i<j;i++){
if(LiveRC_Params != InputName) continue;
LiveRC_Params = (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.name;
if(Inputs.checked){
for(var b=0,m=lrcExtensions.length;b<m;b++){
var ExtName = lrcExtensions;
if(ExtName==iName) lrcExtensions = true;
}
}
}
LiveRC_ManageParams_CreateNewParamPage();
}
// Création nouveau script (≠RAZ)
function LiveRC_ManageParams_CreateNewParamPage(Input){
lrcDisableLink(Input);
var ParamPage = "// "+lrcManageParamsText+ "\n";
var Variables = "\n/* ** "+lrcManageParamsText + " ** */\n\n";
Variables += "function LiveRC_getUserCustom(){\n\n";
for(var ArrayName in LiveRC_Params){
var ThisArray = LiveRC_Params;
if(typeof(ThisArray)=="undefined") continue;
Variables += " // "+ LiveRC_ManageParams_Translate(ArrayName, 0) +"\n";
Variables += "try{\n";
if(ThisArray === 0 || ThisArray === "0" ){
var AllValues = new Array()
for(var i=0,j=ThisArray.length;i<j;i++){
if(typeof(ThisArray)!="undefined") AllValues.push("\n "+ThisArray);
}
Variables += ArrayName + " = ;\n";
}else{
for(var i=0,j=ThisArray.length;i<j;i++){
Variables += ArrayName +"+"\"] = "+ThisArray + ";\n";
}
}
Variables += "}catch(e){ }\n\n";
}
Variables += "}\n\n";
//alert(Variables); return;
try{ eval(Variables); LiveRC_getUserCustom(); }catch(e){ }
ParamPage += Variables;
var Extensions = "\n/* ** "+lrcManageParamsText + " ** */\n\n"
+ LiveRC_ExtensionSetupComment;
var ExtensionList = "";
for(var ArrayName in lrcExtensions){
var ThisArray = lrcExtensions;
if(ThisArray === true){
Extensions += " |"+ThisArray+"|";
ExtensionList += "// "+ThisArray+ " : "+ThisArray+"\n"
+ "importScriptURI('"+ThisArray+"&action=raw&ctype=text/javascript');\n\n"
}
}
Extensions += "\n\n"+ExtensionList;
ParamPage += Extensions;
LiveRC_ManageParams_UpdateParams(ParamPage);
}
// Création nouveau script (RAZ)
function LiveRC_ManageParams_RAZParams(){
var ParamPage = "// "+lrcManageParamsText+ "\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.split("$1").join(mw.config.get('wgFormattedNamespaces')+":"+mw.config.get('wgUserName')+"/LiveRCparam.js");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+mw.config.get('wgFormattedNamespaces')+':' + 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);
Textarea.value = NewPage;
getElementWithId("wpSummary", 'input', Temp).value = lang_messages.RESUMESTART + lrcManageParamsText;
var P = document.getElementById("LiveRC_ParamMenuRunning");
if(P) P.innerHTML += "<br />"
+ lrcManageParamsText.split("$1").join(mw.config.get('wgFormattedNamespaces')+":"+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));
}
var headers = new Array();
headers = '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.split("$1").join(mw.config.get('wgFormattedNamespaces')+":"+ mw.config.get('wgUserName')+"/LiveRCparam.js" )
+ "<br/>" + lrcManageParamsText;
}
/* </source>
==== Manipulation de classes ====
<source lang="javascript"> */
if(typeof(hasClass)!='function')
function hasClass(node, className){
var haystack = node.className;
if(!haystack) return false;
if (className === haystack) {
return true;
}
return (" " + haystack + " ").indexOf(" " + className + " ") > -1;
}
if(typeof(addClass)!='function')
function addClass(node, className) {
if (hasClass(node, className)) {
return false;
}
var cache = node.className;
if (cache) {
node.className = cache + ' ' + className;
} else {
node.className = className;
}
return true;
}
if(typeof(removeClass)!='function')
function removeClass(node, className) {
if (!hasClass(node, className)) {
return false;
}
node.className = node.className.replace(new RegExp('(^|\\s+)'+ className +'($|\\s+)','g'), ' ');
return true;
}
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.className) ) {
classElements = els;
j++;
}
}
return classElements;
}
/* </source>
==== Horloge ====
<source lang="javascript"> */
var lrcClockTime = new Array();
function lrcSetClock(){
var Logo = document.getElementById("p-logo");
if(!Logo) Logo = document.getElementById("logo");
if(!Logo) return;
var Link = Logo.getElementsByTagName('a');
if(!Link) return;
Link.setAttribute('style', 'background-image: url("http://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/LiveRC.svg/150px-LiveRC.svg.png") !important;');
Link.href= "javascript:lrcToggleClock();";
Link.title= lang_messages.CLOCKTITLE;
var ClockSpan = document.createElement('div');
ClockSpan.id = "ClockSpan";
ClockSpan.innerHTML = "XX:XX:XX";
Link.parentNode.appendChild(ClockSpan);
ClockSpan.setAttribute('style', 'position:relative;top:-50px;text-align:center;font-weight:bold;');
lrcSetTimeInClock();
}
function lrcSetTimeInClock(){
var ClockSpan = document.getElementById("ClockSpan");
if(!ClockSpan) return;
var Now = new Date();
var Heures = Now.getHours();
var Minutes = Now.getMinutes();
var Secondes = Now.getSeconds();
lrcClockTime = Heures
lrcClockTime = Minutes
lrcClockTime = Secondes
ClockSpan.innerHTML = (Heures < 10 ? '0' : '') + Heures + ':' + (Minutes < 10 ? '0' : '') + Minutes + ':' + (Secondes<10 ? '0' : '') + Secondes;
setTimeout("lrcClockTimer()", 1000);
}
function lrcClockTimer(){
var ClockSpan = document.getElementById("ClockSpan");
if(!ClockSpan) return;
var H = lrcClockTime;
var M = lrcClockTime;
var S = lrcClockTime;
S = S+1;
var Reload = false;
if(S==60){
Reload = true;
S = 0;
M = M+1;
if(M==60){
M = 0;
H = H+1;
if(H==24) H = 0;
}
}
lrcClockTime = H;
lrcClockTime = M;
lrcClockTime = S;
ClockSpan.innerHTML = (H < 10 ? '0' : '') + H + ':' + (M < 10 ? '0' : '') + M + ':' + (S<10 ? '0' : '') + S;
if(!Reload){
setTimeout("lrcClockTimer()", 1000);
}else{
setTimeout("lrcSetTimeInClock()", 1000);
}
}
function lrcToggleClock(){
var ClockSpan = document.getElementById("ClockSpan");
if(!ClockSpan) return;
if(ClockSpan.style.display == "none"){
ClockSpan.style.display = "";
}else{
ClockSpan.style.display = "none";
}
}
/* </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.getAttribute('id');
if(Id){
if(Id==elementId){
TheElement = Elements;
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) return;
if(DebugDiv) DebugDiv.style.display = "none";
if(DebugUl) DebugUl.innerHTML = "";
}else{
if(Logo && AnimatedLogo){
Logo.style.display = "none";
AnimatedLogo.style.display = "";
}
if(!lrcParams) 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, "g");
string = string.replace(regex, '&' + entities + ';');
}
return string;
}
function lrcEncode(text){
return encodeURIComponent(text).replace(/%3A/g, ":").replace(/%2F/g, "/");
}
function lrcGetPageURL(page) {
return mw.config.get('wgServer') + mw.config.get('wgArticlePath').split('$1').join(lrcEncode(page));
}
function lrcGetUglyPageURL(page, params) {
return mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + lrcEncode(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')+":";
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) + '</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) {
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;
if(!lnk.tagName) return;
var DisableElementTimer = 2;
if(lnk.tagName.toLowerCase() == "a"){
var DisabledLink = document.createElement('a');
DisabledLink.id = id + "_disabled";
DisabledLink.title = lnk.title;
DisabledLink.innerHTML = lnk.innerHTML;
DisabledLink.href = "javascript:;";
DisabledLink.style.color = "silver";
DisabledLink.style.cursor = "default";
DisabledLink.style.textDecoration = "none";
lnk.style.display = "none";
lnk.parentNode.insertBefore(DisabledLink, lnk);
}else if(lnk.tagName.toLowerCase() == "input" || lnk.tagName.toLowerCase() == "select"){
lnk.disabled = "disabled";
}
setTimeout("lrcEnableLink('"+id+"')", DisableElementTimer*1000);
}
function lrcEnableLink(id, OldHref, OldOnclick, OldColor, OldCursor, OldTextDecoration) {
var lnk = document.getElementById(id);
if(!lnk) return;
if(!lnk.tagName) return;
var DisableElementTimer = 5;
if(lnk.tagName.toLowerCase() == "a"){
var DisabledLink = document.getElementById(id+"_disabled");
if(!DisabledLink) return;
DisabledLink.parentNode.removeChild(DisabledLink);
lnk.style.display = "";
}else if(lnk.tagName.toLowerCase() == "input" || lnk.tagName.toLowerCase() == "select"){
lnk.disabled = false;
}
}
function tsToHhMm(timestamp) {
var tz = lrcGetTimeZone();
var regex = new RegExp(/^\d\d\d\d-\d\d-\d\dT(\d\d):(\d\d):\d\dZ$/);
match = regex.exec(timestamp);
if (!match) {
return 'xx:xx';
}
var tt = (match*60 + match*1 + tz + 1440) % 1440;
var mm = tt % 60;
var hh = (tt - mm) / 60 % 24;
return hh + ':' + (mm < 10 ? '0' : '') + mm;
}
function lrcGetTimeZone(){
var tz;
var match;
if (lrcParams) {
var regex = new RegExp(/^()?(\d?\d):?(\d\d)$/);
match = regex.exec(lrcParams);
if (!match) {
return 0;
}
tz = match*60 + match*1;
tz = match == '-' ? -tz : tz;
} else {
var now = new Date();
tz = -now.getTimezoneOffset();
}
return tz;
}
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.indexOf(Arg+"=")!=-1) return Args.split("=");
}
}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');
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);
for(var b=0,m=Elements.length;b<m;b++){
var Element = Elements;
var ElName = Element.name;
if(!ElName) continue;
var ElValue = Element.value;
var ElType = Element.type;
if(Tags.toLowerCase()=='input' && (ElType == "checkbox" || ElType == "radio") && Element.checked){
Params = ElValue;
}else if(Tags.toLowerCase()=='input' && (ElType == "text" || ElType == "hidden") ){
Params = ElValue;
}else if(Tags.toLowerCase()!='input'){
Params = ElValue;
}
}
}
return Params;
}
function updatePreviewWindowAttributes(){
var LP = document.getElementById( 'livePreview' );
if(!LP) return;
LP.style.height = lrcParams;
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.value == lrcOptionMenuValues.RCType) RCTypeOptions.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.value === lrcOptionMenuValues.RCns || parseInt(OptionsNS.value) === lrcOptionMenuValues.RCns){
Select.value = lrcOptionMenuValues.RCns;
}
}
}
function getPageContent(Req, ID){
var OldTemp = document.getElementById("TempDiv");
if(OldTemp) OldTemp.parentNode.removeChild(OldTemp);
var Temp = document.createElement('div');
Temp.id = "TempDiv";
Temp.style.display = "none";
document.body.appendChild(Temp);
Temp.innerHTML = Req.responseText;
var bC;
if(ID){
bC = getElementWithId(ID, '*', Temp);
}else{
bC = getElementWithId('bodyContent', 'div', Temp);
if (bC == null) bC = getElementWithId('article', 'div', Temp);
if (bC == null) bC = getElementWithId('mw_contentholder', 'div', Temp);
}
return bC;
}
/* </source>
=== Fonctions d'initialisation ===
==== addOnloadHook ====
<source lang="javascript"> */
function LiveRC_Init() {
if (mw.config.get('wgPageName') == LiveRC_PageTitle && (mw.config.get('wgAction')=="view"||mw.config.get('wgAction')=="purge")) {
// Get Site params
if(typeof(LiveRC_getSiteCustom)==="function") try{ LiveRC_getSiteCustom(); }catch(e){ }
// Get User params
if(typeof(LiveRC_getUserCustom)==="function") try{ LiveRC_getUserCustom(); }catch(e){ }
// 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){
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));
if(Element == null) Element = getElementsByClass(ElementsToHide);
if (Element != null){
for(var b=0,c=Element.length;b<c;b++){
Element.setAttribute("style", "display:none");
}
}
}
}
// Set clock
lrcSetClock();
// Set preview height
updatePreviewWindowAttributes();
// Update icons
for(var Icon in lrcIcon){
var IconContainer = document.getElementById("lrcIcon_"+Icon);
if(!IconContainer) continue;
IconContainer.innerHTML = lrcIcon;
}
// 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 = mw.config.get('wgServer')+mw.config.get('wgArticlePath').split("$1").join(encodeURIComponent(LiveRC_PageTitle));
LiveRCLink.appendChild(document.createTextNode('LiveRC'));
LiveRCLi.appendChild(LiveRCLink);
RCLi.parentNode.insertBefore(LiveRCLi,RCLi.nextSibling);
if((mw.config.get('wgNamespaceNumber')==2 || mw.config.get('wgNamespaceNumber')==3) && mw.config.get('wgPageName').indexOf('/') == -1 ){
wpajax.http({url : mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?action=query&list=watchlistraw&wrlimit=1&format=xml&wrcontinue='
+ encodeURIComponent('0|LiveRCWatch:' + mw.config.get('wgTitle')),
onSuccess : LiveWatchInitButton
});
}
}
}
$(LiveRC_Init);
/* </source>
==== getRights ====
<source lang="javascript"> */
function getRights(xmlreq, data) {
var api = xmlreq.responseXML;
if (api.firstChild.nodeName == "error") return;
var rights = api.getElementsByTagName('query').getElementsByTagName('userinfo').getElementsByTagName('rights').getElementsByTagName('r');
var len = rights.length;
var i;
var id,right;
for (i=0; i<len; i++) {
right = rights.textContent;
// Handle IE
if (!right) right = rights.text;
if(right) lrcUserRights.push(right);
}
if(lrcUserHasRight("apihighlimits")) lrcAPIlimit = 4999;
LiveMessages();
}
function lrcUserHasRight(Right){
return (lrcUserRights.indexOf(Right)!=-1);
}
/* </source>
==== Allmessages ====
<source lang="javascript"> */
function LiveMessages(update){
var lrcMissingMessages = new Array();
if(update){
for(var MessageName in lrcMediawikiMessages){
lrcMissingMessages.push(MessageName);
}
}else{
for(var a=0,l=lrcNeededMessages.length;a<l;a++){
if(typeof(lrcMediawikiMessages])=="undefined") lrcMissingMessages.push(lrcNeededMessages);
}
}
if(lrcMissingMessages.length>0){
lrcDisplayDebug("Get system messages");
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=query&meta=allmessages&ammessages='+lrcMissingMessages.join('|')+'&format=xml',
onSuccess: getAllmessages,
updateMode:(update ? true : false)
});
}else if(!update){
getDisambiguationTemplates();
buildControlBar();
}
}
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.getAttribute('name');
var MessageValue = (messages.firstChild ? messages.firstChild.nodeValue : "");
lrcMediawikiMessages = MessageValue;
}
if(data.updateMode===true){
lrcDisplayDebug("Save system messages");
UpdateAllmessages();
}else{
getDisambiguationTemplates();
buildControlBar();
}
}
function UpdateAllmessages(){
var Messages = "\n/* ** "+lrcManageParamsText + " ** */\n\n";
for(var MessageName in lrcMediawikiMessages){
Messages += "lrcMediawikiMessages = "
+ lrcEscapeStrHTML(lrcMediawikiMessages.split('\n').join("")) + ";\n";
}
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?format=xml&action=query&prop=info&intoken=edit&inprop=protection&titles='+encodeURIComponent(LiveRC_MessagesPage),
onSuccess: UpdateAllmessagesRunning, messages: Messages});
}
function UpdateAllmessagesRunning(Req, data){
var EditParam = new Array();
var Page = Req.responseXML.getElementsByTagName("page");
EditParam = encodeURIComponent(Page.getAttribute("edittoken"));
EditParam = encodeURIComponent(data.messages);
EditParam = encodeURIComponent(lang_messages.RESUMESTART+lang_messages.UPDATEMESSAGES);
EditParam = encodeURIComponent(LiveRC_MessagesPage);
EditParam = "preferences";
if(lrcParams) EditParam = "nochange";
var Params = new Array();
for(var Param in EditParam){
Params.push(Param+"="+EditParam);
}
Params = Params.join("&");
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?action=edit',
method: "POST", headers: headers,
onSuccess:UpdateAllmessagesDone,
data: Params
});
}
function UpdateAllmessagesDone(Req, data){
lrcDisplayDebug("");
}
/* </source>
==== getDisambiguationTemplates ====
<source lang="javascript"> */
function getDisambiguationTemplates(){
lrcDisplayDebug("Get disambiguation templates")
var DisambiguationPage = lrcMediawikiMessages;
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.split("]").join("");
if(getNamespaceInfoFromPage(ThisLink)!=10) continue;
lrcHomonTemplates.push(ThisLink);
}
buildAskForSysopCreateReasons();
}
/* </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(\'*\'); return false;" '
+ 'style="color: red; font-weight: bold;" title="'+lang_tooltips.HIDE_ALL+'">X</a>'
+ ' | '
+ '<a href="javascript:;" onClick="supprLigne(\'d\'); return false;" '
+ 'style="color: rgb(255, 235, 71); font-weight: bold;" title="'+lang_tooltips.HIDE_REVIEWED+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'r\'); return false;" '
+ 'style="color: rgb(255, 99, 83); font-weight: bold;" title="'+lang_tooltips.HIDE_REVERTS+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'n\'); return false;" '
+ 'style="color: rgb(178, 243, 113); font-weight: bold;" title="'+lang_tooltips.HIDE_NEW+'">X</a>'
+ ' '
+ '<a href="javascript:;" onClick="supprLigne(\'c\'); return false;" '
+ '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="if (this.checked) { buildTchatWindow(); } 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+'" '
+ 'href="javascript:;" onClick="LiveRC_ManageParams_OpenMenu(); return false;">'
+ lrcManageParamsText+'</a>';
// Apply options
showHideObj(document.getElementById("shidList"), 'liveFollow');
var showTchat = document.getElementById("showTchat");
if (showTchat.checked) {
buildTchatWindow();
showHideObj(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');
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').getElementsByTagName('namespaces').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.getAttribute('id');
ns = nss.textContent;
// Handle IE
if (!ns) ns = nss.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')] = lstNsName;
}
}
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" });
if (lrcParams) {
liveWatch();
} else {
liveRC();
loadBlocks();
}
}
function getSysop(xmlreq, data) {
var api = xmlreq.responseXML.getElementsByTagName('api');
if (api.firstChild.nodeName == "error") return;
var rcs = api.getElementsByTagName('query').getElementsByTagName('allusers').getElementsByTagName('u');
leni=rcs.length;
for (i=leni-1; i>=0; i--) {
lstSysop.push(rcs.getAttribute('name'));
}
}
/* </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');
var clPrefix = 'LiveRCWatch:';
if (api.firstChild.nodeName == "error") return;
var rcs = api.getElementsByTagName('watchlistraw').getElementsByTagName('wr');
leni=rcs.length;
for (i=0; i<leni; i++) {
var article = rcs.getAttribute('title');
if (article.substr(0, clPrefix.length) == clPrefix) {
var userName = article.substr(clPrefix.length);
if (!lstContact2)
lstContact2 = {ts: 0, fromjs: false};
} else {
lstSuivi.getAttribute('title')] = "--:--";
}
}
var wc1=api.getElementsByTagName('query-continue');
if (wc1){
var wrcontinue=wc1.getElementsByTagName('watchlistraw').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();
loadBlocks();
}
}
/* </source>
==== loadBlocks ====
<source lang="javascript"> */
function loadBlocks() {
if (lrcParams) {
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');
if (typeof(logevents) == 'undefined') return;
lst = logevents.childNodes;
for (var i = 0; i < lst.length; i++) {
if (lst.getAttribute('action') == 'block') {
var user = lst.getAttribute('title');
if (user != null) {
user = user.substr(user.indexOf(':') + 1);
lstBlocks = 1;
}
}
}
if (data.minCount > lrcAPIlimit) {
var lestart = xmlreq.responseXML.getElementsByTagName('query-continue').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 {
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=' + encodeURIComponent(watchCategories.category),
onSuccess: fillUserCat,
wcIndex: i,
category:watchCategories.category
});
}
}
function fillUserCat(xmlreq,data) {
var cats = xmlreq.responseXML.getElementsByTagName('cm');
for (var a = 0; a < cats.length; a++) {
var ns = parseInt(cats.getAttribute('ns'));
if (ns == 3) {
var title = cats.getAttribute('title').split(mw.config.get('wgFormattedNamespaces')+":").join("");
lstUserCat = data.wcIndex;
}else{
continue;
}
}
var cmcontinue="";
if (xmlreq.responseXML.getElementsByTagName('query-continue')) {
cmcontinue = xmlreq.responseXML.getElementsByTagName('query-continue').getElementsByTagName('categorymembers').getAttribute('cmcontinue');
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?format=xml&action=query&list=categorymembers'
+ '&cmlimit=' + lrcAPIlimit
+ '&cmtitle=' + encodeURIComponent(data.category)
+ '&cmcontinue=' + encodeURIComponent(cmcontinue),
onSuccess: fillUserCat,
wcIndex: data.wcIndex,
category:data.category
});
}
}
/* </source>
=== Fonctions de mise à jour des modifications récentes ===
==== liveRC ====
<source lang="javascript"> */
function liveRC() {
if (document.getElementById('stopLive').checked){
lrcDisplayDebug("");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",1000);
LiveRC_RequestError = 0;
return;
}
lrcDisplayDebug("Get RC");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("LiveRC_RequestError++; if(LiveRC_RequestError>4){ document.getElementById('stopLive').checked = 'checked'; }; liveRC(); ",(lrcParams+30)*1000);
var HookResult = LiveRC_RunHooks("BeforeRC");
if(!HookResult) return;
var rcns = document.getElementById('showNS0').value;
if (rcns == null) return;
var withFilters = document.getElementById('showFilter').checked;
var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath')
+ '/api.php?action=query&list=recentchanges|logevents' + (withFilters ? '|abuselog&aflprop=ids|filter|user|title|action|result|timestamp|hidden' : '') + '&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
+ '&leend=' + lastletimestamp + '&lelimit=' + lrcParams
+ (withFilters ? '&aflend=' + lastfiltertimestamp + '&afllimit=' + lrcParams : '')
+ '&format=xml';
wpajax.http({url:URL, onSuccess:getRC, message:lang_tooltips.WORKING, nsfilter:rcns , withFilters:withFilters});
}
function getRC(xmlreq, data) {
if (document.getElementById('stopLive').checked){
lrcDisplayDebug("");
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",1000);
return;
}
var NSFilter = data.nsfilter;
var api = xmlreq.responseXML.getElementsByTagName('api');
if (api.firstChild.nodeName == "error") return;
var query = api.getElementsByTagName('query');
var rcs = query.getElementsByTagName('recentchanges').getElementsByTagName('rc');
var i,j,leni,lenj,rc;
goNext(2); // Set lrcAllLinesSeen if we need to preload a line after the function completes.
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.getAttribute('rcid') <= lastrcid) continue;
rc = new Object();
rc.state = 0;
lenj = rcs.attributes.length;
for (j=0; j<lenj; j++) {
switch(rcs.attributes.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.attributes.name] = rcs.attributes.value;
break;
}
}
var tags = rcs.getElementsByTagName('tags').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.regex).test(rc.comment))
rc.state += commenttests.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
|| (lstRevoc)
|| (rc.user == mw.config.get('wgUserName'))
|| (lrcParams && 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) continue;
if (lrcParams) {
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?titles=' + encodeURIComponent(rc.title) + '&action=query&prop=categories|templates&cllimit='+lrcAPIlimit+'&clprop=hidden&tllimit='+lrcAPIlimit+'&redirects&format=xml',
onSuccess: getRedirCat, rc: rc });
} else {
getRevision(rc);
}
}
// Log
var logs = query.getElementsByTagName('logevents').getElementsByTagName('item');
var i,j,leni,lenj,log;
leni=logs.length;
for (i=leni-1; i>=0; i--) {
if (logs.getAttribute('logid') <= lastlogid) continue;
log = new Object();
log.state = 0;
lenj = logs.attributes.length;
for (j=0; j<lenj; j++) {
if (logs.attributes.name == 'type')
{
switch(logs.attributes.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.firstChild)
log.duration = logs.firstChild.attributes.value;
break;
case 'delete':
log.state += DELETE;
break;
case 'move':
log.state += MOVE;
if (logs.firstChild)
log.new_title = logs.firstChild.attributes.value;
case 'protect':
log.state += PROTECT;
break;
case 'review':
log.state += REVIEW;
break;
default:
break;
}
}
else
log.attributes.name] = logs.attributes.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.regex).test(log.comment))
log.state += commenttests.state;
}
if (lstSysop.indexOf(log.user) != -1)
log.state += SYSOP;
if( (NSFilter.indexOf("|")==-1) && (log.ns!=null) && (NSFilter!=log.ns) ) continue;
if (!(log.state & REVIEW)) {
if (lrcParams) {
wpajax.http({url: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/api.php?titles=' + encodeURIComponent(log.title) + '&action=query&prop=categories|templates&cllimit='+lrcAPIlimit+'&clprop=hidden&tllimit='+lrcAPIlimit+'&redirects&format=xml',
onSuccess: getRedirCat2, log: log });
} else {
getRevision(log);
}
}
}
if (data.withFilters) {
// Filters
var filters = query.getElementsByTagName('abuselog').getElementsByTagName('item');
var i,j,leni,lenj,filter;
leni=filters.length;
for (i=leni-1; i>=0; i--) {
if (filters.getAttribute('id') <= lastfilterid) continue;
filter = new Object();
filter.state = ABFILTER;
lenj = filters.attributes.length;
for (j=0; j<lenj; j++) {
filter.attributes.name] = filters.attributes.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
if( (NSFilter.indexOf("|")==-1) && (filter.ns!=null) && (NSFilter!=filter.ns) ) continue;
getRevision(filter);
}
if(filters){
lastfilterid = filters.getAttribute('id');
lastfiltertimestamp = filters.getAttribute('timestamp').replace(new RegExp(/\D/g), "");
}
}
if(rcs){
lastrcid = rcs.getAttribute('rcid');
lastrctimestamp = rcs.getAttribute('timestamp').replace(new RegExp(/\D/g), "");
}
if(logs){
lastlogid = logs.getAttribute('logid');
lastletimestamp = logs.getAttribute('timestamp').replace(new RegExp(/\D/g), "");
}
lrcDisplayDebug("");
LiveRC_RequestError = 0;
clearTimeout(lrcTimer);
lrcTimer = setTimeout("liveRC()",lrcParams*1000);
}
/* </source>
==== getRedirCat ====
<source lang="javascript"> */
function getRedirCat(xmlreq, data) {
var yurik = xmlreq.responseXML.getElementsByTagName('api');
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').getElementsByTagName('page');
if (page.getElementsByTagName('redirect').length) {
state |= REDIRECT;
if (page.getElementsByTagName('redirect').getElementsByTagName('to').length)
rc.redirect = page.getElementsByTagName('redirect').getElementsByTagName('to').textContent;
}
rc.categories = new Array();
if (page.getElementsByTagName('categories').length) {
var cats = page.getElementsByTagName('categories').getElementsByTagName('cl');
var i,j;
var leni = cats.length;
var lenj = categoriestests.length;
var pageHasCat = false;
for (i=0; i<leni; i++){
if(cats.getAttribute("hidden")==null) pageHasCat = true;
var catTitle = cats.getAttribute('title');
rc.categories.push(catTitle);
for (j=0; j<lenj; j++){
if (new RegExp(lang_category+categoriestests.regex, "i").test(catTitle)){
state |= categoriestests.state;
}
}
}
if(pageHasCat) state |= CATEGORIZED;
}
rc.templates = new Array();
if (page.getElementsByTagName('templates').length) {
var temps = page.getElementsByTagName('templates').getElementsByTagName('tl');
var i,j;
var leni = temps.length;
for (i=0; i<leni; i++){
var templateTitle = temps.getAttribute('title');
if(lrcHomonTemplates.indexOf(templateTitle)!=-1) state |= HOMONYMIE;
if(templateTitle=="Modèle:Méta lien vers portail") state |= PORTAIL;
rc.templates.push(templateTitle);
}
}
rc.state = state;
getRevision(rc);
}
function getRedirCat2(xmlreq, data) {
var api = xmlreq.responseXML.getElementsByTagName('api');
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');
if (query.getElementsByTagName('redirects').length) {
state |= REDIRECT;
if (query.getElementsByTagName('redirects').getElementsByTagName('r').length)
log.redirect = query.getElementsByTagName('redirects').getElementsByTagName('r').getAttribute('to');
}
log.categories = new Array();
if (query.getElementsByTagName('categories').length) {
var cats = query.getElementsByTagName('categories').getElementsByTagName('cl');
var i,j;
var leni = cats.length;
var lenj = categoriestests.length;
var queryHasCat = false;
for (i=0; i<leni; i++){
if(cats.getAttribute("hidden")==null) queryHasCat = true;
var catTitle = cats.getAttribute('title');
log.categories.push(catTitle);
for (j=0; j<lenj; j++){
if (new RegExp(lang_category+categoriestests.regex, "i").test(catTitle)){
state |= categoriestests.state;
}
}
}
if(queryHasCat) state |= CATEGORIZED;
}
log.templates = new Array();
if (query.getElementsByTagName('templates').length) {
var temps = query.getElementsByTagName('templates').getElementsByTagName('tl');
var i,j;
var leni = temps.length;
for (i=0; i<leni; i++){
var templateTitle = temps.getAttribute('title');
if(lrcHomonTemplates.indexOf(templateTitle)!=-1) state |= HOMONYMIE;
if(templateTitle=="Modèle:Méta lien vers portail") state |= PORTAIL;
log.templates.push(templateTitle);
}
}
log.state = state;
getRevision(log);
}
/* </source>
==== getFilterTitle, getFilterAction ====
<source lang="javascript"> */
function getFilterAction(action){
if(lrcMediawikiMessages) return lrcMediawikiMessages;
return action;
}
function getFilterComment(filter) {
filter.comment = lang_messages.FILTER+' '
filter.comment += '<a href="'+lrcGetPageURL("Special:Abuselog/"+filter.filter_id)+'" '
+ ' onclick="liveFilter(\'AbuseFilter\', '+filter.filter_id+'); return false;" >'+filter.filter_id+'</a>';
filter.comment += ': ';
filter.comment += filter.filter;
filter.comment += ' ('+getFilterAction("action")+' : '+ getFilterAction(filter.result) + ')';
return filter.comment;
}
/* </source>
==== getRevision ====
<source lang="javascript"> */
var lrcRCpaused = new Array();
function getRevisionPaused() {
if (document.getElementById('stopLive').checked){
setTimeout("getRevisionPaused()", 1000);
return;
}
for(var a=0,l=lrcRCpaused.length;a<l;a++){
if(lrcRCpaused) getRevision(lrcRCpaused);
}
while(lrcRCpaused){ lrcRCpaused.pop(); }
}
function getRevision(rc) {
if (document.getElementById('stopLive').checked){
var ID = lrcRCpaused.length;
lrcRCpaused = rc;
if(ID==0) setTimeout("getRevisionPaused()", 1000);
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 lineUID = generateNewID();
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');
th0.className = "th0RC";
th1.className = "th1RC";
td2.className = "td2RC";
td3.className = "td3RC";
td4.className = "td4RC";
lrcLines = {tr1: tr1, title: title, user: user, revid: revid, oldid: oldid, state: state};
// SUPPR. LIGNE //
th0.innerHTML = '<a href="javascript:;" onClick="supprLigne(\''+pageid+'_'+revid+'\'); return false;" style="color:red" title="'+lang_tooltips.HIDE_THIS+'">X</a>';
th0.id = lineUID;
// ARTICLE //
var arti = "", artiStyle = "";
var preArti = "", postArti = "";
var diff = "";
var diffClose = "";
if (lrcParams == 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(\'AbuseLog\', {\'details\':'+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 watch = '';
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(lstSuivi){
watch = '<a href="'+lrcGetUglyPageURL(title,'&action=unwatch') + '" '
+ 'onClick="LiveWatchArticle(this, 0, '+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.UNWATCH_TIP+' « '+title+' »" '
+ '>'+lang_tooltips.UNWATCH_SHORT+'</a>';
}else{
watch = '<a href="'+lrcGetUglyPageURL(title,'&action=watch') + '" '
+ 'onClick="LiveWatchArticle(this, 0, '+escTitle+'); return false;" '
+ 'title="'+lang_tooltips.WATCH_TIP+' « '+title+' »" '
+ '>'+lang_tooltips.WATCH_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 + ' ';
}
// Stub / Ébauche ? ;
///////////////////////////
if (state & STUB) {
preArti += lrcIcon + ' ';
}
// Page protégée ? ;
////////////////////
if (state & FULLLOCK)
preArti += lrcIcon+' ';
if (state & LOCK)
preArti += lrcIcon+' ';
// Copyright ? ;
//////////
if (state & COPYRIGHT)
preArti += lrcIcon+' ';
// PaS ? ;
//////////////////
if (state & PAS)
preArti += lrcIcon+' ';
// Adq ? ;
//////////
if (state & ADQ)
postArti += lrcIcon;
// Bon article ? ;
//////////////////
if (state & BA)
postArti += lrcIcon;
// Article potentiellement de qualité ? ;
/////////////////////////////////////////
if (state & APDQ)
postArti += lrcIcon;
// Article catégorisé ? ;
/////////////////////////
if ((!(state & UPLOAD) &&
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & PATROL) &&
!(state & MOVE) &&
!(state & ABFILTER))
&& !(state & REDIRECT)
&& !(state & HOMONYMIE)
&& !(state & CATEGORIZED)
&& (ns == 0 || ns==6)
&& lrcParams)
postArti += lrcIcon;
// Article sans portail ? ;
/////////////////////////
if ((!(state & UPLOAD) &&
!(state & NEWUSER) &&
!(state & BLOCK) &&
!(state & DELETE) &&
!(state & PROTECT) &&
!(state & PATROL) &&
!(state & MOVE) &&
!(state & ABFILTER))
&& !(state & REDIRECT)
&& !(state & HOMONYMIE)
&& !(state & PORTAIL)
&& (ns == 0)
&& lrcParams)
postArti += lrcIcon;
// 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;
postArti += ' <a '
+ 'href="'+lrcGetPageURL(rc.new_title)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(rc.new_title)+','+escUser+'); return false;"'
+ '>'+lrcStripString(rc.new_title, lrcParams)+'</a>';
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ 'class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams)+'</a>';
}else if (state & REDIRECT) {
artiStyle = 'color: green; font-weight: bold; font-style: italic;';
postArti += ' '+lrcIcon;
postArti += ' <a '
+ 'href="'+lrcGetPageURL(rc.redirect)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(rc.redirect)+','+escUser+');" '
+ '>'+lrcStripString(rc.redirect, lrcParams)+'</a>';
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ 'class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams)+'</a>';
} else if (state & UPLOAD) {
postArti += ' '+lrcIcon;
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams)+'</a>';
}else if (state & NEWUSER) {
postArti += ' '+lrcIcon;
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'" >'+lrcStripString(title, lrcParams)+'</a>';
}else if (state & BLOCK) {
// artiStyle = 'color: magenta; font-weight: bold; font-style: italic;';
postArti += ' '+lrcIcon;
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)+'</a>';
}else if (state & DELETE) {
postArti += ' '+lrcIcon;
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams)+'</a>';
}else if (state & PROTECT) {
postArti += ' '+lrcIcon;
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams)+'</a>';
}else {
arti = '<a '
+ 'href="'+lrcGetPageURL(title)+'" '
+ 'onClick="liveArticle('+escTitle+','+escUser+'); return false;" '
+ dlbClick + ' class="lrc_ArticleLink" style="'+artiStyle+'">'+lrcStripString(title, lrcParams)+'</a>';
}
th1.innerHTML = '<small>' + tsToHhMm(timestamp) + ' • ' + diff + ' • ' + hist + ' • ' + edit + ' • ' + watch + admin + ' • </small>'
+ preArti + arti + postArti;
addClass(th1,"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')+':'+user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')+':'+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) {
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+' ';
// Bot ? ;
//////////
if (state & BOT)
preEditor += lrcIcon+' ';
// Sysop ? ;
////////////
if (state & SYSOP)
preEditor += lrcIcon+' ';
// TOR potentiel / AOL
var isTOR = new RegExp(/172\.\d+\.\d+\.\d+/);
if (isTOR.test(user))
preEditor += lrcIcon+' ';
if (typeof(lstUserCat) != 'undefined') {
preEditor += lrcIcon].image]+' ';
}
if (typeof(lstBlocks) != 'undefined' && user != mw.config.get('wgUserName')) {
preEditor += lrcIcon+' ';
}
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;
addClass(td2, "creator-name");
td2.style.border = "1px";
td2.style.width = "20%";
td2.id = td2id;
if (lstRevoc) {
addClass(tr1, "RcReverted");
td2.innerHTML += lrcIcon.split("$1").join(lstRevoc.nb).split("$2").join(escUser)+lrcGetAllRevoc(user);
}
// COMMENT //
var wcomment = "";
if( (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 if (state & ABFILTER) {
wcomment = getFilterComment(rc);
}else{
wcomment = parsedcomment;
}
if (lrcParams) wcomment = '<b>' + wcomment + '</b>';
// Abusefilter tag ? ;
/////////////////
if (state & TAG) {
var TagTemplate = lrcIcon;
TagTemplate = TagTemplate.split("$1").join(rc.tags.firstChild.nodeValue);
var TagList = "";
for (var tagId = 1; tagId < rc.tags.length; ++tagId)
TagList += ' | ' + rc.tags.firstChild.nodeValue;
TagTemplate = TagTemplate.split("$2").join(TagList);
wcomment += TagTemplate;
addClass(tr1, "RcTag");
} else {
td3.style.border = "1px";
td3.style.width = "40%";
}
td3.innerHTML = "<small>" + wcomment + "</small>";
if (!(state & ABFILTER)) {
var CommentLinks = td3.getElementsByTagName('a');
for(var a=0,l=CommentLinks.length;a<l;a++){
var Target = CommentLinks.title.replace(lrcMediawikiMessages.split("$1").join(""), "");
if(!Target || Target === "") Target = CommentLinks.innerHTML;
if(CommentLinks.className && CommentLinks.className == "new"){
CommentLinks.setAttribute("onClick", "liveEdit("+lrcEscapeStr(Target)+", '&redlink=1'); return false;");
}else{
if(Target.indexOf(mw.config.get('wgFormattedNamespaces')+":"+lrcMediawikiMessages+"/")==0){
Target = CommentLinks.innerHTML;
CommentLinks.setAttribute("onClick", "liveContrib("+lrcEscapeStr(Target)+"); return false;");
}else{
CommentLinks.setAttribute("onClick", "liveArticle("+lrcEscapeStr(Target)+"); return false;");
}
}
}
}
if(state & PATROLLED) addClass(tr1, "RcPatrolled");
if(state & ABFILTER) addClass(tr1, "RcAbFilter");
if (state & UPLOAD) addClass(tr1, "RcUpload");
if (state & NEWUSER) addClass(tr1, "RcNewUser");
if(state & BLOCK) addClass(tr1, "RcBlock");
if(state & DELETE) addClass(tr1, "RcDelete");
if(state & MOVE) addClass(tr1, "RcMove");
if(state & PROTECT) addClass(tr1, "RcProtect");
if(state & REVERT) addClass(tr1, "RcRevert");
if(state & BLANKING || newsize == 0) addClass(tr1, "RcBlanking");
if(state & NEW) addClass(tr1, "RcNew");
if(state & IP) addClass(tr1, "RcIp");
if(isTOR.test(user)) addClass(tr1, "RcTOR");
if(state & REPLACED) {
addClass(tr1, "RcReplaced");
td4.innerHTML = lrcIcon;
}
// CONTACT LIST //
//////////////////
if (lstContact2) {
addClass(tr1, "RcContact");
} else if (user == mw.config.get('wgUserName')) {
addClass(tr1, "RcSelf");
}
// 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){ // NO LIMIT
if(lrcParams){ // 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){ // Insert in first position
tab.appendChild(tr1);
if (elold == null) {
if (tab.childNodes.length > lrcParams) {
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) {
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);
// MISE A JOUR LISTE "Liste de suivi" //
if(lstSuivi) {
addClass(tr1, "RcWatched");
lstSuivi = tsToHhMm(timestamp);
var tempsAr = new Array();
var len = lstSuivi.length;
for (var n in lstSuivi) {
if(lstSuivi == "--:--") continue;
var cstilde = lrcEscapeStr(n);
var sdiff = '<a '
+ 'href="'+mw.config.get('wgServer') + mw.config.get('wgScript') + '?title='+encodeURIComponent(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(n)+'&action=history" '
+ 'onClick="liveHist('+cstilde+'); return false;" '
+ 'style="color:darkorange">H</a>';
var sarti = '<a '
+ 'href="'+lrcGetPageURL(n)+'" '
+ 'onClick="liveArticle('+cstilde+'); return false;"'
+ '>'+n+'</a>';
var sotherns = getNamespaceInfoFromPage(n);
var sotherpn = getNamespaceInfoFromPage(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')+":"+sotherpn);
var stalk = '<a style="color: seagreen;" '
+ 'href="'+lrcGetPageURL(sothername)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(sothername)+'); return false;"'
+ '>'+sotherText+'</a>';
var ligne='<small>' + lstSuivi + ' • ' + 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;
}
if (lstContact2) {
lstContact2.ts = timestamp;
updateFollowContact();
}
if (state & REVERT) {
var regex = new RegExp(/\cial:Contributions\/(\|]+)/);
match = regex.exec(comment);
if (!match) {
var regex2 = new RegExp(/\\|]+)/);
match = regex2.exec(comment);
}
if (match) {
var userR = match;
if (userR != user && userR != mw.config.get('wgUserName')) {
if (!lstRevoc) lstRevoc = { ts: 0, nb: 0, pages:new Array() };
lstRevoc.ts = timestamp;
lstRevoc.nb += 1;
lstRevoc.pages.push({title:title, oldid:oldid, timestamp:timestamp});
updateFollowRevoc();
}
}
}
LiveRC_RunHooks("AfterRC", {id:tr1.id, rc:rc});
if (lrcAllLinesSeen && document.getElementById(tr1.id)) {
lrcAllLinesSeen = false;
goNext(1);
}
}
/* </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) {
var Height = (lrcParams * 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(mode) {
//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);
var found = false;
for (var j = length; j >= 0; j--) {
var i = (lrcParams?(length - j):j);
var thisline = lines;
if(!hasClass(thisline, "RcChecked")){
var Links = thisline.getElementsByTagName('a');
for (var a=0,l=Links.length;a<l;a++) {
if (Links.className && Links.className == "lrc_PreviewLink") {
if (found || mode) {
var ln = lrcLines.id];
if (ln.title && ln.revid && ln.oldid) {
if (mode == 2) return;
var lnURL = lrcGetUglyPageURL(ln.title, '&diffonly=1&unhide=1&diff=' + ln.revid + '&oldid=' + ln.oldid)
wpajax.preload(lnURL);
return;
}
} else {
var code = Links.getAttribute("onclick");
var ReturnRegExp = new RegExp("return+false*;");
code = code.replace(ReturnRegExp, "");
eval(code);
found = true;
}
}
}
}
}
if (mode == 2) {
lrcAllLinesSeen = true;
}
}
/* </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') {
els = getElementsByClass("RcChecked",tab,'tr');
} else if (quelLigne == 'r') {
els = getElementsByClass("RcRevert",tab,'tr');
} else if (quelLigne == 'n') {
els = getElementsByClass("RcNew",tab,'tr');
} else if (quelLigne == 'c') {
els = getElementsByClass("RcBlanking",tab,'tr');
} else
els.push(document.getElementById(quelLigne));
len = els.length;
for (i=len-1; i>=0; i--){
if (els != null) {
lineUID = els.getElementsByTagName('th').id;
delete lrcLines;
tab.removeChild(els);
}
}
lrcUpdateRCTableLength();
return false;
}
/* </source>
==== changeLigne ====
<source lang="javascript"> */
function changeLigne(quelLigne) {
var el = document.getElementById(quelLigne);
el.className = "RcChecked";
}
/* </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')+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')+':'+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;
}
function hideUser(name) {
lstHidden = true;
updateHidden();
}
function unhideUser(name) {
delete lstHidden;
updateHidden();
}
/* </source>
===== updateFollowContact =====
<source lang="javascript"> */
function updateFollowContact() {
var tempAr = new Array();
for (var user in lstContact2) {
if(!lstContact2) continue;
var timestamp = lstContact2.ts;
if (timestamp == 0) continue;
var utilde = lrcEscapeStr(user);
var udiscut = '<a '
+ 'href="'+lrcGetPageURL(mw.config.get('wgFormattedNamespaces')+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')+':'+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;
}
/* </source>
===== updateFollowRevoc =====
<source lang="javascript"> */
function updateFollowRevoc() {
var tempAr = new Array();
for (var user in lstRevoc) {
var timestamp = lstRevoc.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')+':' + user)+'" '
+ 'onClick="liveArticle('+lrcEscapeStr(mw.config.get('wgFormattedNamespaces')+':'+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 MoreLink = lrcGetAllRevoc(user);
var ligne = '<span id="revoc-' + timestamp + '"><small>' + tsToHhMm(timestamp) + ' • ' + uremove + ' • ' + udiscut + ' • ' + ucontrib + udeletedcontrib + uadmin + ' • </small>' + ueditor + ' : ' + lstRevoc.nb + ' '+lang_menu.XTIMES + MoreLink + '</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;
}
function lrcGetAllRevoc(user){
if(!lstRevoc) return "";
var pages = lstRevoc.pages;
var RevocLink = '<a href="javascript:;" onclick="lrcShowHideAllRevoc(this);"><b>+</b></a>'
+ '<span id="" style="display:none"><br/>';
for(var a=0,l=pages.length;a<l;a++){
var Page = pages.title;
var Oldid = pages.oldid;
var Time = pages.timestamp;
var Links = new Array();
Links.time = tsToHhMm(Time);
Links.page = '<a href="'+lrcGetPageURL(Page)+'" onclick="liveArticle('+lrcEscapeStr(Page)+'); return false;">'+Page+'</a>';
Links.diff = '<a href="'+lrcGetUglyPageURL(Page, '&diffonly=1&unhide=1&diff=next&oldid='+Oldid)+'" onclick="liveDiff('+lrcEscapeStr(Page)+', \'next\', '+Oldid+'); return false;">'+lang_tooltips.DIFF_SHORT+'</a>';
RevocLink += '<span style="margin-left:0.5em;font-size:75%">'+Links.time+' – '+Links.page+' ('+Links.diff+')</span>';
if(a!=(l-1)) RevocLink += '<br/>';
}
RevocLink += '</span>';
return RevocLink;
}
function removeRevoc(name) {
delete lstRevoc;
updateFollowRevoc();
}
function lrcShowHideAllRevoc(Link){
if(!Link) return false;
var Span = Link.nextSibling;
if(!Span) return false;
if(Span.style.display == "none"){
Span.style.display = "";
}else{
Span.style.display = "none";
}
}
/* </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);
if (x == null) return false;
lrcPatrolLnk = x.getElementsByTagName('a');
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: lrcGetUglyPageURL(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;
var page=data.mpage;
var oldid=data.moldid;
var id=data.mid;
var bC = getPageContent(xmlreq);
var LP = document.getElementById( 'livePreview' );
var dLP = document.getElementById( 'divLivePreview' );
var lD = getElementsByClass('diff',bC,null);
var upage = lrcEscapeStr(page);
if (lD == 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 != null){
rl += '<span class="mw-rollback-link">'+ rollback.innerHTML + '</span> ';
}
if (revisiondelete != null){
rl += lang_tooltips.REVISIONDELETE_SHORT + ' :';
for(var a=0,l=revisiondelete.length;a<l;a++){
var rdl = revisiondelete.getElementsByTagName('a');
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 != null){
rl += ' <span class="patrollink">'+ patrol.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.innerHTML + "<br />";
for(var n=0; n < lap ; n++)
apres = apres + apresEl.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.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', bC);
if (user1 != null) {
user1 = user1.getElementsByTagName('a').innerHTML;
}
var user2 = getElementWithId('mw-diff-ntitle2', 'div', bC);
if (user2 != null) {
user2 = user2.getElementsByTagName('a').innerHTML;
}
var Previous = false;
var asPreviousDiff = getElementWithId('differences-prevlink', 'a', bC);
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', bC);
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){
if(param!="title" && param!="action"){
HistoryParams.push(param+":"+lrcEscapeStr(Params));
URL += "&"+param+"="+encodeURIComponent(Params);
}
}
}
lrcAddToHistory("liveHist",
new Array(lrcEscapeStr(page), "{"+HistoryParams.join(",")+"}"),
URL,
page + " : " + HistoryParams.join(" ")
);
}
wpajax.http({url:URL, onSuccess: getHist, message: page });
}
function getHist(xmlreq, data) {
var bC = getPageContent(xmlreq);
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.type && SInputs.type === "submit"){
var Input = SInputs;
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.type && CInputs.type === "submit"){
var Input = CInputs;
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);
}
}
var DRButtons = CompareForm.getElementsByTagName('button');
for(var a=0,l=DRButtons.length;a<l;a++){
if(DRButtons && DRButtons.className && DRButtons.className=="mw-history-revisiondelete-button"){
var Input = DRButtons;
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.value = Input.innerHTML + " (live)";
NewInput.onclick = function(){ processHistRevisionDelete(this)}
NewInput.onselect = function(){ processHistRevisionDelete(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.parentNode.removeChild(Input);
}
}
}
function processHistSearch(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params;
liveHist(page, Params);
}
function processHistCompare(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params;
var diff = Params;
var oldid = Params;
liveDiff(page, diff, oldid);
}
function processHistRevisionDelete(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var page = Params;
var Ids = new Array();
for(var Id in Params){
if(Id.indexOf("ids").join(""));
}
if(!Ids) return;
liveRevisiondelete(page,Ids);
}
/* </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:lrcGetUglyPageURL(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) {
var bC = getPageContent(xmlreq);
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", data);
}
/* </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){
URL += "&"+param+"="+encodeURIComponent(Params);
if(param!="target") HistoryParams.push(param+":"+lrcEscapeStr(Params));
}
}
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 bC = getPageContent(xmlreq);
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');
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs.type && Inputs.type === "submit"){
var Input = Inputs;
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;
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){
URL += "&"+param+"="+encodeURIComponent(Params);
if(param!="target") HistoryParams.push(param+":"+lrcEscapeStr(Params));
}
}
lrcAddToHistory("liveDeletedContrib",
new Array(lrcEscapeStr(user), "{"+HistoryParams.join(",")+"}"),
URL,
user + " : " + HistoryParams.join(" ")
);
}
wpajax.http({url:URL, onSuccess: getDeletedContrib, message: user });
}
function getDeletedContrib(xmlreq, data) {
var bC = getPageContent(xmlreq);
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');
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs.type && Inputs.type === "submit"){
var Input = Inputs;
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;
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){
URLParams += "&"+ param + "=" + encodeURIComponent(params);
HistoryParams.push(param + ":" + lrcEscapeStr(""+params));
}
}
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:lrcGetUglyPageURL('Special:Log', '&type=' + action + URLParams), onSuccess: getLog, page:params , user:params });
}
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];
}
return lrcMediawikiMessages;
}
function getLog(xmlreq, data) {
var bC = getPageContent(xmlreq);
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');
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs.type && Inputs.type === "submit"){
var Input = Inputs;
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;
var page = Params;
var user = Params;
liveLog(action, {page:page,user:user});
}
/* </source>
==== LiveFilter ====
<source lang=javascript> */
function liveFilter(Page, params) {
var URL = mw.config.get('wgServer');
if(Page=="AbuseFilter"){
URL += mw.config.get('wgArticlePath').split("$1").join("Special:AbuseFilter/"+params);
var FilterParams = params;
}else{
URL += mw.config.get('wgScript') + "?title=Special:AbuseLog";
var FilterParams = new Array();
for(var param in params){
if(params){
URL += "&"+ param + "=" + encodeURIComponent(params);
FilterParams.push(param + ":" + lrcEscapeStr(""+params));
}
}
FilterParams = "{"+FilterParams.join(",")+"}";
}
lrcAddToHistory("liveFilter", new Array(lrcEscapeStr(Page), FilterParams), URL, FilterParams);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Filter: <span style='color:red'></span>...</b>");
wpajax.http({ url: URL,
onSuccess: getFilter,
page: Page,
args: params
});
}
function getFilter(xmlreq, data) {
var Args = data.args;
var Page = data.page;
var bC = getPageContent(xmlreq);
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";
}
if(typeof(Args)!="object"){
var LogLink = '<a href="'+lrcGetUglyPageURL("Special:Abuselog", "&wpSearchFilter="+Args)+'" '
+ ' onclick="liveFilter(\'AbuseLog\', {\'wpSearchFilter\': \''+Args+'\'}); return false;" '
+ '>Abuselog '+Args+'</a>';
buildBlanckPreviewBar('<b><a href="'+data.url+'" target="_new">'+Page+'</a></b> '+Args, true, LogLink);
}else{
var Text = "";
for(var param in Args){
Text += param + " = " + Args + " ; ";
}
buildBlanckPreviewBar('<b><a href="'+data.url+'" target="_new">'+Page+'</a></b> '+Text, true);
var InputTD = getElementsByClass("mw-submit", LP, "td");
if(InputTD){
var Input = InputTD.firstChild;
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_mw-submit";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processFilter(this)}
NewInput.onselect = function(){ processFilter(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
}
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewFilter", data);
}
function processFilter(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
liveFilter("AbuseLog", Params);
}
/* </source>
==== LiveDelete ====
<source lang="javascript"> */
function liveDelete(Title){
lrcAddToHistory("liveDelete", new Array(lrcEscapeStr(Title)), lrcGetUglyPageURL(Title, '&action=delete'), Title);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Suppr : <span style='color:red'>"+Title+"</span>...</b>");
wpajax.http({url: lrcGetUglyPageURL(Title, '&action=delete'),
onSuccess: getDelete, title:Title});
}
function getDelete(xmlreq, data){
var c = data.title;
var bC = getPageContent(xmlreq, "deleteconfirm");
if(!bC) bC = getPageContent(xmlreq, "mw-img-deleteconfirm");
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");
if(!Input) Input = document.getElementById("mw-filedelete-submit");
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_wpConfirmB";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processDelete(this)}
NewInput.onselect = function(){ processDelete(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
buildPreviewBar({
"Mode" : "Delete",
"Url" : lrcGetPageURL(c),
"Page" : c,
"User1" : ""
});
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewDelete");
}
function processDelete(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
var action = Form.action;
var Page = false;
try{ Page = action.split("?title=").split("&action=delete"); }catch(e){ }
try{ Page = decodeURIComponent(Page); }catch(e){ }
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL.join("&"),
onSuccess:doneDelete,
page:Page
});
}
function doneDelete(ajaxDelete, data){
var bC = getPageContent(ajaxDelete);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
if(data.data.indexOf("&wpWatch=1")!=-1){
if(!lstSuivi) lstSuivi = "--:--";
}else{
if(lstSuivi) delete lstSuivi;
}
}
/* </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: lrcGetUglyPageURL(Title, '&action=protect'),
onSuccess: getProtect, title:Title});
}
function getProtect(xmlreq, data){
var c = data.title;
var ProtectionForm = getPageContent(xmlreq, "mw-Protect-Form");
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(this)}
NewInput.onselect = function(){ processProtect(this)}
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').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;
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(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
var action = Form.action;
var Page = false;
try{ Page = action.split("?title=").split("&action=protect"); }catch(e){ }
try{ Page = decodeURIComponent(Page); }catch(e){ }
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL.join("&"),
onSuccess:doneProtect,
page:Page
});
}
function doneProtect(ajaxProtect, data){
var bC = getPageContent(ajaxProtect);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
if(data.data.indexOf("&mwProtectWatch=1")!=-1){
if(!lstSuivi) lstSuivi = "--:--";
}else{
if(lstSuivi) delete lstSuivi;
}
}
/* </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 bC = getPageContent(xmlreq, "blockip");
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");
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_wpBlock";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processBlock(this)}
NewInput.onselect = function(){ processBlock(this)}
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(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
var user = Params;
var duration = Params;
if(Params!="") duration = Params;
var action = Form.action;
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL.join("&"),
onSuccess:doneBlock,
user:user,
duration:duration
});
}
function doneBlock(ajaxBlock, data){
var user = data.user;
var userpage = mw.config.get('wgFormattedNamespaces')+":"+user;
var usertalk = mw.config.get('wgFormattedNamespaces')+":"+user;
if(data.data.indexOf("&wpWatchUser=1")!=-1){
if(!lstSuivi) lstSuivi = "--:--";
if(!lstSuivi) lstSuivi = "--:--";
}else{
if(lstSuivi) delete lstSuivi;
if(lstSuivi) delete lstSuivi;
}
var bC = getPageContent(ajaxBlock);
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')+":"+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: lrcGetUglyPageURL(Title, '&action=edit' + (Param ? Param : "")),
onSuccess: getEdit, title:Title});
}
function getEdit(xmlreq, data){
var c = data.title;
var bC = getPageContent(xmlreq);
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);
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').innerHTML;
eval(ToolbarButtons);
mwSetupToolbar();
}catch(e){ }
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewEdit");
}
function processEdit(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
var Type = Input.id.replace(/.*_/g, "");
ParamsInURL = ParamsInURL.join("&")+"&"+Type+"=1";
var action = Form.action;
var Page = false;
try{ Page = action.split("?title=").split("&action=submit"); }catch(e){ }
try{ Page = decodeURIComponent(Page); }catch(e){ }
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL,
onSuccess:doneEdit,
type:Type,
page:Page
});
}
function doneEdit(ajaxEdit, data){
var Type = data.type;
var bC = getPageContent(ajaxEdit);
var PreviewWindow = document.getElementById("livePreview");
PreviewWindow.innerHTML = bC.innerHTML;
if(getElementWithId("editform", 'form', bC)){
modifyEditform();
if(Type=="wpDiff") getElementWithId('wikiPreview', 'div', PreviewWindow).style.display = "";
}else if(Type == "wpSave"){
PreviewWindow.className = "";
if(data.data.indexOf("&wpWatchtis=1")!=-1){
if(!lstSuivi) lstSuivi = "--:--";
}else{
if(lstSuivi) delete lstSuivi;
}
LiveRC_RunHooks("AfterPreviewArticle", data);
}
}
/* </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: lrcGetPageURL("Special:Movepage/"+ Title), onSuccess: getMove, title:Title});
}
function getMove(xmlreq, data){
var c = data.title;
var bC = getPageContent(xmlreq, "movepage");
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.name && Inputs.name == "wpMove") MoveSubmit = Inputs;
}
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(this)}
NewInput.onselect = function(){ processMove(this)}
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(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
var action = Form.action;
var OldPage = Params;
var NewPage = Params;
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL.join("&"),
onSuccess:doneMove,
oldpage:OldPage,
newpage:NewPage
});
}
function doneMove(ajaxMove, Type){
var bC = getPageContent(ajaxMove);
var PreviewWindow = document.getElementById("livePreview");
var MoveForm = getElementWithId("movepage", 'form', PreviewWindow)
if(MoveForm){
var OldTitle = document.getElementsByName("wpOldTitle").value;
getMove(ajaxMove, OldTitle);
}else{
PreviewWindow.innerHTML = bC.innerHTML;
if(data.data.indexOf("&wpWatch=1")!=-1){
if(!lstSuivi) lstSuivi = "--:--";
if(!lstSuivi) lstSuivi = "--:--";
}else{
if(lstSuivi) delete lstSuivi;
if(lstSuivi) delete lstSuivi;
}
}
}
/* </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.getElementsByTagName('a');
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){
var URLids = "";
var Histids = "";
var HistPamamids = Id;
if(typeof(Id)=='object'){
URLids = lrcGetUglyPageURL(Page, '&action=historysubmit&revisiondelete=1&diff=prev&oldid='+Id);
HistPamamids = new Array();
for(var Num in Id){
HistPamamids.push(Num+":"+Id);
URLids += "&ids + "]=1";
Histids += Id + " ";
}
HistPamamids = "{"+HistPamamids.join(",")+"}";
}else{
URLids = lrcGetUglyPageURL('Special:Revisiondelete', '&type=revision&target='+encodeURIComponent(Page)+"&");
URLids += 'ids='+Id;
Histids = Id;
}
lrcAddToHistory("liveRevisiondelete", new Array(lrcEscapeStr(Page), HistPamamids), URLids, Page + " id="+Histids);
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Revision delete : <span style='color:red'>"+Page+" id="+Histids+"</span>...</b>")
wpajax.http({ url: URLids, onSuccess: getRevisiondelete, mpage: Page});
}
function getRevisiondelete(xmlreq, data){
var c = data.mpage;
var bC = getPageContent(xmlreq);
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,
"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");
if(Input){
var NewInput = document.createElement('input');
NewInput.type = "button";
NewInput.id = "Live_Revisiondelete";
NewInput.value = Input.value + " (live)";
NewInput.onclick = function(){ processRevisiondelete(this)}
NewInput.onselect = function(){ processRevisiondelete(this)}
Input.parentNode.insertBefore(NewInput, Input);
Input.style.display = "none";
}
updatePreviewWindowAttributes();
LiveRC_RunHooks("AfterPreviewRevisiondelete");
}
function processRevisiondelete(Input){
var Form = getFormFromThisInput(Input);
var Params = getFormParams(Form);
if(!Params) return;
var Page = decodeURIComponent(Params);
var Id = Params;
var action = Form.action;
var headers = new Array();
headers = 'application/x-www-form-urlencoded';
buildBlanckPreviewBar("<b style='text-decoration: blink;'>Revision delete : <span style='color:red'>"+Page+" id="+Id+"</span>...</b>")
var ParamsInURL = new Array();
for(var P in Params){
if(typeof(Params)=="string") ParamsInURL.push(P+"="+encodeURIComponent(Params));
}
wpajax.http({ url: action,
method: "POST",
headers: headers,
data: ParamsInURL.join("&")+"&wpSubmit=1",
onSuccess:doneRevisiondelete,
mpage:Page,
mid:Id
});
}
function doneRevisiondelete(xmlreq, data){
var Page = data.mpage;
var Id = data.mid;
var bC = getPageContent(xmlreq);
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){
URLParams += "&"+ param + "=" + encodeURIComponent(params);
HistoryParams.push(param + ":" + lrcEscapeStr(""+params));
}
}
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) {
var bC = getPageContent(xmlreq);
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');
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
if(Inputs.type && Inputs.type === "submit"){
var Input = Inputs;
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').appendChild(NewFiltersContainer);
var FilterFieldset = LP.getElementsByTagName('fieldset');
if(FilterFieldset){
var FilterLegend = FilterFieldset.getElementsByTagName('legend');
NewFiltersContainer.appendChild(document.createTextNode(lrcMediawikiMessages+' : '));
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].split("$1").join(lrcMediawikiMessages);
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;
liveWhatlinkshere(page, Params);
}
/* </source> */