Add self-hosted RCS backend, extension, and ops tooling
Ship the Go/SQLite API and Web UI, Chrome/Brave capture addon, Docker Compose, Pangolin reverse-proxy support, and a user-crontab watchdog so the binary stays running without systemd.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
document.querySelectorAll(".copy-url").forEach((button) => {
|
||||
button.addEventListener("click", async () => {
|
||||
const url = button.getAttribute("data-url");
|
||||
if (!url) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(url);
|
||||
const hint = button.parentElement.querySelector(".copied-hint");
|
||||
if (hint) {
|
||||
hint.hidden = false;
|
||||
setTimeout(() => {
|
||||
hint.hidden = true;
|
||||
}, 1500);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("copy failed", err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
(function setupLightbox() {
|
||||
const lightbox = document.getElementById("lightbox");
|
||||
const lightboxImg = document.getElementById("lightbox-img");
|
||||
if (!lightbox || !lightboxImg) {
|
||||
console.warn("[RCS] lightbox elements missing");
|
||||
return;
|
||||
}
|
||||
|
||||
function openLightbox(src) {
|
||||
lightboxImg.src = src;
|
||||
lightbox.hidden = false;
|
||||
lightbox.setAttribute("aria-hidden", "false");
|
||||
document.body.classList.add("lightbox-open");
|
||||
}
|
||||
|
||||
function closeLightbox() {
|
||||
lightbox.hidden = true;
|
||||
lightbox.setAttribute("aria-hidden", "true");
|
||||
lightboxImg.removeAttribute("src");
|
||||
document.body.classList.remove("lightbox-open");
|
||||
}
|
||||
|
||||
// Event delegation so thumbs work even if markup is re-rendered later.
|
||||
document.addEventListener("click", (event) => {
|
||||
const thumb = event.target.closest(".shot-thumb");
|
||||
if (thumb) {
|
||||
event.preventDefault();
|
||||
const src = thumb.getAttribute("data-full") || (thumb.querySelector("img") && thumb.querySelector("img").src);
|
||||
if (src) openLightbox(src);
|
||||
return;
|
||||
}
|
||||
if (event.target === lightbox || event.target.classList.contains("lightbox-close")) {
|
||||
closeLightbox();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "Escape" && !lightbox.hidden) {
|
||||
closeLightbox();
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user