From 91ab2127f67ad695a2e0bcd818263b25fc07c8f5 Mon Sep 17 00:00:00 2001 From: andywang425 <56548456+andywang425@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:58:18 +0800 Subject: [PATCH 01/37] =?UTF-8?q?=F0=9F=8E=88=20perf(minifyUserscript.js):?= =?UTF-8?q?=20import=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/minifyUserscript.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/minifyUserscript.js b/scripts/minifyUserscript.js index b5518e3..6556d1f 100644 --- a/scripts/minifyUserscript.js +++ b/scripts/minifyUserscript.js @@ -1,11 +1,11 @@ /** * @description 压缩编译后的用户脚本 */ -import { promises as fs } from 'fs' +import { readFile, writeFile } from 'node:fs/promises' import { minify } from 'terser' async function minifyUserscript(inputPath, outputPath) { - const code = await fs.readFile(inputPath, 'utf-8') + const code = await readFile(inputPath, 'utf-8') // 获取 Userscript metadata const metadataMatch = code.match(/\/\/ ==UserScript==[\s\S]*?\/\/ ==\/UserScript==/) @@ -21,7 +21,7 @@ async function minifyUserscript(inputPath, outputPath) { // 加上 metadata const result = `${metadata}\n${minified.code}` - await fs.writeFile(outputPath, result, 'utf-8') + await writeFile(outputPath, result, 'utf-8') console.log(`压缩完成: ${inputPath} -> ${outputPath}`) } From 9df287ef66f07a600db0273103a34d48a0ec5d92 Mon Sep 17 00:00:00 2001 From: andywang425 <56548456+andywang425@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:13:58 +0800 Subject: [PATCH 02/37] =?UTF-8?q?=F0=9F=8E=88=20perf:=20hasOwnProperty=20-?= =?UTF-8?q?>=20hasOwn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/enhanceExperience/banP2P.ts | 4 ++-- src/modules/enhanceExperience/switchLiveStreamQuality.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/enhanceExperience/banP2P.ts b/src/modules/enhanceExperience/banP2P.ts index b7c4390..e226e63 100644 --- a/src/modules/enhanceExperience/banP2P.ts +++ b/src/modules/enhanceExperience/banP2P.ts @@ -17,8 +17,8 @@ class BanP2P extends BaseModule { 'webkitRTCPeerConnection' ] for (const i of RTClist) { - // 判断属性是否存在并且是否可配置 - if (Object.prototype.hasOwnProperty.call(unsafeWindow, i)) { + // 判断属性是否存在 + if (Object.hasOwn(unsafeWindow, i)) { // 定义属性 Object.defineProperty(unsafeWindow, i, { value: class { diff --git a/src/modules/enhanceExperience/switchLiveStreamQuality.ts b/src/modules/enhanceExperience/switchLiveStreamQuality.ts index 938f44b..51d6ed3 100644 --- a/src/modules/enhanceExperience/switchLiveStreamQuality.ts +++ b/src/modules/enhanceExperience/switchLiveStreamQuality.ts @@ -16,8 +16,8 @@ class SwitchLiveStreamQuality extends BaseModule { const findPlayertimer = setInterval(() => { if ( topWindow.livePlayer && - Object.prototype.hasOwnProperty.call(topWindow.livePlayer, 'switchQuality') && - Object.prototype.hasOwnProperty.call(topWindow.livePlayer, 'getPlayerInfo') + Object.hasOwn(topWindow.livePlayer, 'switchQuality') && + Object.hasOwn(topWindow.livePlayer, 'getPlayerInfo') ) { clearInterval(findPlayertimer) clearTimeout(timeoutTimer) From 01a51fcbb583a4fc6093396df0e4e42e5c84f791 Mon Sep 17 00:00:00 2001 From: andywang425 <56548456+andywang425@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:28:19 +0800 Subject: [PATCH 03/37] =?UTF-8?q?=F0=9F=8E=88=20perf:=20v-slot=20->=20#?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LiveTasks.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LiveTasks.vue b/src/components/LiveTasks.vue index cc27b09..ab6893a 100644 --- a/src/components/LiveTasks.vue +++ b/src/components/LiveTasks.vue @@ -280,7 +280,7 @@ function handleRowClick(row: MedalInfoRow, _column: any, event: PointerEvent) { > -