|
export class NotificationManager {
|
|
constructor() {
|
|
this.initHashScroll();
|
|
}
|
|
|
|
initHashScroll() {
|
|
const hash = window.location.hash;
|
|
if (!hash.startsWith("#comment-")) {
|
|
return;
|
|
}
|
|
window.addEventListener("load", () => {
|
|
const target = document.getElementById(hash.slice(1));
|
|
if (!target) {
|
|
return;
|
|
}
|
|
requestAnimationFrame(() => {
|
|
target.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
target.classList.add("comment-highlight");
|
|
setTimeout(() => target.classList.remove("comment-highlight"), 2000);
|
|
});
|
|
});
|
|
}
|
|
}
|