[28/02, 6:32 pm] Harmanpreet Singh: ...termux/files/home/FilMan/filman/static/js/script.js
//alert("hu");

let navs=document.querySelectorAll("[data-type='file'>
let currentpath="";
let path= document.querySelector("#path");
let selected =document.querySelector("#selected");
let nano = document.querySelector("#nano");
let nav=document.querySelector("#navigation-panel");
let navBtn= document.querySelector("#nav-btn");
let saveBtn= document.querySelector("#save-btn");
let runBtn= document.querySelector("#run-btn");
navBtn.onclick=function(){
//alert("hi");
try{
nav.classList.toggle("hide-element");
nav.classList.toggle("navigation-panel")
}catch(ee){
alert(ee);
}
}
class FileManagerUI{
constructor(name){
this.name=name;
//this.NanoValue("hi");
[28/02, 6:47 pm] Harmanpreet Singh: //this.NanoValue("hi");
}


sayHi(){
alert("Hi " this.name);
}


CreateElem(tag,className,value, content,parent){
let elem= document.createElement(tag);
elem.classList.add(className);
elem.setAttribute("value",value);
elem.innerHTML = content;
parent.appendChild(elem);
return elem;
}


static NanoValue(text){
//alert(text);
nano.value= text;
 }
[28/02, 6:47 pm] Harmanpreet Singh: nano.value= text;
 }


SendAjaxRequest(url,method,data){
try{
//let data =[];
let req=new XMLHttpRequest()
req.open(method,url)
req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded")
req.onreadystatechange=function(){
if(this.readyState==4 && this.status==200){
//alert(this.responseText);
FileManagerUI.NanoValue(this.responseText);
}

}
req.send(data);
}catch(err){
alert(err);
}
}
}
[28/02, 6:49 pm] Harmanpreet Singh: function ReturnPath(elem){
let path=[];
while(elem.dataset.name!='navigation'){
path.unshift(elem.dataset.name);
elem=elem.parentNode;
}
return path.join("/");
}


function main(){
try{
let fm= new FileManagerUI("JJSR");
for (let i of navs){
i.addEventListener("click",function(){
currentpath=ReturnPath(i);
document.querySelector("#total-path").innerHTML=curre>
let fd= new FormData();
fd.append("path",currentpath);
fd.append("nano",nano.value);
fm.SendAjaxRequest("{{url_for('file_manager_response'>
"path="+currentpath+"&nano=");

});
[28/02, 6:49 pm] Harmanpreet Singh: });
}
saveBtn.addEventListener("click",function(){
fm.SendAjaxRequest("{{url_for('file_manager_response'>
"path="+currentpath+"&nano="+nano.value);
});
}catch(e){
alert(e);
}
}
main();