v0.11.2 - #48
This commit is contained in:
parent
b5d81abfd2
commit
f9b137c866
3 changed files with 69 additions and 29 deletions
94
dist/main.js
vendored
94
dist/main.js
vendored
|
@ -5,7 +5,7 @@
|
||||||
// @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.11.1
|
// @version 0.11.2
|
||||||
// @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/*/*
|
||||||
|
@ -26440,6 +26440,54 @@ Please pipe the document into a Node stream.\
|
||||||
return t(moduleId);
|
return t(moduleId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* eslint-disable no-extend-native */
|
||||||
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
|
/**
|
||||||
|
* make hooked methods "native"
|
||||||
|
*/
|
||||||
|
const makeNative = (() => {
|
||||||
|
const l = new Set();
|
||||||
|
hookNative(Function.prototype, 'toString', (_toString) => {
|
||||||
|
return function () {
|
||||||
|
if (l.has(this)) {
|
||||||
|
// "function () {\n [native code]\n}"
|
||||||
|
return _toString.call(parseInt);
|
||||||
|
}
|
||||||
|
return _toString.call(this);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return (fn) => {
|
||||||
|
l.add(fn);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
function hookNative(target, method, hook) {
|
||||||
|
// reserve for future hook update
|
||||||
|
const _fn = target[method];
|
||||||
|
const detach = () => {
|
||||||
|
target[method] = _fn; // detach
|
||||||
|
};
|
||||||
|
// This script can run before anything on the page,
|
||||||
|
// so setting this function to be non-configurable and non-writable is no use.
|
||||||
|
const hookedFn = hook(_fn, detach);
|
||||||
|
target[method] = hookedFn;
|
||||||
|
setTimeout(() => {
|
||||||
|
makeNative(hookedFn);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const hideFromArrFilter = (() => {
|
||||||
|
const l = new Set();
|
||||||
|
hookNative(Array.prototype, 'filter', (_filter) => {
|
||||||
|
return function (...args) {
|
||||||
|
const arr = _filter.apply(this, args);
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return _filter.call(arr, (e) => !l.has(e));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return (item) => {
|
||||||
|
l.add(item);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
/* eslint-disable no-extend-native */
|
/* eslint-disable no-extend-native */
|
||||||
const FILE_URL_MODULE_ID = 'iNJA';
|
const FILE_URL_MODULE_ID = 'iNJA';
|
||||||
const MAGIC_REG = /^\d+(img|mp3|midi)\d(.+)$/;
|
const MAGIC_REG = /^\d+(img|mp3|midi)\d(.+)$/;
|
||||||
|
@ -26451,31 +26499,17 @@ Please pipe the document into a Node stream.\
|
||||||
* I know this is super hacky.
|
* I know this is super hacky.
|
||||||
*/
|
*/
|
||||||
let magic = new Promise((resolve) => {
|
let magic = new Promise((resolve) => {
|
||||||
// reserve for future hook update
|
hookNative(String.prototype, 'charCodeAt', (_fn, detach) => {
|
||||||
const target = String.prototype;
|
return function (i) {
|
||||||
const method = 'charCodeAt';
|
const m = this.match(MAGIC_REG);
|
||||||
const _fn = target[method];
|
if (m) {
|
||||||
// This script can run before anything on the page,
|
resolve(m[2]);
|
||||||
// so setting this function to be non-configurable and non-writable is no use.
|
magic = m[2];
|
||||||
const hookFn = function (i) {
|
detach();
|
||||||
const m = this.match(MAGIC_REG);
|
}
|
||||||
if (m) {
|
return _fn.call(this, i);
|
||||||
resolve(m[2]);
|
};
|
||||||
magic = m[2];
|
});
|
||||||
target[method] = _fn; // detach
|
|
||||||
}
|
|
||||||
return _fn.call(this, i);
|
|
||||||
};
|
|
||||||
target[method] = hookFn;
|
|
||||||
// make hooked methods "native"
|
|
||||||
const _toString = Function.prototype['toString'];
|
|
||||||
Function.prototype.toString = function s() {
|
|
||||||
if (this === hookFn || this === s) {
|
|
||||||
// "function () {\n [native code]\n}"
|
|
||||||
return _toString.call(parseInt);
|
|
||||||
}
|
|
||||||
return _toString.call(this);
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
const getFileUrl = (type, index = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
const getFileUrl = (type, index = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const fileUrlModule = webpackHook(FILE_URL_MODULE_ID, {
|
const fileUrlModule = webpackHook(FILE_URL_MODULE_ID, {
|
||||||
|
@ -26734,6 +26768,9 @@ Please pipe the document into a Node stream.\
|
||||||
this.list = [];
|
this.list = [];
|
||||||
this.antiDetectionText = 'Download';
|
this.antiDetectionText = 'Download';
|
||||||
}
|
}
|
||||||
|
hide(el) {
|
||||||
|
hideFromArrFilter(el);
|
||||||
|
}
|
||||||
add(options) {
|
add(options) {
|
||||||
const btn = this.templateBtn.cloneNode(true);
|
const btn = this.templateBtn.cloneNode(true);
|
||||||
const textNode = [...btn.childNodes].find((x) => {
|
const textNode = [...btn.childNodes].find((x) => {
|
||||||
|
@ -26750,10 +26787,13 @@ Please pipe the document into a Node stream.\
|
||||||
get: () => {
|
get: () => {
|
||||||
// first time only
|
// first time only
|
||||||
const t = this.antiDetectionText;
|
const t = this.antiDetectionText;
|
||||||
this.antiDetectionText = '';
|
this.antiDetectionText = ' ';
|
||||||
return t;
|
return t;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// hide this button from Array.prototype.filter
|
||||||
|
this.hide(btn);
|
||||||
|
this.hide(textNode);
|
||||||
const setText = (str) => {
|
const setText = (str) => {
|
||||||
textNode.textContent = str;
|
textNode.textContent = str;
|
||||||
};
|
};
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.11.1",
|
"version": "0.11.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.11.1",
|
"version": "0.11.2",
|
||||||
"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",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in a new issue