From e39e38da112d0dee5fb96ea7de9cfe2c36777928 Mon Sep 17 00:00:00 2001 From: Sun Jia Cheng Date: Sat, 9 Mar 2024 11:06:14 +0800 Subject: [PATCH] Implement 'Show Hidden Files' feature --- .gitignore | 3 ++- src/UI/UIDesktop.js | 12 ++++++++++++ src/UI/UIItem.js | 3 ++- src/UI/UIWindow.js | 12 ++++++++++++ src/css/style.css | 12 ++++++++++++ src/globals.js | 13 ++++++++++++ src/helpers.js | 48 ++++++++++++++++++++++++++++++++++++++++----- 7 files changed, 96 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 8b23bc40..289d6b5b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ node_modules/ *.tgz license.config.json license-header.txt -dist/ \ No newline at end of file +dist/ +.vscode/ \ No newline at end of file diff --git a/src/UI/UIDesktop.js b/src/UI/UIDesktop.js index 6b85a06e..844053be 100644 --- a/src/UI/UIDesktop.js +++ b/src/UI/UIDesktop.js @@ -683,6 +683,18 @@ async function UIDesktop(options){ } }, // ------------------------------------------- + // Show/Hide hidden files + // ------------------------------------------- + { + html: `${window.user_preferences.show_hidden_files ? 'Hide' : 'Show'} hidden files`, + onClick: function(){ + window.mutate_user_preferences({ + show_hidden_files : !window.user_preferences.show_hidden_files, + }); + window.show_or_hide_files(document.querySelectorAll('.item-container')); + } + }, + // ------------------------------------------- // - // ------------------------------------------- '-', diff --git a/src/UI/UIItem.js b/src/UI/UIItem.js index b40cf5fc..4d580128 100644 --- a/src/UI/UIItem.js +++ b/src/UI/UIItem.js @@ -46,6 +46,7 @@ function UIItem(options){ // set options defaults options.disabled = options.disabled ?? false; + options.visible = options.visible ?? 'visible'; // one of 'visible', 'revealed', 'hidden' options.is_dir = options.is_dir ?? false; options.is_selected = options.is_selected ?? false; options.is_shared = options.is_shared ?? false; @@ -71,7 +72,7 @@ function UIItem(options){ // -------------------------------------------------------- let h = ''; h += `