Refactor blog click event listener in global.js in web UI to also add the event to the title of the news post

This commit is contained in:
Théophile Diot 2024-03-19 13:03:37 +00:00
parent ab921f06e1
commit 60b0a7b74b
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -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";
});