// JavaScript Document var ___xfileInput = document.getElementById("xfileInput"); if(___xfileInput)___xfileInput.style.backgroundColor='yellow'; if(0){ var ___spanxfileInput = document.getElementById("spanxfileInput"); spanxfileInput.style.width='20px'; if(spanxfileInput)spanxfileInput.style.width='20px'; } //if(spanxfileInput)spanxfileInput.style.width='20px';//!\warning: var tableBody = document.getElementById("desc"); var imagesMultiple = document.getElementById("imagesMultiple"); var imagesDir=js$Obj$KV$FS$FilesOfSite.imagesDir;//`../../../atelier/steganography-main`; var numimagesDir=numimagesDirDel=-1; var html = []; // var imvDiv = []; var tfiles; var ttrnbrrow=0; var distantDIRS={ case1:`distantDIRS/systemboost.entreprise/photos/case1` }; distantDIRS.case2=distantDIRS.case1; distantDIRS.case3=distantDIRS.case1; distantDIRS.case4=distantDIRS.case1; distantDIRS={ case1:`/localDIRS/namesite/photos/case1` }; distantDIRS.case2=distantDIRS.case1; distantDIRS.case3=distantDIRS.case1; distantDIRS.case4=distantDIRS.case1; var GridOfImages={// GridOfImages.PlugFctDisplayDatas , ridOfImages.PlugFctPostDatas PlugFctDisplayDatas:window.DisplayDataOpen ,PlugFctPostDatas:window.sendDataOpen }; function ___getXDomainRequest(){ try{xline+=`96;index=1;//js.fct="js.fct:jsb:getXDomainRequest()"; //===== fcttxt=`function getXDomainRequest()`;js.fct=parent.alertFunctionProperties(fcttxt); //===== if (window.XDomainRequest){js.xdr = new XDomainRequest(); }  else if (window.XMLHttpRequest) { js.xdr = new XMLHttpRequest(); }  else {xline+=`/51`;jsfct_dvlptAlert(['',l2p,h2p,"//!\fr Votre navigateur ne gère pas l'AJAX cross-domain !"]); } return js.xdr;         }catch(e){parent.alertError(e,index);} } //}//!\end:function getXDomainRequest(){js.fct="js.fct:jsb:getXDomainRequest()"; // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/cells // https://www.geeksforgeeks.org/javascript-loop-through-table-cells-using-js/ // https://www.codeguage.com/courses/ajax/response-handling function ___loopThroughTableRows(sectionTBody,view) { stophere=1; let rowstr=alltr={};//zrow={}; let table = document.getElementById(sectionTBody); Array.from(table.rows).forEach(row => { cells={};map=new Map([[`row`+(row.rowIndex-1), {}],]); objRow=Object.fromEntries(map);nameRow=Object.keys(objRow);// cellule ["row0", "tr"] /* if(0&&stophere&&view)alert("Object.entries(objRow)= "+Object.entries(objRow) +"\n row.rowIndex= "+row.rowIndex +"\n row.cells.length= "+row.cells.length ); */ Array.from(row.cells).forEach(cell => { //c=cell.cellIndex; if(cell.cellIndex( js.iData[key]=value )); alert(Object.entries(js.iData)); */ //sendDataOpen(null); } function sendDataOpen(formthis){ try{xline+=`/104`;index=1;js.fct="js.fct:jsb:aX:sendDataOpen(formthis)"; js.fctAction="send datas to aX"; //===== js.fct=fcttxt=`function sendDataOpen(formthis)`;fct=parent.alertFunctionProperties(js.fct); //===== gridDatas=DisplayDataOpen(0); alert("sendDataOpen(formthis) for SEND DATAS with AJAX \n "+Object.entries(gridDatas.row0)); js.xdr=getXDomainRequest(); // arr0=jsc_getformDataObj(formthis); js.formdata=(formthis? new FormData(formthis):new FormData()); //jspageFileAXForum testtext="FileAX";testgridDatas="gridDatas"; js.formdata.append(testtext,`xcodeValues.dirUserSite`); // js.formdata.append(testgridDatas,JSON.stringify({\"row0\":\"michel\"}));//gridDatas); //texte='{"row0":"michel"}'; //obj={"row0":"michel"}; //json=JSON.stringify(obj); js.formdata.append(testgridDatas,JSON.stringify(gridDatas));//gridDatas); // js.formdata=arr0[0];js.iData=arr0[1];// iDataSerialize js.xdr.onload=function(){ outText=js.xdr.responseText;//js.xdr.responseText; alert(`RECEPTION js.xdr.onload=function() ! `+js.xdr.responseText);// this.responseText; // sendDataOpenResults(formthis); if(1)// 1 est indispensable car si avec 0, on remplace le " par vide ça pose des problèmes pour les objects js.oData=JSON.parse(js.xdr.responseText); else js.oData=JSON.parse(decodeURI(js.xdr.responseText).replace(/\\"/gi,"")); if(!js.oData.outajax||js.oData.outajax!=`startoutajax`){ alert(`Erreur dans script AJAX ! `+js.oData.outajax);return(`error AJAX`); } // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement/cellIndex alert(`SUCCESS js.xdr.onload=function() ! `+js.xdr.responseText); alert("line 335 alors js.oData.FileAX= "+js.oData.FileAX); // texte=String(js.oData[`gridDatasOK`]); texte=String(js.oData[`gridDatas`]);//gridDatasOK alert("Object.entries(texte)= "+Object.entries(texte)); alert("texte= "+texte); // alert("js.oData[`gridDatasOK`]= "+JSON.parse(js.oData[`gridDatasOK`])); // texte="`"+js.oData[`gridDatasOK`]+"`"; //const json = '{"result":true, "count":42}'; //const json = '{result:true, count:42}'; obj=JSON.parse(texte); // "typeof obj= "+typeof obj+ // obj=JSON.parse(js.oData[`gridDatasOK`],reviver); // "typeof obj= "+typeof obj+ alert("\n typeof texte= "+typeof texte+"\n typeof obj= "+typeof obj+"\n Object.entries(obj)= "+Object.entries(obj) +"\n obj.row0.c1= "+obj.row0.c1 +"\n obj.row0.c3= "+obj.row0.c3+"\n obj.row2.c1= "+obj.row2.c1 ); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify serialize un object // alert("Object.entries(js.oData[`gridDatasOK`])= "+Object.entries(obj)); // alert("js.oData.gridDatasOK.row0= "+Object.entries(js.oData.gridDatasOK.row0)); // essai=`essai`; outajax']=' // alert(js.oData[`outajax`]);//ok js.xdr.responseText); // alert(js.oData.outajax);// ok js.xdr.responseText); // alert(js.oData.outajax[essai]);// not ok js.xdr.responseText); // alert(js.oData.outajax[`essai`]);// not ok js.xdr.responseText); // alert(js.oData.outajax.essai);//js.xdr.responseText); // alert(js.oData.outajax[`essai`]);//js.xdr.responseText); // alert(js.oData[`outajax`][`essai`]);//js.xdr.responseText); // alert(js.oData[testtext]);//ok js.xdr.responseText); // alert(js.oData.FileAX);//ok js.xdr.responseText); } //----- // js.xdr.open("POST",js.linkAjax,js.synchro);// synchro=false permet d'ATTENDRE que results vers return(results); js.xdr.open("POST",`../ajax-test.php`,false);// synchro=false permet d'ATTENDRE que results vers return(results); // C:\atelier\steganography-main\ajax-test.php //js.xdr.setRequestHeader('Content-type', 'application/json; charset=UTF-8'); js.xdr.send(js.formdata); }catch(e){parent.alertError(e,index);} } //}//!\end:function sendDataOpen(formthis){js.fct="js.fct:jsb:aX:sendDataOpen(formthis)"; /* function jsc_getformDataObj(formthis){js.fct="js.fct:jsb:jsc_getformDataObj(formthis)"; //---- js.formdata=new FormData(formthis); //jspageFileAXForum js.formdata.append("FileAX",postPostit.jspageFileAXForum); js.formdata.append("FileLearnerSerialData",postPostit.jsfileLearnerSerialData); js.formdata.append("userSite",jsStartSite.userSite); js.formdata.append("isDir_iC",jsStartSite.isDir_iC); js.formdata.append("isDir_Site",jsStartSite.isDir_Site); js.formdata.append("isLOCALHOST",jsStartSite.isLOCALHOST); js.formdata.append("isRemoteIP",jsStartSite.isRemoteIP); js.formdata.append("isLang",jsStartSite.isLang); js.formdata.append("isConnected",jsStartSite.isConnected); //---- js.iData={};js.formdata.forEach((value,key)=>(js.iData[key]=value)); return(new Array(js.formdata,js.iData)); }//!\end:function jsc_getformDataObj(formthis){js.fct="js.fct:jsb:jsc_getformDataObj(formthis)"; */ //sendDataOpen(null); //===================================== //===================================== function ___modeCases(This) { try{xline+=`/109`;index=1; //===== fcttxt=`function ___modeCases(This)`;fct=parent.alertFunctionProperties(fcttxt); //===== choiced=This.options[This.selectedIndex].value; if(0)alert("line "+line+"\/"+fcttxt+"\n"+" dirname destination= "+choiced); x=document.querySelector(`#dirnameModeCases`); y=document.querySelector(`#labelxfileInput`);if(y)y.style.display=`block`; l=document.getElementById(`labelxfileInput`).setAttribute(`onclick`,`return(true);`); document.getElementById(`ixfileInput`).style.display=`none`; switch(choiced){ case "case1": if(x)x.innerHTML=choiced; break; case "case2": if(x)x.innerHTML=choiced; break; case "case3": if(x)x.innerHTML=choiced; break; case "case4": if(x)x.innerHTML=choiced; break; } //let labelspan = document.querySelectorAll(".truc span"); //if(labelspan){ //alert("labelspan.style.background= "+labelspan.style.background); //labelspan.style.height='20px'; //} }catch(e){parent.alertError(e,index);} } //===================================== //===================================== // https://www.codeguage.com/courses/advanced-js/file-apis-file-object super // https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces // https://www.strangebuzz.com/en/snippets/adding-row-numbers-to-an-html-table-using-the-browser-javascript-console // https://www.swebdev.fr/blog/personnaliser-l-apparence-d-un-input-file-en-css // https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse function ___testdeleteRowTable(This){//tfiles){ table=This.parentElement.parentElement.parentElement; tbody=This.parentElement.parentElement;// tableBody tr=This.parentElement; //var i=r.parentNode.parentNode.rowIndex; //document.getElementById('myTable').deleteRow(i); //alert("This.parentNode.parentNode.rowIndex= "+This.parentNode.parentNode.rowIndex // https://gist.github.com/rheno/8610935 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement/sectionRowIndex // https://gist.github.com/rheno/8610935 index0=parseInt(tr.rowIndex); //index=parseInt(tr.rowIndex-1); index=parseInt(index0-1); alert("test \n (This.parentElement.parentElement==tbody)= "+(This.parentElement.parentElement==tbody) +"\n tr.rowIndex= "+tr.rowIndex+"\n index= "+index +"\n tbody.rows.length= "+tbody.rows.length +"\n document.getElementsByName(arrayImages)[index]= "+document.getElementsByName("arrayImages")[index0-1] +"\n This.children[0].src= "+This.children[0].src +"\n This.children[0].id= "+This.children[0].id //+"\n document.getElementsByName(arrayImages)[index].src= "+document.getElementsByName("arrayImages")[index0-1].src ); // // arrayImages //tbody.deleteRow(index); tbody.getElementsByTagName("tr")[index].remove(); html[index]=``; document.getElementById(This.children[0].id).remove(); //autoriseImagesSearch(tbody.rows.length); autoriseImagesSearch(); //autoriseImagesSearch(tbody.rows.length,selectedIndex); //document.getElementsByName("arrayImages")[index].remove(); ////tbody.getElementsByTagName("tr")[index].innerHTML=null; ////tbody.rows[tr.rowIndex].remove(); } //!\warning:très intéressant xline+=`/336`;if(0)alert("line "+xline+" \n xfileInput= "+___xfileInput); if(___xfileInput) ___xfileInput.onchange = function(e) { var files = this.files; // var html = []; tfiles=this.files; // iterate over all files for (var file of files) { x=file.type.split(`image/`); if(!x[1]){ alert(file.name+` `+`n\'est pas une image`);return; } //myTable = tableBody.getElementsByTagName("table")[0]; //myTableBody = tableBody.getElementsByTagName("tbody")[0]; //myRow = myTableBody.getElementsByTagName("tr")[1]; //myCell = myRow.getElementsByTagName("td")[1]; // numimagesDir++;// tableBody.rows // xnum=tableBody.rows.length; // xnum=myTableBody.rows; // rows = table.getElementsByTagName('tbody')[0].rows; // rows = table.getElementsByTagName('tbody')[0].rows; // properties=jsMinElementHTML.GetId(`NbrFiles`); // selectedIndex=properties.selectedIndex;//=3; //selectedIndex=document.getElementById(`NbrFiles`).selectedIndex; // w=document.getElementById(`NbrFiles`).options[properties.selectedIndex].value; if(0&&xnum){ w=properties.element.value; alert(`xnum= `+xnum+`\n w= `+w);//[0]);Object.entries(xnum));//[0]); /* // if(parseInt(w)>=3){alert(`Le nombre d\`images ne doit pas dépasser à `+xnum);return;} if(0&&xnum&&xnum>=3){ //