| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							| 
									
										
										
										
											2016-05-02 17:08:40 +03:00
										 |  |  | // Pre-setup...
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 15:12:18 +03:00
										 |  |  | // Add node_modules path outside of the packed nwjs code...
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This keeps the large node module set outside the zip thus speeding
 | 
					
						
							|  |  |  | // up the loading process significantly...
 | 
					
						
							| 
									
										
										
										
											2016-05-02 17:08:40 +03:00
										 |  |  | if((typeof(process) != 'undefined' ? process : {}).__nwjs){ | 
					
						
							| 
									
										
										
										
											2016-05-02 15:12:18 +03:00
										 |  |  | 	var path = require('path') | 
					
						
							|  |  |  | 	require('app-module-path') | 
					
						
							|  |  |  | 		.addPath(path.dirname(process.execPath) + '/node_modules/') | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 17:08:40 +03:00
										 |  |  | // Setup requirejs if we are in node/nw...
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // NOTE: no need to do this in browser...
 | 
					
						
							|  |  |  | if(typeof(process) != 'undefined'){ | 
					
						
							| 
									
										
										
										
											2018-11-29 04:59:50 +03:00
										 |  |  | 	//require('v8-compile-cache')
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 05:49:50 +03:00
										 |  |  | 	requirejs =  | 
					
						
							| 
									
										
										
										
											2016-05-28 16:29:57 +03:00
										 |  |  | 	global.requirejs =  | 
					
						
							|  |  |  | 	window.requirejs =  | 
					
						
							| 
									
										
										
										
											2016-08-26 05:49:50 +03:00
										 |  |  | 		// XXX for some reason we can't just use the browser requirejs 
 | 
					
						
							|  |  |  | 		// 		even if we pass it nodeRequire, it still can't pass the
 | 
					
						
							|  |  |  | 		// 		node stuff to node...
 | 
					
						
							| 
									
										
										
										
											2016-05-28 16:29:57 +03:00
										 |  |  | 		require('requirejs') | 
					
						
							| 
									
										
										
										
											2016-05-29 19:50:37 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 05:49:50 +03:00
										 |  |  | 	nodeRequire = | 
					
						
							| 
									
										
										
										
											2016-05-29 19:50:37 +03:00
										 |  |  | 	global.nodeRequire =  | 
					
						
							|  |  |  | 	window.nodeRequire = | 
					
						
							|  |  |  | 		require | 
					
						
							| 
									
										
										
										
											2014-12-28 03:47:44 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-26 05:49:50 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 17:08:40 +03:00
										 |  |  | /*********************************************************************/ | 
					
						
							| 
									
										
										
										
											2016-08-20 22:49:36 +03:00
										 |  |  | (typeof(define)[0]=='u'?function(f){module.exports=f(require)}:define)( | 
					
						
							|  |  |  | function(require){ var module={} // makes module AMD/node compatible...
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-20 01:16:05 +03:00
										 |  |  | var utildom = require('lib/util-dom') | 
					
						
							| 
									
										
										
										
											2016-06-01 16:12:10 +03:00
										 |  |  | var viewer = require('imagegrid/viewer') | 
					
						
							| 
									
										
										
										
											2014-10-11 06:33:49 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-02 02:55:03 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(function(){ | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 	try { | 
					
						
							|  |  |  | 		// setup actions...
 | 
					
						
							|  |  |  | 		window.ig =  | 
					
						
							|  |  |  | 		window.ImageGrid =  | 
					
						
							|  |  |  | 			viewer.ImageGridFeatures | 
					
						
							|  |  |  | 				.setup([ | 
					
						
							| 
									
										
										
										
											2017-12-09 03:14:36 +03:00
										 |  |  | 					'imagegrid-testing', | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 					'demo', | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 					// XXX this is not for production...
 | 
					
						
							|  |  |  | 					'experiments', | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 					//'-commandline',
 | 
					
						
							|  |  |  | 					//'-ui-partial-ribbons',
 | 
					
						
							|  |  |  | 				]) | 
					
						
							| 
									
										
										
										
											2016-05-28 16:29:57 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-27 06:50:29 +03:00
										 |  |  | 		window.ImageGridFeatures = viewer.ImageGridFeatures | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 	} catch(err){ | 
					
						
							|  |  |  | 		console.error(err) | 
					
						
							| 
									
										
										
										
											2018-02-14 16:49:44 +03:00
										 |  |  | 		//throw err
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 		return | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 	// used to switch experimental actions on (set to true) or off (unset or false)...
 | 
					
						
							| 
									
										
										
										
											2016-05-27 18:56:08 +03:00
										 |  |  | 	//ig.experimental = true
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:23:32 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-13 19:31:03 +03:00
										 |  |  | 	// report stuff...
 | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 	console.log('Loaded features:', | 
					
						
							| 
									
										
										
										
											2016-05-27 18:56:08 +03:00
										 |  |  | 		ig.features.features) | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 	console.log('Disabled features:',  | 
					
						
							| 
									
										
										
										
											2017-06-22 16:11:17 +03:00
										 |  |  | 		ig.features.disabled) | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 	console.log('Not applicable features:',  | 
					
						
							| 
									
										
										
										
											2017-06-22 16:11:17 +03:00
										 |  |  | 		ig.features.unapplicable) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	ig.features.excluded.length > 0  | 
					
						
							| 
									
										
										
										
											2017-06-25 08:59:01 +03:00
										 |  |  | 		&& console.warn('Excluded features:', | 
					
						
							| 
									
										
										
										
											2017-06-22 16:11:17 +03:00
										 |  |  | 			ig.features.excluded) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// NOTE: fatal errors will get reported by setup...
 | 
					
						
							|  |  |  | 	if(ig.features.error){ | 
					
						
							|  |  |  | 		var err = ig.features.error | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 		err.missing_suggested.length > 0 | 
					
						
							| 
									
										
										
										
											2017-06-25 08:59:01 +03:00
										 |  |  | 			&& console.warn('Missing suggested features:',  | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 				err.missing_suggested) | 
					
						
							| 
									
										
										
										
											2017-06-22 16:11:17 +03:00
										 |  |  | 		err.missing.length > 0 | 
					
						
							| 
									
										
										
										
											2017-06-25 08:54:00 +03:00
										 |  |  | 			&& console.warn('Missing dependencies:',  | 
					
						
							| 
									
										
										
										
											2017-06-22 16:11:17 +03:00
										 |  |  | 				err.missing) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-14 00:06:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// setup logger...
 | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 	// XXX STUB...
 | 
					
						
							|  |  |  | 	ig.logger = ig.logger || { | 
					
						
							|  |  |  | 		root: true, | 
					
						
							|  |  |  | 		message: null, | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 		log: null, | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		emit: function(e, v){  | 
					
						
							|  |  |  | 			var msg = this.message | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 			var log = this.log = this.log || [] | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-07 09:34:49 +03:00
										 |  |  | 			var i = v instanceof Array ? v.length : 1 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 			// report progress...
 | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 			// XXX HACK -- need meaningful status...
 | 
					
						
							|  |  |  | 			if(e == 'queued'  | 
					
						
							|  |  |  | 					|| e == 'found'){ | 
					
						
							| 
									
										
										
										
											2019-01-07 09:34:49 +03:00
										 |  |  | 				ig.showProgress(msg || ['Progress', e], '+0', '+'+i) | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			} else if(e == 'loaded' || e == 'done' || e == 'written'  | 
					
						
							| 
									
										
										
										
											2016-12-14 03:44:33 +03:00
										 |  |  | 					|| e == 'index'){ | 
					
						
							| 
									
										
										
										
											2019-01-07 09:34:49 +03:00
										 |  |  | 				ig.showProgress(msg || ['Progress', e], '+'+i) | 
					
						
							| 
									
										
										
										
											2016-12-14 03:44:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			} else if(e == 'skipping' || e == 'skipped'){ | 
					
						
							|  |  |  | 				// XXX if everything is skipped the indicator does not 
 | 
					
						
							|  |  |  | 				// 		get hidden...
 | 
					
						
							|  |  |  | 				//ig.showProgress(msg || ['Progress', e], '+0', '-1')
 | 
					
						
							| 
									
										
										
										
											2019-01-07 09:34:49 +03:00
										 |  |  | 				ig.showProgress(msg || ['Progress', e], '+'+i) | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// XXX STUB...
 | 
					
						
							|  |  |  | 			} else if(e == 'error' ){ | 
					
						
							| 
									
										
										
										
											2019-01-07 09:34:49 +03:00
										 |  |  | 				ig.showProgress(['Error'].concat(msg), '+0', '+'+i) | 
					
						
							| 
									
										
										
										
											2018-09-21 16:42:49 +03:00
										 |  |  | 				console.log(msg ?  | 
					
						
							|  |  |  | 					'    '+ msg.join(': ') + ':'  | 
					
						
							|  |  |  | 					: '', ...arguments)  | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				// console...
 | 
					
						
							| 
									
										
										
										
											2018-09-21 16:42:49 +03:00
										 |  |  | 				console.log(msg ?  | 
					
						
							|  |  |  | 					'    '+ msg.join(': ') + ':'  | 
					
						
							|  |  |  | 					: '', ...arguments)  | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// XXX
 | 
					
						
							|  |  |  | 			//log.push([msg, e, v])
 | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		push: function(msg){ | 
					
						
							|  |  |  | 			if(msg == null){ | 
					
						
							|  |  |  | 				return this | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			var logger = Object.create(this) | 
					
						
							|  |  |  | 			logger.root = false | 
					
						
							|  |  |  | 			logger.message = logger.message == null ? [msg] : logger.message.concat([msg]) | 
					
						
							| 
									
										
										
										
											2016-11-15 18:29:33 +03:00
										 |  |  | 			logger.log = this.log = this.log || [] | 
					
						
							| 
									
										
										
										
											2016-11-04 23:00:34 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			return logger | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		pop: function(){ | 
					
						
							|  |  |  | 			return !this.__proto__.root ? this.__proto__ : this	 | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-10-20 06:52:13 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-02 21:06:42 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-03 03:01:51 +03:00
										 |  |  | 	// setup the viewer...
 | 
					
						
							| 
									
										
										
										
											2016-05-27 18:56:08 +03:00
										 |  |  | 	ig | 
					
						
							| 
									
										
										
										
											2015-12-14 02:49:04 +03:00
										 |  |  | 		.load({ viewer: $('.viewer') }) | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 		.start() | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ | 
					
						
							|  |  |  | return module }) | 
					
						
							| 
									
										
										
										
											2016-05-28 16:29:57 +03:00
										 |  |  | //})
 |