Skip to content

Commit 0de586f

Browse files
committed
Demos: Add new infrastructure using a require.js bootstrap
1 parent f499569 commit 0de586f

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

demos/bootstrap.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
(function() {
2+
3+
// Find the script element
4+
var scripts = document.getElementsByTagName( "script" );
5+
var script = scripts[ scripts.length - 1 ];
6+
7+
// Read the modules
8+
var modules = script.getAttribute( "data-modules" );
9+
var demoScripts = script.getAttribute( "data-modules" );
10+
var path = window.location.pathname;
11+
var pathParts = path.split( "/" );
12+
var pathLength = pathParts.length;
13+
if ( modules ) {
14+
modules = modules
15+
.replace( /^\s+|\s+$/g, "" )
16+
.split( /\s+/ );
17+
} else {
18+
modules = [];
19+
}
20+
modules.push( pathParts[ pathLength - 2 ] );
21+
require( modules, function() {
22+
$( "body" ).css( "visibility", "visible" );
23+
eval( $( script ).html() );
24+
} );
25+
})();

demos/demos.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
body {
22
font-family: Arial, Helvetica, sans-serif;
3+
visibility: hidden;
34
}
45

56
table {

demos/require-config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var requirejs = {
2+
baseUrl: "../../ui",
3+
paths: {
4+
jquery: "../../external/jquery/jquery"
5+
}
6+
};

0 commit comments

Comments
 (0)