From cb6437a9e5db30175f274a7c13b863ecd6861aae Mon Sep 17 00:00:00 2001 From: nelu Date: Sat, 4 May 2024 06:31:38 +0300 Subject: [PATCH] fixed settings: hide dot files --- init.js | 2 +- js/app.js | 57 +++++++++++++++++----------------------- views/settings-pane.twig | 17 ------------ 3 files changed, 25 insertions(+), 51 deletions(-) diff --git a/init.js b/init.js index 743d9b8..6fa8c02 100644 --- a/init.js +++ b/init.js @@ -261,7 +261,7 @@ plugin.ui.init = function () { if (plugin.enabled) { window.flm.ui.settings.onSave(arg); } - plugin.flmSetSettings.call(this); + plugin.flmSetSettings.call(this, arg); }; diff --git a/js/app.js b/js/app.js index b7c948c..bbce47b 100644 --- a/js/app.js +++ b/js/app.js @@ -433,11 +433,10 @@ "sccols": 4, "scwidth": 300 }, - init: false, getSettingValue: function (name) { return $type(theWebUI.settings["webui.flm.settings." + name]) - && theWebUI.settings["webui.flm.settings." + name] - || this.defaults[name]; + ? theWebUI.settings["webui.flm.settings." + name] + : this.defaults[name]; }, getSettings: function () { @@ -450,49 +449,41 @@ return all; }, - + // plugin config tab in UI settings onShow: function () { - // plugin config tab in UI settings - - var self = this; - // 1 dialog is enough :) - - flm.views.getView(flm.views.viewsPath + '/' + 'settings-pane', {'opts': this.getSettings()}, function (view) { - if (!self.init) { - self.init = true; - flm.getPlugin() - .attachPageToOptions($('
').get(0), theUILang.fManager); - } - - $(document).trigger(flm.EVENTS.settingsShow, view); - - $('#flm-settings-pane').html(view); - - }); + if (!$('#flm-settings-pane').length) { + // load view + flm.views.getView(flm.views.viewsPath + '/' + 'settings-pane', + {'opts': this.getSettings()}, + function (view) { + flm.getPlugin() + .attachPageToOptions($('
'+view+'
').get(0), theUILang.fManager); + $(document).trigger(flm.EVENTS.settingsShow, view); + } + ); + } else { + $(document).trigger(flm.EVENTS.settingsShow); + } }, onSave: function () { var needsave = false; $('#flm-settings-pane').find('input,select').each(function (index, ele) { - var inid = $(ele).attr('id').split('flm-settings-opt-'); - var inval; - - if ($(ele).attr('type') === 'checkbox') { - inval = $(ele).is(':checked'); - } else { - inval = $(ele).val(); - } + var inid = $(ele).attr('id').split('flm-settings-opt-')[1]; + var inval = $(ele).attr('type') === 'checkbox' + ? $(ele).is(':checked') + : $(ele).val(); - if (inval !== self.settings.getSettingValue(inid[1])) { - theWebUI.settings["webui.flm.settings." + inid[1]] = inval; + if (inval !== self.settings.getSettingValue(inid)) { + theWebUI.settings["webui.flm.settings." + inid] = inval; needsave = true; } }); if (needsave) { theWebUI.save(); - self.browser.table().refreshRows(); + flm.Refresh(); } } }; @@ -961,7 +952,7 @@ table.addRowById(entry, hash, flm.utils.getICO(file.name)); - if (!self.settings.getSettingValue('showhidden') && (file.name.charAt(0) === '.')) { + if (!flm.ui.settings.getSettingValue('showhidden') && (file.name.charAt(0) === '.')) { table.hideRow(hash); } }); diff --git a/views/settings-pane.twig b/views/settings-pane.twig index ebd46e0..46bcdc0 100644 --- a/views/settings-pane.twig +++ b/views/settings-pane.twig @@ -74,20 +74,3 @@ -{#
- Screenshot Settings - - - - - - - - - - - - - -
Screens rows:
Screens columns:
Thumbnail width:
-
#}