From 141e9192a384e9d27ce5e55dd2bb33707df194fa Mon Sep 17 00:00:00 2001 From: Yukimura Aoi Date: Thu, 29 Aug 2024 14:52:25 +0800 Subject: [PATCH] =?UTF-8?q?v0.0.2=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 51 ++++++++++++++++++++------------------------------- manifest.json | 2 +- 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/main.js b/main.js index 6b2f41b..9d57039 100644 --- a/main.js +++ b/main.js @@ -97,25 +97,28 @@ async function loadPiP(isToPiP=true) { if (q(".m-pinfo [data-log-type='dj']")) {return} let l = ".rnp-lyrics-line", o = `${l}-original`, k = `${l}-karaoke`, t = `${l}-translated` try { - lyrics["M0"] = q(".m-lyric .s-fc0").textContent - lyrics["T0"] = q(".m-lyric .s-fc3").textContent - }catch{ - lyrics["M0"] = q(".m-lyric p").textContent - } - for (i = 0; i <= 4; i++) { - try { + for (i = 0; i <= 4; i++) { try { - lyrics[`M${i}`] = q(`${l}[offset='${i}'] ${o}`).textContent; + try { + lyrics[`M${i}`] = q(`${l}[offset='${i}'] ${o}`).textContent; + } catch { + lyrics[`M${i}`] = q(`${l}[offset='${i}'] ${k}`).textContent; + } + lyrics[`T${i}`] = q(`${l}[offset='${i}'] ${t}`).textContent; } catch { - lyrics[`M${i}`] = q(`${l}[offset='${i}'] ${k}`).textContent; - } - lyrics[`T${i}`] = q(`${l}[offset='${i}'] ${t}`).textContent; - } catch { - if (q(`${l}.rnp-interlude[offset='${i}']`)) { - lyrics[`M${i}`] = " · · · "; - lyrics[`T${i}`] = ""; + if (q(`${l}.rnp-interlude[offset='${i}']`)) { + lyrics[`M${i}`] = " · · · "; + lyrics[`T${i}`] = ""; + } } } + } catch { + try { + lyrics["M0"] = q(".m-lyric .s-fc0").textContent + lyrics["T0"] = q(".m-lyric .s-fc3").textContent + }catch{ + lyrics["M0"] = q(".m-lyric p").textContent + } } } @@ -203,19 +206,6 @@ async function loadPiP(isToPiP=true) { cC.fillRect(pbMgL, pbMgT, (c.width-pbMgL)*tP, 5); /*进度条*/ let lrcFS = 55, lrcMgT = 45, lrcMgL = 15; - /*for (i = 1, n = 2; i <= 3; i++, n=n+2) { - if (i==1) { - cC.fillStyle = textC; cC.font = `bold ${lrcFS}px "Microsoft YaHei"`; - cC.fillText(lrcM, lrcMgL, cvSize+lrcFS*i+30); /*主歌词 - cC.fillStyle = textCT56; cC.font = `${lrcFS-5}px "Microsoft YaHei"`; - cC.fillText(T, lrcMgL, cvSize+lrcFS*n+40); /*翻译歌词 - } else { - cC.fillStyle = textCT56; cC.font = `bold ${lrcFS-10}px "Microsoft YaHei"`; - cC.fillText(eval(`M${i}`), lrcMgL, cvSize+lrcFS*i+60); /*下句主歌词 - cC.fillStyle = textCT31; cC.font = `${lrcFS-15}px "Microsoft YaHei"`; - cC.fillText(eval(`M${i}`), lrcMgL, cvSize+lrcFS*n+60); /*下句翻译歌词 - } - }*/ let lrcTop = cvSize+lrcMgT; cC.fillStyle = textC; cC.font = `bold ${lrcFS}px "Microsoft YaHei"`; cC.fillText(lyrics["M0"], lrcMgL, lrcTop+lrcFS); /*主歌词*/ @@ -294,12 +284,11 @@ async function load() { }); } -plugin.onAllPluginsLoaded(() => { //插件初始化 +plugin.onAllPluginsLoaded(() => { load(); }); plugin.onConfig( () => { - //创建DOM let crCfgPage = document.createElement("div"); crCfgPage.setAttribute("id", "PiPWSettings"); crCfgPage.innerHTML = ` @@ -352,7 +341,7 @@ border: 0 solid;

PiPWindow


-

v0.0.1 by

+

v0.0.2 by

开发ing

diff --git a/manifest.json b/manifest.json index e186d56..26e37a0 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "PiPWindow", "slug": "PiPWindow", "type": "extension", - "version": "0.0.1", + "version": "0.0.2", "author": "Lukoning", "author_links": ["https://github.com/Lukoning"], "description": "一个纯JavaScript实现的歌曲信息小窗",