diff --git a/ui/files.js b/ui/files.js index f3d7a481..8dc23645 100755 --- a/ui/files.js +++ b/ui/files.js @@ -171,6 +171,7 @@ function loadLatestFile(path, dfl, pattern, diff_pattern){ // // NOTE: this depends on listDir(...) // NOTE: this assumes that images contain ALL the images... +// NOTE: this assumes that all file names are unique... function ribbonsFromFavDirs(path, images, cmp){ path = path == null ? getBaseURL() : path images = images == null ? IMAGES : images @@ -198,16 +199,20 @@ function ribbonsFromFavDirs(path, images, cmp){ // collect the images... $.each(files, function(i, e){ var _gid = index[e] - // filter out non-image files... - if(/.*\.(jpg|jpeg)$/i.test(e)){ - ribbon.push(_gid) - } + // skip files not in index... + // NOTE: we do not need to filter the files by name as we + // trust the index... + if(_gid == null){ + return + } // remove the found item from each of the below ribbons... $.each(ribbons, function(i ,e){ if(e.indexOf(_gid) != -1){ e.splice(e.indexOf(_gid), 1) } }) + + ribbon.push(_gid) }) ribbons.push(ribbon) } diff --git a/ui/ui.js b/ui/ui.js index 0b458fca..ed7820a9 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -20,25 +20,27 @@ var STATUS_QUEUE_TIME = 200 // XXX revise... // NOTE: to catch the click event correctly while the cursor is hidden // this must be the first to get the event... +// NOTE: this uses element.data to store the timer and cursor position... function autoHideCursor(elem){ elem = $(elem) + var data = elem.data() elem .on('mousemove', function(evt){ var cursor = elem.css('cursor') - _cursor_pos = window._cursor_pos == null || cursor != 'none' ? + data._cursor_pos = data._cursor_pos == null || cursor != 'none' ? [evt.clientX, evt.clientY] - : _cursor_pos + : data._cursor_pos // cursor visible -- extend visibility... if(cursor != 'none'){ - if(window._cursor_timeout != null){ - clearTimeout(_cursor_timeout) + if(data._cursor_timeout != null){ + clearTimeout(data._cursor_timeout) } - _cursor_timeout = setTimeout(function(){ - if(Math.abs(evt.clientX - _cursor_pos[0]) < CURSOR_SHOW_THRESHOLD - || Math.abs(evt.clientY - _cursor_pos[1]) < CURSOR_SHOW_THRESHOLD){ + data._cursor_timeout = setTimeout(function(){ + if(Math.abs(evt.clientX - data._cursor_pos[0]) < CURSOR_SHOW_THRESHOLD + || Math.abs(evt.clientY - data._cursor_pos[1]) < CURSOR_SHOW_THRESHOLD){ elem.css('cursor', 'none') } @@ -46,8 +48,8 @@ function autoHideCursor(elem){ // cursor hidden -- if outside the threshold, show... - } else if(Math.abs(evt.clientX - _cursor_pos[0]) > CURSOR_SHOW_THRESHOLD - || Math.abs(evt.clientY - _cursor_pos[1]) > CURSOR_SHOW_THRESHOLD){ + } else if(Math.abs(evt.clientX - data._cursor_pos[0]) > CURSOR_SHOW_THRESHOLD + || Math.abs(evt.clientY - data._cursor_pos[1]) > CURSOR_SHOW_THRESHOLD){ elem.css('cursor', '') } @@ -57,9 +59,9 @@ function autoHideCursor(elem){ //event.stopImmediatePropagation() //event.preventDefault() - if(window._cursor_timeout != null){ - clearTimeout(_cursor_timeout) - _cursor_timeout = null + if(data._cursor_timeout != null){ + clearTimeout(data._cursor_timeout) + data._cursor_timeout = null } elem.css('cursor', '') @@ -70,6 +72,20 @@ function autoHideCursor(elem){ } +/* +// XXX does not work... +// ...does not show the cursor without moving it... +function showCursor(elem){ + elem = $(elem) + var data = elem.data() + if(data._cursor_timeout != null){ + clearTimeout(data._cursor_timeout) + } + elem.css('cursor', '') +} +*/ + + function flashIndicator(direction){ var cls = { // shift up/down...