From 557a531e5b21fa2783ea0a5c73180b47d977165e Mon Sep 17 00:00:00 2001 From: Xmader Date: Sun, 6 Dec 2020 03:05:25 -0500 Subject: [PATCH] v0.21.1 --- dist/main.js | 46 +++++++++++++++++++++++++++++++++++----------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/dist/main.js b/dist/main.js index a1d9d83..9f991aa 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.21.0 +// @version 0.21.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/*/* @@ -15,13 +15,46 @@ // @grant unsafeWindow // @grant GM.registerMenuCommand // @grant GM.addElement +// @grant GM.openInTab // @run-at document-start // ==/UserScript== (function () { 'use strict'; - const w=typeof unsafeWindow=='object'?unsafeWindow:window;const gmId=''+Math.random();w[gmId]=typeof GM=='object'?GM:undefined;new Promise(resolve=>{const id=''+Math.random();w[id]=resolve;setTimeout(`(function a(){window['${id}'](new Image())})()//# sourceURL=${location.href}`)}).then(d=>{d.style.display='none';d.src='data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';d.once=false;d.setAttribute('onload',`if(this.once)return;this.once=true;this.remove();const GM=window['${gmId}'];(` + function a () { + /* eslint-disable */ + const w = typeof unsafeWindow == 'object' ? unsafeWindow : window; + + // GM APIs glue + const _GM = typeof GM == 'object' ? GM : undefined; + const gmId = '' + Math.random(); + w[gmId] = _GM; + + if (_GM && _GM.registerMenuCommand && _GM.openInTab) { + // add buttons to the userscript manager menu + _GM.registerMenuCommand( + '** Source Code **', + () => _GM.openInTab(_GM.info.script.homepage, { active: true }) + ) + + _GM.registerMenuCommand( + '** Discord **', + () => _GM.openInTab("https://discord.gg/DKu7cUZ4XQ", { active: true }) + ) + } + + // script loader + new Promise(resolve => { + const id = '' + Math.random(); + w[id] = resolve; + setTimeout(`(function a(){window['${id}'](new Image());delete window['${id}'];})()//# sourceURL=${location.href}`) + }).then(d => { + d.style.display = 'none'; + d.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='; + d.once = false; + d.setAttribute('onload', `if(this.once)return;this.once=true;this.remove();const GM=window['${gmId}'];delete window['${gmId}'];(` + function a () { + /** script code here */ + function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } @@ -26522,15 +26555,6 @@ Please pipe the document into a Node stream.\ */ const magicHookConstr = (() => { const l = {}; - // get rid of `Disable Tampermonkey` - const observer = new MutationObserver((mutations) => { - mutations.forEach(x => [...x.addedNodes].forEach(e => { - if (!document.querySelector('.js-page')) { - e.replaceWith(...x.removedNodes); - } - })); - }); - observer.observe(document, { childList: true, subtree: true }); try { const p = Object.getPrototypeOf(document.body); Object.setPrototypeOf(document.body, null); diff --git a/package-lock.json b/package-lock.json index a292965..467800b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.21.0", + "version": "0.21.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d3595b5..4aa6a0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.21.0", + "version": "0.21.1", "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",