Test meme voting

This commit is contained in:
2024-04-27 10:30:01 +02:00
parent 154cff0372
commit cd487d155c
5 changed files with 110 additions and 12 deletions

View File

@@ -621,4 +621,24 @@ async function getMemeImages() {
memeImageSelector.appendChild(option);
});
}
async function reloadMemeVotes(memeID) {
let memeVoteCounterElement = document.getElementById(`meme_votes_counter_${memeID}`);
let memeVoteResponse = await doAction('/meme', {
action: "getMemeVotes",
meme_id: memeID
}, "Počet hlasov k meme-u bol stiahnutý", "Nastala chyba pri sťahovaní počtu hlasov k meme-u", true);
memeVoteCounterElement.innerText = memeVoteResponse.NetVotes;
}
async function voteMeme(memeID, isUpvote){
await doAction("/meme", {
action: "voteMeme",
meme_id: memeID,
is_upvote: isUpvote
}, "Meme bol upvotenutý", "Nastala chyba pri upvoteovaní meme-u", true);
await reloadMemeVotes(memeID);
}

View File

@@ -356,6 +356,21 @@ div#articleslist>article{
height: auto;
}
.meme_info {
display: flex;
flex-direction: row;
}
.meme {
display: flex;
flex-direction: column;
}
.meme_body {
display: flex;
flex-direction: column;
}
@media (max-width: 1050px) {
div#articleslist {