File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1829,15 +1829,18 @@ window.addEventListener('message', async (event) => {
18291829 }
18301830 } ;
18311831
1832- const libUrl = isMobile
1833- ? 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js'
1834- : 'https://cdn.jsdelivr.net/npm/modern-screenshot@4.6.8/dist/index.min.js' ;
1835- const libCheck = isMobile ? ( typeof html2canvas === 'function' ) : ( typeof modernScreenshot !== 'undefined' ) ;
1832+ const needsH2C = _isMobile && typeof html2canvas !== 'function' ;
1833+ const needsMS = ! _isMobile && typeof modernScreenshot === 'undefined' ;
18361834
1837- if ( ! libCheck ) {
1835+ if ( needsH2C ) {
18381836 const script = document . createElement ( 'script' ) ;
1839- script . src = libUrl ;
1840- script . onload = doCapture ;
1837+ script . src = 'https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js' ;
1838+ script . onload = ( ) => doCapture ( ) ;
1839+ document . head . appendChild ( script ) ;
1840+ } else if ( needsMS ) {
1841+ const script = document . createElement ( 'script' ) ;
1842+ script . src = 'https://cdn.jsdelivr.net/npm/modern-screenshot@4.6.8/dist/index.min.js' ;
1843+ script . onload = ( ) => doCapture ( ) ;
18411844 document . head . appendChild ( script ) ;
18421845 } else {
18431846 doCapture ( ) ;
You can’t perform that action at this time.
0 commit comments