mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-03 12:50:09 +00:00
added history api...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ef2bc3c38c
commit
f8812049f6
23
ui/data.js
23
ui/data.js
@ -1619,7 +1619,9 @@ function preCacheAllRibbons(){
|
|||||||
function setupBaseURLHistory(){
|
function setupBaseURLHistory(){
|
||||||
$('.viewer')
|
$('.viewer')
|
||||||
.on('baseURLChanged', function(evt, old_url, new_url){
|
.on('baseURLChanged', function(evt, old_url, new_url){
|
||||||
BASE_URL_HISTORY.splice(0, 0, old_url)
|
if(BASE_URL_HISTORY.indexOf(old_url) < 0){
|
||||||
|
BASE_URL_HISTORY.splice(0, 0, old_url)
|
||||||
|
}
|
||||||
|
|
||||||
// truncate the history if needed...
|
// truncate the history if needed...
|
||||||
if(BASE_URL_HISTORY.length > BASE_URL_LIMIT){
|
if(BASE_URL_HISTORY.length > BASE_URL_LIMIT){
|
||||||
@ -1628,10 +1630,23 @@ function setupBaseURLHistory(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX...
|
function getURLHistoryPosition(){
|
||||||
function getNextLocation(){
|
return BASE_URL_HISTORY.indexOf(BASE_URL)
|
||||||
}
|
}
|
||||||
function getPrevLocation(){
|
function getURLHistoryNext(){
|
||||||
|
var res = BASE_URL_HISTORY[ getURLHistoryPosition() + 1]
|
||||||
|
return res == null ? BASE_URL : res
|
||||||
|
}
|
||||||
|
function getURLHistoryPrev(){
|
||||||
|
var res = BASE_URL_HISTORY[ getURLHistoryPosition() - 1 ]
|
||||||
|
return res == null ? BASE_URL : res
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadURLHistoryNext(){
|
||||||
|
statusNotify(loadDir(getURLHistoryNext()))
|
||||||
|
}
|
||||||
|
function loadURLHistoryPrev(){
|
||||||
|
statusNotify(loadDir(getURLHistoryPrev()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user