| 1 |
|
| 2 |
( function() { |
| 3 |
"use strict"; |
| 4 |
|
| 5 |
var script = document.currentScript; |
| 6 |
|
| 7 |
|
| 8 |
var modules = script.getAttribute( "data-modules" ); |
| 9 |
var composite = script.getAttribute( "data-composite" ) || false; |
| 10 |
var pathParts = window.location.pathname.split( "/" ); |
| 11 |
var effectsAll = [ |
| 12 |
"effects/effect-blind", |
| 13 |
"effects/effect-bounce", |
| 14 |
"effects/effect-clip", |
| 15 |
"effects/effect-drop", |
| 16 |
"effects/effect-explode", |
| 17 |
"effects/effect-fade", |
| 18 |
"effects/effect-fold", |
| 19 |
"effects/effect-highlight", |
| 20 |
"effects/effect-puff", |
| 21 |
"effects/effect-pulsate", |
| 22 |
"effects/effect-scale", |
| 23 |
"effects/effect-shake", |
| 24 |
"effects/effect-size", |
| 25 |
"effects/effect-slide", |
| 26 |
"effects/effect-transfer" |
| 27 |
]; |
| 28 |
var widgets = [ |
| 29 |
"accordion", |
| 30 |
"autocomplete", |
| 31 |
"button", |
| 32 |
"checkboxradio", |
| 33 |
"controlgroup", |
| 34 |
"datepicker", |
| 35 |
"dialog", |
| 36 |
"draggable", |
| 37 |
"droppable", |
| 38 |
"menu", |
| 39 |
"mouse", |
| 40 |
"progressbar", |
| 41 |
"resizable", |
| 42 |
"selectable", |
| 43 |
"selectmenu", |
| 44 |
"slider", |
| 45 |
"sortable", |
| 46 |
"spinner", |
| 47 |
"tabs", |
| 48 |
"tooltip" |
| 49 |
]; |
| 50 |
|
| 51 |
function getPath( module ) { |
| 52 |
for ( var i = 0; i < widgets.length; i++ ) { |
| 53 |
if ( widgets[ i ] === module ) { |
| 54 |
return "widgets/" + module; |
| 55 |
} |
| 56 |
} |
| 57 |
for ( var j = 0; j < effectsAll.length; j++ ) { |
| 58 |
if ( module !== "effect" ) { |
| 59 |
if ( effectsAll[ j ] === module ) { |
| 60 |
return module; |
| 61 |
} |
| 62 |
if ( effectsAll[ j ].indexOf( module ) !== -1 ) { |
| 63 |
return "effects/" + module; |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
return module; |
| 68 |
} |
| 69 |
function fixPaths( modules ) { |
| 70 |
for ( var i = 0; i < modules.length; i++ ) { |
| 71 |
modules[ i ] = getPath( modules[ i ] ); |
| 72 |
} |
| 73 |
return modules; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
document.documentElement.className = "demo-loading"; |
| 78 |
|
| 79 |
require.config( { |
| 80 |
baseUrl: window.location.pathname.indexOf( "demos/" ) !== -1 ? "../../ui" : "../../../ui", |
| 81 |
paths: { |
| 82 |
jquery: "../external/jquery/jquery", |
| 83 |
external: "../external/" |
| 84 |
}, |
| 85 |
shim: { |
| 86 |
"external/globalize/globalize.culture.de-DE": [ "external/globalize/globalize" ], |
| 87 |
"external/globalize/globalize.culture.ja-JP": [ "external/globalize/globalize" ] |
| 88 |
} |
| 89 |
} ); |
| 90 |
|
| 91 |
|
| 92 |
if ( modules && modules.indexOf( "effects-all" ) !== -1 ) { |
| 93 |
modules = modules.replace( /effects-all/, effectsAll.join( " " ) ); |
| 94 |
} |
| 95 |
|
| 96 |
modules = modules ? modules.replace( /^\s+|\s+$/g, "" ).split( /\s+/ ) : []; |
| 97 |
if ( !composite ) { |
| 98 |
modules.push( pathParts[ pathParts.length - 2 ] ); |
| 99 |
} |
| 100 |
modules = fixPaths( modules ); |
| 101 |
|
| 102 |
require( modules, function() { |
| 103 |
var newScript = document.createElement( "script" ); |
| 104 |
|
| 105 |
document.documentElement.className = ""; |
| 106 |
|
| 107 |
newScript.text = "( function() { " + script.innerHTML + " } )();"; |
| 108 |
document.body.appendChild( newScript ).parentNode.removeChild( newScript ); |
| 109 |
} ); |
| 110 |
|
| 111 |
} )(); |