From 62ee92dc819d7e7f584a540a5120459c182bb950 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 15 May 2013 00:24:33 +0400 Subject: [PATCH] minor tweeks, still data-binding buggy -- problems loading section while sorting/shifting/moving, needs more tweeking... Signed-off-by: Alex A. Naanou --- ui/base.js | 9 +++++++-- ui/data.js | 17 +++++++---------- ui/index.html | 5 ++++- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ui/base.js b/ui/base.js index eabec693..d035de3c 100755 --- a/ui/base.js +++ b/ui/base.js @@ -642,10 +642,15 @@ function centerRibbon(ribbon, image, mode){ // a shorthand... -function centerRibbons(mode){ +function centerRibbons(mode, no_skip_current){ return $('.ribbon') .filter(':visible') - .each(function(){ centerRibbon($(this), null, mode) }) + .each(function(){ + if(no_skip_current == true && $(this).find('.current.image').length > 0){ + return + } + centerRibbon($(this), null, mode) + }) } diff --git a/ui/data.js b/ui/data.js index 5d9f84d4..0a6e74d8 100755 --- a/ui/data.js +++ b/ui/data.js @@ -245,8 +245,10 @@ function updateImage(image, gid, size){ } // select best preview by size... - var url, s - var preview_size = "0px" + // NOTE: this will use the original if everything else is smaller... + var s + var url = 'url('+DATA.images[gid].path+')' + var preview_size = 'Original' var p = Infinity for(var k in img_data.preview){ s = parseInt(k) @@ -256,14 +258,9 @@ function updateImage(image, gid, size){ url = 'url('+ img_data.preview[k] +')' } } - // if no preview found use the original... - if(url == null){ - preview_size = 'Original' - url = 'url('+DATA.images[gid].path+')' - } image.css({ - 'background-image': url, - }) + 'background-image': url, + }) window.DEBUG && image.html(DATA.order.indexOf(gid) +'
'+ gid +'
'+ preview_size) @@ -419,7 +416,7 @@ function convertDataGen1(data){ var images = res.images var order = res.order var _dateSort = function(a, b){ - return Math.round(images[a].ctime - images[b].ctime) + return images[b].ctime - images[a].ctime } // position... diff --git a/ui/index.html b/ui/index.html index 6a1edcc8..09219842 100755 --- a/ui/index.html +++ b/ui/index.html @@ -258,6 +258,7 @@ body { DEBUG = true + // setup... $(function(){ @@ -275,7 +276,9 @@ $(function(){ $(document) .keydown(makeKeyboardHandler( KEYBOARD_CONFIG, - function(k){console.log(k)})) + function(k){ + window.DEBUG && console.log(k) + })) setupDataBindings()