now loading default state from local storage...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-29 19:14:57 +04:00
parent 59fda8dd47
commit 3a4a276f63
4 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,6 @@
Priority work Priority work
[_] 63% Preview II [_] 67% Preview II
[_] 40% save state [_] 42% save state
[X] minimal: Local Storage (manual) [X] minimal: Local Storage (manual)
| works across all targets (CEF, PhoneGap, browser) | works across all targets (CEF, PhoneGap, browser)
[_] local JSON (file) [_] local JSON (file)
@ -8,10 +8,12 @@ Priority work
[_] 0% autosave [_] 0% autosave
[_] on edit [_] on edit
[_] on timer [_] on timer
[X] manual save
[_] manual named save
[X] versions/history [X] versions/history
[_] 33% load state [_] 66% load state
[X] load mechanics [X] load mechanics
[_] auto-load last state on startup [X] auto-load last state on startup
[_] manual [_] manual
[_] 50% load folder [_] 50% load folder
[X] drag'n'drop [X] drag'n'drop

View File

@ -117,8 +117,9 @@ function setup(){
// XXX not allowed... // XXX not allowed...
//$.getJSON('images.js', loadImages}) //$.getJSON('images.js', loadImages})
// XXX STUB // XXX STUB
//loadImages(image_list) //loadJSON(image_list)
loadJSON(image_list)
ImageGrid.load()
// set the default position and init... // set the default position and init...
$('.current.image').click() $('.current.image').click()

View File

@ -1096,17 +1096,19 @@ function makeImage(url, order, set_order){
function loadImages(json){ function loadImagesFromList(images){
var images = json.images var field = $('.field')
var ribbon = $('.ribbon').last()
$('.image').remove() field.children('.ribbon').remove()
var ribbon = $('<div class="ribbon"></div>')
.appendTo(field)
for(var i = 0; i < images.length; i++){ for(var i = 0; i < images.length; i++){
makeImage(images[i], i) makeImage(images[i], i)
.appendTo(ribbon) .appendTo(ribbon)
} }
ribbon.children().first().click() $('.image').first().click()
} }
@ -1153,7 +1155,6 @@ function buildJSON(get_order){
// XXX use this instead of loadImages(...)
// XXX might be good to add images in packs here, not one by one... // XXX might be good to add images in packs here, not one by one...
function loadJSON(data, set_order){ function loadJSON(data, set_order){
if(set_order == null){ if(set_order == null){
@ -1286,6 +1287,12 @@ function makeKeyboardHandler(keybindings, ignore, unhandled){
/************************************************ Mode & UI Actions **/ /************************************************ Mode & UI Actions **/
ImageGrid.GROUP('Mode: All', ImageGrid.GROUP('Mode: All',
ImageGrid.ACTION({
title: 'Save current state.',
},
function saveState(){
ImageGrid.save()
}),
ImageGrid.ACTION({ ImageGrid.ACTION({
title: 'Get the background mode', title: 'Get the background mode',
display: false, display: false,

View File

@ -24,6 +24,7 @@ var keybindings = {
73: ImageGrid.toggleCurrentRibbonOpacity, // i 73: ImageGrid.toggleCurrentRibbonOpacity, // i
77: toggleMarkers, // m 77: toggleMarkers, // m
87: ImageGrid.saveState, // w
27: ImageGrid.closeOverlay, // Esc 27: ImageGrid.closeOverlay, // Esc