File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 7
7
// Read the modules
8
8
var modules = script . getAttribute ( "data-modules" ) ;
9
9
var pathParts = window . location . pathname . split ( "/" ) ;
10
+ var effectsAll = [
11
+ "effect-blind" ,
12
+ "effect-bounce" ,
13
+ "effect-clip" ,
14
+ "effect-drop" ,
15
+ "effect-explode" ,
16
+ "effect-fade" ,
17
+ "effect-fold" ,
18
+ "effect-highlight" ,
19
+ "effect-puff" ,
20
+ "effect-pulsate" ,
21
+ "effect-scale" ,
22
+ "effect-shake" ,
23
+ "effect-size" ,
24
+ "effect-slide"
25
+ ] ;
10
26
11
27
require . config ( {
12
28
baseUrl : "../../ui" ,
15
31
}
16
32
} ) ;
17
33
34
+ // Replace effects all shortcut modules with all the effects modules
35
+ if ( modules && modules . indexOf ( "effects-all" ) !== - 1 ) {
36
+ modules = modules . replace ( / e f f e c t s - a l l / , effectsAll . join ( " " ) ) ;
37
+ }
38
+
18
39
modules = modules ? modules . replace ( / ^ \s + | \s + $ / g, "" ) . split ( / \s + / ) : [ ] ;
19
40
modules . push ( pathParts [ pathParts . length - 2 ] ) ;
20
41
21
42
require ( modules , function ( ) {
22
43
$ ( "body" ) . css ( "visibility" , "visible" ) ;
23
- eval ( $ ( script ) . html ( ) ) ;
44
+
45
+ // We wrap the code in an IIFE so that return statements work and we
46
+ // dont polute the global scope with variables
47
+ $ . globalEval ( "(function(){ " + $ ( script ) . html ( ) + "})();" ) ;
24
48
} ) ;
25
49
} ) ( ) ;
You can’t perform that action at this time.
0 commit comments