Skip to content

Commit 8d90413

Browse files
author
Gurasuraisu
committed
Gurappaipfi uyoate
1 parent 1f94bd8 commit 8d90413

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

assets/gurapp/api/gurasuraisu-api.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)