v0.12.5
This commit is contained in:
parent
942acd0842
commit
1f44fcf449
|
@ -26786,7 +26786,7 @@ Please pipe the document into a Node stream.\
|
||||||
* Select the original Download Button
|
* Select the original Download Button
|
||||||
*/
|
*/
|
||||||
const getDownloadBtn = () => {
|
const getDownloadBtn = () => {
|
||||||
const btnsDiv = document.querySelector('.score-right .buttons-wrapper') || document.querySelectorAll('aside > section > section > div')[3];
|
const btnsDiv = document.querySelector('.score-right .buttons-wrapper') || document.querySelectorAll('aside>section>section')[0].children[3];
|
||||||
const btn = btnsDiv.querySelector('button, .button');
|
const btn = btnsDiv.querySelector('button, .button');
|
||||||
btn.onclick = null;
|
btn.onclick = null;
|
||||||
// fix the icon of the download btn
|
// fix the icon of the download btn
|
||||||
|
@ -26803,32 +26803,14 @@ Please pipe the document into a Node stream.\
|
||||||
}
|
}
|
||||||
return btn;
|
return btn;
|
||||||
};
|
};
|
||||||
const SCORE_BTN_MODULE_ID = 'WYqd';
|
|
||||||
webpackGlobalOverride(SCORE_BTN_MODULE_ID, (_, r, t) => {
|
|
||||||
const fn = r.a;
|
|
||||||
let firstTime = true;
|
|
||||||
// the root container of btns refreshes every 1s
|
|
||||||
t.d(r, 'a', () => {
|
|
||||||
return function () {
|
|
||||||
if (!firstTime) {
|
|
||||||
// force state update
|
|
||||||
this.__H.__[0].__[0] = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
firstTime = false;
|
|
||||||
}
|
|
||||||
return fn();
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
class BtnList {
|
class BtnList {
|
||||||
constructor(templateBtn) {
|
constructor(getTemplateBtn) {
|
||||||
this.templateBtn = templateBtn;
|
this.getTemplateBtn = getTemplateBtn;
|
||||||
this.list = [];
|
this.list = [];
|
||||||
this.antiDetectionText = 'Download';
|
this.antiDetectionText = 'Download';
|
||||||
}
|
}
|
||||||
add(options) {
|
add(options) {
|
||||||
const btn = this.templateBtn.cloneNode(true);
|
const btn = this.getTemplateBtn().cloneNode(true);
|
||||||
const textNode = [...btn.childNodes].find((x) => {
|
const textNode = [...btn.childNodes].find((x) => {
|
||||||
const txt = x.textContent;
|
const txt = x.textContent;
|
||||||
return txt.includes('Download') || txt.includes('Print');
|
return txt.includes('Download') || txt.includes('Print');
|
||||||
|
@ -26864,11 +26846,8 @@ Please pipe the document into a Node stream.\
|
||||||
}
|
}
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
/**
|
_commit() {
|
||||||
* replace the template button with the list of new buttons
|
const parent = this.getTemplateBtn().parentElement;
|
||||||
*/
|
|
||||||
commit() {
|
|
||||||
const parent = this.templateBtn.parentElement;
|
|
||||||
const shadow = parent.attachShadow({ mode: 'closed' });
|
const shadow = parent.attachShadow({ mode: 'closed' });
|
||||||
// style the shadow DOM from outside css
|
// style the shadow DOM from outside css
|
||||||
document.head.querySelectorAll('style').forEach(s => {
|
document.head.querySelectorAll('style').forEach(s => {
|
||||||
|
@ -26878,6 +26857,19 @@ Please pipe the document into a Node stream.\
|
||||||
const newParent = parent.cloneNode(false);
|
const newParent = parent.cloneNode(false);
|
||||||
newParent.append(...this.list);
|
newParent.append(...this.list);
|
||||||
shadow.append(newParent);
|
shadow.append(newParent);
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* replace the template button with the list of new buttons
|
||||||
|
*/
|
||||||
|
commit() {
|
||||||
|
let el = this._commit();
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
if (!document.contains(el)) {
|
||||||
|
el = this._commit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
observer.observe(document, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
@ -26957,7 +26949,7 @@ Please pipe the document into a Node stream.\
|
||||||
// init recaptcha
|
// init recaptcha
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
init();
|
init();
|
||||||
const btnList = new BtnList(getDownloadBtn());
|
const btnList = new BtnList(getDownloadBtn);
|
||||||
const filename = scoreinfo.fileName;
|
const filename = scoreinfo.fileName;
|
||||||
btnList.add({
|
btnList.add({
|
||||||
name: i18n('DOWNLOAD')('MSCZ'),
|
name: i18n('DOWNLOAD')('MSCZ'),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "musescore-downloader",
|
"name": "musescore-downloader",
|
||||||
"version": "0.12.4",
|
"version": "0.12.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": {
|
||||||
|
|
Loading…
Reference in New Issue