From de96ce812994cbd384bd49e25833d42c56e57633 Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 30 Dec 2023 13:59:27 +0000 Subject: [PATCH] [bbcode] remove jquery --- ext/bbcode/script.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ext/bbcode/script.js b/ext/bbcode/script.js index 96c6ea7d..acedba74 100644 --- a/ext/bbcode/script.js +++ b/ext/bbcode/script.js @@ -1,18 +1,20 @@ document.addEventListener('DOMContentLoaded', () => { - $(".shm-clink").each(function(idx, elm) { - var target_id = $(elm).data("clink-sel"); - if(target_id && $(target_id).length > 0) { + document.querySelectorAll(".shm-clink").forEach(function(el) { + var target_id = el.getAttribute("data-clink-sel"); + if(target_id && document.querySelectorAll(target_id).length > 0) { // if the target comment is already on this page, don't bother // switching pages - $(elm).attr("href", target_id); + el.setAttribute("href", target_id); + // highlight it when clicked - $(elm).click(function(e) { + el.addEventListener("click", function(e) { // This needs jQuery UI $(target_id).highlight(); }); + // vanilla target name should already be in the URL tag, but this // will include the anon ID as displayed on screen - $(elm).html("@"+$(target_id+" .username").html()); + el.innerHTML = "@"+document.querySelector(target_id+" .username").innerHTML; } }); });