/********************************************************************** * * * **********************************************************************/ define(function(require){ var module = {} //var DEBUG = DEBUG != null ? DEBUG : true var toggler = require('lib/toggler') var actions = require('lib/actions') var features = require('lib/features') var data = require('data') var images = require('images') var ribbons = require('ribbons') var core = require('features/core') var base = require('features/base') /*********************************************************************/ // XXX add setup / teardown... // XXX might be a good idea to merge this with single image mode... var makeStateIndicator = function(type){ return $('
') .addClass('state-indicator-container ' + type || '') } // XXX do we need this??? var makeStateIndicatorItem = function(container, type, text){ var item = $('
') .addClass('item '+ type || '') .attr('text', text) this.ribbons.viewer.find('.state-indicator-container.'+container) .append(item) return item } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // XXX Add status messages and log... var ImageStateIndicatorActions = actions.Actions({ config: { // XXX might be a good idea to add custom components API... 'global-state-indicator-elements': [ // XXX should index be here or to the right??? 'index', //'path', 'gid', // separates left/right aligned elements... '---', 'mark', 'bookmark', ], 'global-state-indicator-elements-full-only': [ 'gid', ], 'global-state-indicator-modes': [ 'none', 'minimal', 'full', ], 'global-state-indicator-mode': null, }, // Format: // { // : , // : | , // ... // } // // Supported actions: // - make // - update // - remove // // NOTE: built-in handlers can be overloaded by user. // NOTE: alias loops are ignored. // // XXX make this visible to the user??? // XXX is this too complex??? __state_indicator_elements__: { index: function(action, container, elem, gid){ // construct... if(action == 'make'){ return $('').addClass(elem) // update... } else if(action == 'update'){ // XXX how do we pass a custom gid to here??? var gid = this.current container.find('.'+elem) .text( (this.data.getImageOrder('ribbon', gid)+1) +'/'+ this.data.getImages(gid).len) // remove... } else if(action == 'remove'){ container.find('.'+elem).remove() } }, // XXX handle path correctly... gid: function(action, container, elem, gid){ // construct... if(action == 'make'){ return $('') .addClass(elem + ' expanding-text ') .append($('')) .append($('