Skip to content

Commit

Permalink
feat: show image number when mouse hover #91;
Browse files Browse the repository at this point in the history
  • Loading branch information
MapoMagpie committed Sep 10, 2024
1 parent 6e464c0 commit 38b251c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion eh-view-enhance.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,12 @@ Report issues here: <a target="_blank" href="https://github.com/MapoMagpie/eh-vi
this.randomID = chapterIndex + Math.random().toString(16).slice(2) + this.node.href;
}
create() {
return this.node.create();
const element = this.node.create();
const noEle = document.createElement("div");
noEle.classList.add("img-node-numtip");
noEle.innerHTML = `<span>${this.index + 1}</span>`;
element.firstElementChild.appendChild(noEle);
return element;
}
// 刷新下载状态
setDownloadState(newState) {
Expand Down Expand Up @@ -7385,6 +7390,21 @@ before contentType: ${contentType}, after contentType: ${blob.type}
.img-node:hover .ehvp-chapter-description {
color: #ffe7f5;
}
.img-node-numtip {
position: absolute;
top: 0;
left: 0.5em;
font-size: 1.8em;
font-weight: 900;
height: 1.8em;
line-height: 1.8em;
text-shadow: 0px 0px 3px #000000;
color: var(--ehvp-font-color);
display: none;
}
.img-node:hover .img-node-numtip {
display: block;
}
.img-node > a {
display: block;
line-height: 0;
Expand Down
7 changes: 6 additions & 1 deletion src/img-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ export class IMGFetcher implements VisualNode {
}

create(): HTMLElement {
return this.node.create();
const element = this.node.create();
const noEle = document.createElement("div");
noEle.classList.add("img-node-numtip");
noEle.innerHTML = `<span>${this.index + 1}</span>`;
element.firstElementChild!.appendChild(noEle);
return element;
}

// 刷新下载状态
Expand Down
15 changes: 15 additions & 0 deletions src/ui/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,21 @@ export function styleCSS() {
.img-node:hover .ehvp-chapter-description {
color: #ffe7f5;
}
.img-node-numtip {
position: absolute;
top: 0;
left: 0.5em;
font-size: 1.8em;
font-weight: 900;
height: 1.8em;
line-height: 1.8em;
text-shadow: 0px 0px 3px #000000;
color: var(--ehvp-font-color);
display: none;
}
.img-node:hover .img-node-numtip {
display: block;
}
.img-node > a {
display: block;
line-height: 0;
Expand Down

0 comments on commit 38b251c

Please sign in to comment.