mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
afcdea9feb
commit
28fac49755
@ -30,6 +30,8 @@ var URLHistoryActions = actions.Actions({
|
||||
// -1 - no limit.
|
||||
// 0 - disabled
|
||||
// 1+ - length of history
|
||||
//
|
||||
// NOTE: this does not account for pinned items.
|
||||
'url-history-length': 100,
|
||||
},
|
||||
|
||||
@ -112,6 +114,8 @@ var URLHistoryActions = actions.Actions({
|
||||
}],
|
||||
// NOTE: if clear is not true then this will update a history item
|
||||
// rather than fully rewriting it...
|
||||
// NOTE: this will not auto-remove pinned items if the length of
|
||||
// history is more than allowed...
|
||||
pushURLToHistory: ['- History/',
|
||||
function(url, open, check, clear){
|
||||
url = url || this.location.path
|
||||
@ -142,6 +146,9 @@ var URLHistoryActions = actions.Actions({
|
||||
// update history length...
|
||||
if(l > 0){
|
||||
var k = Object.keys(this.url_history)
|
||||
// we will not remove pinned items...
|
||||
.filter((function(e){
|
||||
return !this.url_history[e].pinned }).bind(this))
|
||||
while(k.length > l){
|
||||
// drop first url in order -- last added...
|
||||
this.dropURLFromHistory(k[0])
|
||||
@ -191,15 +198,15 @@ var URLHistoryActions = actions.Actions({
|
||||
core.doc`Get/set history pin order
|
||||
|
||||
Get pin order...
|
||||
.pinURLOrder(<url>)
|
||||
.pinnnedURLOrder(<url>)
|
||||
-> order
|
||||
|
||||
Set pin order...
|
||||
.pinURLOrder(<url>, <order>)
|
||||
.pinnnedURLOrder(<url>, <order>)
|
||||
-> this
|
||||
|
||||
Set pin order to 'auto'...
|
||||
.pinURLOrder(<url>, 'auto')
|
||||
.pinnnedURLOrder(<url>, 'auto')
|
||||
-> this
|
||||
|
||||
Auto-ordered pins are sorted in the same order as .url_history
|
||||
|
||||
@ -399,18 +399,27 @@ function(path, index_dir, logger){
|
||||
|
||||
// Load index(s)...
|
||||
//
|
||||
// Load path (use default INDEX_DIR)...
|
||||
// loadIndex(path)
|
||||
// -> data
|
||||
//
|
||||
// loadIndex(path, logger)
|
||||
// -> data
|
||||
//
|
||||
// Load path with custom index_dir...
|
||||
// loadIndex(path, index_dir, logger)
|
||||
// -> data
|
||||
//
|
||||
// Load from date...
|
||||
// loadIndex(path, index_dir, from_date, logger)
|
||||
// -> data
|
||||
//
|
||||
// Load path as-is (do not search for index dir)...
|
||||
// loadIndex(path, false)
|
||||
// loadIndex(path, false, logger)
|
||||
// -> data
|
||||
//
|
||||
// loadIndex(path, false, from_date, logger)
|
||||
// -> data
|
||||
//
|
||||
//
|
||||
// Procedure:
|
||||
// - locate indexes in path given
|
||||
@ -490,7 +499,10 @@ function(path, index_dir, from_date, logger){
|
||||
logger = from_date
|
||||
from_date = null
|
||||
}
|
||||
index_dir = index_dir || INDEX_DIR
|
||||
//index_dir = index_dir || INDEX_DIR
|
||||
index_dir = index_dir === false ?
|
||||
index_dir
|
||||
: (index_dir || INDEX_DIR)
|
||||
|
||||
// XXX should this be interactive (a-la EventEmitter) or as it is now
|
||||
// return the whole thing as a block (Promise)...
|
||||
@ -499,13 +511,15 @@ function(path, index_dir, from_date, logger){
|
||||
return new Promise(function(resolve, reject){
|
||||
// prepare the index_dir and path....
|
||||
// NOTE: index_dir can be more than a single directory...
|
||||
var i = util.normalizePath(index_dir).split(/[\\\/]/g)
|
||||
var i = index_dir
|
||||
&& util.normalizePath(index_dir).split(/[\\\/]/g)
|
||||
var p = util.normalizePath(path).split(/[\\\/]/g).slice(-i.length)
|
||||
|
||||
var explicit_index_dir = (i.filter(function(e, j){ return e == p[j] }).length == i.length)
|
||||
var explicit_index_dir = !index_dir
|
||||
|| (i.filter(function(e, j){ return e == p[j] }).length == i.length)
|
||||
|
||||
// we've got an index...
|
||||
// XXX do we need to check if if it's a dir???
|
||||
// XXX do we need to check if it's a dir???
|
||||
if(explicit_index_dir){
|
||||
|
||||
logger && logger.emit('path', path)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user