2014-08-29 19:06:45 +04:00
|
|
|
/**********************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
|
|
//var DEBUG = DEBUG != null ? DEBUG : true
|
|
|
|
|
|
|
|
|
|
define(function(require){ var module = {}
|
|
|
|
|
console.log('>>> ui')
|
|
|
|
|
|
|
|
|
|
doc = require('keyboard').doc
|
|
|
|
|
|
|
|
|
|
data = require('data')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-29 19:19:21 +04:00
|
|
|
function proxy(attr, name){
|
|
|
|
|
return function(){
|
|
|
|
|
this[attr][name].apply(this[attr], arguments)
|
|
|
|
|
return this
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-29 19:06:45 +04:00
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
var CLIENT_ACTIONS = {
|
|
|
|
|
// this expects the folowing attrs:
|
|
|
|
|
//
|
|
|
|
|
// .data
|
|
|
|
|
//
|
|
|
|
|
|
2014-08-29 19:19:21 +04:00
|
|
|
focusImage: doc('Focus Image',
|
|
|
|
|
proxy('data', 'focusImage')),
|
2014-08-29 19:06:45 +04:00
|
|
|
|
|
|
|
|
// target can be:
|
|
|
|
|
// - current
|
|
|
|
|
// - base
|
|
|
|
|
// - before
|
|
|
|
|
// - after
|
|
|
|
|
//
|
2014-08-29 19:19:21 +04:00
|
|
|
// XXX should this be implemented here on in data.js????
|
2014-08-29 19:06:45 +04:00
|
|
|
focusRibbon: doc('Focus ribbon',
|
|
|
|
|
function(target){
|
|
|
|
|
var cur = this.data.getRibbonIndex()
|
|
|
|
|
var ribbon = this.data.getRibbon(target)
|
|
|
|
|
var t = this.data.getRibbonIndex(ribbon)
|
|
|
|
|
|
|
|
|
|
// XXX revise this...
|
|
|
|
|
var direction = t < cur ? 'before' : 'after'
|
|
|
|
|
|
|
|
|
|
return this.focusImage(
|
|
|
|
|
this.data.getImage(ribbon, direction))
|
|
|
|
|
}),
|
2014-08-29 19:19:21 +04:00
|
|
|
|
|
|
|
|
firstImage: doc('',
|
|
|
|
|
proxy('data', 'firstImage')),
|
|
|
|
|
lastImage: doc('',
|
|
|
|
|
proxy('data', 'lastImage')),
|
2014-08-29 19:06:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */
|
|
|
|
|
return module })
|