| 
									
										
										
										
											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'){ | 
					
						
							| 
									
										
										
										
											2014-12-28 03:47:44 +03:00
										 |  |  | 	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
										 |  |  | 	}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 17:08:40 +03:00
										 |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | define(function(require){ var module = {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //var DEBUG = DEBUG != null ? DEBUG : true
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-11 06:33:49 +04:00
										 |  |  | var viewer = require('viewer') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-08 07:56:01 +03:00
										 |  |  | 	// list all loaded modules...
 | 
					
						
							| 
									
										
										
										
											2015-12-13 19:31:03 +03:00
										 |  |  | 	var m = requirejs.s.contexts._.defined | 
					
						
							|  |  |  | 	m = Object.keys(m).filter(function(e){ return m[e] != null }) | 
					
						
							|  |  |  | 	console.log('Modules (%d):', m.length, m) | 
					
						
							| 
									
										
										
										
											2015-12-08 07:56:01 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-21 23:53:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-03 03:01:51 +03:00
										 |  |  | 	// setup actions...
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:23:32 +03:00
										 |  |  | 	window.a = viewer.ImageGridFeatures | 
					
						
							|  |  |  | 		.setup([ | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 			'viewer-testing', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 			'demo', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 			// XXX this is not for production...
 | 
					
						
							|  |  |  | 			'experiments', | 
					
						
							|  |  |  | 		]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 	// used to switch experimental actions on (set to true) or off (unset or false)...
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:23:32 +03:00
										 |  |  | 	//a.experimental = true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-13 19:31:03 +03:00
										 |  |  | 	// report stuff...
 | 
					
						
							|  |  |  | 	// XXX we also have .conflicts and .missing
 | 
					
						
							|  |  |  | 	a.features.excluded.length > 0  | 
					
						
							|  |  |  | 		&& console.warn('Features excluded (%d):', | 
					
						
							|  |  |  | 			a.features.excluded.length,  | 
					
						
							|  |  |  | 			a.features.excluded) | 
					
						
							|  |  |  | 	console.log('Features not applicable (%d):',  | 
					
						
							|  |  |  | 		a.features.unapplicable.length,  | 
					
						
							|  |  |  | 		a.features.unapplicable) | 
					
						
							|  |  |  | 	console.log('Features loaded (%d):', | 
					
						
							|  |  |  | 		a.features.features.length,  | 
					
						
							|  |  |  | 		a.features.features) | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-13 19:31:03 +03:00
										 |  |  | 	a.logger = a.logger || {emit: function(e, v){ console.log('    ', e, v) }} | 
					
						
							| 
									
										
										
										
											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...
 | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 	a | 
					
						
							| 
									
										
										
										
											2015-12-14 02:49:04 +03:00
										 |  |  | 		.load({ viewer: $('.viewer') }) | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 		.start() | 
					
						
							| 
									
										
										
										
											2015-12-10 00:24:43 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 10:55:27 +03:00
										 |  |  | 	// load some testing data if nothing else loaded...
 | 
					
						
							|  |  |  | 	if(!a.url_history || Object.keys(a.url_history).length == 0){ | 
					
						
							| 
									
										
										
										
											2015-12-10 00:24:43 +03:00
										 |  |  | 		// NOTE: we can (and do) load this in parts...
 | 
					
						
							| 
									
										
										
										
											2016-04-02 16:28:53 +03:00
										 |  |  | 		a.loadDemoIndex() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-10 00:24:43 +03:00
										 |  |  | 			// this is needed when loading legacy sources that do not have tags
 | 
					
						
							|  |  |  | 			// synced...
 | 
					
						
							|  |  |  | 			// do not do for actual data...
 | 
					
						
							|  |  |  | 			//.syncTags()
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-07-21 16:38:06 +04:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ | 
					
						
							|  |  |  | return module }) |