Skip to content

Commit

Permalink
feat: ✨ 为 eh 的快捷收藏增加调出原收藏弹窗的方式
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Jul 5, 2024
1 parent c5dabc6 commit 2cb1ccb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ Cotrans 也有自己的油猴脚本 —— 「[Cotrans 漫画/图片翻译器](h

![eh快捷收藏-列表页](/docs/public/eh快捷收藏-列表页.webp)

> 使用 `鼠标中键` 点击或按住 `ctrl``shift``alt` 再点击可以调出原本的收藏弹窗
### 快捷键翻页

在漫画列表页和详情页增加通过左右方向键翻页的功能。
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ Cotrans 也有自己的油猴脚本 —— 「[Cotrans 漫画/图片翻译器](h

![eh快捷收藏-列表页](https://comic-read-docs.pages.dev/eh快捷收藏-列表页.webp)

> 使用 `鼠标中键` 点击或按住 `ctrl``shift``alt` 再点击可以调出原本的收藏弹窗
### 快捷键翻页

在漫画列表页和详情页增加通过左右方向键翻页的功能。
Expand Down
Binary file modified docs/public/eh快捷收藏-详情页.webp
Binary file not shown.
7 changes: 6 additions & 1 deletion src/site/ehentai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ const addQuickFavorite = (
};

// 将原本的收藏按钮改为切换显示快捷收藏夹
const rawClick = favoriteButton.onclick as (ev: MouseEvent) => unknown;
favoriteButton.onclick = null;
favoriteButton.addEventListener('click', async (e) => {
favoriteButton.addEventListener('mousedown', async (e) => {
e.stopPropagation();
e.preventDefault();

if (e.shiftKey || e.ctrlKey || e.altKey || e.buttons === 4)
return rawClick.call(favoriteButton, e);

renderDom();
setShow((val) => !val);
if (show()) await updateFavorite();
Expand Down

0 comments on commit 2cb1ccb

Please sign in to comment.