This commit is contained in:
Xmader 2020-11-06 13:45:55 -05:00
parent cb7366228f
commit 19df4e16a1
No known key found for this signature in database
GPG Key ID: A20B97FB9EB730E4
3 changed files with 18 additions and 7 deletions

21
dist/main.js vendored
View File

@ -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.4 // @version 0.11.5
// @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/*/*
@ -26483,13 +26483,18 @@ Please pipe the document into a Node stream.\
const l = new Set(); const l = new Set();
const qsaHook = (_fn) => { const qsaHook = (_fn) => {
return function (...args) { return function (...args) {
const arr = _fn.apply(this, args); const nodes = _fn.apply(this, args);
const results = Array.prototype.filter.call(nodes, (e) => !l.has(e));
// convert back to a NodeList/HTMLCollection instead of an Array
Object.setPrototypeOf(results, Object.getPrototypeOf(nodes));
// eslint-disable-next-line @typescript-eslint/no-unsafe-return // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Array.prototype.filter.call(arr, (e) => !l.has(e)); return results;
}; };
}; };
hookNative(Element.prototype, 'querySelectorAll', qsaHook); hookNative(Element.prototype, 'querySelectorAll', qsaHook);
hookNative(document, 'querySelectorAll', qsaHook); hookNative(document, 'querySelectorAll', qsaHook);
hookNative(Element.prototype, 'getElementsByClassName', qsaHook);
hookNative(document, 'getElementsByClassName', qsaHook);
return (item) => { return (item) => {
l.add(item); l.add(item);
}; };
@ -26774,6 +26779,7 @@ Please pipe the document into a Node stream.\
this.templateBtn = templateBtn; this.templateBtn = templateBtn;
this.list = []; this.list = [];
this.antiDetectionText = 'Download'; this.antiDetectionText = 'Download';
this.firstBtn = true;
} }
hide(el) { hide(el) {
hideFromArrFilter(el); hideFromArrFilter(el);
@ -26800,8 +26806,13 @@ Please pipe the document into a Node stream.\
}); });
}); });
// hide this button from Array.prototype.filter // hide this button from Array.prototype.filter
this.hide(btn); if (this.firstBtn) {
this.hide(textNode); this.firstBtn = false;
}
else {
this.hide(btn);
this.hide(textNode);
}
const setText = (str) => { const setText = (str) => {
textNode.textContent = str; textNode.textContent = str;
}; };

2
package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "musescore-downloader", "name": "musescore-downloader",
"version": "0.11.4", "version": "0.11.5",
"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": {