File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ jQuery(function($) {
5252 ]
5353 } ) ;
5454
55+ // ----- Global ----- //
56+
57+ JS . injectSvg ( { assetPath : '/images/icons/icons.svg' } ) ;
58+
5559} ) ;
5660
5761// -------------------------------------
Original file line number Diff line number Diff line change 1+ // *************************************
2+ //
3+ // Inject SVG
4+ // -> Asynchronously append an SVG
5+ //
6+ // *************************************
7+ //
8+ // @param assetPath { string }
9+ //
10+ // *************************************
11+
12+ JS . injectSvg = function ( options ) {
13+ var settings = $ . extend ( {
14+ assetPath : null
15+ } , options ) ;
16+
17+ $ . get ( settings . assetPath , function ( data ) {
18+ var $element = $ ( new XMLSerializer ( ) . serializeToString ( data . documentElement ) ) ;
19+
20+ $element . css ( { display : 'none' } ) . appendTo ( 'body' ) ;
21+ } ) ;
22+ }
23+
24+ // -------------------------------------
25+ // Usage
26+ // -------------------------------------
27+ //
28+ // JS.injectSvg({ assetPath : '/path/to/file.svg' });
29+ //
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ html(lang='en')
66
77 - dispatcher = dispatcher ? dispatcher : ' '
88 body.js-dispatcher ( data-dispatcher-page =dispatcher)
9- .dn
10- include /public/images/icons/icons.svg
119
1210 - headerPartial = { bleed: true }
1311 include /views/partials/_header
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ html.courseLayout.js-courseLayout(lang='en')
66
77 - dispatcher = dispatcher ? dispatcher : ' '
88 body.mbf.js-dispatcher ( data-dispatcher-page =dispatcher)
9- .dn
10- include /public/images/icons/icons.svg
119
1210 header.header.courseLayout-header ( role ='banner' )
1311 .row
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ html(lang='en')
66
77 - dispatcher = dispatcher ? dispatcher : ' '
88 body.js-dispatcher ( data-dispatcher-page =dispatcher)
9- .dn
10- include /public/images/icons/icons.svg
119
1210 include /views/partials/_header
1311
You can’t perform that action at this time.
0 commit comments