Skip to content

Commit

Permalink
Fix #165
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoNezd committed Sep 15, 2024
1 parent aeb4f67 commit 45d6f0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/features/posts/css/votes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
.ol-vote-count.ol-votecount-enabled {
display: block;
}
.score:not(.ol-score) {
.score:not(.ol-votecount) {
display: none !important;
}
.score.ol-score {
.score.ol-votecount {
display: inline !important;
font-size: 1em;
}
Expand Down
18 changes: 8 additions & 10 deletions src/features/posts/reimplementVotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,11 @@ export default class ReimplementVotes extends OLFeature {
}
const entry = post.querySelector(".entry") as HTMLDivElement;
const oldLanderScore = document.createElement("span");
oldLanderScore.classList.add("score", "ol-score");
oldLanderScore.classList.add("score", "ol-votecount");
if (unvotedScoreEl === null) {
oldLanderScore.innerText = "[score unavailable]";
} else {
oldLanderScore.innerText = `${
Number(post.dataset.neutralScore) + postState
} point(s)`;
oldLanderScore.innerText = post.dataset.olVote;
}
const dislikes = entry.querySelector(".score.dislikes");
if (dislikes !== null) {
Expand Down Expand Up @@ -155,22 +153,22 @@ export default class ReimplementVotes extends OLFeature {
buttons[0].classList.toggle("act", false);
buttons[1].classList.toggle("act", false);
score_el.innerText = (
score_res.querySelector(".score.unvoted") as HTMLDivElement
).innerText;
post.querySelector(".score.unvoted") as HTMLDivElement
).innerText.split(" ")[0];
}
if (score_res.classList.contains("likes")) {
buttons[0].classList.toggle("act", true);
buttons[1].classList.toggle("act", false);
score_el.innerText = (
score_res.querySelector(".score.likes") as HTMLDivElement
).innerText;
post.querySelector(".score.likes") as HTMLDivElement
).innerText.split(" ")[0];
}
if (score_res.classList.contains("dislikes")) {
buttons[0].classList.toggle("act", false);
buttons[1].classList.toggle("act", true);
score_el.innerText = (
score_res.querySelector(".score.dislikes") as HTMLDivElement
).innerText;
post.querySelector(".score.dislikes") as HTMLDivElement
).innerText.split(" ")[0];
}
}
}

0 comments on commit 45d6f0c

Please sign in to comment.