Enhance HUD functionality: implement flashing effect for HUD dot to indicate member-only video detection
This commit is contained in:
parent
f708833cdf
commit
a4f2f5c60b
18
content.js
18
content.js
@ -17,6 +17,7 @@ const DEFAULT_MAX_ARCHIVE = 500;
|
||||
const MAX_SNAPSHOT_CHARS = 20000;
|
||||
let persistTimer = null;
|
||||
let contextInvalidated = false;
|
||||
let hudFlashTimer = null;
|
||||
|
||||
function safeSnapshot(video) {
|
||||
if (typeof buildSnapshot !== "function") return "";
|
||||
@ -82,6 +83,13 @@ function injectStyleOnce() {
|
||||
box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.4);
|
||||
animation: ${DATA_PREFIX}-pulse 1.8s ease-in-out infinite;
|
||||
}
|
||||
#${HUD_DOT_ID}[data-${DATA_PREFIX}-flash="true"] {
|
||||
background: #ffd84a;
|
||||
border-color: #e0a600;
|
||||
transform: scale(1.8);
|
||||
box-shadow: 0 0 0 10px rgba(255, 216, 74, 0.4);
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
@keyframes ${DATA_PREFIX}-pulse {
|
||||
0% {
|
||||
transform: scale(0.9);
|
||||
@ -381,6 +389,7 @@ function process(root = document) {
|
||||
if (!whitelisted) {
|
||||
if (id && memberOnlyIndex.has(id)) {
|
||||
const meta = memberOnlyIndex.get(id);
|
||||
if (!meta.hidden) flashHudDot();
|
||||
if (!meta.snapshot) meta.snapshot = safeSnapshot(video);
|
||||
if (!meta.hidden) hudDirty = true;
|
||||
meta.hidden = true;
|
||||
@ -674,6 +683,15 @@ function updateHudDot() {
|
||||
}
|
||||
}
|
||||
|
||||
function flashHudDot() {
|
||||
const dot = ensureHudDot();
|
||||
dot.setAttribute(`data-${DATA_PREFIX}-flash`, "true");
|
||||
if (hudFlashTimer) clearTimeout(hudFlashTimer);
|
||||
hudFlashTimer = setTimeout(() => {
|
||||
dot.removeAttribute(`data-${DATA_PREFIX}-flash`);
|
||||
}, 900);
|
||||
}
|
||||
|
||||
function updateSharedIndex(meta, hidden) {
|
||||
if (!meta.stableId) {
|
||||
meta.stableId = meta.url || meta.id || "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user