From 7b140d47b7636a78fff2dc5186da47b12df76a52 Mon Sep 17 00:00:00 2001 From: amy Date: Wed, 1 Mar 2023 14:11:14 +0000 Subject: experimental mouse things --- src/window-utils.js | 84 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 5 deletions(-) diff --git a/src/window-utils.js b/src/window-utils.js index 89f56de..4d529ec 100644 --- a/src/window-utils.js +++ b/src/window-utils.js @@ -194,6 +194,7 @@ let util = { return promise; }, async fd(inp) { + //let filter = "" let i = document.getElementsByClassName("window").length; let promise = new Promise(async (res, rej) => { @@ -303,8 +304,8 @@ let util = { i + "-fd-bottom' class='fd-bottom' >
File name:
uwu
nyadjkbkcbshvbhfbvjhdfvbdfbvjhdf
" - +"
File name:
"+ //
uwu
nyadjkbkcbshvbhfbvjhdfvbdfbvjhdf
" + "
") + em = document.getElementById(i+"-fd-bottom-sel-sug") + } + let oldsearch = [...search] + console.log(oldsearch) + for(let s in oldsearch){ + oldsearch[s] = "
"+oldsearch[s]+"
" + } + em.style.display="block" + em.innerHTML = oldsearch.join("
") + //console.log(search) + for(let s in search){ + document.getElementById(i+"-fd-bottom-sel-sug-item-"+s).onmousedown = () => { + console.log("click") + let pp = ll.clean_path(search[s]).split("/").filter(rem_emp) + sel = [...pp.splice(pp.length - 1,1)] + inp.path = (pp.length == 0) ? "/" : pp.join("/").trim() + load() + } + } + //console.log(em) + } else { + try{document.getElementById(i+"-fd-bottom-sel-sug").style.display = "none"}catch(e){} + + } //console.log() } + zzz() document.body.addEventListener("input",zzz) document.getElementById(i +"-fd-bottom-sel").onblur = ((ev)=>{ + console.log("blur") document.body.removeEventListener("input",zzz) + //setTimeout(()=>{ + try{document.getElementById(i+"-fd-bottom-sel-sug").style.display = "none"}catch(e){} + //},300) + }) }) //console.log(inp.path.split("/").filter(rem_emp)) @@ -438,7 +488,8 @@ let util = { }} ],on_exit:()=>{for(let z in tt.children){tt.children.item(z).innerHTML = fil[fil.indexOf(f)].name} }},Array.from(tt.children)) let dou = false; - tt.onclick = (ev) => { + tt.onmousedown = (ev) => { + if (dou) { //console.log(f, inp); if (f.dir) { @@ -468,6 +519,9 @@ let util = { dou = true; tt.style.boxShadow = "0 0 0 1px rgba(0,0,244,0.4) inset" tt.style.backgroundColor = "rgba(0,0,244,0.2)"; + tt.onmouseup = (()=>{ + //console.log(aauwu) + clearInterval(aauwu) setTimeout(() => { if (dou) { if (ev.ctrlKey) { @@ -513,7 +567,27 @@ let util = { //load(); dou = false; } - }, 200); + }, 100); + }) + let aauwu = setTimeout(()=>{ + tt.onmouseup = null; + for (let aa of tfs) { + let ttt = document.getElementById( + i + "-id-name-" + aa.name + ); + if (sel.includes(aa.name)) { + ttt.style.backgroundColor = "rgba(0,0,244,0.2)"; + ttt.style.boxShadow = "0 0 0 1px rgba(0,0,244,0.4) inset" + + } else { + ttt.style.boxShadow = "" + ttt.style.backgroundColor = ""; + } + } + //load(); + dou = false; + //the click was long enough to be a drag + },200) } }; } -- cgit v1.2.3