From d31678d3e67ced1f9995774876b284c1c2303f5f Mon Sep 17 00:00:00 2001 From: Xmader Date: Fri, 13 Nov 2020 16:01:47 -0500 Subject: [PATCH] v0.15.1 --- dist/main.js | 18 ++++++++++++++---- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dist/main.js b/dist/main.js index 0080480..37a1310 100644 --- a/dist/main.js +++ b/dist/main.js @@ -5,7 +5,7 @@ // @supportURL https://github.com/Xmader/musescore-downloader/issues // @updateURL https://msdl.librescore.org/install.user.js // @downloadURL https://msdl.librescore.org/install.user.js -// @version 0.15.0 +// @version 0.15.1 // @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro,免费下载 musescore.com 上的曲谱 // @author Xmader // @match https://musescore.com/*/* @@ -231,6 +231,16 @@ promise.then(resolve, reject).finally(() => clearTimeout(i)); }); }); + const getSandboxWindow = () => { + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + document.body.append(iframe); + const w = iframe.contentWindow; + return w; + }; + const windowOpen = (...args) => { + return getSandboxWindow().open(...args); + }; const waitForDocumentLoaded = () => { if (document.readyState !== 'complete') { return new Promise(resolve => { @@ -26862,7 +26872,7 @@ Please pipe the document into a Node stream.\ } case BtnListMode.ExtWindow: { const div = this._commit(); - const w = window.open('', undefined, 'resizable,width=230,height=270'); + const w = windowOpen('', undefined, 'resizable,width=230,height=270'); // eslint-disable-next-line no-unused-expressions w === null || w === void 0 ? void 0 : w.document.body.append(div); window.addEventListener('unload', () => w === null || w === void 0 ? void 0 : w.close()); @@ -26884,7 +26894,7 @@ Please pipe the document into a Node stream.\ }; BtnAction.openUrl = (url) => { return BtnAction.process(() => __awaiter(this, void 0, void 0, function* () { - window.open(yield normalizeUrlInput(url)); + windowOpen(yield normalizeUrlInput(url)); })); }; BtnAction.download = (url, fallback, timeout) => { @@ -26900,7 +26910,7 @@ Please pipe the document into a Node stream.\ const _onclick = btn.onclick; btn.onclick = null; setText(i18n('PROCESSING')()); - const w = window.open(''); + const w = windowOpen(''); const txt = document.createTextNode(i18n('PROCESSING')()); w.document.body.append(txt); // set page hooks diff --git a/package-lock.json b/package-lock.json index 1ae9ff3..2c685f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.15.0", + "version": "0.15.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4d4c1b3..8e76a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.15.0", + "version": "0.15.1", "description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro,免费下载 musescore.com 上的曲谱", "main": "dist/main.js", "repository": {