From cda009f4679fb7cfdce121f2379b68c0d46008b1 Mon Sep 17 00:00:00 2001 From: enncy <877526278@qq.com> Date: Mon, 26 Feb 2024 14:17:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(script):=20=E4=BF=AE=E5=A4=8D=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=97=B6=E9=97=B4=E5=BE=88=E7=9F=AD=E5=B0=B1=E6=B6=88?= =?UTF-8?q?=E5=A4=B1=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/utils/tampermonkey.ts | 4 ++-- packages/scripts/src/projects/common.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/utils/tampermonkey.ts b/packages/core/src/utils/tampermonkey.ts index b3a35c41..8ef5a5c1 100644 --- a/packages/core/src/utils/tampermonkey.ts +++ b/packages/core/src/utils/tampermonkey.ts @@ -1,4 +1,4 @@ -/* global Tampermonkey GM_getTab */ +/* global Tampermonkey GM_getTab GM_notification */ /** * 油猴封装库 @@ -48,7 +48,7 @@ export const $gm = { ) { const { onclick, ondone, important, duration = 30, silent = true, extraTitle = '' } = options || {}; const { icon, name } = $gm.getInfos()?.script || {}; - // eslint-disable-next-line no-undef + GM_notification({ title: name + (extraTitle ? '-' + extraTitle : ''), text: content, diff --git a/packages/scripts/src/projects/common.ts b/packages/scripts/src/projects/common.ts index 8d0a9539..fe8897b8 100644 --- a/packages/scripts/src/projects/common.ts +++ b/packages/scripts/src/projects/common.ts @@ -502,7 +502,7 @@ export const CommonProject = Project.create({ if (this.cfg.notification !== 'no-notify') { $gm.notification(content, { extraTitle: opts?.extraTitle, - duration: opts?.duration || 30, + duration: opts?.duration ?? 30, important: this.cfg.notification === 'all', silent: this.cfg.notification === 'only-notify' });