Update meme voting
This commit is contained in:
parent
cad1e333fe
commit
8702a549ab
@ -628,6 +628,9 @@ async function reloadMemeVotes(memeID) {
|
|||||||
let memeVoteCounterElement = document.getElementById(`meme_votes_counter_${memeID}`);
|
let memeVoteCounterElement = document.getElementById(`meme_votes_counter_${memeID}`);
|
||||||
let memeVoteUpvoteElement = document.getElementById(`meme_votes_upvote_${memeID}`);
|
let memeVoteUpvoteElement = document.getElementById(`meme_votes_upvote_${memeID}`);
|
||||||
let memeVoteDownvoteElement = document.getElementById(`meme_votes_downvote_${memeID}`);
|
let memeVoteDownvoteElement = document.getElementById(`meme_votes_downvote_${memeID}`);
|
||||||
|
let memeVoteUpvoteButtonElement = document.getElementById(`meme_votes_upvote_button_${memeID}`);
|
||||||
|
let memeVoteDownvoteButtonElement = document.getElementById(`meme_votes_downvote_button_${memeID}`);
|
||||||
|
|
||||||
|
|
||||||
let memeVoteResponse = await doAction('/meme', {
|
let memeVoteResponse = await doAction('/meme', {
|
||||||
action: "getMemeVotes",
|
action: "getMemeVotes",
|
||||||
@ -649,17 +652,17 @@ async function reloadMemeVotes(memeID) {
|
|||||||
memeVoteCounterElement.classList.add("neutral");
|
memeVoteCounterElement.classList.add("neutral");
|
||||||
}
|
}
|
||||||
|
|
||||||
memeVoteUpvoteElement.classList.remove('visual_hover');
|
memeVoteUpvoteButtonElement.classList.remove('visual_hover');
|
||||||
memeVoteDownvoteElement.classList.remove('visual_hover');
|
memeVoteDownvoteButtonElement.classList.remove('visual_hover');
|
||||||
if (userVote > 0) {
|
if (userVote > 0) {
|
||||||
memeUpvoteVariant = "fill";
|
memeUpvoteVariant = "fill";
|
||||||
memeDownvoteVariant = "line";
|
memeDownvoteVariant = "line";
|
||||||
memeVoteUpvoteElement.classList.add('visual_hover');
|
memeVoteUpvoteButtonElement.classList.add('visual_hover');
|
||||||
}
|
}
|
||||||
else if (userVote < 0) {
|
else if (userVote < 0) {
|
||||||
memeUpvoteVariant = "line";
|
memeUpvoteVariant = "line";
|
||||||
memeDownvoteVariant = "fill";
|
memeDownvoteVariant = "fill";
|
||||||
memeVoteDownvoteElement.classList.add('visual_hover');
|
memeVoteDownvoteButtonElement.classList.add('visual_hover');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memeUpvoteVariant = "line";
|
memeUpvoteVariant = "line";
|
||||||
|
@ -360,6 +360,8 @@ div#articleslist>article{
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meme, .meme_body {
|
.meme, .meme_body {
|
||||||
|
@ -47,8 +47,8 @@ function renderMeme(int $id, int $authorId, string $title, string $textContent,
|
|||||||
$meme_upvote_active = 'line';
|
$meme_upvote_active = 'line';
|
||||||
$meme_vote_counter_class = 'neutral';
|
$meme_vote_counter_class = 'neutral';
|
||||||
}
|
}
|
||||||
$meme_upvote = isLoggedIn() ? "<button class='meme_upvote' onclick=\"voteMeme($id, 1);\"> <i id='meme_votes_upvote_$id' class=\"ri-arrow-up-circle-$meme_upvote_active\"></i></button>" : '';
|
$meme_upvote = isLoggedIn() ? "<button id='meme_votes_upvote_button_$id' class='meme_upvote' onclick=\"voteMeme($id, 1);\"> <i id='meme_votes_upvote_$id' class=\"ri-arrow-up-circle-$meme_upvote_active\"></i></button>" : '';
|
||||||
$meme_downvote = isLoggedIn() ? "<button class='meme_downvote' onclick=\"voteMeme($id, 0);\"> <i id='meme_votes_downvote_$id' class=\"ri-arrow-down-circle-$meme_downvote_active\"></i></button>" : '';
|
$meme_downvote = isLoggedIn() ? "<button id='meme_votes_downvote_button_$id' class='meme_downvote' onclick=\"voteMeme($id, 0);\"> <i id='meme_votes_downvote_$id' class=\"ri-arrow-down-circle-$meme_downvote_active\"></i></button>" : '';
|
||||||
|
|
||||||
$meme_out = str_replace('__TEMPLATE_MEME_VOTES_NUMBER__', strval($meme_net_votes), $meme_out);
|
$meme_out = str_replace('__TEMPLATE_MEME_VOTES_NUMBER__', strval($meme_net_votes), $meme_out);
|
||||||
$meme_out = str_replace('__TEMPLATE_MEME_UPVOTE__', $meme_upvote, $meme_out);
|
$meme_out = str_replace('__TEMPLATE_MEME_UPVOTE__', $meme_upvote, $meme_out);
|
||||||
|
Loading…
Reference in New Issue
Block a user