updated docs in jli...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-09 07:17:40 +04:00
parent e2ef549038
commit edc3af20c8
2 changed files with 14 additions and 5 deletions

View File

@ -11,24 +11,33 @@
/*********************************************************************/
// XXX find a better name for this...
// this will create a function that will add/remove a css_class to elem
// this will create a function that will cycle through a class_list on elem
// calling the optional callbacks before and/or after.
// if class_list is given as a string, then this will create a toggler that
// will turn the given class on the element on and off.
//
// elem is a jquery compatible object; default use-case: a css selector.
//
// the resulting function understands the folowing arguments:
// if class_list is a list, the resulting function understands the
// folowing arguments:
// - <index> : 0 for 'off' and 1 for 'on' (see below)
// - 'on' : switch mode on
// - 'off' : switch mode off
// - '?' : return current state ('on'|'off')
// - no arguments : toggle the state
//
// otherwise:
// - <index> : explicitly set the state to index in class_list
// - <class-name> : explicitly set a class from the list
// - '?' : return current state ('on'|'off')
// - no arguments : set next state in cycle
//
// NOTE: <class-name> must be an exact match to a string given in class_list
// NOTE: of only one callback is given then it will be called after the
// class change...
// a way around this is to pass an empty function as callback_b
//
function createCSSClassToggler(elem, class_list, callback_a, callback_b){
var bool_action = false
if(typeof(class_list) == typeof('')){

View File

@ -70,7 +70,7 @@ var toggleInlineEditorMode = createCSSClassToggler('.viewer', 'inline-editor-mod
// toggle between viewer themes...
var toggleThemes = createCSSClassToggler('.viewer', [
'light',
// this is the default...
// this is the default (no class set)...
'none',
'dark'
])