From 92470b5b2d6c434d7502fcd6540f61e7794cc6ca Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 29 Aug 2012 17:02:40 +0400 Subject: [PATCH] updated todo, added local-storage state storing (manual)... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 25 ++++++++++++++++--------- ui/gallery-prototype.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index 2093545b..44c7f514 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -1,16 +1,23 @@ Priority work - [_] 62% Preview II - [_] 50% load folder - [X] drag'n'drop - [_] open dilog + [_] 55% Preview II + [_] 0% save state + [_] minimal: Local Storage + | works across all targets (CEF, PhoneGap, browser) + [_] local JSON (file) + [_] CouchDB [_] 0% load state [_] auto: last state [_] manual - [_] 0% save state - [_] minimal: Local Storage - | XXX does not seem to work in CEF - [_] local JSON (file) - [_] CouchDB + [_] 50% load folder + [X] drag'n'drop + [_] open dilog + [_] 0% dynamic loading of images + [_] sizes on zoom + [_] stream on navigate + | NOTE: here the trigger must be proximity to the view as we + | can reach an image not just by navigating close but + | also by scrolling/dragging to it (without changing the + | current image)... [_] 49% native client [_] 33% Windows (CEF / CEFPython) [X] basic test diff --git a/ui/gallery-prototype.js b/ui/gallery-prototype.js index 2fc3c278..aa816197 100755 --- a/ui/gallery-prototype.js +++ b/ui/gallery-prototype.js @@ -99,6 +99,24 @@ ImageGrid.GROUP('API', } } }), + ImageGrid.ACTION({ + doc: 'save state to local storage', + group: 'API', + display: false, + }, + function save(){ + $.jStorage.set(ImageGrid.option.KEY_NAME_CONFIG, ImageGrid.sync()) + $.jStorage.set(ImageGrid.option.KEY_NAME_STATE, buildJSON()) + }), + ImageGrid.ACTION({ + doc: 'load state from local storage', + group: 'API', + display: false, + }, + function load(){ + loadJSON($.jStorage.get(ImageGrid.option.KEY_NAME_STATE, {})) + ImageGrid.set($.jStorage.get(ImageGrid.option.KEY_NAME_CONFIG, {})) + }), ImageGrid.ACTION({ doc: 'Sync and update option values.\n\n'+ 'NOTE: this is here because JS has no direct way to '+ @@ -171,6 +189,16 @@ var DEBUG = true ImageGrid.GROUP('State', + ImageGrid.OPTION({ + name: 'KEY_NAME_CONFIG', + title: 'Name of localStorage key to store config data.', + value: 'ImageGrid_config', + }), + ImageGrid.OPTION({ + name: 'KEY_NAME_STATE', + title: 'Name of localStorage key to store state.', + value: 'ImageGrid_state', + }), ImageGrid.OPTION({ name: 'CURRENT_IMAGE_ID', doc: '',