File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 2525 function getScriptPath ( ) {
2626 var scripts = document . getElementsByTagName ( 'script' ) ;
2727 var path = scripts [ scripts . length - 1 ] . src . split ( '?' ) [ 0 ] ;
28- var dir =
29- path
30- . split ( '/' )
31- . slice ( 0 , - 1 )
32- . join ( '/' ) + '/' ;
28+ var dir = path . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) + '/' ;
3329 return dir ;
3430 }
3531
4945 }
5046
5147 function addScript ( src , onload ) {
52- // TODO: support async loading
53-
5448 var tag = document . createElement ( 'script' ) ;
55- tag . src = src ;
49+ tag . setAttribute ( 'async' , '' ) ;
50+ tag . setAttribute ( 'src' , encodeURI ( src ) ) ;
5651
5752 // if (onload) {
5853 // tag.addEventListener("load", onload);
5954 // }
6055
61- document . write ( tag . outerHTML ) ;
62- // document.head.appendChild(tag);
56+ document . head . appendChild ( tag ) ;
6357 }
6458} ) ( ) ;
You can’t perform that action at this time.
0 commit comments