| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 01:01:06 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-25 18:34:53 +04:00
										 |  |  | window.nodejs = (typeof(process) === 'object' && process.features.uv)  | 
					
						
							|  |  |  | 	? { | 
					
						
							|  |  |  | 		require: window.require, | 
					
						
							|  |  |  | 	}  | 
					
						
							|  |  |  | 	: null | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-28 03:47:44 +03:00
										 |  |  | // XXX for some reason requirejs does not fall back to node's require...
 | 
					
						
							|  |  |  | if(nodejs){ | 
					
						
							|  |  |  | 	var requirejs = require('requirejs') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	requirejs.config({ | 
					
						
							|  |  |  | 		nodeRequire: require, | 
					
						
							|  |  |  | 		//baseUrl: __dirname,
 | 
					
						
							| 
									
										
										
										
											2015-11-16 17:00:56 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// XXX this does not work on direct filesystem access...
 | 
					
						
							|  |  |  | 		//urlArgs: 'bust='+Date.now(),
 | 
					
						
							| 
									
										
										
										
											2014-12-28 03:47:44 +03:00
										 |  |  | 	}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | define(function(require){ var module = {} | 
					
						
							|  |  |  | console.log('>>> ui') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //var DEBUG = DEBUG != null ? DEBUG : true
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | var keyboard = require('lib/keyboard') | 
					
						
							|  |  |  | var doc = keyboard.doc | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // compatibility...
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | var browser = require('browser') | 
					
						
							|  |  |  | var nw = require('nw') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | // XXX load only the actualy used here modules...
 | 
					
						
							| 
									
										
										
										
											2015-11-07 19:44:52 +03:00
										 |  |  | var actions = require('lib/actions') | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | var data = require('data') | 
					
						
							| 
									
										
										
										
											2014-07-21 18:33:31 +04:00
										 |  |  | var ribbons = require('ribbons') | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-15 06:03:36 +04:00
										 |  |  | // XXX 
 | 
					
						
							|  |  |  | var testing = require('testing') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-02 02:55:03 +04:00
										 |  |  | var client = require('client') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-11 06:33:49 +04:00
										 |  |  | var viewer = require('viewer') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-28 03:47:44 +03:00
										 |  |  | //var promise = require('promise')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-02 02:55:03 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-15 02:57:31 +03:00
										 |  |  | // XXX move this to config...
 | 
					
						
							| 
									
										
										
										
											2015-09-15 03:03:13 +03:00
										 |  |  | // NOTE: setting this here (and only here) to -1 or null will desable 
 | 
					
						
							|  |  |  | // 		key dropping...
 | 
					
						
							|  |  |  | // NOTE: keeping this disabled is recommended for development...
 | 
					
						
							| 
									
										
										
										
											2015-09-15 03:38:30 +03:00
										 |  |  | // NOTE: setting this to 0 will only allow a single keypress per 
 | 
					
						
							|  |  |  | // 		execution frame...
 | 
					
						
							|  |  |  | // 		XXX yes there should be only one execution frame per event 
 | 
					
						
							|  |  |  | // 			triggered but this actually improves things, thus the issue 
 | 
					
						
							|  |  |  | // 			needs more investigation...
 | 
					
						
							|  |  |  | module.MAX_KEY_REPEAT_RATE = 0 | 
					
						
							| 
									
										
										
										
											2015-09-15 02:57:31 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:33:31 +04:00
										 |  |  | // XXX add this to the global doc...
 | 
					
						
							| 
									
										
										
										
											2014-07-22 17:09:25 +04:00
										 |  |  | module.GLOBAL_KEYBOARD = { | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 	'Global bindings': { | 
					
						
							|  |  |  | 		doc: 'NOTE: binding priority is the same as the order of sections '+ | 
					
						
							|  |  |  | 			'on this page.', | 
					
						
							|  |  |  | 		pattern: '*', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		F4: { | 
					
						
							| 
									
										
										
										
											2014-10-22 01:05:59 +04:00
										 |  |  | 			alt: 'close', | 
					
						
							|  |  |  | 			/* | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 			alt: doc('Close viewer',  | 
					
						
							|  |  |  | 				function(){  | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 					window.close()  | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 					return false | 
					
						
							|  |  |  | 				}), | 
					
						
							| 
									
										
										
										
											2014-10-22 01:05:59 +04:00
										 |  |  | 			*/ | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2015-04-25 20:17:21 +03:00
										 |  |  | 		Q: { | 
					
						
							|  |  |  | 			meta: 'close', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		F5: doc('Full reload viewer',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							|  |  |  | 				/* | 
					
						
							|  |  |  | 				killAllWorkers() | 
					
						
							|  |  |  | 					.done(function(){ | 
					
						
							|  |  |  | 						reload()  | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 				*/ | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 				location.reload() | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							| 
									
										
										
										
											2014-10-22 01:05:59 +04:00
										 |  |  | 		F12: 'showDevTools', | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		// NOTE: these are for systems where F** keys are not available 
 | 
					
						
							|  |  |  | 		// 		or do other stuff...
 | 
					
						
							|  |  |  | 		R: { | 
					
						
							| 
									
										
										
										
											2014-10-24 04:51:35 +04:00
										 |  |  | 			default: 'rotateCW', | 
					
						
							|  |  |  | 			shift: 'reverseImages', | 
					
						
							| 
									
										
										
										
											2014-10-22 01:05:59 +04:00
										 |  |  | 			ctrl: 'reload!', | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 			'ctrl+shift': 'F5', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-24 04:51:35 +04:00
										 |  |  | 		L: 'rotateCCW', | 
					
						
							|  |  |  | 		H: 'flipHorizontal', | 
					
						
							|  |  |  | 		V: 'flipVertical', | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		P: { | 
					
						
							|  |  |  | 			'ctrl+shift': 'F12', | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// NOTE: this is handled by the wrapper at this point, so we do 
 | 
					
						
							|  |  |  | 		// 		not have to do anything here...
 | 
					
						
							| 
									
										
										
										
											2014-10-22 01:23:56 +04:00
										 |  |  | 		F11: 'toggleFullScreen',  | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		F: { | 
					
						
							|  |  |  | 			ctrl: 'F11', | 
					
						
							| 
									
										
										
										
											2015-04-25 20:17:21 +03:00
										 |  |  | 			meta: 'F11', | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// XXX testing...
 | 
					
						
							| 
									
										
										
										
											2014-10-22 13:11:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-06 03:56:54 +03:00
										 |  |  | 		Enter: 'toggleSingleImage', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-21 21:17:44 +04:00
										 |  |  | 		Home: { | 
					
						
							|  |  |  | 			default: 'firstImage', | 
					
						
							| 
									
										
										
										
											2014-10-22 13:11:26 +04:00
										 |  |  | 			ctrl: 'firstGlobalImage', | 
					
						
							|  |  |  | 			shift: 'firstRibbon', | 
					
						
							| 
									
										
										
										
											2014-10-21 21:17:44 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		End: { | 
					
						
							|  |  |  | 			default: 'lastImage', | 
					
						
							| 
									
										
										
										
											2014-10-22 13:11:26 +04:00
										 |  |  | 			ctrl: 'lastGlobalImage', | 
					
						
							|  |  |  | 			shift: 'lastRibbon', | 
					
						
							| 
									
										
										
										
											2014-10-21 21:17:44 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		Left: { | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			default: 'prevImage', | 
					
						
							|  |  |  | 			alt: 'shiftImageLeft!', | 
					
						
							|  |  |  | 			ctrl: 'prevScreen', | 
					
						
							| 
									
										
										
										
											2015-04-25 20:17:21 +03:00
										 |  |  | 			// XXX need to prevent default on mac + browser...
 | 
					
						
							|  |  |  | 			meta: 'prevScreen', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-21 21:17:44 +04:00
										 |  |  | 		PgUp: 'prevScreen', | 
					
						
							|  |  |  | 		PgDown: 'nextScreen', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		Right: { | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			default: 'nextImage', | 
					
						
							|  |  |  | 			alt: 'shiftImageRight!', | 
					
						
							|  |  |  | 			ctrl: 'nextScreen', | 
					
						
							| 
									
										
										
										
											2015-04-25 20:17:21 +03:00
										 |  |  | 			// XXX need to prevent default on mac + browser...
 | 
					
						
							|  |  |  | 			meta: 'nextScreen', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 		'(': 'prevImageInOrder', | 
					
						
							|  |  |  | 		')': 'nextImageInOrder', | 
					
						
							| 
									
										
										
										
											2014-11-19 19:30:38 +03:00
										 |  |  | 		',': 'prevMarked', | 
					
						
							|  |  |  | 		'.': 'nextMarked', | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 		'[': 'prevBookmarked', | 
					
						
							|  |  |  | 		']': 'nextBookmarked', | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 		Up: { | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			default: 'prevRibbon', | 
					
						
							|  |  |  | 			shift: 'shiftImageUp', | 
					
						
							| 
									
										
										
										
											2015-01-07 17:44:24 +03:00
										 |  |  | 			'alt+shift': 'travelImageUp', | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			'ctrl+shift': 'shiftImageUpNewRibbon', | 
					
						
							| 
									
										
										
										
											2014-10-12 03:14:29 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		Down: { | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			default: 'nextRibbon', | 
					
						
							|  |  |  | 			shift: 'shiftImageDown', | 
					
						
							| 
									
										
										
										
											2015-01-07 17:44:24 +03:00
										 |  |  | 			'alt+shift': 'travelImageDown', | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			'ctrl+shift': 'shiftImageDownNewRibbon', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-20 16:38:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 		'#0': 'fitMax', | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		'#1': { | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			default: 'fitImage', | 
					
						
							| 
									
										
										
										
											2014-11-05 03:26:29 +03:00
										 |  |  | 			shift: 'fitRibbon', | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 			ctrl: 'fitOrig!', | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-11-05 16:19:37 +03:00
										 |  |  | 		'#2': 'fitImage: 2', | 
					
						
							| 
									
										
										
										
											2014-11-05 01:09:06 +03:00
										 |  |  | 		'#3': { | 
					
						
							| 
									
										
										
										
											2014-11-05 16:19:37 +03:00
										 |  |  | 			default: 'fitImage: 3', | 
					
						
							| 
									
										
										
										
											2014-11-05 16:24:36 +03:00
										 |  |  | 			shift: 'fitRibbon: 3.5', | 
					
						
							| 
									
										
										
										
											2014-11-05 01:09:06 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-11-05 16:24:36 +03:00
										 |  |  | 		'#4': 'fitImage: 4', | 
					
						
							| 
									
										
										
										
											2014-11-05 01:09:06 +03:00
										 |  |  | 		'#5': { | 
					
						
							| 
									
										
										
										
											2014-11-05 16:24:36 +03:00
										 |  |  | 			default: 'fitImage: 5', | 
					
						
							|  |  |  | 			shift: 'fitRibbon: 5.5', | 
					
						
							| 
									
										
										
										
											2014-11-05 01:09:06 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-11-05 16:24:36 +03:00
										 |  |  | 		'#6': 'fitImage: 6', | 
					
						
							|  |  |  | 		'#7': 'fitImage: 7', | 
					
						
							|  |  |  | 		'#8':'fitImage: 8', | 
					
						
							|  |  |  | 		'#9': 'fitImage: 9', | 
					
						
							| 
									
										
										
										
											2014-10-13 00:18:26 +04:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 		'+': 'zoomIn', | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		'=': '+', | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 		'-': 'zoomOut', | 
					
						
							| 
									
										
										
										
											2014-10-22 05:49:11 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		F2: { | 
					
						
							|  |  |  | 			default: 'cropRibbon', | 
					
						
							|  |  |  | 			shift: 'cropRibbonAndAbove', | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 			ctrl: 'cropMarked', | 
					
						
							|  |  |  | 			alt: 'cropBookmarked', | 
					
						
							| 
									
										
										
										
											2014-10-22 05:49:11 +04:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		Esc: { | 
					
						
							|  |  |  | 			default: 'uncrop', | 
					
						
							|  |  |  | 			ctrl: 'uncropAll', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-11-19 22:26:59 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// marking...
 | 
					
						
							| 
									
										
										
										
											2014-11-20 21:45:06 +03:00
										 |  |  | 		M: { | 
					
						
							|  |  |  | 			default: 'toggleMark', | 
					
						
							| 
									
										
										
										
											2015-09-12 04:53:13 +03:00
										 |  |  | 			alt: 'browseActions: "/Mark/"', | 
					
						
							| 
									
										
										
										
											2014-11-20 21:45:06 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-11-19 22:26:59 +03:00
										 |  |  | 		A: { | 
					
						
							| 
									
										
										
										
											2015-09-12 04:53:13 +03:00
										 |  |  | 			alt: 'browseActions', | 
					
						
							| 
									
										
										
										
											2015-11-07 22:14:19 +03:00
										 |  |  | 			'alt+shift': 'listActions', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-19 22:26:59 +03:00
										 |  |  | 			ctrl: 'toggleMark!: "ribbon" "on"', | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		D: { | 
					
						
							|  |  |  | 			ctrl: 'toggleMark!: "ribbon" "off"', | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		I: { | 
					
						
							|  |  |  | 			ctrl: 'toggleMark!: "ribbon"', | 
					
						
							| 
									
										
										
										
											2015-04-25 20:17:21 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			'meta+alt': 'showDevTools', | 
					
						
							| 
									
										
										
										
											2014-11-19 22:26:59 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2014-10-18 17:32:41 +04:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2014-11-20 21:45:06 +03:00
										 |  |  | 		B: { | 
					
						
							|  |  |  | 			default: 'toggleBookmark', | 
					
						
							| 
									
										
										
										
											2014-11-21 17:11:13 +03:00
										 |  |  | 			ctrl: 'toggleTheme!', | 
					
						
							| 
									
										
										
										
											2015-09-12 04:53:13 +03:00
										 |  |  | 			alt: 'browseActions: "/Bookmark/"', | 
					
						
							| 
									
										
										
										
											2014-11-20 21:45:06 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2015-09-15 03:38:30 +03:00
										 |  |  | 		C: 'browseActions: "/Crop/"', | 
					
						
							| 
									
										
										
										
											2015-11-28 18:15:12 +03:00
										 |  |  | 		O: 'browsePath', | 
					
						
							| 
									
										
										
										
											2015-11-15 01:25:04 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// XXX for debug...
 | 
					
						
							|  |  |  | 		G: function(){ $('.viewer').toggleClass('visible-gid') }, | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }	 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(function(){ | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-07 19:44:52 +03:00
										 |  |  | 	// XXX stub action set -- this needs to be auto-generated...
 | 
					
						
							|  |  |  | 	window.a = actions.Actions() | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-08 13:04:09 +03:00
										 |  |  | 	// used switch experimental actions on (set to true) or off (unset or false)...
 | 
					
						
							|  |  |  | 	//a.experimental = true
 | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-03 03:01:51 +03:00
										 |  |  | 	// setup actions...
 | 
					
						
							| 
									
										
										
										
											2014-12-05 00:10:01 +03:00
										 |  |  | 	viewer.ImageGridFeatures.setup(a, [ | 
					
						
							| 
									
										
										
										
											2014-12-09 16:34:14 +03:00
										 |  |  | 		'viewer-testing', | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-08 13:04:09 +03:00
										 |  |  | 		// XXX this is not for production...
 | 
					
						
							|  |  |  | 		'experiments', | 
					
						
							|  |  |  | 	]) | 
					
						
							| 
									
										
										
										
											2015-11-02 21:06:42 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-03 03:01:51 +03:00
										 |  |  | 	// setup the viewer...
 | 
					
						
							|  |  |  | 	a.load({ | 
					
						
							|  |  |  | 			viewer: $('.viewer'), | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-08 16:18:20 +03:00
										 |  |  | 	// load some testing data...
 | 
					
						
							| 
									
										
										
										
											2015-11-07 21:08:12 +03:00
										 |  |  | 	// NOTE: we can (and do) load this in parts...
 | 
					
						
							| 
									
										
										
										
											2014-12-08 13:04:09 +03:00
										 |  |  | 	a | 
					
						
							| 
									
										
										
										
											2015-11-03 03:01:51 +03:00
										 |  |  | 		.setEmptyMsg('Loading...') | 
					
						
							| 
									
										
										
										
											2014-12-08 13:04:09 +03:00
										 |  |  | 		.load({ | 
					
						
							|  |  |  | 			data: data.Data(testing.mock_data), | 
					
						
							|  |  |  | 			images: testing.makeTestImages(), | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 		// this is needed when loading legacy sources that do not have tags
 | 
					
						
							|  |  |  | 		// synced...
 | 
					
						
							|  |  |  | 		// do not do for actual data...
 | 
					
						
							|  |  |  | 		//.syncTags()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-08 16:18:20 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 	a.setEmptyMsg( | 
					
						
							|  |  |  | 		'Nothing loaded...', | 
					
						
							|  |  |  | 		'Press \'O\' to load, \'F1\' for help or \'?\' for keyboard mappings.') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 18:21:36 +04:00
										 |  |  | 	// setup base keyboard for devel, in case something breaks...
 | 
					
						
							| 
									
										
										
										
											2015-11-07 19:44:52 +03:00
										 |  |  | 	// This branch does not drop keys...
 | 
					
						
							| 
									
										
										
										
											2015-11-14 04:48:55 +03:00
										 |  |  | 	if(a.config['max-key-repeat-rate'] < 0 || a.config['max-key-repeat-rate'] == null){ | 
					
						
							| 
									
										
										
										
											2015-09-15 03:03:13 +03:00
										 |  |  | 		$(document) | 
					
						
							|  |  |  | 			.keydown( | 
					
						
							| 
									
										
										
										
											2015-09-15 02:57:31 +03:00
										 |  |  | 				keyboard.makeKeyboardHandler( | 
					
						
							|  |  |  | 					module.GLOBAL_KEYBOARD, | 
					
						
							|  |  |  | 					function(k){ | 
					
						
							|  |  |  | 						window.DEBUG && console.log(k) | 
					
						
							|  |  |  | 					},  | 
					
						
							| 
									
										
										
										
											2015-09-15 03:03:13 +03:00
										 |  |  | 					a)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-07 19:44:52 +03:00
										 |  |  | 	// drop keys if repeating to fast...
 | 
					
						
							|  |  |  | 	// NOTE: this is done for smoother animations...
 | 
					
						
							| 
									
										
										
										
											2015-09-15 03:03:13 +03:00
										 |  |  | 	} else { | 
					
						
							|  |  |  | 		$(document) | 
					
						
							|  |  |  | 			.keydown( | 
					
						
							|  |  |  | 				keyboard.dropRepeatingkeys( | 
					
						
							|  |  |  | 					keyboard.makeKeyboardHandler( | 
					
						
							|  |  |  | 						module.GLOBAL_KEYBOARD, | 
					
						
							|  |  |  | 						function(k){ | 
					
						
							|  |  |  | 							window.DEBUG && console.log(k) | 
					
						
							|  |  |  | 						}, | 
					
						
							|  |  |  | 						a),  | 
					
						
							|  |  |  | 					function(){  | 
					
						
							| 
									
										
										
										
											2015-11-14 04:48:55 +03:00
										 |  |  | 						return a.config['max-key-repeat-rate'] | 
					
						
							| 
									
										
										
										
											2015-09-15 03:03:13 +03:00
										 |  |  | 					})) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ | 
					
						
							|  |  |  | return module }) |