Added raw mode supprot

This commit is contained in:
Marco Cetica 2024-03-06 11:04:08 +01:00
parent 14996a8936
commit b6798c4ac7
Signed by: marco
GPG Key ID: 45060A949E90D0FD
1 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,7 @@ const searchPost = (post_id, event) => {
search_form.style.display = "none";
// Set post title. Add the edit and the delete button if the user != anonymous
const title = data.user
let title = data.user
? (`${data.title} <a style="text-decoration: none;" href="/edit?id=${data.id}">✏️</a> ` +
`<a style="text-decoration: none;" href="/delete?id=${data.id}">♻️</a>`)
: `${data.title}`;
@ -51,7 +51,10 @@ const searchPost = (post_id, event) => {
// Set post ID
const id = data.id;
document.querySelector(".metadata").innerHTML +=
`<span class="metadata-el">ID</span>: <code><a href="/search?id=${id}">${id}</a></code>`;
`<span class="metadata-el">ID</span>: <code><a href="/search?id=${id}">${id}</a></code>&nbsp;/&nbsp;`;
// Add 'raw mode' button
document.querySelector(".metadata").innerHTML +=
`<code><a style="text-decoration: none;" href="/api/posts/raw/${data.id}">raw</a></code>`;
// Set post content
document.querySelector(".content").textContent = data.content;
})