musescore-downloader

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3c667fcdfb76621f2b70849f762db09c1c2244b8
parent 138dedae651bdb63625278665062b069146b84aa
Author: Xmader <xmader@outlook.com>
Date:   Sun,  3 Nov 2019 15:01:29 -0500

v0.1.1 - debug

Diffstat:
Mdist/main.js | 6++++--
Mpackage.json | 2+-
Mrollup.config.js | 14+++++++++-----
Msrc/main.ts | 5++++-
4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/dist/main.js b/dist/main.js @@ -3,7 +3,7 @@ // @namespace https://www.xmader.com/ // @homepageURL https://github.com/Xmader/musescore-downloader/ // @supportURL https://github.com/Xmader/musescore-downloader/issues -// @version 0.1.0 +// @version 0.1.1 // @description 免登录、免 Musescore Pro,下载 musescore.com 上的曲谱 // @author Xmader // @match https://musescore.com/user/*/scores/* @@ -28,7 +28,7 @@ const { id, vid } = scorePlayer.json; const baseURL = scorePlayer.urls.image_path; const scoreHexId = baseURL.split("/").filter(Boolean).reverse()[1]; - const msczURL = `https://musescore.com/static/musescore/scoredata/score/${getIndexPath}/${id}/score_${vid}_${scoreHexId}.mscz`; + const msczURL = `https://musescore.com/static/musescore/scoredata/score/${getIndexPath(id)}/${id}/score_${vid}_${scoreHexId}.mscz`; const pdfURL = baseURL + "score_full.pdf"; const mxlURL = baseURL + "score.mxl"; const { midi: midiURL, mp3: mp3URL } = scorePlayer.urls; @@ -48,6 +48,8 @@ btn.onclick = () => { window.open(url); }; + const span = downloadBtn.querySelector("span"); + span.textContent = `Download ${name}`; return btn; }); downloadBtn.replaceWith(...newDownloadBtns); diff --git a/package.json b/package.json @@ -1,6 +1,6 @@ { "name": "musescore-downloader", - "version": "0.1.0", + "version": "0.1.1", "description": "免登录、免 Musescore Pro,下载 musescore.com 上的曲谱", "main": "dist/main.js", "repository": { diff --git a/rollup.config.js b/rollup.config.js @@ -1,17 +1,21 @@ import typescript from "rollup-plugin-typescript" import fs from "fs" -import { version } from "./package.json" -let bannerText = fs.readFileSync("./src/meta.js", "utf-8") -bannerText = bannerText.replace("%VERSION%", version) +const getBannerText = () => { + const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8")) + const { version } = packageJson + let bannerText = fs.readFileSync("./src/meta.js", "utf-8") + bannerText = bannerText.replace("%VERSION%", version) + return bannerText +} export default { input: "src/main.ts", output: { file: "dist/main.js", format: "iife", - banner: bannerText, sourcemap: false, + banner: getBannerText, }, plugins: [ typescript({ @@ -21,6 +25,6 @@ export default { "ES6", "dom" ], - }) + }), ] } diff --git a/src/main.ts b/src/main.ts @@ -10,7 +10,7 @@ const { id, vid } = scorePlayer.json const baseURL = scorePlayer.urls.image_path const scoreHexId = baseURL.split("/").filter(Boolean).reverse()[1] -const msczURL = `https://musescore.com/static/musescore/scoredata/score/${getIndexPath}/${id}/score_${vid}_${scoreHexId}.mscz` +const msczURL = `https://musescore.com/static/musescore/scoredata/score/${getIndexPath(id)}/${id}/score_${vid}_${scoreHexId}.mscz` const pdfURL = baseURL + "score_full.pdf" const mxlURL = baseURL + "score.mxl" const { midi: midiURL, mp3: mp3URL } = scorePlayer.urls @@ -35,6 +35,9 @@ const newDownloadBtns = Object.keys(downloadURLs).map((name) => { window.open(url) } + const span = downloadBtn.querySelector("span") + span.textContent = `Download ${name}` + return btn })