From fd1cbd101fb3de7f68e2c0edb2075a537ed6755a Mon Sep 17 00:00:00 2001 From: joshuaboud Date: Thu, 27 May 2021 16:22:08 -0300 Subject: [PATCH] add footer and file/dir count --- navigator/navigator.css | 17 +++++++++++++---- navigator/navigator.html | 24 +++++++++++++++--------- navigator/navigator.js | 8 ++++++++ 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/navigator/navigator.css b/navigator/navigator.css index 9202cd2..05ccb1c 100644 --- a/navigator/navigator.css +++ b/navigator/navigator.css @@ -139,6 +139,10 @@ body::-webkit-scrollbar-thumb { margin-bottom: 1em; } +.spacer-stretchy { + flex-grow: 1; +} + .nav-hidden { display: none; } @@ -148,6 +152,7 @@ body::-webkit-scrollbar-thumb { background-color: var(--container); color: var(--font); padding: 1em; + padding-bottom: 0; } .navigation-bar { @@ -291,11 +296,15 @@ body::-webkit-scrollbar-thumb { background-color: var(--textarea-bg); } +.nav-footer { + flex: 1; + align-items: baseline; + justify-content: flex-start; + padding: 5px; +} + .nav-toggle { - position: absolute; - right: 0; - bottom: 1.5em; - margin-right: 1.9em; + justify-self: flex-end; } .switch { diff --git a/navigator/navigator.html b/navigator/navigator.html index a6ea1d3..637838d 100644 --- a/navigator/navigator.html +++ b/navigator/navigator.html @@ -127,15 +127,21 @@ - + + diff --git a/navigator/navigator.js b/navigator/navigator.js index 7d4e9dd..416e490 100644 --- a/navigator/navigator.js +++ b/navigator/navigator.js @@ -423,6 +423,8 @@ class NavWindow { } } async refresh() { + var num_dirs = 0; + var num_files = 0; this.start_load(); var files = await this.pwd().get_children(this); while (this.entries.length) { @@ -430,12 +432,18 @@ class NavWindow { entry.destroy(); } files.forEach((file) => { + if (file.nav_type === "dir") + num_dirs++; + else + num_files++; file.show(); this.entries.push(file); }); document.getElementById("pwd").value = this.pwd().path_str(); this.set_selected(this.pwd()); this.show_selected_properties(); + document.getElementById("nav-num-dirs").innerText = num_dirs.toString(); + document.getElementById("nav-num-files").innerText = num_files.toString(); this.stop_load(); } pwd() {