From cd0e8b43dc696f5cb9f2937ffc59d67413a0bc11 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 25 Nov 2013 07:43:15 +0400 Subject: [PATCH] now open dialog will push the path to top of history... Signed-off-by: Alex A. Naanou --- ui/data.js | 27 ++++++++++++++++++++++++--- ui/ui.js | 4 ++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ui/data.js b/ui/data.js index b8e8a7e2..463b98c7 100755 --- a/ui/data.js +++ b/ui/data.js @@ -1655,6 +1655,25 @@ function setupBaseURLHistory(){ } +// Push a url to top of history... +// +// NOTE: this does not care if a url exists or not, all other instances +// will get removed... +function pushURLHistory(url){ + url = url == null ? BASE_URL : url + + while(BASE_URL_HISTORY.indexOf(url) >= 0){ + BASE_URL_HISTORY.splice(BASE_URL_HISTORY.indexOf(url), 1) + } + + BASE_URL_HISTORY.splice(0, 0, url) + + saveLocalStorageBaseURLHistory() + + return url +} + + function getURLHistoryPosition(){ return BASE_URL_HISTORY.indexOf(BASE_URL) } @@ -1668,17 +1687,19 @@ function getURLHistoryPrev(){ } -function makeURLHistoryLoader(get){ +function makeURLHistoryLoader(get, end_msg){ return function(){ var url = get() if(url != BASE_URL){ statusNotify(loadDir(url)) + } else { + showStatusQ('History: '+ end_msg +'...') } return url } } -var loadURLHistoryNext = makeURLHistoryLoader(getURLHistoryNext) -var loadURLHistoryPrev = makeURLHistoryLoader(getURLHistoryPrev) +var loadURLHistoryNext = makeURLHistoryLoader(getURLHistoryNext, 'at last URL') +var loadURLHistoryPrev = makeURLHistoryLoader(getURLHistoryPrev, 'at first URL') diff --git a/ui/ui.js b/ui/ui.js index 7320f4e3..0731073f 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -993,6 +993,10 @@ function loadDirectoryDialog(dfl){ } }) */ + .done(function(){ + // XXX is this the right place for this??? + pushURLHistory(BASE_URL) + }) }) .fail(function(){ showStatusQ('Open: canceled.')