mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +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.
|
// -1 - no limit.
|
||||||
// 0 - disabled
|
// 0 - disabled
|
||||||
// 1+ - length of history
|
// 1+ - length of history
|
||||||
|
//
|
||||||
|
// NOTE: this does not account for pinned items.
|
||||||
'url-history-length': 100,
|
'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
|
// NOTE: if clear is not true then this will update a history item
|
||||||
// rather than fully rewriting it...
|
// rather than fully rewriting it...
|
||||||
|
// NOTE: this will not auto-remove pinned items if the length of
|
||||||
|
// history is more than allowed...
|
||||||
pushURLToHistory: ['- History/',
|
pushURLToHistory: ['- History/',
|
||||||
function(url, open, check, clear){
|
function(url, open, check, clear){
|
||||||
url = url || this.location.path
|
url = url || this.location.path
|
||||||
@ -142,6 +146,9 @@ var URLHistoryActions = actions.Actions({
|
|||||||
// update history length...
|
// update history length...
|
||||||
if(l > 0){
|
if(l > 0){
|
||||||
var k = Object.keys(this.url_history)
|
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){
|
while(k.length > l){
|
||||||
// drop first url in order -- last added...
|
// drop first url in order -- last added...
|
||||||
this.dropURLFromHistory(k[0])
|
this.dropURLFromHistory(k[0])
|
||||||
@ -191,15 +198,15 @@ var URLHistoryActions = actions.Actions({
|
|||||||
core.doc`Get/set history pin order
|
core.doc`Get/set history pin order
|
||||||
|
|
||||||
Get pin order...
|
Get pin order...
|
||||||
.pinURLOrder(<url>)
|
.pinnnedURLOrder(<url>)
|
||||||
-> order
|
-> order
|
||||||
|
|
||||||
Set pin order...
|
Set pin order...
|
||||||
.pinURLOrder(<url>, <order>)
|
.pinnnedURLOrder(<url>, <order>)
|
||||||
-> this
|
-> this
|
||||||
|
|
||||||
Set pin order to 'auto'...
|
Set pin order to 'auto'...
|
||||||
.pinURLOrder(<url>, 'auto')
|
.pinnnedURLOrder(<url>, 'auto')
|
||||||
-> this
|
-> this
|
||||||
|
|
||||||
Auto-ordered pins are sorted in the same order as .url_history
|
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 index(s)...
|
||||||
//
|
//
|
||||||
|
// Load path (use default INDEX_DIR)...
|
||||||
// loadIndex(path)
|
// loadIndex(path)
|
||||||
// -> data
|
|
||||||
//
|
|
||||||
// loadIndex(path, logger)
|
// loadIndex(path, logger)
|
||||||
// -> data
|
// -> data
|
||||||
//
|
//
|
||||||
|
// Load path with custom index_dir...
|
||||||
// loadIndex(path, index_dir, logger)
|
// loadIndex(path, index_dir, logger)
|
||||||
// -> data
|
// -> data
|
||||||
//
|
//
|
||||||
|
// Load from date...
|
||||||
// loadIndex(path, index_dir, from_date, logger)
|
// loadIndex(path, index_dir, from_date, logger)
|
||||||
// -> data
|
// -> 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:
|
// Procedure:
|
||||||
// - locate indexes in path given
|
// - locate indexes in path given
|
||||||
@ -490,7 +499,10 @@ function(path, index_dir, from_date, logger){
|
|||||||
logger = from_date
|
logger = from_date
|
||||||
from_date = null
|
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
|
// XXX should this be interactive (a-la EventEmitter) or as it is now
|
||||||
// return the whole thing as a block (Promise)...
|
// 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){
|
return new Promise(function(resolve, reject){
|
||||||
// prepare the index_dir and path....
|
// prepare the index_dir and path....
|
||||||
// NOTE: index_dir can be more than a single directory...
|
// 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 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...
|
// 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){
|
if(explicit_index_dir){
|
||||||
|
|
||||||
logger && logger.emit('path', path)
|
logger && logger.emit('path', path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user