Implement 'Show Hidden Files' feature

This commit is contained in:
Sun Jia Cheng
2024-03-09 11:37:34 +08:00
parent b56392cf3a
commit e39e38da11
7 changed files with 96 additions and 7 deletions
+12
View File
@@ -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'));
}
},
// -------------------------------------------
// -
// -------------------------------------------
'-',
+2 -1
View File
@@ -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 += `<div id="item-${item_id}"
class="item${options.is_selected ? ' item-selected':''} ${options.disabled ? 'item-disabled':''}"
class="item${options.is_selected ? ' item-selected':''} ${options.disabled ? 'item-disabled':''} item-${options.visible}"
data-id="${item_id}"
data-name="${html_encode(options.name)}"
data-metadata="${html_encode(options.metadata)}"
+12
View File
@@ -1880,6 +1880,18 @@ async function UIWindow(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'));
}
},
// -------------------------------------------
// -
// -------------------------------------------
'-',