mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-30 19:40:12 +00:00 
			
		
		
		
	updated docs in jli...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									e2ef549038
								
							
						
					
					
						commit
						edc3af20c8
					
				
							
								
								
									
										17
									
								
								lib/jli.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								lib/jli.js
									
									
									
									
									
								
							| @ -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.
 | // 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.
 | // 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
 | // 	- 'on'			: switch mode on
 | ||||||
| // 	- 'off'			: switch mode off
 | // 	- 'off'			: switch mode off
 | ||||||
| // 	- '?'			: return current state ('on'|'off')
 | // 	- '?'			: return current state ('on'|'off')
 | ||||||
| // 	- no arguments	: toggle the state
 | // 	- 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 
 | // NOTE: of only one callback is given then it will be called after the 
 | ||||||
| // 		 class change...
 | // 		 class change...
 | ||||||
| // 		 a way around this is to pass an empty function as callback_b
 | // 		 a way around this is to pass an empty function as callback_b
 | ||||||
| //
 | //
 | ||||||
| 
 |  | ||||||
| function createCSSClassToggler(elem, class_list, callback_a, callback_b){ | function createCSSClassToggler(elem, class_list, callback_a, callback_b){ | ||||||
| 	var bool_action = false | 	var bool_action = false | ||||||
| 	if(typeof(class_list) == typeof('')){ | 	if(typeof(class_list) == typeof('')){ | ||||||
|  | |||||||
| @ -70,7 +70,7 @@ var toggleInlineEditorMode = createCSSClassToggler('.viewer', 'inline-editor-mod | |||||||
| // toggle between viewer themes...
 | // toggle between viewer themes...
 | ||||||
| var toggleThemes = createCSSClassToggler('.viewer', [ | var toggleThemes = createCSSClassToggler('.viewer', [ | ||||||
| 	'light', | 	'light', | ||||||
| 	// this is the default...
 | 	// this is the default (no class set)...
 | ||||||
| 	'none', | 	'none', | ||||||
| 	'dark' | 	'dark' | ||||||
| ]) | ]) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user