From da06d91930df7b3ccd0205ee55fb92956bd1fa8b Mon Sep 17 00:00:00 2001 From: Jarian Cottingham Date: Tue, 14 Oct 2025 23:07:53 -0500 Subject: [PATCH] Stay on the same page when clicking buttons --- src/website/app.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/website/app.js b/src/website/app.js index 7b77eae..1acffe6 100644 --- a/src/website/app.js +++ b/src/website/app.js @@ -5,6 +5,10 @@ let currentPostCount = 0; function createPostElement(post) { const postElement = document.createElement("div"); postElement.className = "post"; + postElement.onclick = () => { + window.location.href = post.url; + }; + postElement.style.cursor = "pointer"; // Create the image container const imageContainer = document.createElement("div"); @@ -24,8 +28,6 @@ function createPostElement(post) { const title = document.createElement("a"); title.href = post.url; - title.target = "_blank"; - title.rel = "noopener noreferrer"; title.className = "post-title"; title.textContent = post.title; @@ -36,26 +38,29 @@ function createPostElement(post) { buttonsContainer.className = "post-buttons"; // Single button - const singleButton = document.createElement("a"); - singleButton.href = post.url + "/singlefile"; - singleButton.target = "_blank"; - singleButton.rel = "noopener noreferrer"; + const singleButton = document.createElement("button"); + singleButton.onclick = (e) => { + e.stopPropagation(); + window.location.href = post.url + "/singlefile"; + }; singleButton.className = "post-button"; singleButton.textContent = "Single"; // HTML button - const htmlButton = document.createElement("a"); - htmlButton.href = post.url + "/html"; - htmlButton.target = "_blank"; - htmlButton.rel = "noopener noreferrer"; + const htmlButton = document.createElement("button"); + htmlButton.onclick = (e) => { + e.stopPropagation(); + window.location.href = post.url + "/html"; + }; htmlButton.className = "post-button"; htmlButton.textContent = "HTML"; // PDF button - const pdfButton = document.createElement("a"); - pdfButton.href = post.url + "/pdf"; - pdfButton.target = "_blank"; - pdfButton.rel = "noopener noreferrer"; + const pdfButton = document.createElement("button"); + pdfButton.onclick = (e) => { + e.stopPropagation(); + window.location.href = post.url + "/pdf"; + }; pdfButton.className = "post-button"; pdfButton.textContent = "PDF";