2014-07-21 16:38:06 +04: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
|
|
|
|
|
|
|
|
|
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...
|
|
|
|
|
if(window.process || global.process && process.__nwjs){
|
|
|
|
|
var path = require('path')
|
|
|
|
|
require('app-module-path')
|
|
|
|
|
.addPath(path.dirname(process.execPath) + '/node_modules/')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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 = {}
|
|
|
|
|
|
|
|
|
|
//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-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
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
|
|
$(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-10 00:24:43 +03:00
|
|
|
.setEmptyMsg('Loading...')
|
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-12-08 13:04:09 +03:00
|
|
|
|
2014-11-08 16:18:20 +03:00
|
|
|
|
2016-04-02 16:28:53 +03:00
|
|
|
// XXX calling a.clear() does not display this...
|
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 16:38:06 +04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* vim:set ts=4 sw=4 : */
|
|
|
|
|
return module })
|