From 0cb10535ba89c8fcd9a9d49444a9a9bea8d0f5e2 Mon Sep 17 00:00:00 2001 From: amy Date: Thu, 23 Feb 2023 15:20:17 +0000 Subject: swapped old scrollbars --- html/display.html | 34 +++++++++++++++++++++++++--------- src/common.js | 22 ++++++++++++++++++++++ src/window-utils.js | 9 +++++++-- 3 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 src/common.js diff --git a/html/display.html b/html/display.html index 118a318..08d8fdb 100644 --- a/html/display.html +++ b/html/display.html @@ -6,6 +6,7 @@ + ~nya @@ -197,10 +198,7 @@ a += "
" a += "
" + content + "
" - if (options.scroll != false && options.scroll != "false") { - a += "
" - a += "
" - } + a += "
" if (options.resize != false && options.resize != "false") { a += "
" @@ -209,6 +207,11 @@ a += "
" } document.getElementById("root").innerHTML += a + if (options.scroll != false && options.scroll != "false") { + //a += "
" + //a += "
" + util.scrollbar(uid,'content-scroll',document.getElementById(uid + "-content-root"),document.getElementById(uid + "-content-content")) + } //console.log(document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) //console.log(document.getElementById(uid + "-content-scrollbar-point")) @@ -219,9 +222,12 @@ } function refresh_windows() { load_bar() + let elems = document.getElementsByClassName("window") for (let i = 0; i != elems.length; i++) { let uid = elems.item(i).id.split("-")[0] + if(null!=procs[uid] && null!=procs[uid].refresh) + procs[uid].refresh() try { document.getElementById(uid + "-content-scrollbar-point").style.height = (document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) + "px" @@ -353,6 +359,7 @@ //if (sel == 'resize-s' || sel == 'resize-n' || ) { if(null!=procs[uid] && null!=procs[uid].refresh) procs[uid].refresh() + /* for (let iii = 0; iii != elem.parentElement.parentElement.parentElement.children.length; iii++) { //console.log(elem.parentElement.parentElement.parentElement.children.item(iii).className) if (elem.parentElement.parentElement.parentElement.children.item(iii).className == "content-root") { @@ -387,7 +394,7 @@ } break } - } + }*/ //} py = (evm.clientY) px = (evm.clientX) @@ -396,6 +403,7 @@ }) } }) + /* let temp let scrolling = false for (let ii = 0; ii != elec.length; ii++) { @@ -415,6 +423,8 @@ for (let iiiii = 0; iiiii != elec.item(ii).children.length; iiiii++) { if (elec.item(ii).children.item(iiiii).className == 'content-content') { + + //console.log(elec.item(ii).children.item(iiiii), "hi") con = elec.item(ii).children.item(iiiii) elec.item(ii).onscroll = ((ev) => { @@ -477,7 +487,7 @@ if (elem.className == 'scrollbar-point') { - } + }*/ @@ -504,9 +514,15 @@ for (let ii = 0; ii != a_p_c.length; ii++) { if (a_p_c.item(ii).id == id + "-history") { let his = a_p_c.item(ii).id - if (procs[id] == undefined) - procs[id] = new jssh(fs, "/", id, inp, his, window_create) - procs[id].ex() + if(procs[id] == undefined) + procs[id] = {} + if (procs[id].comm == undefined){ + + procs[id].comm = new jssh(fs, "/", id, inp, his, window_create) + } + //console.log(procs) + //return + procs[id].comm.ex() refresh_windows() a.parentElement.parentElement.scrollTop = a.parentElement.parentElement.scrollHeight break diff --git a/src/common.js b/src/common.js new file mode 100644 index 0000000..5606706 --- /dev/null +++ b/src/common.js @@ -0,0 +1,22 @@ +Object.prototype.clone = Array.prototype.clone = function() //https://stackoverflow.com/questions/12690107/clone-object-without-reference-javascript +{ + if (Object.prototype.toString.call(this) === '[object Array]') + { + var clone = []; + for (var i=0; i
" let thi_point = document.getElementById(uid + "-" + minor_uid + "-content-scrollbar-point") let thi_base = document.getElementById(uid + "-" + minor_uid + "-content-scrollbar") procs[uid].refresh = ()=>{ - console.log(root.clientHeight / (target.clientHeight / root.clientHeight) / root.clientHeight) + + //console.log(root.clientHeight / (target.clientHeight / root.clientHeight) / root.clientHeight) thi_point.style.display = "block" thi_base.style.display = "block" thi_point.style.height = root.clientHeight / (target.clientHeight / root.clientHeight) @@ -35,6 +36,10 @@ let util = { thi_point.style.display = "none" thi_base.style.display = "none" } + + if(thi_base.clientHeight { -- cgit v1.2.3