several bugfixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-09-04 16:04:54 +04:00
parent f28b928b26
commit 14a0ae2c53

View File

@ -1162,7 +1162,7 @@ function makeImage(url, order, set_order){
} }
return (setupImageEventHandlers( return (setupImageEventHandlers(
set_order($('<div class="image"/>') set_order($('<div class="image"/>')
//.css({ 'background-image': 'url('+url+')' }), order))) //.css({ 'background-image': 'url('+url.replace(/ /g, '%20')+')' }), order)))
, order))) , order)))
} }
@ -1175,7 +1175,12 @@ function getURL(id){
for(var i=0; i<ribbons.length; i++){ for(var i=0; i<ribbons.length; i++){
var ribbon = ribbons[i] var ribbon = ribbons[i]
if(ribbon[id] != null){ if(ribbon[id] != null){
return ribbon[id].url // do not escape the url schema...
var o = /([a-zA-Z0-9]*:)(.*)/.exec(ribbon[id].url)
if(o.length == 3){
return o[1] + escape(o[2])
}
return escape(ribbon[id].url)
} }
} }
} }
@ -1261,6 +1266,7 @@ function loadImagesFromList(images){
* } * }
*/ */
// XXX add incremental or partial updates... // XXX add incremental or partial updates...
// XXX this will break when trying to read unloaded images...
function buildJSON(get_order){ function buildJSON(get_order){
/* XXX can't return this yet as we are not updating this properly yet... /* XXX can't return this yet as we are not updating this properly yet...
if(ImageGrid.image_data != null){ if(ImageGrid.image_data != null){
@ -1282,14 +1288,15 @@ function buildJSON(get_order){
continue continue
} }
var ribbon = {} var ribbon = {}
res.ribbons[res.ribbons.length] = ribbon res.ribbons.push(ribbon)
for(var j=0; j < images.length; j++){ for(var j=0; j < images.length; j++){
var image = $(images[j]) var image = $(images[j])
var id = get_order(image) var id = get_order(image)
ribbon[id] = { ribbon[id] = {
// unwrap the url... // unwrap the url...
// XXX would be nice to make this a relative path... (???) // XXX would be nice to make this a relative path... (???)
url: /url\((.*)\)/.exec(image.css('background-image'))[1], //url: /url\((.*)\)/.exec(image.css('background-image'))[1],
url: getURL(id)
} }
} }
} }