mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
some cleanup and testing of new code...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
144cd4b0d7
commit
9b88630c4d
@ -131,6 +131,7 @@ var SCREEN_IMAGES = null
|
|||||||
var BaseActions =
|
var BaseActions =
|
||||||
module.BaseActions = actions.Actions({
|
module.BaseActions = actions.Actions({
|
||||||
// state props...
|
// state props...
|
||||||
|
/*
|
||||||
get current(){
|
get current(){
|
||||||
// XXX should this return a gid or a jQuery-like object for
|
// XXX should this return a gid or a jQuery-like object for
|
||||||
// image-oriented operations???
|
// image-oriented operations???
|
||||||
@ -139,6 +140,7 @@ module.BaseActions = actions.Actions({
|
|||||||
set current(val){
|
set current(val){
|
||||||
return this.focusImage(val)
|
return this.focusImage(val)
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
// life-cycle / state...
|
// life-cycle / state...
|
||||||
// XXX
|
// XXX
|
||||||
|
|||||||
@ -246,7 +246,11 @@ function createCSSClassToggler(elem, class_list, callback_a, callback_b){
|
|||||||
// NOTE: for single state toggling, 'none' will get passed to
|
// NOTE: for single state toggling, 'none' will get passed to
|
||||||
// state_accessor to indicate an "empty" state...
|
// state_accessor to indicate an "empty" state...
|
||||||
//
|
//
|
||||||
function makeToggler(state_accessor, states, callback_a, callback_b){
|
// XXX technically we do not need both elem and state_accessor here, the
|
||||||
|
// later is enough, but as strict mode is not stable enough (sometimes
|
||||||
|
// works and sometimes does not), we can not reliably pass the element
|
||||||
|
// via 'this'.
|
||||||
|
function makeToggler(elem, state_accessor, states, callback_a, callback_b){
|
||||||
// normalize states...
|
// normalize states...
|
||||||
states = typeof(states) == typeof('str') ? ['none', states] : states
|
states = typeof(states) == typeof('str') ? ['none', states] : states
|
||||||
// normalize the callbacks...
|
// normalize the callbacks...
|
||||||
@ -260,16 +264,18 @@ function makeToggler(state_accessor, states, callback_a, callback_b){
|
|||||||
|
|
||||||
var bool_action = (states.length == 2 && states[0] == 'none')
|
var bool_action = (states.length == 2 && states[0] == 'none')
|
||||||
|
|
||||||
|
// NOTE: this needs to be strict so as to be able to distinguish
|
||||||
|
// between a method and a root context in a simple manner...
|
||||||
var func = function(a, b){
|
var func = function(a, b){
|
||||||
// so as to be able to distinguish between a method and a root
|
// XXX for some magical reason this does not work...
|
||||||
// context in a simple manner...
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
// parse arguments...
|
// parse arguments...
|
||||||
if(b == null){
|
if(b == null){
|
||||||
var action = a == 'next' ? null : a
|
var action = a == 'next' ? null : a
|
||||||
// XXX is this correct???
|
// XXX is this correct???
|
||||||
var e = this
|
//var e = this
|
||||||
|
var e = elem
|
||||||
} else {
|
} else {
|
||||||
var e = a
|
var e = a
|
||||||
var action = b == 'next' ? null : b
|
var action = b == 'next' ? null : b
|
||||||
@ -309,7 +315,7 @@ function makeToggler(state_accessor, states, callback_a, callback_b){
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var state = bool_action ? states[1] : action
|
var state = bool_action ? states[action == 'off' ? 0 : 1] : action
|
||||||
// get the right class...
|
// get the right class...
|
||||||
if(action == null){
|
if(action == null){
|
||||||
var i = states.indexOf(cur)+1
|
var i = states.indexOf(cur)+1
|
||||||
@ -384,7 +390,9 @@ function makeCSSClassToggler(elem, classes, callback_a, callback_b){
|
|||||||
})
|
})
|
||||||
|
|
||||||
return makeToggler(
|
return makeToggler(
|
||||||
|
elem,
|
||||||
function(state){
|
function(state){
|
||||||
|
'use strict'
|
||||||
var e = $(this == null ? elem : this)
|
var e = $(this == null ? elem : this)
|
||||||
// get the state...
|
// get the state...
|
||||||
if(state == null){
|
if(state == null){
|
||||||
@ -403,7 +411,7 @@ function makeCSSClassToggler(elem, classes, callback_a, callback_b){
|
|||||||
// set the state...
|
// set the state...
|
||||||
} else {
|
} else {
|
||||||
e.removeClass(classes.join(' '))
|
e.removeClass(classes.join(' '))
|
||||||
if(state != 'none' && action != 'off'){
|
if(state != 'none' && state != 'off'){
|
||||||
e.addClass(state)
|
e.addClass(state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user