even more bugfixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-09-05 00:04:07 +04:00
parent 8e53c0d840
commit fb81d9918c
2 changed files with 28 additions and 10 deletions

View File

@ -1312,6 +1312,9 @@ function loadJSON(data, position, set_order, escape_urls){
if(ribbons == null){ if(ribbons == null){
return return
} }
if(escape_urls == null){
escape_urls = true
}
// store the structure... // store the structure...
ImageGrid.image_data = data ImageGrid.image_data = data
@ -1332,14 +1335,6 @@ function loadJSON(data, position, set_order, escape_urls){
.appendTo(field) .appendTo(field)
for(var j in images){ for(var j in images){
var image = images[j] 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... // create image...
makeImage(image.url, j, set_order) makeImage(image.url, j, set_order)
.appendTo(ribbon) .appendTo(ribbon)

View File

@ -9,13 +9,36 @@
* *
*/ */
function loadJSONfile(path){ function loadJSONfile(path, escape_urls){
if(escape_urls == null){
escape_urls = true
}
// XXX CEF (file) - binding // XXX CEF (file) - binding
if(CEF_loadJSON != null){ if(CEF_loadJSON != null){
return CEF_loadJSON(path) var data = CEF_loadJSON(path)
} }
// XXX PhoneGap (file) - binding // XXX PhoneGap (file) - binding
// XXX browser - open file dialog // XXX browser - open file dialog
// escape the URLs...
var ribbons = data.ribbons
for(var i=0; i<ribbons.length; i++){
var images = ribbons[i]
for(var id in images){
var image = images[id]
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])
} else {
console.log('no schema...')
image.url = escape(image.url)
}
}
}
}
return data
} }
function dumpJSONfile(path, value){ function dumpJSONfile(path, value){