Skip to content

Commit

Permalink
fixed settings: hide dot files
Browse files Browse the repository at this point in the history
  • Loading branch information
nelu committed May 4, 2024
1 parent b9e99c0 commit cb6437a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 51 deletions.
2 changes: 1 addition & 1 deletion init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

};

Expand Down
57 changes: 24 additions & 33 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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($('<div id="flm-settings-pane"></div>').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($('<div id="flm-settings-pane">'+view+'</div>').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();
}
}
};
Expand Down Expand Up @@ -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);
}
});
Expand Down
17 changes: 0 additions & 17 deletions views/settings-pane.twig
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,3 @@
</table>
</fieldset>

{# <fieldset>
<legend>Screenshot Settings</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Screens rows:</td>
<td><input type="text" name="textfield" class="Textbox num1" id="flm-settings-opt-scrows" value=""/></td>
</tr>
<tr>
<td>Screens columns:</td>
<td><input type="text" name="textfield" class="Textbox num1" id="flm-settings-opt-sccols" value=""/></td>
</tr>
<tr>
<td>Thumbnail width:</td>
<td><input type="text" name="textfield" class="Textbox num1" id="flm-settings-opt-scwidth" value=""/></td>
</tr>
</table>
</fieldset>#}

0 comments on commit cb6437a

Please sign in to comment.