mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-02 01:51:55 +00:00
Implement 'Show Hidden Files' feature
This commit is contained in:
@@ -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
@@ -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)}"
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
},
|
||||
// -------------------------------------------
|
||||
// -
|
||||
// -------------------------------------------
|
||||
'-',
|
||||
|
||||
Reference in New Issue
Block a user