This commit is contained in:
Xmader 2020-11-26 00:02:05 -05:00
parent f3fc5aeb6a
commit 548f7c02ba
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
3 changed files with 15 additions and 26 deletions

37
dist/main.js vendored
View File

@ -5,22 +5,19 @@
// @supportURL https://github.com/Xmader/musescore-downloader/issues // @supportURL https://github.com/Xmader/musescore-downloader/issues
// @updateURL https://msdl.librescore.org/install.user.js // @updateURL https://msdl.librescore.org/install.user.js
// @downloadURL https://msdl.librescore.org/install.user.js // @downloadURL https://msdl.librescore.org/install.user.js
// @version 0.16.2 // @version 0.17.0
// @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱 // @description download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱
// @author Xmader // @author Xmader
// @match https://musescore.com/*/* // @match https://musescore.com/*/*
// @license MIT // @license MIT
// @copyright Copyright (c) 2019-2020 Xmader // @copyright Copyright (c) 2019-2020 Xmader
// @grant none // @grant unsafeWindow
// @run-at document-start // @run-at document-start
// ==/UserScript== // ==/UserScript==
(function () { (function () {
'use strict'; 'use strict';
// fix for Greasemonkey
window.eval('(' + function () {
function __awaiter(thisArg, _arguments, P, generator) { function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -78,20 +75,16 @@
promise.then(resolve, reject).finally(() => clearTimeout(i)); promise.then(resolve, reject).finally(() => clearTimeout(i));
}); });
}); });
const getSandboxWindow = () => { const getUnsafeWindow = () => {
if (typeof document === 'undefined') // eslint-disable-next-line no-eval
return {}; return window.eval('window');
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.append(iframe);
const w = iframe.contentWindow;
return w;
}; };
const sandboxWindow = getSandboxWindow(); const console$1 = (window || global).console; // Object.is(window.console, unsafeWindow.console) == false
const console$1 = sandboxWindow['console'];
const _Element = sandboxWindow['Element'];
const windowOpen = (...args) => { const windowOpen = (...args) => {
return sandboxWindow.open(...args); return window.open(...args); // Object.is(window.open, unsafeWindow.open) == false
};
const attachShadow = (el) => {
return Element.prototype.attachShadow.call(el, { mode: 'closed' });
}; };
const waitForDocumentLoaded = () => { const waitForDocumentLoaded = () => {
if (document.readyState !== 'complete') { if (document.readyState !== 'complete') {
@ -26271,9 +26264,10 @@ Please pipe the document into a Node stream.\
}); });
} }
// hook `webpackJsonpmusescore.push` as soon as `webpackJsonpmusescore` is available // hook `webpackJsonpmusescore.push` as soon as `webpackJsonpmusescore` is available
let jsonp = window['webpackJsonpmusescore']; const _w = getUnsafeWindow();
let jsonp = _w['webpackJsonpmusescore'];
let hooked = false; let hooked = false;
Object.defineProperty(window, 'webpackJsonpmusescore', { Object.defineProperty(_w, 'webpackJsonpmusescore', {
get() { return jsonp; }, get() { return jsonp; },
set(v) { set(v) {
jsonp = v; jsonp = v;
@ -26707,9 +26701,6 @@ Please pipe the document into a Node stream.\
n.onclick = btn.onclick; n.onclick = btn.onclick;
return n; return n;
}; };
const attachShadow = (el) => {
return _Element.prototype.attachShadow.call(el, { mode: 'closed' });
};
var BtnListMode; var BtnListMode;
(function (BtnListMode) { (function (BtnListMode) {
BtnListMode[BtnListMode["InPage"] = 0] = "InPage"; BtnListMode[BtnListMode["InPage"] = 0] = "InPage";
@ -27044,6 +27035,4 @@ Please pipe the document into a Node stream.\
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
waitForDocumentLoaded().then(main); waitForDocumentLoaded().then(main);
}.toString() + ')()')
}()); }());

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.16.2", "version": "0.17.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.16.2", "version": "0.17.0",
"description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱", "description": "download sheet music from musescore.com for free, no login or Musescore Pro required | 免登录、免 Musescore Pro免费下载 musescore.com 上的曲谱",
"main": "dist/main.js", "main": "dist/main.js",
"bin": "dist/cli.js", "bin": "dist/cli.js",