From cbc448089d51a07db840043191c58ac1c7e9468d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 26 May 2013 03:34:15 +0400 Subject: [PATCH] some cleanup, updated todo... Signed-off-by: Alex A. Naanou --- ui/Gen3-TODO.otl | 9 ++++++--- ui/data.js | 20 ++++++++++++++------ ui/index.html | 4 +++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ui/Gen3-TODO.otl b/ui/Gen3-TODO.otl index 12aed956..7ccc14af 100755 --- a/ui/Gen3-TODO.otl +++ b/ui/Gen3-TODO.otl @@ -1,5 +1,5 @@ -[_] 24% Gen 3 current todo - [_] 48% High priority +[_] 22% Gen 3 current todo + [_] 44% High priority [_] BUG: aligning still sometimes gets off... | ...after rotating a number of images | @@ -20,8 +20,10 @@ | prior sizing after recycling... | ...check if centerRibbon(...) and correctImageProportionsForRotation(...) | are called in right sequence... - [_] ASAP: support relative paths in cache... + [_] BUG: changing window size in single image modes messes things up... + | until we cycle to ribbon mode and back... [_] ASAP: load/view un-cached directories... + [_] slideshow mode... [_] import fav dirs (wo. index)... [_] add ability to save/load ranges of images and the structures around them | e.g.load image 100 to current ribbon -> will load 100 images @@ -81,6 +83,7 @@ [_] thresholds and frame size [_] remove extra and repetitive actions [_] caching config + [X] ASAP: support relative paths in cache... [X] ASAP: account for image rotation with screen proportions while positioning | getRelativeVisualPosition(...) gives an odd position when: | - image is rotated diff --git a/ui/data.js b/ui/data.js index 3282687f..e605f220 100755 --- a/ui/data.js +++ b/ui/data.js @@ -324,6 +324,9 @@ function normalizePath(url, base, mode){ mode = mode == null ? 'absolute' : mode base = base == null ? BASE_URL : base + // windows path... + + // absolute path... if(/^(file|http|https):\/\/.*$/.test(url)){ // check if we start with base, and remove it if so... @@ -652,13 +655,17 @@ function loadLocalStorageData(attr){ if(data == null){ data = '{}' } - return JSON.parse(data) + return { + data: JSON.parse(data), + base_url: localStorage[attr + '_BASE_URL'], + } } function saveLocalStorageData(attr){ attr = attr == null ? DATA_ATTR : attr localStorage[attr] = JSON.stringify(DATA) + localStorage[attr + '_BASE_URL'] = BASE_URL } @@ -683,7 +690,9 @@ function saveLocalStorageImages(attr){ // generic save/load... function loadLocalStorage(attr){ attr = attr == null ? DATA_ATTR : attr - DATA = loadLocalStorageData(attr) + var d = loadLocalStorageData(attr) + BASE_URL = d.base_url + DATA = d.data IMAGES = loadLocalStorageImages(attr) return loadData() } @@ -751,7 +760,6 @@ function loadFileImages(path, callback){ } -// XXX add relative path support (via. normalizePath(...)) function loadFile(data_path, image_path, callback){ var base = data_path.split(CACHE_DIR)[0] base = base == data_path ? '.' : base @@ -835,11 +843,11 @@ function openImage(){ // XXX need revision... function loadDir(path){ - return loadFile(path +'/data.json') + return loadFile(BASE_URL +'/data.json') .fail(function(){ - loadFile(path +'/.ImageGrindCache/data.json') + loadFile(BASE_URL +'/'+ CACHE_DIR +'/data.json') .fail(function(){ - // XXX load separate images... + // XXX load plain images... // XXX }) }) diff --git a/ui/index.html b/ui/index.html index 79b9eb84..6985950c 100755 --- a/ui/index.html +++ b/ui/index.html @@ -461,7 +461,9 @@ $(function(){ if((DATA_ATTR + '_IMAGES_FILE') in localStorage){ var loading = loadFileImages(localStorage[DATA_ATTR + '_IMAGES_FILE']) .done(function(){ - DATA = loadLocalStorageData() + var d = loadLocalStorageData() + DATA = d.data + BASE_URL = d.base_url loadData() })