/********************************************************************** * * **********************************************************************/ /********************************************************************** * Info & status... */ // XXX do we need a full rewrite here, or will it be better to just fill // the slots... function updateGlobalImageInfo(image){ image = image == null ? getImage() : $(image) image = image.length == 0 ? getImage() : image var elem = $('.global-image-info') if(elem.length == 0){ elem = $('
') } // no image no update... if(image.length == 0){ return elem } var gid = getImageGID(image) var r = getRibbonIndex(getRibbon(image)) var data = IMAGES[gid] var date = new Date(data.ctime * 1000) var meta = [] image.hasClass('bookmarked') ? meta.push( 'B'+ '') : '' image.hasClass('marked') ? meta.push( 'M'+ '') : '' var orientation = data.orientation orientation = orientation == null ? 0 : orientation orientation != 0 ? meta.push( 'R'+ '') : '' var flip = data.flipped flip != null ? meta.push( 'F'+ '') : '' meta = meta.join(', ') meta = meta != '' ? '( '+ meta +' )' : '' return updateInfo(elem, // path... ''+ ''+ getImageFileName(gid) + ''+ ''+ ' '+ // metadata... ''+ meta + ' '+ ''+ // XXX do we need to display a short gid? //gid + 'GID:'+ ''+ gid.slice(gid.length-6) + ''+ ''+ ' '+ // date... ''+ 'TS:' + date.toShortDate() + ''+ ''+ ''+ // position... '('+ (DATA.ribbons[r].indexOf(gid)+1) +'/'+ DATA.ribbons[r].length + ')') } function updateInlineImageInfo(image, target){ image = image == null ? getImage() : $(image) image = image.length == 0 ? getImage() : image target = target == null ? image : target var elem = $('.inline-image-info') if(elem.length == 0){ elem = $('
') } // no image no update... if(image.length == 0){ return elem } var gid = getImageGID(image) //var r = getRibbonIndex(getRibbon(image)) var data = IMAGES[gid] var date = new Date(data.ctime * 1000) var orientation = data.orientation orientation = orientation == null ? 0 : orientation return updateInfo(elem, // name... getImageFileName(gid) +'
'+ // date... ''+ //date.toShortDate() + '' + date.toShortDate() + ''+ ''+ ''+ '', target) } function inlineImageInfoHoverHandler(evt){ if($(evt.target).hasClass('current-marker')){ var img = getImage() var target = $('.current-marker') } else { var img = $(evt.target).closest('.image') var target = img } if(img.length > 0){ if(target.find('.inline-image-info:visible').length == 0){ updateInlineImageInfo(img, target) } } } /*********************************************************************/ function setupInfo(viewer){ console.log('Info: setup...') return viewer // info... .on('focusingImage', function(){ showRibbonIndicator() }) .on([ 'focusedNextRibbon', 'focusedPrevRibbon' ].join(' '), function(){ if(toggleSingleImageMode('?') == 'on'){ flashRibbonIndicator() } }) .on([ 'rotatingLeft', 'rotateingRight', 'flippingVertical', 'flippingHorizontal' ].join(' '), function(evt, image){ updateGlobalImageInfo($(image)) }) .on([ 'focusingImage', 'togglingMarks', 'togglingBookmarks', 'removeingAllMarks', 'removeingRibbonMarks', 'markingAll', 'markingRibbon', 'invertingMarks' ].join(' '), function(){ updateGlobalImageInfo() updateContextIndicators() }) } SETUP_BINDINGS.push(setupInfo) /********************************************************************** * vim:set ts=4 sw=4 spell nowrap : */