tagliatelle

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 5f2166b4f4ee13c33167932a00126205c8aa08dc
parent 92574b5632c5709e932421d45b5917a4f9bd7ee8
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Thu, 30 Jul 2026 11:49:35 +0100

AJAX container fix

innerHTML gets replaced every call, but the container remains which will stack listeners

Diffstat:
Mstatic/text-viewer.js | 3+++
Mstatic/timestamps.js | 3+++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/static/text-viewer.js b/static/text-viewer.js @@ -50,6 +50,9 @@ function makeLineNumbersClickable(containerId, viewerId) { return `<a href="#" class="line-link" data-line="${lineNum}">${match}</a>`; }); + if (container.dataset.lineClickBound) return; + container.dataset.lineClickBound = 'true'; + container.addEventListener("click", e => { if (e.target.classList.contains("line-link")) { e.preventDefault(); diff --git a/static/timestamps.js b/static/timestamps.js @@ -54,6 +54,9 @@ function makeTimestampsClickable(containerId, videoId, imageId) { // Restore the markdown links now that no other regex can touch them container.innerHTML = html.replace(/\u0000MDLINK(\d+)\u0000/g, (_, i) => mdLinks[Number(i)]); // Handle clicks + if (container.dataset.timestampClickBound) return; + container.dataset.timestampClickBound = 'true'; + container.addEventListener("click", e => { if (e.target.classList.contains("timestamp")) { e.preventDefault();