From fb81d9918c171e31a6789d9572844cfe98b0c755 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 5 Sep 2012 00:04:07 +0400 Subject: [PATCH] even more bugfixes... Signed-off-by: Alex A. Naanou --- ui/gallery-prototype.js | 11 +++-------- ui/persistance.js | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ui/gallery-prototype.js b/ui/gallery-prototype.js index bcdbf487..f144fd64 100755 --- a/ui/gallery-prototype.js +++ b/ui/gallery-prototype.js @@ -1312,6 +1312,9 @@ function loadJSON(data, position, set_order, escape_urls){ if(ribbons == null){ return } + if(escape_urls == null){ + escape_urls = true + } // store the structure... ImageGrid.image_data = data @@ -1332,14 +1335,6 @@ function loadJSON(data, position, set_order, escape_urls){ .appendTo(field) for(var j in images){ var image = images[j] - if(escape_urls == true){ - // escape the url ... - var o = /([a-zA-Z0-9]*:\/\/)(.*)/.exec(image.url) - if(o.length == 3){ - image.url = o[1] + escape(o[2]) - } - image.url = escape(image.url) - } // create image... makeImage(image.url, j, set_order) .appendTo(ribbon) diff --git a/ui/persistance.js b/ui/persistance.js index 863ac561..ab55ac03 100755 --- a/ui/persistance.js +++ b/ui/persistance.js @@ -9,13 +9,36 @@ * */ -function loadJSONfile(path){ +function loadJSONfile(path, escape_urls){ + if(escape_urls == null){ + escape_urls = true + } // XXX CEF (file) - binding if(CEF_loadJSON != null){ - return CEF_loadJSON(path) + var data = CEF_loadJSON(path) } // XXX PhoneGap (file) - binding // XXX browser - open file dialog + + // escape the URLs... + var ribbons = data.ribbons + for(var i=0; i