2015-08-21 04:14:29 +00:00
|
|
|
/* globals window, document */
|
2015-05-14 13:57:50 +00:00
|
|
|
( 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" );
|
2015-09-30 07:49:13 +00:00
|
|
|
var composite = script.getAttribute( "data-composite" ) || false;
|
2015-05-14 13:57:50 +00:00
|
|
|
var pathParts = window.location.pathname.split( "/" );
|
|
|
|
var effectsAll = [
|
2015-07-15 02:01:41 +00:00
|
|
|
"effects/effect-blind",
|
|
|
|
"effects/effect-bounce",
|
|
|
|
"effects/effect-clip",
|
|
|
|
"effects/effect-drop",
|
|
|
|
"effects/effect-explode",
|
|
|
|
"effects/effect-fade",
|
|
|
|
"effects/effect-fold",
|
|
|
|
"effects/effect-highlight",
|
|
|
|
"effects/effect-puff",
|
|
|
|
"effects/effect-pulsate",
|
|
|
|
"effects/effect-scale",
|
|
|
|
"effects/effect-shake",
|
|
|
|
"effects/effect-size",
|
2015-09-30 07:49:13 +00:00
|
|
|
"effects/effect-slide",
|
|
|
|
"effects/effect-transfer"
|
2015-05-14 13:57:50 +00:00
|
|
|
];
|
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",
|
2015-07-15 01:58:04 +00:00
|
|
|
"button",
|
2015-08-20 13:48:11 +00:00
|
|
|
"calendar",
|
2015-08-09 13:16:05 +00:00
|
|
|
"checkboxradio",
|
2015-08-09 13:18:44 +00:00
|
|
|
"controlgroup",
|
2015-07-15 01:59:10 +00:00
|
|
|
"datepicker",
|
2015-07-15 01:59:40 +00:00
|
|
|
"dialog",
|
2015-07-15 02:03:06 +00:00
|
|
|
"draggable",
|
2015-07-15 02:03:37 +00:00
|
|
|
"droppable",
|
2015-07-15 02:04:22 +00:00
|
|
|
"menu",
|
2015-07-15 02:18:43 +00:00
|
|
|
"mouse",
|
2015-07-15 02:05:00 +00:00
|
|
|
"progressbar",
|
2015-07-15 02:05:54 +00:00
|
|
|
"resizable",
|
2015-07-15 02:06:31 +00:00
|
|
|
"selectable",
|
2015-07-15 02:08:11 +00:00
|
|
|
"selectmenu",
|
2015-07-15 02:08:51 +00:00
|
|
|
"slider",
|
2015-07-15 02:10:12 +00:00
|
|
|
"sortable",
|
2015-07-15 02:11:35 +00:00
|
|
|
"spinner",
|
2015-07-15 02:12:14 +00:00
|
|
|
"tabs",
|
|
|
|
"tooltip"
|
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;
|
|
|
|
}
|
|
|
|
}
|
2015-07-15 02:01:41 +00:00
|
|
|
for ( var j = 0; j < effectsAll.length; j++ ) {
|
2015-09-30 07:49:13 +00:00
|
|
|
if ( module !== "effect" ) {
|
|
|
|
if ( effectsAll[ j ] === module ) {
|
|
|
|
return module;
|
|
|
|
}
|
|
|
|
if ( effectsAll[ j ].indexOf( module ) !== -1 ) {
|
|
|
|
return "effects/" + module;
|
|
|
|
}
|
2015-07-15 02:01:41 +00:00
|
|
|
}
|
|
|
|
}
|
2015-07-21 19:54:14 +00:00
|
|
|
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( {
|
2015-09-30 07:49:13 +00:00
|
|
|
baseUrl: window.location.pathname.indexOf( "demos/" ) !== -1 ? "../../ui" : "../../../ui",
|
2015-05-14 13:57:50 +00:00
|
|
|
paths: {
|
2015-08-20 13:48:11 +00:00
|
|
|
cldr: "../external/cldrjs/cldr",
|
2015-11-18 16:04:20 +00:00
|
|
|
"globalize-runtime": "../external/globalize/globalize-runtime",
|
2015-08-20 13:48:11 +00:00
|
|
|
"globalize-locales": "../external/localization",
|
2015-05-14 13:57:50 +00:00
|
|
|
jquery: "../external/jquery/jquery",
|
|
|
|
external: "../external/"
|
|
|
|
},
|
2015-11-18 16:04:20 +00:00
|
|
|
map: {
|
|
|
|
"*": {
|
|
|
|
"globalize": "globalize-runtime"
|
|
|
|
}
|
|
|
|
},
|
2015-05-14 13:57:50 +00:00
|
|
|
shim: {
|
2015-08-20 13:48:11 +00:00
|
|
|
"external/globalize-old/globalize.culture.de-DE": [ "external/globalize-old/globalize" ],
|
|
|
|
"external/globalize-old/globalize.culture.ja-JP": [ "external/globalize-old/globalize" ]
|
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+/ ) : [];
|
2015-09-30 07:49:13 +00:00
|
|
|
if ( !composite ) {
|
|
|
|
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-10-06 12:30:15 +00:00
|
|
|
document.body.appendChild( newScript ).parentNode.removeChild( newScript );
|
2015-05-14 13:57:50 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
} )();
|