From 68665527687d470574ae08a03aac2470e6708ba8 Mon Sep 17 00:00:00 2001 From: amy Date: Tue, 21 Feb 2023 19:56:13 +0000 Subject: new stuff! --- .gitignore | 3 +++ justfile | 2 +- package.json | 5 +++++ src/fs-types.json | 4 ++-- src/fs.json | 2 +- src/window-utils.js | 34 +++++++++++++++++++++++++++++----- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .gitignore create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3f340cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*replit* +package-lock.json +node_modules \ No newline at end of file diff --git a/justfile b/justfile index a34080c..f98af2b 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,5 @@ alias cloc := loc -set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] +#set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] default: @echo "fun fact your pc is {{arch()}} and is probably on {{os()}}" @just --list --list-heading $'and you can use these scripts (maybe)\n' diff --git a/package.json b/package.json new file mode 100644 index 0000000..0e6cd98 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "express": "^4.18.2" + } +} diff --git a/src/fs-types.json b/src/fs-types.json index 4b1d9f7..6d5c755 100644 --- a/src/fs-types.json +++ b/src/fs-types.json @@ -1,4 +1,4 @@ [ - { "identifier": "*", "descriptor": "All Files", "regex": "/(.*)/g" }, - { "identifier": "*.txt", "descriptor": "Text Files", "regex": "/(.*txt$)/g" } + { "identifier": "*", "descriptor": "All Files", "regex": "(.*)" }, + { "identifier": "*.txt", "descriptor": "Text Files", "regex": "(.*txt$)" } ] diff --git a/src/fs.json b/src/fs.json index 2b93344..31b2c4a 100644 --- a/src/fs.json +++ b/src/fs.json @@ -6,7 +6,7 @@ "content": [] }, { - "name": "file", + "name": "file.txt", "perms": { "r": true }, "dir": false, "content": "hi" diff --git a/src/window-utils.js b/src/window-utils.js index 8f990c8..f2cb794 100644 --- a/src/window-utils.js +++ b/src/window-utils.js @@ -46,11 +46,21 @@ let util = { let promise = new Promise(async (res, rej) => { let i = document.getElementsByClassName("window").length; let sel = []; + let sel_t_n = 0 + let sel_t = fs_types[sel_t_n] + l_b_width = 80 await window_create(i, "fs", ""); function load() { + let fil = [] let ll = 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 += "
" + //left bar + files+= "
" + files += "
" + files += "
" for (let f of tfs) { if (f.dir) { files += @@ -61,7 +71,9 @@ let util = { "' style='height:55px;position:relative;width:48px;display:inline-block;padding:10px;'>
" + f.name + "
"; + fil.push(f) } else { + if(RegExp(sel_t.regex,"g").test(f.name)){ files += "
" + f.name + "
"; + fil.push(f) + } } } + files+="
" let opts = ""; for (let uwu of fs_types) { + let aad = "" + if(uwu==sel_t) + aad = "selected" opts += - ""; + ""; } files += "
" + - "
File type:
" + + "-fd-bottom2-sel' >"+ opts + "'" + "
" + "
"; document.getElementById(i + "-content-content").innerHTML = files; - for (let f of tfs) { + //console.log(tfs) + for (let f of fil) { let tt = document.getElementById(i + "-id-name-" + f.name); + //console.log(tt,f) let dou = false; tt.onclick = (ev) => { if (dou) { - console.log(f, inp); + //console.log(f, inp); if (f.dir) { inp.path += f.name; } else { @@ -161,6 +181,10 @@ let util = { } }; } + document.getElementById(i +"-fd-bottom2-sel").onchange = (ev) => { + sel_t = fs_types[ev.target.selectedIndex] + load() + }; } load(); }); -- cgit v1.2.3