2015-05-14 13:57:50 +00:00
|
|
|
/* globals window:true, document:true */
|
|
|
|
( function() {
|
|
|
|
|
|
|
|
// Find the script element
|
|
|
|
var scripts = document.getElementsByTagName( "script" );
|
|
|
|
var script = scripts[ scripts.length - 1 ];
|
|
|
|
|
|
|
|
// Read the modules
|
|
|
|
var modules = script.getAttribute( "data-modules" );
|
|
|
|
var pathParts = window.location.pathname.split( "/" );
|
|
|
|
var effectsAll = [
|
|
|
|
"effect-blind",
|
|
|
|
"effect-bounce",
|
|
|
|
"effect-clip",
|
|
|
|
"effect-drop",
|
|
|
|
"effect-explode",
|
|
|
|
"effect-fade",
|
|
|
|
"effect-fold",
|
|
|
|
"effect-highlight",
|
|
|
|
"effect-puff",
|
|
|
|
"effect-pulsate",
|
|
|
|
"effect-scale",
|
|
|
|
"effect-shake",
|
|
|
|
"effect-size",
|
|
|
|
"effect-slide"
|
|
|
|
];
|
2015-07-15 01:54:33 +00:00
|
|
|
var widgets = [
|
2015-07-15 01:56:36 +00:00
|
|
|
"accordion",
|
2015-07-15 01:57:20 +00:00
|
|
|
"autocomplete",
|
|
|
|
"button"
|
2015-07-15 01:54:33 +00:00
|
|
|
];
|
2015-07-21 19:54:14 +00:00
|
|
|
|
|
|
|
function getPath( module ) {
|
|
|
|
for ( var i = 0; i < widgets.length; i++ ) {
|
|
|
|
if ( widgets[ i ] === module ) {
|
|
|
|
return "widgets/" + module;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return module;
|
|
|
|
}
|
|
|
|
function fixPaths( modules ) {
|
|
|
|
for ( var i = 0; i < modules.length; i++ ) {
|
|
|
|
modules[ i ] = getPath( modules[ i ] );
|
|
|
|
}
|
|
|
|
return modules;
|
|
|
|
}
|
2015-05-14 13:57:50 +00:00
|
|
|
|
|
|
|
// Hide the page while things are loading to prevent a FOUC
|
|
|
|
document.documentElement.className = "demo-loading";
|
|
|
|
|
|
|
|
require.config( {
|
|
|
|
baseUrl: "../../ui",
|
|
|
|
paths: {
|
|
|
|
jquery: "../external/jquery/jquery",
|
|
|
|
external: "../external/"
|
|
|
|
},
|
|
|
|
shim: {
|
|
|
|
"external/globalize/globalize.culture.de-DE": [ "external/globalize/globalize" ],
|
|
|
|
"external/globalize/globalize.culture.ja-JP": [ "external/globalize/globalize" ]
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2015-07-21 19:54:14 +00:00
|
|
|
|
2015-05-14 13:57:50 +00:00
|
|
|
// Replace effects all shortcut modules with all the effects modules
|
|
|
|
if ( modules && modules.indexOf( "effects-all" ) !== -1 ) {
|
|
|
|
modules = modules.replace( /effects-all/, effectsAll.join( " " ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
modules = modules ? modules.replace( /^\s+|\s+$/g, "" ).split( /\s+/ ) : [];
|
|
|
|
modules.push( pathParts[ pathParts.length - 2 ] );
|
2015-07-21 19:54:14 +00:00
|
|
|
modules = fixPaths( modules );
|
2015-05-14 13:57:50 +00:00
|
|
|
|
|
|
|
require( modules, function() {
|
|
|
|
var newScript = document.createElement( "script" );
|
|
|
|
|
|
|
|
document.documentElement.className = "";
|
|
|
|
|
|
|
|
newScript.text = "( function() { " + script.innerHTML + " } )();";
|
2015-07-21 14:55:41 +00:00
|
|
|
document.head.appendChild( newScript ).parentNode.removeChild( newScript );
|
2015-05-14 13:57:50 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
} )();
|