From 112ea2c6a2568f23906dec7d5f5a86018c931e79 Mon Sep 17 00:00:00 2001 From: amy Date: Wed, 22 Feb 2023 18:45:28 +0000 Subject: some cool stuff:) --- html/display.html | 1 + src/fs.json | 12 +++++++ src/window-utils.js | 99 ++++++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 103 insertions(+), 9 deletions(-) diff --git a/html/display.html b/html/display.html index 44b68e1..c9e360c 100644 --- a/html/display.html +++ b/html/display.html @@ -323,6 +323,7 @@ bottom: 0; overflow: hidden; white-space: nowrap; + align-self: flex-end; } textarea { diff --git a/src/fs.json b/src/fs.json index 31b2c4a..5e42304 100644 --- a/src/fs.json +++ b/src/fs.json @@ -3,7 +3,19 @@ "name": "nya", "perms": { "r": true }, "dir": true, + "content": [{ + "name": "uwu", + "perms": { "r": true }, + "dir": true, + "content": [ + { + "name": "nya", + "perms": { "r": true }, + "dir": true, "content": [] + } + ] + }] }, { "name": "file.txt", diff --git a/src/window-utils.js b/src/window-utils.js index f2cb794..79868f9 100644 --- a/src/window-utils.js +++ b/src/window-utils.js @@ -50,16 +50,59 @@ let util = { let sel_t = fs_types[sel_t_n] l_b_width = 80 await window_create(i, "fs", ""); - function load() { + async function load() { let fil = [] - let ll = new jssh(fs, "/", i, "null", "null", window_create); + let ll = await new jssh(fs, "/", i, "null", "null", window_create); let tfs = ll.set_wd(ll.clean_path(inp.path)); //console.log(sel_t) let files = ""; - files += "
" + files += "
" //left bar - files+= "
" - files += "
" + //console.log(inp.path) + let ppp = inp.path.split("/").filter(function (e) { + return e !== ""; + }) + + + function rec_bar_fun(cdir,target_full,target_ind,padding,patt){ + let ret = "" + for(let f of cdir){ + if(f.dir){ + //console.log(f.name,target_full,target_ind) + let t_ret = '' + let ttu = false + if(f.name==target_full[target_ind]){ + ttu = true + t_ret += rec_bar_fun(f.content,target_full,target_ind+1,padding+5,patt+"/"+f.name) + } + ret += "
"+(ttu?"v ":"> ")+f.name+"
" + t_ret + //console.log(false,f.name) + + } + } + return ret + } + + let bar_opt = "
v /
" + + (rec_bar_fun(fs,ppp,0,5,'')) + + /* + for(let dd of ppp){ + paa+=5 + cur_pat.push(dd) + console.log(cur_pat,dd) + tt_ppp = "/" + cur_pat.join("/") + console.log(dd) + let ttwd = (ll.set_wd(tt_ppp)) + for(let ff of ttwd){ + if(ff.dir){ + bar_opt+="
"+ff.name+"
" + } + } + }*/ + + files+= "
"+bar_opt+"
" + files += "
" files += "
" for (let f of tfs) { if (f.dir) { @@ -96,7 +139,7 @@ let util = { ""; } files += - "
cancel
" + - "
"; + ""; document.getElementById(i + "-content-content").innerHTML = files; //console.log(tfs) + //util.scrollbar(document.getElementById(i+"-fs-inner-cont")) + document.getElementById(i+"-fs-inner-cont").oncontextmenu = (ev) => { + return false + } + document.getElementById(i +"-content-button-sub").onclick = () => { + res(inp.path+document.getElementById(i +"-fd-bottom-sel").value) + document.getElementById(i+"-root").remove() + + } + document.getElementById(i+"-left-pane-resize-e").onmousedown = (ev) => { + let elep = document.getElementById(i+"-fs-left-bar") + let px = ev.clientX + document.body.style.cursor = "ew-resize" + document.body.style.userSelect = "none" + document.onmouseup = (() => { + document.body.style.userSelect = "" + document.onmousemove = null + document.onmouseup = null + document.body.style.cursor = '' + + }) + + document.onmousemove = (ev) => { + elep.style.width = (parseInt(elep.clientWidth) + (ev.clientX - px)) + "px" + px = (ev.clientX) + } + } + let aaaa = document.getElementById(i+"-fs-left-bar").children + //console.log(aaaa) + for(let zz = 0; zz!=aaaa.length; zz++){ + //console.log(zz) + aaaa.item(zz).onclick = (()=>{ + inp.path = aaaa.item(zz).id + load() + }) + } for (let f of fil) { let tt = document.getElementById(i + "-id-name-" + f.name); //console.log(tt,f) @@ -130,7 +209,7 @@ let util = { if (dou) { //console.log(f, inp); if (f.dir) { - inp.path += f.name; + inp.path += f.name + "/"; } else { if (f.name.includes(".exe")) ll.ex_file(inp.path + "/" + f.name); @@ -143,7 +222,9 @@ let util = { inp.path + "/" + f.name ).content; } else { - return inp.path + "/" + f.name; + //console.log(inp.path,'/',f.name) + inp.path = inp.path + f.name + "/"; + return } //console.log(); } -- cgit v1.2.3