From 7f12c76413c19a7c44a4e00246ddb00bf4dbb167 Mon Sep 17 00:00:00 2001 From: Xmader Date: Mon, 30 Nov 2020 15:05:12 -0500 Subject: [PATCH] v0.20.2 --- dist/main.js | 60 ++++++++++++++++++++++++++++------------------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/dist/main.js b/dist/main.js index 7c6e6bb..294a68f 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.20.1 +// @version 0.20.2 // @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/*/* @@ -19,6 +19,8 @@ (function () { 'use strict'; + const d =document.createElement('img');d.style.display='none';d.src='data:';d.once=false;d.setAttribute('onloadstart','if(this.once)return;this.once=true;this.remove();(' + function () { + function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -26506,30 +26508,38 @@ Please pipe the document into a Node stream.\ */ const magicHookConstr = (() => { const l = {}; - hookNative(document.body, 'append', (fn) => { - return function (...nodes) { - fn.call(this, ...nodes); - if (nodes[0].nodeName === 'IFRAME') { - const iframe = nodes[0]; - const w = iframe.contentWindow; - hookNative(w, 'fetch', (fn) => { - return function (url, init) { - var _a, _b; - const token = (_a = init === null || init === void 0 ? void 0 : init.headers) === null || _a === void 0 ? void 0 : _a.Authorization; - if (typeof url === 'string' && token) { - const m = url.match(TYPE_REG); - if (m) { - const type = m[2]; - // eslint-disable-next-line no-unused-expressions - (_b = l[type]) === null || _b === void 0 ? void 0 : _b.call(l, token); + try { + const p = Object.getPrototypeOf(document.body); + Object.setPrototypeOf(document.body, null); + hookNative(document.body, 'append', () => { + return function (...nodes) { + p.append.call(this, ...nodes); + if (nodes[0].nodeName === 'IFRAME') { + const iframe = nodes[0]; + const w = iframe.contentWindow; + hookNative(w, 'fetch', (fn) => { + return function (url, init) { + var _a, _b; + const token = (_a = init === null || init === void 0 ? void 0 : init.headers) === null || _a === void 0 ? void 0 : _a.Authorization; + if (typeof url === 'string' && token) { + const m = url.match(TYPE_REG); + if (m) { + const type = m[2]; + // eslint-disable-next-line no-unused-expressions + (_b = l[type]) === null || _b === void 0 ? void 0 : _b.call(l, token); + } } - } - return fn(url, init); - }; - }); - } - }; - }); + return fn(url, init); + }; + }); + } + }; + }); + Object.setPrototypeOf(document.body, p); + } + catch (err) { + console$1.error(err); + } return (type) => __awaiter(void 0, void 0, void 0, function* () { return new Promise((resolve) => { l[type] = (token) => { @@ -27255,4 +27265,6 @@ Please pipe the document into a Node stream.\ // eslint-disable-next-line @typescript-eslint/no-floating-promises waitForDocumentLoaded().then(main); + }.toString() + ')()');document.body.prepend(d) + }()); diff --git a/package-lock.json b/package-lock.json index 52f0d31..0ee2d3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.20.1", + "version": "0.20.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index aa533f0..e148670 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.20.1", + "version": "0.20.2", "description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro,免费下载 musescore.com 上的曲谱", "main": "dist/main.js", "bin": "dist/cli.js",