81 lines
1.8 KiB
JavaScript
81 lines
1.8 KiB
JavaScript
/*global require, requirejs, define, Modernizr, _basepath_ */
|
|
// http://requirejs.org/docs/api.html#config
|
|
var path = typeof _basepath_ === 'string' ? _basepath_ + '/' : '';
|
|
requirejs.config(
|
|
{
|
|
baseUrl: path + 'scripts/',
|
|
waitSeconds: 50,
|
|
urlArgs: 'bust=' + ( new Date() ).getTime()
|
|
}
|
|
);
|
|
|
|
require(
|
|
[
|
|
'src/process',
|
|
'src/image',
|
|
'src/file',
|
|
'src/dragdrop',
|
|
'src/controls',
|
|
'src/export-button',
|
|
'src/import-button',
|
|
'src/random-button',
|
|
'src/upload-imgur',
|
|
'util/feature-test',
|
|
'lib/signals-1.0.0'
|
|
],
|
|
function(
|
|
process,
|
|
image,
|
|
file,
|
|
dragdrop,
|
|
controls,
|
|
export_button,
|
|
import_button,
|
|
random_button,
|
|
imgur,
|
|
testFeatures,
|
|
Signal
|
|
)
|
|
{
|
|
testFeatures( init, showError );
|
|
|
|
function init( supported_features )
|
|
{
|
|
var shared = {
|
|
feature: supported_features,
|
|
signals: {
|
|
'load-file' : new Signal(),
|
|
'image-loaded' : new Signal(),
|
|
'set-new-src' : new Signal(),
|
|
'control-set' : new Signal(),
|
|
'control-updated' : new Signal(),
|
|
'image-data-url-requested' : new Signal()
|
|
}
|
|
};
|
|
|
|
process.init( shared );
|
|
dragdrop.init( shared );
|
|
controls.init( shared );
|
|
export_button.init( shared );
|
|
import_button.init( shared );
|
|
random_button.init( shared );
|
|
image.init( shared );
|
|
file.init( shared );
|
|
imgur.init( shared );
|
|
}
|
|
|
|
function showError( required_features )
|
|
{
|
|
var message = document.createElement( 'div' );
|
|
|
|
var message_text = 'sorry. it looks like your browser is missing some of the features ';
|
|
message_text += '(' + required_features.join( ', ' ) + ') that are required to run this ';
|
|
message_text += 'experiment.';
|
|
|
|
message.innerText = message_text;
|
|
message.className = 'missing-feature';
|
|
|
|
document.getElementsByTagName( 'body' )[0].appendChild( message );
|
|
}
|
|
}
|
|
); |