mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added option to hide dod files in the fs browser...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
62a9b43fe5
commit
f7cc2ba306
@ -78,14 +78,21 @@ function(attr, states, a, b){
|
||||
: states instanceof Function ? states.call(this)
|
||||
: states
|
||||
|
||||
// get attr path...
|
||||
var a = attr.split(/\./g)
|
||||
var cfg = a.slice(0, -1)
|
||||
.reduce(function(res, cur){
|
||||
return res[cur] }, this.config)
|
||||
|
||||
if(action == null){
|
||||
var cfg = this.config[attr]
|
||||
return cfg == null ?
|
||||
var val = cfg[a.pop()]
|
||||
return val == null ?
|
||||
(lst[lst.indexOf('none')] || lst[0])
|
||||
: cfg
|
||||
: val
|
||||
|
||||
} else {
|
||||
this.config[attr] = action
|
||||
cfg[a[a.length-1]] = action
|
||||
this.config[a[0]] = this.config[a[0]]
|
||||
}
|
||||
},
|
||||
states, pre, post)
|
||||
|
||||
@ -874,6 +874,9 @@ var FileSystemLoaderUIActions = actions.Actions({
|
||||
showNonTraversable: true,
|
||||
showDisabled: true,
|
||||
|
||||
disableDotFiles: 'on',
|
||||
//disableHiddenFiles: false,
|
||||
|
||||
//actionButton: '⋯', // "..."
|
||||
//actionButton: '⮠', // down then left arrow (long)
|
||||
//actionButton: '▹', // right-pointing white triangle
|
||||
@ -896,6 +899,8 @@ var FileSystemLoaderUIActions = actions.Actions({
|
||||
|
||||
var cfg = Object.create(this.config['file-browser-settings'])
|
||||
cfg.cls = 'file-browser'
|
||||
// normalize...
|
||||
cfg.disableDotFiles = cfg.disableDotFiles == 'on'
|
||||
|
||||
base = base || this.location.path || '/'
|
||||
base = util.normalizePath(base)
|
||||
@ -936,12 +941,15 @@ var FileSystemLoaderUIActions = actions.Actions({
|
||||
})
|
||||
// we closed the browser -- save settings to .config...
|
||||
.on('close', function(){
|
||||
|
||||
var config = that.config['file-browser-settings']
|
||||
var config =
|
||||
that.config['file-browser-settings'] =
|
||||
that.config['file-browser-settings'] || {}
|
||||
|
||||
config.disableFiles = o.options.disableFiles
|
||||
config.showDisabled = o.options.showDisabled
|
||||
config.showNonTraversable = o.options.showNonTraversable
|
||||
// normalize...
|
||||
config.disableDotFiles = o.options.disableDotFiles ? 'on' : 'off'
|
||||
})
|
||||
|
||||
return o
|
||||
@ -1005,6 +1013,11 @@ var FileSystemLoaderUIActions = actions.Actions({
|
||||
|
||||
return o
|
||||
})],
|
||||
|
||||
toggleDotFileDrawing: ['Interface/File browser/Hide dot files',
|
||||
core.makeConfigToggler(
|
||||
'file-browser-settings.disableDotFiles',
|
||||
['on', 'off'])],
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -196,16 +196,20 @@ function(path, make){
|
||||
}
|
||||
|
||||
var dir = res.isDirectory()
|
||||
var elem = res && make(fullpath
|
||||
? path +'/'+ file
|
||||
: file + (dir ? '/' : ''),
|
||||
null,
|
||||
that.options.disableFiles && !dir)
|
||||
var elem = res
|
||||
&& !(that.options.disableDotFiles
|
||||
&& file.startsWith('.'))
|
||||
&& make(fullpath
|
||||
? path +'/'+ file
|
||||
: file + (dir ? '/' : ''),
|
||||
null,
|
||||
that.options.disableFiles
|
||||
&& !dir)
|
||||
|
||||
// count the number of files...
|
||||
// NOTE: we do not care how long it will take
|
||||
// so we'll not wait...
|
||||
res && dir && _countDirFiles(path, file, elem)
|
||||
res && dir && elem && _countDirFiles(path, file, elem)
|
||||
})
|
||||
// NOTE: we are not using promise.all(..) here because it
|
||||
// triggers BEFORE the first make(..) is called...
|
||||
@ -285,41 +289,60 @@ var listDir = module.listDir = listDirfs
|
||||
// XXX for some reason pop does not focus the container dir correctly...
|
||||
// ...this is potentially due to the list not being ready yet...
|
||||
// XXX this should be smarter and support other URL schemes...
|
||||
var WalkPrototype = Object.create(browse.Browser.prototype)
|
||||
WalkPrototype.options = {
|
||||
// XXX this should be smarter and support other URL schemes...
|
||||
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
|
||||
var WalkPrototype = {
|
||||
__proto__: browse.Browser.prototype,
|
||||
|
||||
fullPathEdit: true,
|
||||
traversable: true,
|
||||
flat: false,
|
||||
options: {
|
||||
__proto__: browse.Browser.prototype.options,
|
||||
|
||||
sortTraversable: 'first',
|
||||
// XXX this should be smarter and support other URL schemes...
|
||||
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
|
||||
|
||||
//actionButton: '⋯', // "..."
|
||||
//actionButton: '⊙', // circle with dot
|
||||
actionButton: '⮠', // down then left arrow (long)
|
||||
//actionButton: '▹', // right-pointing white triangle
|
||||
//actionButton: '◹', // ne white triangle
|
||||
//actionButton: '↗', // ne arrow
|
||||
//actionButton: '⮣', // up then right arrow
|
||||
//actionButton: '»', // right-pointing double angle
|
||||
// quotation mark
|
||||
// XXX not sure about this...
|
||||
//actionButton: '📂', // folder icon (color)
|
||||
fullPathEdit: true,
|
||||
traversable: true,
|
||||
flat: false,
|
||||
|
||||
pushButton: false,
|
||||
sortTraversable: 'first',
|
||||
|
||||
list: listDir,
|
||||
//actionButton: '⋯', // "..."
|
||||
//actionButton: '⊙', // circle with dot
|
||||
actionButton: '⮠', // down then left arrow (long)
|
||||
//actionButton: '▹', // right-pointing white triangle
|
||||
//actionButton: '◹', // ne white triangle
|
||||
//actionButton: '↗', // ne arrow
|
||||
//actionButton: '⮣', // up then right arrow
|
||||
//actionButton: '»', // right-pointing double angle
|
||||
// quotation mark
|
||||
// XXX not sure about this...
|
||||
//actionButton: '📂', // folder icon (color)
|
||||
|
||||
fileCountPattern: '*',
|
||||
pushButton: false,
|
||||
|
||||
disableFiles: false,
|
||||
list: listDir,
|
||||
|
||||
// enable '.' and '..' dirs...
|
||||
dotDirs: true,
|
||||
fileCountPattern: '*',
|
||||
|
||||
disableFiles: false,
|
||||
|
||||
disableDotFiles: true,
|
||||
//disableHiddenFiles: false,
|
||||
|
||||
|
||||
// enable '.' and '..' dirs...
|
||||
dotDirs: true,
|
||||
},
|
||||
|
||||
toggleDotFileDrawing: function(){
|
||||
var cur = this.selected
|
||||
if(this.options.toggleDisabledDrawing == false){
|
||||
return this
|
||||
}
|
||||
this.options.disableDotFiles = !this.options.disableDotFiles
|
||||
this.update()
|
||||
cur && this.select(cur)
|
||||
return this
|
||||
},
|
||||
}
|
||||
WalkPrototype.options.__proto__ = browse.Browser.prototype.options
|
||||
|
||||
|
||||
var Walk =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user