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...
|
2016-05-28 16:29:57 +03:00
|
|
|
//
|
|
|
|
|
// XXX this will create a second requirejs instance with node
|
|
|
|
|
// compatibility...
|
|
|
|
|
// ...would be nice if we could avoid this...
|
|
|
|
|
// XXX setting nodeRequire on existing requirejs will change how
|
|
|
|
|
// everything is loaded...
|
2016-05-02 17:08:40 +03:00
|
|
|
if(typeof(process) != 'undefined'){
|
2016-05-28 16:29:57 +03:00
|
|
|
var requirejs =
|
|
|
|
|
global.requirejs =
|
|
|
|
|
window.requirejs =
|
|
|
|
|
require('requirejs')
|
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 = {}
|
2016-05-28 16:29:57 +03:00
|
|
|
//requirejs(['viewer'], function(viewer){
|
2014-07-21 16:38:06 +04:00
|
|
|
|
|
|
|
|
//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...
|
2016-05-27 18:56:08 +03:00
|
|
|
window.ig =
|
|
|
|
|
window.ImageGrid =
|
|
|
|
|
viewer.ImageGridFeatures
|
|
|
|
|
.setup([
|
|
|
|
|
'viewer-testing',
|
2015-12-11 10:55:27 +03:00
|
|
|
|
2016-05-27 18:56:08 +03:00
|
|
|
'demo',
|
2016-04-02 17:34:25 +03:00
|
|
|
|
2016-05-27 18:56:08 +03:00
|
|
|
// XXX this is not for production...
|
|
|
|
|
'experiments',
|
2016-05-28 16:29:57 +03:00
|
|
|
|
|
|
|
|
// XXX BUG: disabling features on this level does not
|
|
|
|
|
// work, yet works deeper down...
|
|
|
|
|
// Example:
|
|
|
|
|
// '-ui' // will throw an error:
|
|
|
|
|
// // Feature "-ui" not loaded...
|
2016-05-27 18:56:08 +03:00
|
|
|
])
|
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...
|
|
|
|
|
// XXX we also have .conflicts and .missing
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.features.excluded.length > 0
|
2015-12-13 19:31:03 +03:00
|
|
|
&& console.warn('Features excluded (%d):',
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.features.excluded.length,
|
|
|
|
|
ig.features.excluded)
|
|
|
|
|
ig.features.disabled.length > 0
|
2016-05-11 05:00:40 +03:00
|
|
|
&& console.log('Features disabled (%d):',
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.features.disabled.length,
|
|
|
|
|
ig.features.disabled)
|
2015-12-13 19:31:03 +03:00
|
|
|
console.log('Features not applicable (%d):',
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.features.unapplicable.length,
|
|
|
|
|
ig.features.unapplicable)
|
2015-12-13 19:31:03 +03:00
|
|
|
console.log('Features loaded (%d):',
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.features.features.length,
|
|
|
|
|
ig.features.features)
|
2015-12-11 10:55:27 +03:00
|
|
|
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.logger = ig.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...
|
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()
|
2015-12-10 00:24:43 +03:00
|
|
|
|
|
|
|
|
|
2015-12-11 10:55:27 +03:00
|
|
|
// load some testing data if nothing else loaded...
|
2016-05-27 18:56:08 +03:00
|
|
|
if(!ig.url_history || Object.keys(ig.url_history).length == 0){
|
2015-12-10 00:24:43 +03:00
|
|
|
// NOTE: we can (and do) load this in parts...
|
2016-05-27 18:56:08 +03:00
|
|
|
ig.loadDemoIndex()
|
2016-04-02 16:28:53 +03:00
|
|
|
|
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 })
|
2016-05-28 16:29:57 +03:00
|
|
|
//})
|