some refactoring, cleanup and minor fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-12-10 06:56:52 +03:00
parent c83a4f9ad3
commit 384450d75f
3 changed files with 43 additions and 17 deletions

View File

@ -197,15 +197,20 @@
opacity: 0.4;
}
/* highlight seach... */
.browse-widget .list>div .text b {
background-color: rgba(0, 0, 255, 0.5);
}
.browse-widget .list>div.strike-out .text {
text-decoration: line-through;
opacity: 0.3;
}
.browse-widget .list>div.highlighted {
font-style: italic;
font-weight: bold;
}
.browse-widget .list>div.highlighted:after {
content: '*';
.browse-widget .list>div.highlighted .text:after {
content: ' *';
}
.browse-widget:not(.flat) .list div:not(.not-traversable) .text:after {
content: "/";

View File

@ -65,6 +65,7 @@ function(path, make){
var listDirfs =
module.listDirfs =
function(path, make){
var that = this
path = path.constructor == Array ? path.join('/') : path
path = /^[a-zA-Z]:/.test(path.trim()) ? path : '/'+path
// XXX the windows root path must have a trailing '/'
@ -127,7 +128,7 @@ function(path, make){
// so we'll not wait...
if(res && dir){
var i = 0
glob(path +'/'+ file +'/*+(jpg|jpeg|png|JPG|JPEG|PNG)')
glob(path +'/'+ file +'/'+ that.options.fileCountPattern)
/*
.on('match', function(){
i += 1
@ -231,6 +232,8 @@ WalkPrototype.options = {
pushButton: false,
list: listDir,
fileCountPattern: '*+(jpg|jpeg|png|JPG|JPEG|PNG)',
}
WalkPrototype.options.__proto__ = browse.Browser.prototype.options
@ -243,16 +246,30 @@ object.makeConstructor('Walk',
var makeWalk =
module.makeWalk = function(elem, path, showNonTraversable, showDisabled){
var w = Walk(elem, {
path: path,
showNonTraversable: showNonTraversable == null ?
WalkPrototype.options.showNonTraversable
: showNonTraversable,
showDisabled: showDisabled == null ?
WalkPrototype.options.showDisabled
: showDisabled,
})
module.makeWalk = function(elem, path, showNonTraversable, showDisabled, fileCountPattern, rest){
var opts = {}
if(rest){
for(var k in rest){
opts[k] = rest[k]
}
}
opts.path = path
opts.showNonTraversable = showNonTraversable == null ?
WalkPrototype.options.showNonTraversable
: showNonTraversable
opts.showDisabled = showDisabled == null ?
WalkPrototype.options.showDisabled
: showDisabled
opts.fileCountPattern = fileCountPattern == null ?
WalkPrototype.options.fileCountPattern
: fileCountPattern
var w = Walk(elem, opts)
return w
}

View File

@ -3453,6 +3453,8 @@ function(path){
var FileSystemLoaderActions = actions.Actions({
config: {
'index-dir': '.ImageGrid',
'image-file-pattern': '*+(jpg|jpeg|png|JPG|JPEG|PNG)',
},
clone: [function(full){
@ -3623,7 +3625,7 @@ var FileSystemLoaderActions = actions.Actions({
// XXX not sure if this is the way to go...
this._base_path = path
glob(path + '/*+(jpg|jpeg|png|JPG|JPEG|PNG)')
glob(path + '/'+ this.config['image-file-pattern'])
.on('error', function(err){
console.log('!!!!', err)
})
@ -3663,7 +3665,7 @@ var FileSystemLoaderActions = actions.Actions({
var base_pattern = RegExp('^'+path)
// find images...
glob(path + '/*+(jpg|jpeg|png|JPG|JPEG|PNG)')
glob(path + '/'+ this.config['image-file-pattern'])
.on('end', function(lst){
// create a new images chunk...
lst = lst
@ -3778,7 +3780,9 @@ var FileSystemLoaderUIActions = actions.Actions({
base = base || this.base_path || '/'
var o = overlay.Overlay(this.ribbons.viewer,
require('./lib/widget/browse-walk').makeWalk(null, base, false, false)
require('./lib/widget/browse-walk').makeWalk(
null, base, false, false,
this.config['image-file-pattern'])
// path selected...
.open(function(evt, path){
var item = o.client.selected
@ -4186,7 +4190,7 @@ var URLHistoryUIActions = actions.Actions({
var makeRE = function(path){
return RegExp('^'
// quote regular expression chars...
+p.replace(/([\.\\\/\(\)\[\]\$\*\+\-\{\}\@\^\&\?\<\>])/g, '\\$1')
+path.replace(/([\.\\\/\(\)\[\]\$\*\+\-\{\}\@\^\&\?\<\>])/g, '\\$1')
+'$')
}