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) {
|
function createPostElement(post) {
|
||||||
const postElement = document.createElement("div");
|
const postElement = document.createElement("div");
|
||||||
postElement.className = "post";
|
postElement.className = "post";
|
||||||
|
postElement.onclick = () => {
|
||||||
|
window.location.href = post.url;
|
||||||
|
};
|
||||||
|
postElement.style.cursor = "pointer";
|
||||||
|
|
||||||
// Create the image container
|
// Create the image container
|
||||||
const imageContainer = document.createElement("div");
|
const imageContainer = document.createElement("div");
|
||||||
@ -24,8 +28,6 @@ function createPostElement(post) {
|
|||||||
|
|
||||||
const title = document.createElement("a");
|
const title = document.createElement("a");
|
||||||
title.href = post.url;
|
title.href = post.url;
|
||||||
title.target = "_blank";
|
|
||||||
title.rel = "noopener noreferrer";
|
|
||||||
title.className = "post-title";
|
title.className = "post-title";
|
||||||
title.textContent = post.title;
|
title.textContent = post.title;
|
||||||
|
|
||||||
@ -36,26 +38,29 @@ function createPostElement(post) {
|
|||||||
buttonsContainer.className = "post-buttons";
|
buttonsContainer.className = "post-buttons";
|
||||||
|
|
||||||
// Single button
|
// Single button
|
||||||
const singleButton = document.createElement("a");
|
const singleButton = document.createElement("button");
|
||||||
singleButton.href = post.url + "/singlefile";
|
singleButton.onclick = (e) => {
|
||||||
singleButton.target = "_blank";
|
e.stopPropagation();
|
||||||
singleButton.rel = "noopener noreferrer";
|
window.location.href = post.url + "/singlefile";
|
||||||
|
};
|
||||||
singleButton.className = "post-button";
|
singleButton.className = "post-button";
|
||||||
singleButton.textContent = "Single";
|
singleButton.textContent = "Single";
|
||||||
|
|
||||||
// HTML button
|
// HTML button
|
||||||
const htmlButton = document.createElement("a");
|
const htmlButton = document.createElement("button");
|
||||||
htmlButton.href = post.url + "/html";
|
htmlButton.onclick = (e) => {
|
||||||
htmlButton.target = "_blank";
|
e.stopPropagation();
|
||||||
htmlButton.rel = "noopener noreferrer";
|
window.location.href = post.url + "/html";
|
||||||
|
};
|
||||||
htmlButton.className = "post-button";
|
htmlButton.className = "post-button";
|
||||||
htmlButton.textContent = "HTML";
|
htmlButton.textContent = "HTML";
|
||||||
|
|
||||||
// PDF button
|
// PDF button
|
||||||
const pdfButton = document.createElement("a");
|
const pdfButton = document.createElement("button");
|
||||||
pdfButton.href = post.url + "/pdf";
|
pdfButton.onclick = (e) => {
|
||||||
pdfButton.target = "_blank";
|
e.stopPropagation();
|
||||||
pdfButton.rel = "noopener noreferrer";
|
window.location.href = post.url + "/pdf";
|
||||||
|
};
|
||||||
pdfButton.className = "post-button";
|
pdfButton.className = "post-button";
|
||||||
pdfButton.textContent = "PDF";
|
pdfButton.textContent = "PDF";
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user