MediaWiki:Gadget-LiveRC.js/Extensions/InstallAndConfigLiveRCExtension.js
Apparence
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;
Firefox (sur GNU/Linux) / Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5./*
--------------------------------------------------------------------------------------
---------LLLL---------III--------------------------RRRRRRRRRR--------CCCCC------------
---------LLLL---------III--------------------------RRRRRRRRRRRR----CCCCCCCCC----------
---------LLLL--------------------------------------RRR------RRR---CCC-----CCC---------
---------LLLL---------III--VV-----VV--EEEEEEEEE----RRR------RRR--CCC------------------
---------LLLL---------III---VV---VV---EEE----------RRRRRRRRRRR---CCC------------------
---------LLLL---------III---VV---VV---EEEEEE-------RRRRRRRRRR----CCC------------------
---------LLLL---------III----VV-VV----EEEEEE-------RRR-----RRR----CCC-----CCC---------
---------LLLLLLLLLLL--III----VVVVV----EEE----------RRR------RRR----CCCCCCCCC----------
---------LLLLLLLLLLL--III-----VVV-----EEEEEEEEE----RRR-------RRR-----CCCCC------------
--------------------------------------------------------------------------------------
'''Extension de LiveRC'''
Fournit une interface de configuration lorsque l'utilisateur est présent sur la page d'installation
* Licence : ...?
* Documentation :
* Auteur : [[:fr:User:Dr Brains]]
* Développement et maintenance :
{{Catégorisation JS|LiveRC}}
<source lang=javascript> */
if(typeof(LiveRC_AddHook)=="function") { // DÉBUT IF
LiveRC_Config["InstalledLiveRCExtensions"].push("InstallAndConfigLiveRCExtension");
/* </source>
== Variables globales ==
<source lang=javascript> */
/* *************************************************************************************************************************** */
lrcTexts["CLRCE_linktext"] = "Configuration";
lrcTexts["CLRCE_linktitle"] = "Configuration locale de LiveRC ($1)";
lrcTexts["CLRCE_legend"] = "Configuration de LiveRC";
UnTranslatedTexts["CLRCE_resume"] = "Mise à jour de la configuration LiveRC locale";
lrcParamDesc['DescCLRCE_linktext'] = "Texte du lien de configuration";
lrcParamDesc['DescCLRCE_linktitle'] = "Infobulle du lien de configuration";
lrcParamDesc['DescCLRCE_legend'] = "Légende du panneau de configuration LiveRC";
lrcParamDesc['DescLiveRCConfigLegend_short'] = "Configuration LiveRC";
lrcParamDesc['DescLiveRCConfigLegend'] = "Paramètres de configuration de LiveRC";
lrcParamDesc['DescCLRCE_resume'] = "Résumé de modification mise à jour de la config LiveRC";
lrcParamDesc["DescCLRCE_SiteConfigs"] = "Configuration de l’installation";
lrcParamDesc["DescCLRCE_InstallationPage"] = "Page d’installation de LiveRC";
lrcParamDesc["DescCLRCE_SiteConfigPage"] = "Page de stockage de la configuration mediawiki locale";
lrcParamDesc["DescCLRCE_CSSPage"] = "Page de stockage du CSS local pour LiveRC";
lrcParamDesc["DescCLRCE_UserParamPage"] = "Sous-page de stockage des paramètres personnalisés";
lrcParamDesc["DescCLRCE_CustomCatTemplate"] = "Modèle pour la catégorisation des pages";
lrcParamDesc["DescCLRCE_BugzillaURL"] = "URL pour les rapports de bugs";
lrcParamDesc["DescCLRCE_ToolTags"] = "Balises pour marquer les édits faits avec des outils automatiques";
lrcParamDesc["DescCLRCE_TrackingCategories"] = "Catégories de suivi";
lrcParamDesc["DescCLRCE_PageContentIds"] = "IDs à rechercher pour le contenu d’une page";
lrcParamDesc["DescCLRCE_UserGroupList"] = "Listes d’utilisateurs locaux par groupe";
lrcParamDesc["DescCLRCE_LimitationsConfigs"] = "Configuration des limitations";
lrcParamDesc["DescCLRCE_RevertLimit"] = "Limite de versions revertables";
lrcParamDesc["DescCLRCE_LimitationsRight"] = "Droits de limitation des fonctions d’édition automatique";
lrcParamDesc["DescCLRCE_LimitationsBlacklist"] = "Liste des utilisateurs interdits d’édition automatique";
lrcParamDesc["DescCLRCE_FlaggedRevsConfigs"] = "Configuration de l’extension FlaggedRevs";
lrcParamDesc["DescCLRCE_FlagRevProtection"] = "Stabilisation intégrée à l’outil de protection";
lrcParamDesc["DescCLRCE_FlagRevNamespaces"] = "Liste des namespaces où la validation est active";
lrcParamDesc["DescCLRCE_FlowConfigs"] = "Configuration de l’extension Flow";
lrcParamDesc["DescCLRCE_FlowOccupyPages"] = "Liste des pages où flow est actif";
lrcParamDesc["DescCLRCE_FlowOccupyNamespaces"] = "Liste des namespaces où flow est actif";
lrcParamDesc["DescCLRCE_FlowCoreActionWhitelist"] = "Actions permises sur les pages où flow est actif";
LiveRC_Config["ExternalConfigs"] = ["InstallationPage","CSSPage","SiteConfigPage","UserParamPage"];
/* *************************************************************************************************************************** */
/* </source>
== Fonctions utilitaires ==
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_UserCanEdit = function(Page){
var Right = LiveRC_ConfigLiveRCExtension_InstallationPageNeededRight(Page);
if(!Right) return true;
else return lrcUserHasRight(Right);
}
window.LiveRC_ConfigLiveRCExtension_InstallationPageNeededRight = function(Page){
Page = Page.replace(/_/g, " ");
var ns = getNamespaceInfoFromPage(Page);
var title = getNamespaceInfoFromPage(Page, "PageName");
if(ns==8) return "editinterface";
if(ns==2 && Page.match(/\.js$/)!=null){
if(title.indexOf(mw.config.get('wgUserName')) === 0) return false;
else return "edituserjs";
}
return false
}
/* </source>
== Lancement ==
=== Divers ===
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_AddNeededRightToExtension = function(){
var Right = LiveRC_ConfigLiveRCExtension_InstallationPageNeededRight(LiveRC_Config["InstallationPage"]);
if(!Right) Right = '';
for(var a=0,l=lrcExtensions.length;a<l;a++){
var Ext = lrcExtensions[a];
if(Ext["name"] != "InstallAndConfigLiveRCExtension") continue;
lrcExtensions[a]["neededright"] = Right;
}
for(var a=0,l=Custom_lrcExtensions.length;a<l;a++){
var Ext = Custom_lrcExtensions[a];
if(Ext["name"] != "InstallAndConfigLiveRCExtension") continue;
Custom_lrcExtensions[a]["neededright"] = Right;
}
}
window.LiveRC_ConfigLiveRCExtension_GetOldLocalCSS = function(){
lrcDisplayDebug("Get LiveRC personal styles");
var URL = lrcGetAPIURL('format=xml&action=query&prop=revisions&rvlimit=1&rvprop=ids')
+ '&titles='+encodeURIComponent(LiveRC_Config["CSSPage"])
wpajax.http({url: URL,
onSuccess: LiveRC_ConfigLiveRCExtension_GetOldLocalCSSOldid
});
}
window.LiveRC_ConfigLiveRCExtension_GetOldLocalCSSOldid = function(RequeteOldid){
var ObjetXML = RequeteOldid.responseXML;
if (ObjetXML){
var LastRevision = ObjetXML.getElementsByTagName('rev')[0];
if (LastRevision){
var Oldid = LastRevision.getAttribute('revid');
var URL = lrcGetUglyPageURL(LiveRC_Config["CSSPage"],'&action=raw&oldid='+Oldid);
wpajax.http({url:URL, onSuccess:LiveRC_ManageParams_GetOldCSS });
}
}
}
/* </source>
== Ajout lien au menu de gauche ==
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_AddLink = function(){
if(!LiveRC_ConfigLiveRCExtension_UserCanEdit(LiveRC_Config["InstallationPage"])) return;
var LRClink = document.getElementById("n-liveRC");
if(!LRClink) return;
var UL = LRClink.getElementsByTagName('ul')[0];
if(!UL){
UL = document.createElement('ul');
LRClink.appendChild(UL);
}
lrcDisplayDebug('Add Config link in tools panel');
var ConfigLi = document.createElement('li');
ConfigLi.id = 'n-liveRC-sitecustom';
UL.insertBefore(ConfigLi, UL.firstChild);
var Link = document.createElement('a');
Link.innerHTML = lrcMakeText("CLRCE_linktext");
Link.title = lrcMakeText("CLRCE_linktitle").split('$1').join(LiveRC_Config["InstallationPage"]);
Link.href = lrcGetPageURL(LiveRC_Config["InstallationPage"]);
ConfigLi.appendChild(Link);
}
/* </source>
== Menu ==
=== Ouverture du menu ===
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_ByPassMissingExtensions = function(){
LiveRC_Config["ByPassMissingExtensions"] = true;
var Alert = document.getElementById("LiveRCAlert");
if(Alert) Alert.parentNode.removeChild(Alert);
setTimeout("LiveRC_ConfigLiveRCExtension_BuildForm();", 50)
}
window.LiveRC_ConfigLiveRCExtension_BuildForm = function(Again){
var Target = $('pre.source-javascript')[0];
if(!Target) Target = document.getElementById("mw-content-text").firstChild;
if(!Target) return;
var MissingExtension = [];
for(var a=0,l=lrcExtensions.length;a<l;a++){
var ExtName = lrcExtensions[a].name;
if(LiveRC_Config["InstalledLiveRCExtensions"].indexOf(ExtName)===-1 && ExtName != "InserisciTemplate"){
MissingExtension.push(ExtName);
mw.loader.load(lrcExtensions[a].url + '&action=raw&ctype=text/javascript');
}
}
var Length = MissingExtension.length;
if(Length>0 && LiveRC_Config["ByPassMissingExtensions"] !== true){
var ByPassLink = '<a href="javascript:LiveRC_ConfigLiveRCExtension_ByPassMissingExtensions();" '
+ '>[bypass]</a>';
if(Again) LiveRC_alert("Missing extension"+(Length>1 ?"s" : "")+" : "+ByPassLink+"<ul><li>"+MissingExtension.join("</li><li>")+"</li></ul>")
LiveRC_Config["Timeout"]["ExtensionsLoaded"] = setTimeout("LiveRC_ConfigLiveRCExtension_BuildForm(true);", (Again ? 5000 : 500 ));
return;
}else{
clearTimeout(LiveRC_Config["Timeout"]["ExtensionsLoaded"]);
}
var clearyourcache = document.getElementById("mw-clearyourcache");
if(clearyourcache) clearyourcache.style.display = "none";
var Fieldset = document.createElement('fieldset');
var Legend = document.createElement('legend');
Fieldset.id = "ConfigLiveRCExtension_Menu";
Fieldset.appendChild(Legend);
Legend.appendChild(document.createTextNode(lrcMakeText("CLRCE_legend")));
Target.parentNode.insertBefore(Fieldset, Target);
var FormDiv = document.createElement('div');
FormDiv.id = "OutFixedBottomPanel";
Fieldset.appendChild(FormDiv);
FormDiv.style.position = "static";
LiveRC_AddHook("AfterCreateParamPanel", LiveRC_ConfigLiveRCExtension_DeleteTabs);
LiveRC_AddHook("AfterCreateParamPanel", LiveRC_ConfigLiveRCExtension_AddConfigTab);
LiveRC_ManageParams_OpenMenu(true);
var MenuTitle = document.getElementById("LiveRC_ParamMenuAnchor");
if(MenuTitle) MenuTitle.parentNode.removeChild(MenuTitle);
var LRCConfigSaveButton = document.getElementById("LiveRC_OptionsContentInput_LiveRCConfigLegend");
if(LRCConfigSaveButton) LRCConfigSaveButton.style.marginLeft = "0.5em";
LiveRC_ConfigLiveRCExtension_EditActionButtons();
LiveRC_ConfigLiveRCExtension_EditCSSActionButtons();
LiveRC_ConfigLiveRCExtension_ShowToggleButtons();
LiveRC_ConfigLiveRCExtension_PopulateConfigTab();
var ResizeZone = document.createElement('div');
ResizeZone.id = "CLRCE_ParamMenuAnchor";
ResizeZone.innerHTML = " "
FormDiv.appendChild(ResizeZone);
LiveRC_SetVerticalResizeZone(document.getElementById("CLRCE_ParamMenuAnchor"),
lrcGetElementsByClass("LiveRC_ParamMenuPart",document.getElementById("LiveRC_ParamMenu"),"div"),
document.getElementById("LiveRC_ParamMenu"), true
);
$(document.body).addClass("InstallAndConfigLiveRCExtensionLaunched");
mw.loader.addStyleTag(".InstallAndConfigLiveRCExtensionLaunched #LiveRC_ParamMenuContent { border:none !important; }");
LiveRC_LaunchProcessNextStep();
}
/* </source>
=== Modifications du menu ===
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_DeleteTabs = function(){
var TabsToDelete = ["lrcTranslatedTexts", "lrcTranslatedParamDesc", "ContactListLegend", "HiddenPagesListLegend", "HiddenListLegend", "ExtensionsLegend"];
if(!LiveRC_ConfigLiveRCExtension_UserCanEdit(LiveRC_Config["CSSPage"])) TabsToDelete.push("lrcCSSstyles");
for(var a=0,l=TabsToDelete.length;a<l;a++){
var TabName = "LiveRC_OptionsContent_"+TabsToDelete[a];
var Tab = document.getElementById(TabName);
if(Tab) Tab.parentNode.removeChild(Tab);
}
}
window.LiveRC_ConfigLiveRCExtension_EditActionButtons = function(){
var AllActionButtons = lrcGetElementsByClass("ActionButtons",document.getElementById("LiveRC_ParamMenuForm"),"p");
for(var a=0,l=AllActionButtons.length;a<l;a++){
var ActionButtons = AllActionButtons[a];
while(ActionButtons.firstChild) { ActionButtons.removeChild(ActionButtons.firstChild); }
var OKInput = document.createElement('input');
OKInput.type = "button";
OKInput.value = lrcMakeText("OK");
OKInput.onclick = function(){ LiveRC_ConfigLiveRCExtension_CheckMenu(this); return false;}
OKInput.onselect = function(){ LiveRC_ConfigLiveRCExtension_CheckMenu(this); return false;}
ActionButtons.appendChild(OKInput);
var RAZInput = document.createElement('input');
RAZInput.type = "button";
RAZInput.value = lrcMakeText("RAZ");
RAZInput.onclick = function(){ LiveRC_ConfigLiveRCExtension_RAZParams(this); return false;}
RAZInput.onselect = function(){ LiveRC_ConfigLiveRCExtension_RAZParams(this); return false;}
ActionButtons.appendChild(RAZInput);
}
}
window.LiveRC_ConfigLiveRCExtension_EditCSSActionButtons = function(){
var Fieldset = document.getElementById("LiveRC_OptionsContent_lrcCSSstyles");
if(!Fieldset) return;
var ActionButtons = lrcGetElementsByClass("ActionButtons",Fieldset,"p")[0];
if(!ActionButtons) return
while(ActionButtons.firstChild) { ActionButtons.removeChild(ActionButtons.firstChild); }
var OKInput = document.createElement('input');
OKInput.type = "button";
OKInput.value = lrcMakeText("OK")+" .";
OKInput.onclick = function(){ LiveRC_ConfigLiveRCExtension_CheckCSSMenu(this); return false;}
OKInput.onselect = function(){ LiveRC_ConfigLiveRCExtension_CheckCSSMenu(this); return false;}
ActionButtons.appendChild(OKInput);
var RAZInput = document.createElement('input');
RAZInput.type = "button";
RAZInput.value = lrcMakeText("RAZ")+" .";
RAZInput.onclick = function(){ LiveRC_ConfigLiveRCExtension_RAZCSSParams(this); return false;}
RAZInput.onselect = function(){ LiveRC_ConfigLiveRCExtension_RAZCSSParams(this); return false;}
ActionButtons.appendChild(RAZInput);
}
window.LiveRC_ConfigLiveRCExtension_ShowToggleButtons = function(){
var ToggleBar = document.getElementById("ToggleButtons");
var Buttons = ToggleBar.getElementsByTagName("input");
for(var a=0,l=Buttons.length;a<l;a++){
var Button = Buttons[a];
if(Button.style.display = "none") Buttons[a].style.display = "";
}
}
/* </source>
=== Onglet "Configuration LiveRC" ===
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_AddConfigTab = function(){
var ConfigUl = LiveRC_ManageParams_CreateNewListMenu("LiveRCConfigLegend", LiveRC_ManageParams_CreateActionButtons());
}
window.LiveRC_ConfigLiveRCExtension_PopulateConfigTab = function(){
var ConfigFieldset = document.getElementById("LiveRC_OptionsContent_LiveRCConfigLegend");
if(!ConfigFieldset) return;
var ConfigUl = ConfigFieldset.getElementsByTagName('ul')[0];
if(!ConfigUl) return;
for(var ParamName in LiveRC_Config["InstallationParamFunctions"]){
var fieldset = document.createElement('fieldset');
fieldset.id = "LiveRCConfig_"+ParamName;
var legend = document.createElement('legend');
legend.innerHTML = lrcMakeParamDescription("CLRCE_"+ParamName);
fieldset.appendChild(legend);
var UL = document.createElement('ul');
fieldset.appendChild(UL);
LiveRC_Config["InstallationParamFunctions"][ParamName](UL);
ConfigUl.parentNode.appendChild(fieldset);
}
ConfigUl.parentNode.removeChild(ConfigUl);
LiveRC_ConfigLiveRCExtension_CustomConfigTab();
}
window.LiveRC_ConfigLiveRCExtension_CustomConfigTab = function(){
var ToolTagsFieldset = document.getElementById("LiveRCConfig_ToolTags");
if(ToolTagsFieldset){
var Inputs = ToolTagsFieldset.getElementsByTagName('input');
for(var i=0,ilen=Inputs.length;i<ilen;i++){
var Input = Inputs[i];
if(Input.name && Input.name == "toolname" && Input.value == "LiveRC") Input.disabled = "disabled";
}
}
}
LiveRC_Config["InstallationParamFunctions"] = {
"SiteConfigs" : function(UL){
var LiParams = [
{
"Desc" : lrcMakeParamDescription("CLRCE_InstallationPage"),
"Name" : "InstallationPage",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["InstallationPage"],
"DefaultValue" : LiveRC_Config["InstallationPage"]
},
{
"Desc" : lrcMakeParamDescription("CLRCE_SiteConfigPage"),
"Name" : "SiteConfigPage",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["SiteConfigPage"],
"DefaultValue" : LiveRC_Config["SiteConfigPage"]
},
{
"Desc" : lrcMakeParamDescription("CLRCE_CSSPage"),
"Name" : "CSSPage",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["CSSPage"],
"DefaultValue" : LiveRC_Config["CSSPage"]
},
{
"Desc" : lrcMakeParamDescription("CLRCE_UserParamPage"),
"Name" : "UserParamPage",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["UserParamPage"],
"DefaultValue" : LiveRC_Config["UserParamPage"]
},
{
"Desc" : lrcMakeParamDescription("CLRCE_CustomCatTemplate"),
"Name" : "CustomCatTemplate",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["CustomCatTemplate"],
"DefaultValue" : LiveRC_Config["CustomCatTemplate"]
},
{
"Desc" : lrcMakeParamDescription("CLRCE_BugzillaURL"),
"Name" : "BugzillaURL",
"ValueType" : "string",
"AddButton" : false,
"OldValue" : LiveRC_Config["BugzillaURL"],
"DefaultValue" : LiveRC_Config["BugzillaURL"]
}
];
for(var a=0,l=LiParams.length;a<l;a++){
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams[a]);
Li = LiveRC_ConfigLiveRCExtension_DisableSomeLines(Li, LiParams[a]);
UL.appendChild(Li);
}
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var TrackingCategoriesUl = document.createElement('ul');
UL.parentNode.appendChild(TrackingCategoriesUl);
var Values = [];
var TrackingCategories = LiveRC_Config["TrackingCategories"];
var desc = lrcMakeParamDescription("CLRCE_TrackingCategories");
for(var a=0,l=TrackingCategories.length;a<l;a++){ Values[a]= {}; Values[a][desc] = TrackingCategories[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_TrackingCategories"),
"Name" : "TrackingCategories",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams);
TrackingCategoriesUl.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_TrackingCategories"))+":'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("TrackingCategories")+', '+Types+');'
P.innerHTML = '<a id="AddParam_TrackingCategories" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
TrackingCategoriesUl.appendChild(P);
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var PageContentIdsUl = document.createElement('ul');
UL.parentNode.appendChild(PageContentIdsUl);
var Values = [];
var PageContentIds = LiveRC_Config["PageContentIds"];
var desc = lrcMakeParamDescription("CLRCE_PageContentIds");
for(var a=0,l=PageContentIds.length;a<l;a++){ Values[a]= {}; Values[a][desc] = PageContentIds[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_PageContentIds"),
"Name" : "PageContentIds",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams);
PageContentIdsUl.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_PageContentIds"))+":'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("PageContentIds")+', '+Types+');'
P.innerHTML = '<a id="AddParam_PageContentIds" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
PageContentIdsUl.appendChild(P);
},
"ToolTags" : function(UL){
var ToolTags = LiveRC_Config["ToolTags"];
for(var toolname in ToolTags){
var groupvalue = {toolname:toolname, tagname:ToolTags[toolname]};
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_ToolTags"),
"Name" : "ToolTags",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : groupvalue,
"DefaultValue" : groupvalue
};
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
UL.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{'toolname':'string','tagname':'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("ToolTags")+', '+Types+');'
P.innerHTML = '<a id="AddParam_ToolTags" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
UL.appendChild(P);
},
"UserGroupList" : function(UL){
var Groups = LiveRC_Config["UserGroupList"];
for(var group in Groups){
var groupvalue = {group:group,show:Groups[group].show};
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_UserGroupList"),
"Name" : "UserGroupList",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : groupvalue,
"DefaultValue" : groupvalue
};
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
UL.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{'group':'string','show':'boolean'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("UserGroupList")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_UserGroupList" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
UL.appendChild(P);
},
"LimitationsConfigs" : function(UL){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_RevertLimit"),
"Name" : "RevertLimit",
"ValueType" : "number",
"AddButton" : false,
"OldValue" : LiveRC_Config["RevertLimit"],
"DefaultValue" : LiveRC_Config["RevertLimit"]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams);
UL.appendChild(Li);
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var LimitationsRightUl = document.createElement('ul');
UL.parentNode.appendChild(LimitationsRightUl);
var LimitationsRight = LiveRC_Config["LimitationsRight"];
var Values = [];
for(var feature in LimitationsRight){ Values.push({feature:feature, limitationright:LimitationsRight[feature] }); }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_LimitationsRight"),
"Name" : "LimitationsRight",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams);
LimitationsRightUl.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{'feature':'string','limitationright':'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("LimitationsRight")+', '+Types+');'
P.innerHTML = '<a id="AddParam_LimitationsRight" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
LimitationsRightUl.appendChild(P);
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var LimitationsBlacklistUl = document.createElement('ul');
UL.parentNode.appendChild(LimitationsBlacklistUl);
var Values = [];
var LimitationsBlacklist = LiveRC_Config["LimitationsBlacklist"];
var desc = lrcMakeParamDescription("CLRCE_LimitationsBlacklist");
for(var a=0,l=LimitationsBlacklist.length;a<l;a++){ Values[a]= {}; Values[a][desc] = LimitationsBlacklist[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_LimitationsBlacklist"),
"Name" : "LimitationsBlacklist",
"ValueType" : "object",
"AddButton" : true,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
LimitationsBlacklistUl.appendChild(Li);
}
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_LimitationsBlacklist"))+":'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("LimitationsBlacklist")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_LimitationsBlacklist" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
LimitationsBlacklistUl.appendChild(P);
},
"FlaggedRevsConfigs" : function(UL){
var AlreadySetOnce = (typeof(LiveRC_getSiteConfig)==="function");
var FlaggedRevsExtensionNotInstalled = (AlreadySetOnce && !lrcIsExtensionInstalled("Flagged Revisions"));
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_FlagRevProtection"),
"Name" : "FlagRevProtection",
"ValueType" : "boolean",
"AddButton" : false,
"OldValue" : LiveRC_Config["FlagRevProtection"],
"DefaultValue" : LiveRC_Config["FlagRevProtection"]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams);
UL.appendChild(Li);
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var FlagRevNamespacesUl = document.createElement('ul');
UL.parentNode.appendChild(FlagRevNamespacesUl);
var Values = [];
var FlagRevNamespaces = LiveRC_Config["FlagRevNamespaces"];
var desc = lrcMakeParamDescription("CLRCE_FlagRevNamespaces");
for(var a=0,l=FlagRevNamespaces.length;a<l;a++){ Values[a]= {}; Values[a][desc] = FlagRevNamespaces[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_FlagRevNamespaces"),
"Name" : "FlagRevNamespaces",
"ValueType" : "object",
"AddButton" : !FlaggedRevsExtensionNotInstalled,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
FlagRevNamespacesUl.appendChild(Li);
}
if(!FlaggedRevsExtensionNotInstalled){
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_FlagRevNamespaces"))+":'number'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("FlagRevNamespaces")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_FlagRevNamespaces" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
FlagRevNamespacesUl.appendChild(P);
}else{
UL.parentNode.disabled = "disabled";
UL.parentNode.style.display = "none";
}
},
"FlowConfigs" : function(UL){
var AlreadySetOnce = (typeof(LiveRC_getSiteConfig)==="function");
var FlowExtensionNotInstalled = (AlreadySetOnce && !lrcIsExtensionInstalled("Flow"));
var Values = [];
var FlowOccupyPages = LiveRC_Config["FlowOccupyPages"];
var desc = lrcMakeParamDescription("CLRCE_FlowOccupyPages");
for(var a=0,l=FlowOccupyPages.length;a<l;a++){ Values[a]= {}; Values[a][desc] = FlowOccupyPages[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_FlowOccupyPages"),
"Name" : "FlowOccupyPages",
"ValueType" : "object",
"AddButton" : !FlowExtensionNotInstalled,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
UL.appendChild(Li);
}
if(!FlowExtensionNotInstalled){
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_FlowOccupyPages"))+":'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("FlowOccupyPages")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_FlowOccupyPages" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
UL.appendChild(P);
}
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var FlowOccupyNamespacesUl = document.createElement('ul');
UL.parentNode.appendChild(FlowOccupyNamespacesUl);
var Values = [];
var FlowOccupyNamespaces = LiveRC_Config["FlowOccupyNamespaces"];
var desc = lrcMakeParamDescription("CLRCE_FlowOccupyNamespaces");
for(var a=0,l=FlowOccupyNamespaces.length;a<l;a++){ Values[a]= {}; Values[a][desc] = FlowOccupyNamespaces[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_FlowOccupyNamespaces"),
"Name" : "FlowOccupyNamespaces",
"ValueType" : "object",
"AddButton" : !FlowExtensionNotInstalled,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
FlowOccupyNamespacesUl.appendChild(Li);
}
if(!FlowExtensionNotInstalled){
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_FlowOccupyNamespaces"))+":'number'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("FlowOccupyNamespaces")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_FlowOccupyNamespaces" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
FlowOccupyNamespacesUl.appendChild(P);
}
var Sep = document.createElement('hr');
Sep.style.margin = "1em";
UL.parentNode.appendChild(Sep);
var FlowCoreActionWhitelistUl = document.createElement('ul');
UL.parentNode.appendChild(FlowCoreActionWhitelistUl);
var Values = [];
var FlowCoreActionWhitelist = LiveRC_Config["FlowCoreActionWhitelist"];
var desc = lrcMakeParamDescription("CLRCE_FlowCoreActionWhitelist");
for(var a=0,l=FlowCoreActionWhitelist.length;a<l;a++){ Values[a]= {}; Values[a][desc] = FlowCoreActionWhitelist[a]; }
for(var a=0,l=Values.length;a<l;a++){
var LiParams = {
"Desc" : lrcMakeParamDescription("CLRCE_FlowCoreActionWhitelist"),
"Name" : "FlowCoreActionWhitelist",
"ValueType" : "object",
"AddButton" : !FlowExtensionNotInstalled,
"OldValue" : Values[a],
"DefaultValue" : Values[a]
}
var Li = LiveRC_ManageParams_CreateLiFromParam(LiParams, false);
FlowCoreActionWhitelistUl.appendChild(Li);
}
if(!FlowExtensionNotInstalled){
var P = document.createElement('li');
var Types = "{"+lrcEscapeStr(lrcMakeParamDescription("CLRCE_FlowCoreActionWhitelist"))+":'string'}";
var func = 'LiveRC_ManageParams_AddNewParam('+lrcEscapeStr("FlowCoreActionWhitelist")+', '+Types+', false);'
P.innerHTML = '<a id="AddParam_FlowCoreActionWhitelist" title="'+lrcMakeText("AddParamLineButton_Title")+'" href="javascript:'+func+'" >'+lrcMakeText("AddParamLineButton_Text")+'</a>';
FlowCoreActionWhitelistUl.appendChild(P);
}else{
UL.parentNode.disabled = "disabled";
UL.parentNode.style.display = "none";
}
}
};
window.LiveRC_ConfigLiveRCExtension_DisableSomeLines = function(Li, Param){
if(mw.config.get('wgServer')==='//fr.wikipedia.org'){
if(LiveRC_Config["ExternalConfigs"].indexOf(Param["Name"])!==-1){
var Inputs = Li.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){ Inputs[a].disabled = "disabled"; }
var Selects = Li.getElementsByTagName('select');
for(var a=0,l=Selects.length;a<l;a++){ Selects[a].disabled = "disabled"; }
Li.style.display = "none";
}
}
return Li;
}
/* </source>
== Sauvegarde de la configuration ==
<source lang=javascript> */
window.LiveRC_ConfigLiveRCExtension_CheckMenu = function(Input){
var Menu = document.getElementById("LiveRC_ParamMenu");
if(!Menu) return;
lrcDisableLink(Input);
// Populate variables
var FieldSets = Menu.getElementsByTagName('fieldset');
for(var b=0,m=FieldSets.length;b<m;b++){
var ArrayName = FieldSets[b].id.split("LiveRC_OptionsContent_").join("");
if(!LiveRC_Config["LiveRCcustomParams"][ArrayName]) continue;
var AddButton = LiveRC_Config["LiveRCcustomParams"][ArrayName]["AddButton"];
var Lis = FieldSets[b].getElementsByTagName('li');
for(var a=0,l=Lis.length;a<l;a++){
var ThisLi = Lis[a];
if(!lrcHasClass(ThisLi, "RealParamMenuLi")) continue;
var Inputs = [];
Inputs.push(ThisLi.getElementsByTagName('input')[0]);
var ElementSpans = lrcGetElementsByClass("ParamMenuLiElement", ThisLi, "span");
for(var y=0,z=ElementSpans.length;y<z;y++){
var ElementSpan = ElementSpans[y];
var InputList = ElementSpan.getElementsByTagName('input');
var SelectList = ElementSpan.getElementsByTagName('select');
for(var S=0,Slen=InputList.length;S<Slen;S++){ Inputs.push(InputList[S]); }
for(var S=0,Slen=SelectList.length;S<Slen;S++){ Inputs.push(SelectList[S]); }
}
if(Inputs.length<2) continue;
var LiParamName = Inputs[0].value;
var Type = LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["ValueType"];
if(Type=="object"){ // ------------------------- object
if(typeof(LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName])=='undefined'){
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName] = [];
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["ValueType"] = "object";
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["AddButton"] = true;
}
var NewValue = [];
for(var i=1,il=Inputs.length;i<il;i++){
var Input = Inputs[i];
var iName = Input.name;
var iValue;
if(Input.type && Input.type=="checkbox"){
iValue = Input.checked;
}else{
iValue = Input.value;
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_number")) iValue = parseInt(iValue);
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_regexp")){
iValue = iValue.replace(/^\//, "").replace(/\/(\D)?$/, "");
iValue = new RegExp(iValue);
}
}
NewValue[iName] = iValue;
}
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["NewValue"] = NewValue;
}else{ // ------------------------- boolean, number, text
var Input = Inputs[1];
if(!Input) continue;
var InputType = Input.type;
var InputId = Input.id;
if(typeof(LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName])=='undefined'){
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName] = [];
}
if(InputType && InputType=="checkbox"){
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["NewValue"] = Input.checked;
}else{
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_string")) LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["NewValue"] = Input.value;
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_number")) LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["NewValue"] = parseInt(Input.value);
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_regexp")){
var iValue = Input.value.replace(/^\//, "").replace(/\/(\D)?$/, "");
LiveRC_Config["LiveRCcustomParams"][ArrayName][LiParamName]["NewValue"] = new RegExp(iValue);
}
}
}
}
}
// Create Wikitext
var NoSavedParams = ["lrcTranslatedTexts","lrcTranslatedParamDesc", "lrcExtensions"];
var ParamPage = "";
var Variables = "window.LiveRC_getSiteCustom = function(){\n lrcDisplayDebug('getSiteCustom');\n\n";
for(var ArrayName in LiveRC_Config["LiveRCcustomParams"]){
if(NoSavedParams.indexOf(ArrayName)!==-1) continue;
var ThisArray = LiveRC_Config["LiveRCcustomParams"][ArrayName];
if(["string","number","boolean","object","regexp"].indexOf(Realtypeof(ThisArray))==-1) continue;
var ParamStyle = "normal";
var ThisVariableText = "";
var Desc = lrcMakeParamDescription(ArrayName);
var ThisVariableValues = [];
var addbutton = false;
for(var LiParamName in ThisArray){
var ParamLine = ThisArray[LiParamName];
if(["string","number","boolean","object","regexp"].indexOf(Realtypeof(ParamLine))==-1) continue;
var ValueType = ParamLine["ValueType"];
var DefaultValue = ParamLine["DefaultValue"];
var OldValue = ParamLine["OldValue"];
var NewValue = ParamLine["NewValue"];
var strNewValue = lrcEscapeStrHTML(NewValue);
var AddButton = ParamLine["AddButton"];
var AddCustomFunction = ParamLine["AddCustomFunction"];
var linecustom = true;
if(ValueType=="object" && AddButton){
addbutton = true;
if(Realtypeof(NewValue)=="undefined") continue;
var ThisLineValues = [];
for(var valuename in NewValue){
var newvaluevalue = NewValue[valuename];
var newvaluetype = Realtypeof(newvaluevalue);
if(["string","number","boolean","regexp"].indexOf(newvaluetype)==-1) continue;
if(newvaluetype=="regexp") newvaluevalue = newvaluevalue.toString();
if(newvaluetype=="string") newvaluevalue = lrcEscapeStrHTML(newvaluevalue);
if(newvaluetype=="boolean") newvaluevalue = (newvaluevalue ? "true" : "false");
if(typeof(NewValue[valuename])!= "undefined"){
if(valuename.indexOf("desc-")!=-1) valuename = "desc";
ThisLineValues.push(lrcEscapeStrHTML(valuename)+" : "+newvaluevalue);
}
}
if(ThisLineValues.length>0) ThisVariableValues.push(" { " + ThisLineValues.join(" , ") + " }");
}else if(ValueType=="object"){
var ThisLineValues = [];
for(var valuename in NewValue){
var newvaluevalue = NewValue[valuename];
var newvaluetype = Realtypeof(newvaluevalue);
if(["string","number","boolean","regexp"].indexOf(newvaluetype)==-1) continue;
if(newvaluetype=="regexp") newvaluevalue = newvaluevalue.toString();
if(newvaluetype=="string") newvaluevalue = lrcEscapeStrHTML(newvaluevalue);
if(newvaluetype=="boolean") newvaluevalue = (newvaluevalue ? "true" : "false");
if(valuename.indexOf("desc-")!=-1) valuename = "desc";
ThisLineValues.push(lrcEscapeStrHTML(valuename)+" : "+newvaluevalue);
}
var ValuesLine = "{ " + ThisLineValues.join(" , ") + " }";
ThisVariableValues.push(" lrcSetConfigSetting(\""+ArrayName+"\",\""+LiParamName+"\", " + ValuesLine + ");\n");
}else if(ValueType=="regexp"){
ThisVariableValues.push(" lrcSetConfigSetting(\""+ArrayName+"\",\""+LiParamName+"\", "+NewValue.toString()+" );\n");
}else if(ValueType=="string"){
ThisVariableValues.push(" lrcSetConfigSetting(\""+ArrayName+"\",\""+LiParamName+"\", "+strNewValue+");\n");
}else if(ValueType=="number"){
ThisVariableValues.push(" lrcSetConfigSetting(\""+ArrayName+"\",\""+LiParamName+"\", " + NewValue + ");\n"); /* TODO */
}else if(ValueType=="boolean"){
ThisVariableValues.push(" lrcSetConfigSetting(\""+ArrayName+"\",\""+LiParamName+"\", "+(NewValue ? "true":"false")+");\n"); /* TODO */
}
}
if(addbutton){
ThisVariableText = " lrcSetConfigSetting(\""+ArrayName+"\", false, [\n" + ThisVariableValues.join(",\n") + "\n ]);\n"; /* TODO */
}else if(!addbutton && ThisVariableValues.length>0){
ThisVariableText = ThisVariableValues.join("");
}
if(ThisVariableText!==""){
ThisVariableText = " try{\n" + ThisVariableText + " }catch(e){ }\n\n";
Variables += "\n // -- "+ Desc +" --\n\n" + ThisVariableText;
}
}
var NewExtensionsArray = LiveRC_Config["LiveRCcustomParams"]["lrcExtensions"];
var OldExtensionsArray = LiveRC_Config["OldExtensions"];
if(["string","number","boolean","object","regexp"].indexOf(Realtypeof(NewExtensionsArray))!=-1){
var ExtensionText = "";
for(var a=0,l=OldExtensionsArray.length;a<l;a++){
var OldExtName = OldExtensionsArray[a];
var found = false;
for(var b=0,m=NewExtensionsArray.length;b<m;b++){
var NewExt = NewExtensionsArray[b]["NewValue"];
if(NewExt && NewExt["name"] == OldExtName) found = true;
}
if(!found) ExtensionText += ' LiveRC_DeleteExtension(' + lrcEscapeStrHTML(OldExtName) + ');\n';
}
for(var a=0,l=NewExtensionsArray.length;a<l;a++){
var NewExt = NewExtensionsArray[a]["NewValue"];
var NewExtName = NewExt["name"];
var found = (OldExtensionsArray.indexOf(NewExtName)!==-1);
if(!found){
var Desc = ( NewExt["desc"] ? NewExt["desc"] : ( NewExt[("desc-"+lrcMakeParam("Language"))] ? NewExt[("desc-"+lrcMakeParam("Language"))] : "") );
ExtensionText += ' LiveRC_AddNewExtension({\n'
+ ' "name" : '+ lrcEscapeStrHTML(NewExtName) + ',\n'
+ ' "url" : '+ lrcEscapeStrHTML(NewExt["url"]) + ',\n'
+ ' "neededright" : '+ lrcEscapeStrHTML(NewExt["neededright"]) + ',\n'
+ ' "desc" : '+ lrcEscapeStrHTML(Desc) + '\n'
+ ' });\n';
};
}
if(ExtensionText!==""){
ExtensionText = " try{\n" + ExtensionText + " }catch(e){ }\n\n";
Variables += "\n // -- "+ lrcMakeParamDescription("lrcExtensions") +" --\n\n" + ExtensionText;
}
}
var LiveRCConfigTextOut = "";
var LiveRCConfigTextPost = "";
var ConfigFieldset = document.getElementById("LiveRC_OptionsContent_LiveRCConfigLegend");
if(ConfigFieldset){
var Configs = {};
var Fieldsets = ConfigFieldset.getElementsByTagName('fieldset');
for(var a=0,l=Fieldsets.length;a<l;a++){
var ThisFieldset = Fieldsets[a];
if(ThisFieldset.style.display == "none") continue;
var Lis = ThisFieldset.getElementsByTagName('li');
for(var b=0,m=Lis.length;b<m;b++){
var ThisLi = Lis[b];
var ConfigID = ThisLi.id.split("LI_").join("");
var Inputs = [];
Inputs.push(ThisLi.getElementsByTagName('input')[0]);
var ElementSpans = lrcGetElementsByClass("ParamMenuLiElement", ThisLi, "span");
for(var y=0,z=ElementSpans.length;y<z;y++){
var ElementSpan = ElementSpans[y];
var InputList = ElementSpan.getElementsByTagName('input');
var SelectList = ElementSpan.getElementsByTagName('select');
for(var S=0,Slen=InputList.length;S<Slen;S++){ Inputs.push(InputList[S]); }
for(var S=0,Slen=SelectList.length;S<Slen;S++){ Inputs.push(SelectList[S]); }
}
if(Inputs.length<2) continue;
switch(ConfigID){
case 'InstallationPage':
case 'SiteConfigPage':
case 'CSSPage':
case 'UserParamPage':
case 'CustomCatTemplate':
case 'BugzillaURL':
case 'RevertLimit':
case 'FlagRevProtection':
var Input = Inputs[1];
if(!Input) continue;
var InputType = Input.type;
var Value = Input.value;
if(InputType && InputType=="checkbox"){
Value = Input.checked;
}else{
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_string")) Value = Value;
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_number")) Value = parseInt(Value);
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_regexp")){
Value = Value.replace(/^\//, "").replace(/\/(\D)?$/, "");
Value = new RegExp(Value);
}
}
Configs[ConfigID] = Value;
break;
case 'PageContentIds':
case 'TrackingCategories':
case 'LimitationsBlacklist':
case 'FlowOccupyPages':
case 'FlowOccupyNamespaces':
case 'FlowCoreActionWhitelist':
if(!Configs[ConfigID]) Configs[ConfigID] = [];
var Input = Inputs[1];
if(!Input) continue;
var InputType = Input.type;
var Value = Input.value;
if(InputType && InputType=="checkbox"){
Value = Input.checked;
}else{
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_string")) Value = Value;
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_number")) Value = parseInt(Value);
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_regexp")){
Value = Value.replace(/^\//, "").replace(/\/(\D)?$/, "");
Value = new RegExp(Value);
}
}
Configs[ConfigID].push(Value);
break;
case 'ToolTags':
case 'UserGroupList':
case 'LimitationsRight':
if(!Configs[ConfigID]) Configs[ConfigID] = [];
var Item = {};
for(var I=0,Ilen=Inputs.length;I<Ilen;I++){
var Input = Inputs[I];
var InputType = Input.type;
if(InputType == "hidden") continue;
var Value = Input.value;
var Name = Input.name;
if(InputType && InputType=="checkbox"){
Value = Input.checked;
}else{
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_string")) Value = Value;
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_number")) Value = parseInt(Value);
if(lrcHasClass(Input.parentNode, "ParamMenuLiElement_regexp")){
Value = Value.replace(/^\//, "").replace(/\/(\D)?$/, "");
Value = new RegExp(Value);
}
}
Item[Name] = Value;
}
Configs[ConfigID].push(Item);
break;
}
}
}
for(var conf in Configs){
var Value = Configs[conf];
switch(conf){
case 'InstallationPage':
case 'SiteConfigPage':
case 'CSSPage':
case 'UserParamPage':
case 'CustomCatTemplate':
case 'BugzillaURL':
case 'RevertLimit':
case 'FlagRevProtection':
var Valuetype = Realtypeof(Value);
if(["string","number","boolean","regexp"].indexOf(Valuetype)==-1) continue;
if(Valuetype=="regexp") Value = Value.toString();
if(Valuetype=="string") Value = lrcEscapeStrHTML(Value);
if(Valuetype=="boolean") Value = (Value ? "true" : "false");
if(LiveRC_Config["ExternalConfigs"].indexOf(conf)===-1){
LiveRCConfigTextPost += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ " LiveRC_Config[\""+conf+"\"] = "+Value+";\n";
}else{
LiveRCConfigTextOut += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ " LiveRC_Config[\""+conf+"\"] = "+Value+";\n";
}
break;
case 'PageContentIds':
case 'TrackingCategories':
case 'LimitationsBlacklist':
case 'FlowOccupyPages':
case 'FlowOccupyNamespaces':
case 'FlowCoreActionWhitelist':
var ThisLineValues = [];
for(var valuename in Value){
var valuevalue = Value[valuename];
var valuetype = Realtypeof(valuevalue);
if(["string","number","boolean","regexp"].indexOf(valuetype)==-1) continue;
if(valuetype=="regexp") valuevalue = valuevalue.toString();
if(valuetype=="string") valuevalue = lrcEscapeStrHTML(valuevalue);
if(valuetype=="boolean") valuevalue = (valuevalue ? "true" : "false");
ThisLineValues.push(valuevalue);
}
LiveRCConfigTextPost += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ " LiveRC_Config[\""+conf+"\"] = [ "+ThisLineValues.join(" , ")+" ];\n";
break;
case 'UserGroupList':
var ThisLineValues = [];
for(var v=0,vlen=Value.length;v<vlen;v++){
var valuevalue = Value[v];
ThisLineValues.push(" \""+valuevalue.group+"\" : { list:[], show:"+(valuevalue.show ? "true" : "false") +" }");
}
LiveRCConfigTextPost += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ " LiveRC_Config[\""+conf+"\"] = {\n"
+ ThisLineValues.join(",\n")+"\n"
+ " };\n";
break;
case 'LimitationsRight':
var ThisLineValues = [];
for(var v=0,vlen=Value.length;v<vlen;v++){
var valuevalue = Value[v];
ThisLineValues.push(" LiveRC_Config[\""+conf+"\"][\""+valuevalue.feature+"\"] = "+lrcEscapeStrHTML(valuevalue.limitationright)+";\n");
}
LiveRCConfigTextPost += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ ThisLineValues.join("");
break;
case 'ToolTags':
var ThisLineValues = [];
for(var v=0,vlen=Value.length;v<vlen;v++){
var valuevalue = Value[v];
ThisLineValues.push(" LiveRC_Config[\""+conf+"\"][\""+valuevalue.toolname+"\"] = "+lrcEscapeStrHTML(valuevalue.tagname)+";\n");
}
LiveRCConfigTextPost += " // -- "+ lrcMakeParamDescription("CLRCE_"+conf) +" --\n"
+ ThisLineValues.join("");
break;
}
}
}
if(LiveRCConfigTextPost!==""){
LiveRCConfigTextPost = " try{\n" + LiveRCConfigTextPost + " }catch(e){ }\n\n";
Variables += "\n // -- "+ lrcMakeParamDescription("LiveRCConfigLegend") +" --\n\n" + LiveRCConfigTextPost;
}
Variables += "}\n\n";
if(LiveRCConfigTextOut!=="" && (mw.config.get('wgServer')!=='//fr.wikipedia.org')){
LiveRCConfigTextOut = "if(typeof(LiveRC_Config)=='undefined'){\n"
+ " var LiveRC_Config = {};\n"
+ LiveRCConfigTextOut;
+ "}\n\n";
}else{
LiveRCConfigTextOut = "";
}
ParamPage += Variables + LiveRCConfigTextOut;
if(mw.config.get('wgServer')!=='//fr.wikipedia.org')
ParamPage += "mw.loader.load('//fr.wikipedia.org/w/index.php?title=Mediawiki:Gadget-LiveRC.js&action=raw&ctype=text/javascript'));\n\n";
LiveRC_ManageParams_UpdateParams(ParamPage, LiveRC_Config["InstallationPage"], "CLRCE_resume");
}
window.LiveRC_ConfigLiveRCExtension_RAZParams = function(Input){
lrcDisableLink(Input);
var ParamPage = "// "+lrcMakeText("Comment")+ "\n";
LiveRC_ManageParams_UpdateParams(ParamPage, LiveRC_Config["InstallationPage"], "CLRCE_resume");
}
window.LiveRC_ConfigLiveRCExtension_CheckCSSMenu = function(Input){
LiveRC_ManageParams_CheckCSSMenu(Input, LiveRC_Config["CSSPage"], "CLRCE_resume");
}
window.LiveRC_ConfigLiveRCExtension_RAZCSSParams = function(Input){
LiveRC_ManageParams_RAZCSSParams(Input, LiveRC_Config["CSSPage"], "CLRCE_resume");
}
/* </source>
== Hooks ==
<source lang=javascript> */
LiveRC_AddHook("BeforeInitActivationProcess", function(){
LiveRC_Config["LaunchProcessForce"]["UserInfos"] = true;
LiveRC_Config["LaunchProcessForce"]["SiteInfos"] = true;
LiveRC_Config["LaunchProcessForce"]["MissingParams"] = true;
if(mw.config.get('wgNamespaceNumber')<0 || (mw.config.get('wgAction')!="view" && mw.config.get('wgAction') != "purge")) return;
if(mw.config.get('wgPageName').replace(/_/g, " ") !== LiveRC_Config["InstallationPage"]) return;
for(var a=0,l=lrcExtensions.length;a<l;a++){
if(LiveRC_Config["InstalledLiveRCExtensions"].indexOf(lrcExtensions[a].name)===-1)
mw.loader.load(lrcExtensions[a].url + '&action=raw&ctype=text/javascript');
}
LiveRC_AddHook("AfterGotUserInfos", function (){
LiveRC_ConfigLiveRCExtension_AddNeededRightToExtension();
if(LiveRC_ConfigLiveRCExtension_UserCanEdit(mw.config.get('wgPageName'))){
if(LiveRC_ConfigLiveRCExtension_UserCanEdit(LiveRC_Config["CSSPage"])){
LiveRC_ConfigLiveRCExtension_GetOldLocalCSS();
}
LiveRC_Config["LaunchProcess"].push({functions:LiveRC_ConfigLiveRCExtension_BuildForm});
}
});
});
LiveRC_AddHook("AfterGotUserInfos", LiveRC_ConfigLiveRCExtension_AddLink );
/* <source lang=javascript> */
/* *************************************************************************************************************************** */
} // FIN IF
//</source>