From 60b0a7b74bddb3db3fd4fbdcfc6d28cd976d4a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Tue, 19 Mar 2024 13:03:37 +0000 Subject: [PATCH] Refactor blog click event listener in global.js in web UI to also add the event to the title of the news post --- src/ui/static/js/global.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/static/js/global.js b/src/ui/static/js/global.js index b485c1231..54ada150c 100644 --- a/src/ui/static/js/global.js +++ b/src/ui/static/js/global.js @@ -110,7 +110,11 @@ class News { document .querySelector("[data-news-container]") .insertAdjacentHTML("afterbegin", cleanHTML); - document.querySelector(`.blog-click-${news.slug}`).addEventListener("click", function () { window.open(`${BASE_URL}/blog/post/${news.slug}`, '_blank') }); + document.querySelectorAll(`.blog-click-${news.slug}`).forEach((slug) => { + slug.addEventListener("click", function () { + window.open(`${BASE_URL}/blog/post/${news.slug}`, "_blank"); + }); + }); document.querySelectorAll(".blog-click-tag").forEach((tag) => { tag.target = "_blank"; });