Stay on the same page when clicking buttons
This commit is contained in:
parent
b919acb09e
commit
da06d91930
@ -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";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user