diff --git a/docs/autoClock.png b/docs/autoClock.png new file mode 100644 index 0000000..41cf4ac Binary files /dev/null and b/docs/autoClock.png differ diff --git a/docs/blockPosts.png b/docs/blockPosts.png new file mode 100644 index 0000000..a5ac3bd Binary files /dev/null and b/docs/blockPosts.png differ diff --git a/docs/onlineStorage.jsonc b/docs/onlineStorage.jsonc index 6b5eb91..e6d69cd 100644 --- a/docs/onlineStorage.jsonc +++ b/docs/onlineStorage.jsonc @@ -2,6 +2,7 @@ "blockWish": false, // 是否屏蔽许愿贴 "blockMakeFriends": false, // 是否屏蔽交友贴 "autoClock": false, // 是否开启自动打卡 + "doubleClickBackToTop": false, // 是否开启双击返回顶部的功能 "feeling": "", // 打开内容 "lastClockDate": "", // 上次打卡日期 "autoClockFailed": false, // 自动打卡失败 diff --git a/src/background/autoClock.ts b/src/background/autoClock.ts index f349533..1d1e7f4 100644 --- a/src/background/autoClock.ts +++ b/src/background/autoClock.ts @@ -45,6 +45,7 @@ export default function() { const { code } = res.data; if (code === 0) { + // eslint-disable-next-line prefer-template notification('牛客网自动打卡成功!', `打卡内容:${feeling ? feeling + '!' : ''}`); } else if (code === 999) { // 999: 未登入 diff --git a/src/contents/discuss/doubleClickBackToTop.ts b/src/contents/all/doubleClickBackToTop.ts similarity index 100% rename from src/contents/discuss/doubleClickBackToTop.ts rename to src/contents/all/doubleClickBackToTop.ts diff --git a/src/contents/all/index.ts b/src/contents/all/index.ts index 0e06cac..3563bfd 100644 --- a/src/contents/all/index.ts +++ b/src/contents/all/index.ts @@ -1,5 +1,6 @@ import { onlineStorage } from 'utils/storage'; import extensionAutoReload from './extensionAutoReload'; +import doubleClickBackToTop from './doubleClickBackToTop'; import './style.scss'; // 存储 cookie @@ -7,3 +8,7 @@ onlineStorage.set({ cookies: document.cookie }); // SSE client process.env.NODE_ENV === 'development' && extensionAutoReload(); + +onlineStorage.get({ doubleClickBackToTop: false }).then(({ doubleClickBackToTop: doubleClickBackToTopSetting }) => { + doubleClickBackToTopSetting && doubleClickBackToTop(); +}); diff --git a/src/contents/discuss/index.ts b/src/contents/discuss/index.ts index 5d16b5f..0c3b74e 100644 --- a/src/contents/discuss/index.ts +++ b/src/contents/discuss/index.ts @@ -1,6 +1,4 @@ import blockPosts from './blockPosts'; -import doubleClickBackToTop from './doubleClickBackToTop'; import './style.scss'; -doubleClickBackToTop(); blockPosts();