mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-21 10:41:39 +00:00
minor simplification in client.js
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
565f712e60
commit
9b2f6e39b0
@ -15,6 +15,15 @@ data = require('data')
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function proxy(attr, name){
|
||||||
|
return function(){
|
||||||
|
this[attr][name].apply(this[attr], arguments)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
var CLIENT_ACTIONS = {
|
var CLIENT_ACTIONS = {
|
||||||
@ -23,12 +32,8 @@ var CLIENT_ACTIONS = {
|
|||||||
// .data
|
// .data
|
||||||
//
|
//
|
||||||
|
|
||||||
focusImage: doc('Focus Image',
|
focusImage: doc('Focus Image',
|
||||||
// XXX do we need to account for event first argument here???
|
proxy('data', 'focusImage')),
|
||||||
function(gid){
|
|
||||||
this.data.focusImage(gid)
|
|
||||||
return this
|
|
||||||
}),
|
|
||||||
|
|
||||||
// target can be:
|
// target can be:
|
||||||
// - current
|
// - current
|
||||||
@ -36,6 +41,7 @@ var CLIENT_ACTIONS = {
|
|||||||
// - before
|
// - before
|
||||||
// - after
|
// - after
|
||||||
//
|
//
|
||||||
|
// XXX should this be implemented here on in data.js????
|
||||||
focusRibbon: doc('Focus ribbon',
|
focusRibbon: doc('Focus ribbon',
|
||||||
function(target){
|
function(target){
|
||||||
var cur = this.data.getRibbonIndex()
|
var cur = this.data.getRibbonIndex()
|
||||||
@ -48,6 +54,11 @@ var CLIENT_ACTIONS = {
|
|||||||
return this.focusImage(
|
return this.focusImage(
|
||||||
this.data.getImage(ribbon, direction))
|
this.data.getImage(ribbon, direction))
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
firstImage: doc('',
|
||||||
|
proxy('data', 'firstImage')),
|
||||||
|
lastImage: doc('',
|
||||||
|
proxy('data', 'lastImage')),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user