From ecb5ddc840b953f7db5d33ed2237ae2dd7cb149b Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 12 Aug 2023 14:12:50 +0300 Subject: [PATCH] fix https://fsdfsd.net/rDrama/rDrama/issues/125 --- files/assets/js/comments+post_listing.js | 6 +++--- files/classes/comment.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/assets/js/comments+post_listing.js b/files/assets/js/comments+post_listing.js index f987d155d..0eb26255f 100644 --- a/files/assets/js/comments+post_listing.js +++ b/files/assets/js/comments+post_listing.js @@ -17,7 +17,7 @@ function option_vote_0(oid, parentid, kind) { for(let el of document.getElementsByClassName('presult-'+parentid)) { el.classList.remove('d-none'); } - const full_oid = kind + '-' + oid + const full_oid = `option-${kind}-${oid}` const type = document.getElementById(full_oid).checked; const scoretext = document.getElementById('score-' + full_oid); const score = Number(scoretext.textContent); @@ -30,8 +30,8 @@ function option_vote_1(oid, parentid, kind) { for(let el of document.getElementsByClassName('presult-'+parentid)) { el.classList.remove('d-none'); } - const full_oid = kind + '-' + oid - let curr = document.getElementById(`current-${kind}-${parentid}`) + const full_oid = `option-${kind}-${oid}` + let curr = document.getElementById(`current-option-${kind}-${parentid}`) if (curr && curr.value) { const scoretext = document.getElementById('score-' + curr.value); diff --git a/files/classes/comment.py b/files/classes/comment.py index 215186761..e57d7f488 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -37,9 +37,9 @@ def add_options(self, body, v): if self.options: curr = [x for x in self.options if x.exclusive and x.voted(v)] - if curr: curr = f" value={kind}-" + str(curr[0].id) + if curr: curr = f" value=option-{kind}-" + str(curr[0].id) else: curr = '' - body += f'' + body += f'' winner = [x for x in self.options if x.exclusive == 3] for o in self.options: @@ -66,7 +66,7 @@ def add_options(self, body, v): option_body += "" else: input_type = 'radio' if o.exclusive else 'checkbox' - option_body += f'
''' + option_body += f'"> - {o.upvotes} votes''' if o.exclusive > 1: s = '##' elif o.exclusive: s = '&&'