Utilisateur:Dr Brains/Remplace.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.//<source lang=javascript>//<pre>//<nowiki>
//////////////// TEXTES //////////////////////
var Remplace_Text = new Array();
Remplace_Text["Remplacer"] = "Remplacer";
Remplace_Text["RemplacerTitle"] = "Remplacement de texte"
Remplace_Text["OldRegExp"] = "Texte à remplacer (RegExp)";
Remplace_Text["NewText"] = "Texte de remplacement";
Remplace_Text["InPage"] = "Remplacer seulement dans la page";
Remplace_Text["Filter"] = "Filtres";
Remplace_Text["Prefix"] = "Pages commençant par";
Remplace_Text["Suffix"] = "Pages finissant par";
Remplace_Text["InNs"] = "Espace de noms";
Remplace_Text["InCat"] = "Pages dans la catégorie";
Remplace_Text["Options"] = "Options";
Remplace_Text["Minor"] = "Modification mineure";
Remplace_Text["Watch"] = "Suivre";
Remplace_Text["No"] = "Non"
Remplace_Text["NoChange"] = "Inchangé"
Remplace_Text["Pref"] = "Préférences"
Remplace_Text["Yes"] = "Oui"
Remplace_Text["Autoconfirm"] = "Publication automatique";
Remplace_Text["OK"] = "Remplacer"
Remplace_Text["Cancel"] = "Annuler"
Remplace_Text["AlertListTooMany"] = "La requête est trop étendue. Effectuez un filtrage plus resséré."
Remplace_Text["AlertListNone"] = "Aucune page ne correspond aux critères spécifiés."
Remplace_Text["AlertList"] = "$1 page{{Plural:$1||s}} {{Plural:$1|va|vont}} être modifiée{{Plural:$1||s}}.\nContinuer ?"
Remplace_Text["ResumeText"] = "Résumé : ";
Remplace_Text["Resume"] = "Remplacement de texte automatisé : « $1 » -> « $2 »";
Remplace_Text["ConfirmSaving"] = "Sauvegarder la modification ?";
Remplace_Text["NextPage"] = "Page suivante ?";
Remplace_Text["JobDone"] = "Remplacement terminé !";
//////////////// PARAMÈTRES //////////////////////
var Remplace_Params = new Array();
Remplace_Params["CatSuggestLimit"] = 20;
Remplace_Params["CatSuggestSelectLimit"] = 5;
Remplace_Params["PageSuggestLimit"] = 20;
Remplace_Params["PageSuggestSelectLimit"] = 5;
//////////////// AUTRES VARIABLES //////////////////////
var Remplace_ReplaceParams = new Array();
////////////////////////////////////////////////////////////////////////////////////////////
function Remplace_PLURAL(Text, Plural){
var PluralRegExp = new RegExp("\\{\\{PLURAL[^\\}]+\\}\\}", "ig")
var Matches = Text.match(PluralRegExp);
if(Matches!=null){
for(var b=0,m=Matches.length;b<m;b++){
var Match = Matches[b];
var Params = Match.split('}}').join('').split('|');
var Result = "";
if(Plural>1){
Result = Params[2];
}else{
Result = Params[1];
}
if(!Result) Result = "";
Text = Text.replace(Match, Result);
}
}
return Text;
}
if(typeof(MoveResizeFixed_AddMoveArea)!="function"){
mw.loader.load("//fr.wikipedia.org/w/index.php?title=Mediawiki:Gadget-MoveResizeFixed.js&action=raw&ctype=text/javascript");
}
if(typeof(Suggest_AddPageSuggestion)!="function"){
mw.loader.load("//fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Suggest.js&action=raw&ctype=text/javascript");
}
if(mw.config.get('wgUserGroups').indexOf("autopatrolled")!=-1 || mw.config.get('wgUserGroups').indexOf("bot")!=-1){
if( (mw.config.get('wgNamespaceNumber')>-1)&&(mw.config.get('wgAction')!="edit")&&(mw.config.get('wgAction')!="submit") ){
addOnloadHook(Remplace_AddButton);
}
}
function Remplace_AddButton(){
var OngletsCactions = document.getElementById('p-cactions');
if(OngletsCactions){
var CactionsUl = OngletsCactions.getElementsByTagName('ul')[0];
CactionsUl.innerHTML += '<li><a href="javascript:Remplace_OpenMenu();" title="'+Remplace_Text["RemplacerTitle"]+'">'+Remplace_Text["Remplacer"]+'</a></li>';
$(OngletsCactions).removeClass("emptyPortlet");
}
}
function Remplace_Cancel(){
var MenuDiv = document.getElementById('Menu_Remplace');
MenuDiv.parentNode.removeChild(MenuDiv);
}
function Remplace_OpenMenu(){
var OldMenuDiv = document.getElementById('Menu_Remplace');
if(OldMenuDiv) return;
var LargeurEcran = MoveResizeFixed_GetScreenWidth();
var HauteurEcran = MoveResizeFixed_GetScreenHeight();
var Menu = document.createElement('div');
Menu.id = 'Menu_Remplace';
Menu.className = 'MenuReplace';
Menu.style.position = 'fixed';
Menu.style.zIndex = 500;
Menu.style.backgroundColor = 'white';
Menu.style.border = '3px double black';
Menu.style.width = '550px';
Menu.style.paddingLeft = '5px';
Menu.style.paddingRight = '5px';
var MenuContainer = document.createElement('div');
Menu.appendChild(MenuContainer);
var MenuContent = '<fieldset><legend>'+Remplace_Text["RemplacerTitle"]+'</legend>'
+ '<table width="100%" style="background:none"><tr><td width="50%" valign="top" align="center">'
+ '<input id="Remplace_Replace1" name="OldRegExp" type="text" value="" /><br/>'
+ '<label for="Remplace_Replace1">'+Remplace_Text["OldRegExp"]+'</label>'
+ '</td><td width="50%" valign="top" align="center">'
+ '<input id="Remplace_Replace2" name="NewText" type="text" value="" /><br/>'
+ '<label for="Remplace_Replace2">'+Remplace_Text["NewText"]+'</label>'
+ '</td></tr></table>'
+ '<hr/>'
+ '<table width="100%" style="background:none"><tr><td width="25%" valign="top" align="right">'
+ '<input id="InPageEnabled" name="InPageEnabled" type="checkbox" value="'+mw.config.get('wgPageName').replace(/_/g, " ")+'" checked="checked" onclick="Remplace_PageEnabledToggle()" onkeyup="Remplace_PageEnabledToggleC(event)"/>'
+ '</td><td valign="top" align="left">'
+ '<form id="InpageForm" style="display:inline">'
+ '<input id="InPage" name="InPage" type="text" size="'+mw.config.get('wgPageName').length+'" value="'+mw.config.get('wgPageName').replace(/_/g, " ")+'" />'
+ '</form><br/>'
+ '<label for="InPage">'+Remplace_Text["InPage"]+'</label>'
+ '</td></tr></table>'
+ '</fieldset>'
+ '<fieldset id="FilterFieldset" ><legend>'+Remplace_Text["Filter"]+'</legend>'
+ '<table width="100%" style="background:none"><tr><td width="50%" valign="top" align="center">'
+ '<input id="Prefix" name="Prefix" type="text" value="" /><br/>'
+ '<label for="Prefix">'+Remplace_Text["Prefix"]+'</label>'
+ '</td><td valign="top" align="center"><form style="display:inline">'
+ '<input id="InCat" name="InCat" type="text" value="'+(mw.config.get('wgNamespaceNumber')==14 ? mw.config.get('wgTitle') : "")+'" onkeyup="Remplace_MenuSuggestCats();" />'
+ '</form><br/>'
+ '<label for="InCat">'+Remplace_Text["InCat"]+'</label>'
+ '</td>'
+ '</tr><tr>'
+ '<td valign="top" align="center">'
+ '<input id="Suffix" name="Suffix" type="text" value="" /><br/>'
+ '<label for="Suffix">'+Remplace_Text["Suffix"]+'</label>'
+ '</td><td valign="top" align="center">'
+ '<span id="InNSSpan" ></span><br/>'
+ '<label for="InNs">'+Remplace_Text["InNs"]+'</label>'
+ '</td></tr></table>'
+ '</fieldset>'
+ '<fieldset><legend>'+Remplace_Text["Options"]+'</legend>'
+ '<table width="100%" style="background:none"><tr><td width="50%" valign="top" align="center">'
+ '<label for="Minor">'+Remplace_Text["Minor"]+'</label>'
+ '<form id="Minor">'
+ '<input type="radio" id="MinorNo" name="Minor" style="cursor:pointer;" />'
+ '<label for="MinorNo">'+Remplace_Text["No"]+'</label>'
+ '<input type="radio" id="MinorPref" name="Minor" style="cursor:pointer;" />'
+ '<label for="MinorPref">'+Remplace_Text["Pref"]+'</label>'
+ '<input type="radio" id="MinorYes" name="Minor" style="cursor:pointer;" checked="checked" />'
+ '<label for="MinorYes">'+Remplace_Text["Yes"]+'</label>'
+ '</form>'
+ '</td><td valign="top" align="center">'
+ '<label for="AutoWatch">'+Remplace_Text["Watch"]+'</label>'
+ '<form id="AutoWatch">'
+ '<input type="radio" id="AutoWatchNo" name="AutoWatch" style="cursor:pointer;" />'
+ '<label for="AutoWatchNo">'+Remplace_Text["No"]+'</label>'
+ '<input type="radio" id="AutoWatchNochange" name="AutoWatch" style="cursor:pointer;" checked="checked" />'
+ '<label for="AutoWatchNochange">'+Remplace_Text["NoChange"]+'</label>'
+ '<input type="radio" id="AutoWatchPref" name="AutoWatch" style="cursor:pointer;" />'
+ '<label for="AutoWatchPref">'+Remplace_Text["Pref"]+'</label>'
+ '<input type="radio" id="AutoWatchYes" name="AutoWatch" style="cursor:pointer;" />'
+ '<label for="AutoWatchYes">'+Remplace_Text["Yes"]+'</label>'
+ '</form>'
+ '</td></tr></table>'
+ '<hr style="margin-bottom:1em" />'
+ '<center>'
+ '<label for="Resume">'+Remplace_Text["ResumeText"]+'</label>'
+ '<input id="Resume" name="Resume" size="'+Remplace_Text["Resume"].length+'" type="text" value="'+Remplace_Text["Resume"]+'" />'
+ '</center>'
+ '</fieldset>'
+ '<fieldset><legend>'+Remplace_Text["Remplacer"]+'</legend><center>'
+ '<input type="checkbox" id="Autoconfirm" name="Autoconfirm" style="cursor:pointer;" />'
+ '<label for="Autoconfirm">'+Remplace_Text["Autoconfirm"]+'</label>'
+ '<br/>'
+ '<input type="button" value="'+Remplace_Text["OK"]+'" onclick="Remplace_CheckParams();" onselect="Remplace_CheckParams();"/>'
+ ' '
+ '<input type="button" value="'+Remplace_Text["Cancel"]+'" onclick="Remplace_Cancel();" onselect="Remplace_Cancel();"/>'
+ '<span id="RequestInProgress" style="display:none;margin-left:1em;"><img height="20" width="20" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif" alt="Requête en cours" /></span>'
+ '</center></fieldset>'
MenuContainer.innerHTML = MenuContent;
var MenuAnchor = document.createElement('div');
MenuAnchor.style.position = 'relative';
MenuAnchor.style.padding = '20px';
MenuAnchor.style.marginBottom = '5px';
MenuAnchor.style.border = '1px dashed grey';
MenuAnchor.innerHTML = "<center> </center>";
Menu.appendChild(MenuAnchor);
document.body.appendChild(Menu);
PositionGauche = parseInt((LargeurEcran-Menu.clientWidth)/2) ;
PositionHaut = parseInt((HauteurEcran-Menu.clientHeight)/3) ;
Menu.style.left=PositionGauche + 'px';
Menu.style.top=PositionHaut + 'px';
document.getElementById("InNSSpan").appendChild(Suggest_AddNamespaceSuggestion("InNs"));
Suggest_AddPageSuggestion({ "InputNode":document.getElementById("InPage"), "SuggestLimit":Remplace_Params["PageSuggestLimit"], "SuggestListSize":Remplace_Params["PageSuggestSelectLimit"] });
Suggest_AddPageSuggestion({ "InputNode":document.getElementById("InCat"), "NSFilter":14, "StripNS":true, "SuggestLimit":Remplace_Params["CatSuggestLimit"], "SuggestListSize":Remplace_Params["CatSuggestSelectLimit"] });
MoveResizeFixed_AddMoveArea(MenuAnchor, new Array(Menu));
Remplace_PageEnabledToggle();
}
function Remplace_PageEnabledToggleC(event){
if (!event.keyCode) return;
if (event.keyCode != 13) return;
Remplace_PageEnabledToggle();
}
function Remplace_PageEnabledToggle(){
var InPageEnabled = document.getElementById("InPageEnabled");
var InpageForm = document.getElementById("InpageForm");
var FilterOptions = document.getElementById("FilterFieldset");
if(InPageEnabled.checked){
Remplace_DisableForm(FilterOptions);
Remplace_EnableForm(InpageForm);
}else{
Remplace_EnableForm(FilterOptions);
Remplace_DisableForm(InpageForm);
}
}
function Remplace_DisableForm(Form){
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
Inputs[a].disabled = "disabled";
}
var Selects = Form.getElementsByTagName('select');
for(var a=0,l=Selects.length;a<l;a++){
Selects[a].disabled = "disabled";
if($(Selects[a]).hasClass("SuggestionList")){
Selects[a].style.display = "none";
}
}
}
function Remplace_EnableForm(Form){
var Inputs = Form.getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
Inputs[a].disabled = false;
}
var Selects = Form.getElementsByTagName('select');
for(var a=0,l=Selects.length;a<l;a++){
Selects[a].disabled = false;
if($(Selects[a]).hasClass("SuggestionList")){
if(Selects[a].getElementsByTagName('option').length>1) Selects[a].style.display = "inline";
}
}
}
function Remplace_RequestInProgressOn(){
var Img = document.getElementById("RequestInProgress");
if(Img) Img.style.display = "inline";
}
function Remplace_RequestInProgressOff(){
var Img = document.getElementById("RequestInProgress");
if(Img) Img.style.display = "none";
}
function Remplace_CheckParams(){
var Alert = "";
var Inputs = document.getElementById('Menu_Remplace').getElementsByTagName('input');
for(var a=0,l=Inputs.length;a<l;a++){
var Input = Inputs[a];
if(Input.disabled) continue;
var InputName = Input.name;
var InputType = Input.type;
var InputId = Input.id;
if(InputName){
if(InputType=="text") Remplace_ReplaceParams[InputName] = Input.value;
if(InputType=="checkbox") Remplace_ReplaceParams[InputName] = (Input.checked ? true : false);
if(InputType=="radio" && Input.checked && InputId) Remplace_ReplaceParams[InputName] = InputId.split(InputName).join('');
}
}
var Selects = document.getElementById('Menu_Remplace').getElementsByTagName('select');
for(var a=0,l=Selects.length;a<l;a++){
var Select = Selects[a];
if(Select.disabled) continue;
var SelectName = Select.name;
var SelectValue = Select.value;
if(SelectName){
var Options = Select.getElementsByTagName('option');
for(var b=0,m=Options.length;b<m;b++){
if(!Options[b].selected) continue;
Remplace_ReplaceParams[SelectName] = Options[b].value;
}
}
}
for(var Param in Remplace_ReplaceParams){
Alert += "* " + Param + " : « " + Remplace_ReplaceParams[Param] + " »\n" ;
}
var Confirm = confirm(Alert);
if(!Confirm) return;
Remplace_PrepareListRequest();
}
function Remplace_PrepareListRequest(){
if(Remplace_ReplaceParams["OldRegExp"]==="") return;
//alert(new RegExp(Remplace_ReplaceParams["OldRegExp"]));
var ListArray = new Array();
if(Remplace_ReplaceParams["InPageEnabled"]){
ListArray.push(Remplace_ReplaceParams["InPage"]);
Remplace_DoPageRequestEdit(ListArray, 0);
return;
}
var URL = "";
var Tag = "";
var RequestParams = new Array();
var ContinueAttribute = "";
var APILimit = ( ((mw.config.get('wgUserGroups').indexOf("sysop")!=-1)||(mw.config.get('wgUserGroups').indexOf("bot")!=-1)) ? 4999 : 499 );
var Params = new Array();
if(Remplace_ReplaceParams["InCat"]!==""){ // *********** Recherche dans une catégorie
URL = "/api.php?format=xml&action=query&list=categorymembers";
Tag = "cm";
RequestParams["cmlimit"] = APILimit;
if(Remplace_ReplaceParams["InNs"].indexOf("|")==-1) RequestParams["cmnamespace"] = Remplace_ReplaceParams["InNs"];
RequestParams["cmtitle"] = mw.config.get('wgFormattedNamespaces')[14]+':'+encodeURIComponent(Remplace_ReplaceParams["InCat"]);
RequestParams["cmprop"] = "title";
}else{
if(Remplace_ReplaceParams["InNs"].indexOf("|")==-1){ // *********** Recherche dans un espace de noms
URL = "/api.php?format=xml&action=query&list=allpages";
Tag = "p";
RequestParams["aplimit"] = APILimit;
RequestParams["apnamespace"] = Remplace_ReplaceParams["InNs"];
if(Remplace_ReplaceParams["Prefix"]!==""){
RequestParams["apprefix"] = Remplace_ReplaceParams["Prefix"];
RequestParams["apfrom"] = Remplace_ReplaceParams["Prefix"];
}
}else if(Remplace_ReplaceParams["Prefix"]!==""){ // *********** Recherche par préfixe
URL = "/api.php?format=xml&action=query&list=allpages";
Tag = "p";
RequestParams["apcontinue"] = Remplace_ReplaceParams["Prefix"];
RequestParams["aplimit"] = APILimit;
RequestParams["apnamespace"] = Remplace_ReplaceParams["InNs"];
RequestParams["apprefix"] = Remplace_ReplaceParams["Prefix"];
}else{ // *********** Recherche sans filtre : trop long
alert(Remplace_Text["AlertListTooMany"]);
return;
}
}
Remplace_DoListRequest(ListArray, URL, Tag, RequestParams);
}
function Remplace_DoListRequest(ListArray, URL, Tag, RequestParams){
Remplace_RequestInProgressOn();
for(var ParamName in RequestParams){
if(RequestParams.hasOwnProperty(ParamName))
URL += "&"+ParamName+"="+RequestParams[ParamName];
}
var xmlhttp = sajax_init_object() ;
xmlhttp.open('GET', mw.config.get('wgServer') + mw.config.get('wgScriptPath') + URL, true);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState != 4) return;
var xml = xmlhttp.responseXML ;
if ( xml == null ) return ;
var titles = new Array () ;
var pages = xml.getElementsByTagName(Tag) ;
for ( var i = 0 ; i < pages.length ; i++ ) {
var Title = pages[i].getAttribute('title');
if(Remplace_ReplaceParams["Suffix"]){
var Reg = new RegExp(Remplace_ReplaceParams["Suffix"]+"$", "g")
if(Title.match(Reg)==null) continue;
}
if(Remplace_ReplaceParams["Prefix"]!=="" && Title.indexOf(Remplace_ReplaceParams["Prefix"])!==0) continue;
ListArray.push(Title);
}
var MustContinue = xml.getElementsByTagName("query-continue")[0];
if(MustContinue){
var MustContinueParam = MustContinue.firstChild.attributes[0];
var MustContinueValue = encodeURIComponent(MustContinueParam.value);
RequestParams[MustContinueParam.name]= MustContinueValue;
Remplace_DoListRequest(ListArray, URL, Tag, RequestParams);
}else{
Remplace_RequestInProgressOff();
if(ListArray.length===0){
alert(Remplace_Text["AlertListNone"]);
return;
}
var Confirm = confirm( Remplace_PLURAL(Remplace_Text["AlertList"], ListArray.length).split('$1').join(ListArray.length));
if(!Confirm) return;
Remplace_Cancel();
Remplace_DoPageRequestEdit(ListArray, 0);
}
}
xmlhttp.send(null);
}
function Remplace_DoPageRequestEdit(ListArray, position){
var Page = ListArray[position];
if(!Page){
alert(Remplace_Text["JobDone"]);
window.location.reload();
return;
}
var URL = mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encodeURIComponent(Page) + "&action=edit";
var xmlhttp = sajax_init_object() ;
xmlhttp.open('GET', URL, true);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState != 4) return;
while(document.body.firstChild){ document.body.removeChild(document.body.firstChild); }
document.body.innerHTML = xmlhttp.responseText;
Remplace_Replace(ListArray, position);
}
xmlhttp.send(null);
}
function Remplace_Replace(ListArray, position){
var OldText = new RegExp(Remplace_ReplaceParams["OldRegExp"], "g");
var Text = document.getElementById("wpTextbox1").value;
var NewText = "";
var matches = Text.match(OldText);
if(matches == null){
Remplace_DoPageRequestEdit(ListArray, (position+1))
return;
}
for(var a=0,l=matches.length;a<l;a++){
var NewValue = Remplace_ReplaceParams["NewText"].replace(/\$1/g, matches[a]);
NewText += Text.substring(0 , Text.indexOf(matches[a])) + NewValue;
Text = Text.substring((Text.indexOf(matches[a])+matches[a].length), Text.length);
}
document.getElementById("wpTextbox1").value = NewText + Text;
Remplace_DoPageRequestSubmit(ListArray, position);
}
function Remplace_DoPageRequestSubmit(ListArray, position){
if(!Remplace_ReplaceParams["Autoconfirm"]){
var Confirm = confirm(Remplace_Text["ConfirmSaving"]);
if(!Confirm){
var Next = confirm(Remplace_Text["NextPage"]);
if(Next) Remplace_DoPageRequestEdit(ListArray, (position+1));
return;
}
}
var EditForm = document.getElementById("editform");
if(!EditForm) return;
var CanEdit = document.getElementById("wpSave");
if(!CanEdit){
Remplace_DoPageRequestEdit(ListArray, (position+1));
return;
}
var action = EditForm.action;
var boundary = '--------123xyz';
var data = '';
var Params = new Array("wpTextbox1", "wpSection", "wpSummary", "wpStarttime", "wpEdittime", "wpEditToken");
if(Remplace_ReplaceParams["Minor"]!="No"){
if(Remplace_ReplaceParams["Minor"]=="Yes") document.getElementById("wpMinoredit").checked = "checked";
Params.push("wpMinoredit");
}
var IsWatched = document.getElementById("ca-unwatch");
var WatchIsChecked = document.getElementById("wpWatchthis").checked;
if(Remplace_ReplaceParams["Watch"]=="Yes" || (IsWatched && Remplace_ReplaceParams["Watch"]=="NoChange") ){
document.getElementById("wpWatchthis").checked = "checked";
}
if(Remplace_ReplaceParams["Watch"]=="No" || (!IsWatched && Remplace_ReplaceParams["Watch"]=="NoChange") ){
document.getElementById("wpWatchthis").checked = false;
}
var NewWatchIsChecked = document.getElementById("wpWatchthis").checked;
if(Remplace_ReplaceParams["Watch"]!="No" && (NewWatchIsChecked!=WatchIsChecked)){
Params.push("wpWatchthis");
}
var Resume = Remplace_ReplaceParams["Resume"];
document.getElementById("wpSummary").value = ( Resume ? Resume.split('$1').join(Remplace_ReplaceParams["OldRegExp"]).split('$2').join(Remplace_ReplaceParams["NewText"]) : Remplace_Text["Resume"].split('$1').join(Remplace_ReplaceParams["OldRegExp"]).split('$2').join(Remplace_ReplaceParams["NewText"]) );
for(var a=0,l=Params.length;a<l;a++){
var Element = document.getElementById(Params[a]);
if(!Element) Element = document.getElementsByName(Params[a])[0];
if(Element){
data += '--' + boundary
+ '\nContent-Disposition: form-data; name="'+Params[a]+'"\n\n'
+ Element.value + '\n'
}
}
var RequestPOST = sajax_init_object();
RequestPOST.open('POST', action, true);
RequestPOST.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+boundary);
RequestPOST.onreadystatechange = function(){
if(RequestPOST.readyState != 4) return;
while(document.body.firstChild){ document.body.removeChild(document.body.firstChild); }
document.body.innerHTML = RequestPOST.responseText;
var EditFormBis = document.getElementById("editform");
if(EditFormBis){
Remplace_DoPageRequestEdit(ListArray, position);
}else{
Remplace_DoPageRequestEdit(ListArray, (position+1));
}
}
RequestPOST.send(data + '--' + boundary);
}
//</nowiki></pre></source>