File tree 1 file changed +12
-8
lines changed
1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
function handleExternalScript ( ) {
2
2
const container = Docsify . dom . getNode ( '#main' )
3
- const script = Docsify . dom . find ( container , 'script' )
3
+ const scripts = Docsify . dom . findAll ( container , 'script' )
4
4
5
- if ( script && script . src ) {
6
- const newScript = document . createElement ( 'script' )
5
+ for ( let i = scripts . length ; i -- ; ) {
6
+ const script = scripts [ i ]
7
7
8
- ; [ 'src' , 'async' , 'defer' ] . forEach ( attribute => {
9
- newScript [ attribute ] = script [ attribute ]
10
- } )
8
+ if ( script && script . src ) {
9
+ const newScript = document . createElement ( 'script' )
11
10
12
- script . parentNode . insertBefore ( newScript , script )
13
- script . parentNode . removeChild ( script )
11
+ ; [ 'src' , 'async' , 'defer' ] . forEach ( attribute => {
12
+ newScript [ attribute ] = script [ attribute ]
13
+ } )
14
+
15
+ script . parentNode . insertBefore ( newScript , script )
16
+ script . parentNode . removeChild ( script )
17
+ }
14
18
}
15
19
}
16
20
You can’t perform that action at this time.
0 commit comments