Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Demos: Add new infrastructure using a require.js bootstrap
Fixes #10119 Closes gh-1557
- Loading branch information
Showing
3 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* 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" | ||
]; | ||
|
||
// 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" ] | ||
} | ||
} ); | ||
|
||
// 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 ] ); | ||
|
||
require( modules, function() { | ||
var newScript = document.createElement( "script" ); | ||
|
||
document.documentElement.className = ""; | ||
|
||
newScript.text = "( function() { " + script.innerHTML + " } )();"; | ||
document.head.appendChild( script ).parentNode.removeChild( script ); | ||
} ); | ||
|
||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2,6 +2,10 @@ body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
.demo-loading { | ||
visibility: hidden; | ||
} | ||
|
||
table { | ||
font-size: 1em; | ||
} | ||