Skip to content

Commit

Permalink
chore: overlay-tip style'
Browse files Browse the repository at this point in the history
  • Loading branch information
MapoMagpie committed Sep 27, 2024
1 parent c3ed567 commit bc4164c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
19 changes: 10 additions & 9 deletions eh-view-enhance.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2832,6 +2832,11 @@ Reporta problemas aquí: <a target='_blank' href='https://github.com/MapoMagpie/
this.matcher = matcher;
const debouncer = new Debouncer();
EBUS.subscribe("ifq-on-finished-report", (index) => debouncer.addEvent("APPEND-NEXT-PAGES", () => this.appendPages(index), 5));
EBUS.subscribe("imf-on-finished", (index, success, imf) => {
if (index === 0 && success) {
this.chapters[imf.chapterIndex].thumbimg = imf.node.blobSrc;
}
});
EBUS.subscribe("pf-try-extend", () => debouncer.addEvent("APPEND-NEXT-PAGES", () => !this.queue.downloading?.() && this.appendNextPage(), 5));
EBUS.subscribe("pf-init", (cb) => this.init().then(cb));
}
Expand Down Expand Up @@ -4615,7 +4620,7 @@ Reporta problemas aquí: <a target='_blank' href='https://github.com/MapoMagpie/
const title = images.length > 1 ? `${node.pk}-${(j + 1).toString().padStart(digits, "0")}` : node.pk;
const ext = videos ? "mp4" : "jpeg";
const [thumb, origin] = this.getThumbAndOrigin(img.candidates, videos);
ret.push(new ImageNode(thumb?.url ?? "", `${window.location.origin}/p/${node.code}`, `${title}.${ext}`, void 0, origin.url, { w: origin.width, h: origin.height }));
ret.push(new ImageNode(thumb?.url ?? "", `${window.location.origin}/p/${node.code}`, `${title}.${ext}`, void 0, origin.url, { w: thumb.width, h: thumb.height }));
}
}
return ret;
Expand Down Expand Up @@ -8184,16 +8189,12 @@ before contentType: ${contentType}, after contentType: ${blob.type}
}
.overlay-tip {
position: absolute;
top: 3px;
right: 3px;
z-index: 10;
height: 1em;
border-radius: 10%;
border: 1px solid #333;
color: var(--ehvp-font-color);
background-color: #959595d1;
text-align: center;
font-weight: 800;
top: 0.3em;
right: 0.3em;
font-size: 0.8em;
text-shadow: 0px 0px 3px #000000;
}
.lightgreen { color: #90ea90; }
.ehvp-full-panel {
Expand Down
6 changes: 3 additions & 3 deletions src/platform/instagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class InstagramMatcher extends BaseMatcher<EdgeNode[]> {
const title = images.length > 1 ? `${node.pk}-${(j + 1).toString().padStart(digits, "0")}` : node.pk;
const ext = videos ? "mp4" : "jpeg";
const [thumb, origin] = this.getThumbAndOrigin(img.candidates, videos);
ret.push(new ImageNode(thumb?.url ?? "", `${window.location.origin}/p/${node.code}`, `${title}.${ext}`, undefined, origin.url, { w: origin.width, h: origin.height }));
ret.push(new ImageNode(thumb?.url ?? "", `${window.location.origin}/p/${node.code}`, `${title}.${ext}`, undefined, origin.url, { w: thumb.width, h: thumb.height }));
}
}
return ret;
Expand Down Expand Up @@ -92,7 +92,7 @@ export class InstagramMatcher extends BaseMatcher<EdgeNode[]> {
return [data.edges.map(e => e.node), data.page_info];
}

getThumbAndOrigin(candidates: MediaInfo[], videos: MediaInfo[] | null): [MediaInfo | undefined, MediaInfo] {
getThumbAndOrigin(candidates: MediaInfo[], videos: MediaInfo[] | null): [MediaInfo, MediaInfo] {
const origin = videos?.[0] ?? candidates[0];
let lastThumb: MediaInfo | undefined = undefined;
for (const ca of candidates) {
Expand All @@ -106,7 +106,7 @@ export class InstagramMatcher extends BaseMatcher<EdgeNode[]> {
}
lastThumb = ca;
}
return [lastThumb, origin];
return [lastThumb!, origin];
}
}

Expand Down
12 changes: 4 additions & 8 deletions src/ui/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,16 +552,12 @@ export function styleCSS() {
}
.overlay-tip {
position: absolute;
top: 3px;
right: 3px;
z-index: 10;
height: 1em;
border-radius: 10%;
border: 1px solid #333;
color: var(--ehvp-font-color);
background-color: #959595d1;
text-align: center;
font-weight: 800;
top: 0.3em;
right: 0.3em;
font-size: 0.8em;
text-shadow: 0px 0px 3px #000000;
}
.lightgreen { color: #90ea90; }
.ehvp-full-panel {
Expand Down

0 comments on commit bc4164c

Please sign in to comment.