forked from rDrama/rDrama
master
parent
ef77784d7a
commit
ecb5ddc840
|
@ -17,7 +17,7 @@ function option_vote_0(oid, parentid, kind) {
|
||||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||||
el.classList.remove('d-none');
|
el.classList.remove('d-none');
|
||||||
}
|
}
|
||||||
const full_oid = kind + '-' + oid
|
const full_oid = `option-${kind}-${oid}`
|
||||||
const type = document.getElementById(full_oid).checked;
|
const type = document.getElementById(full_oid).checked;
|
||||||
const scoretext = document.getElementById('score-' + full_oid);
|
const scoretext = document.getElementById('score-' + full_oid);
|
||||||
const score = Number(scoretext.textContent);
|
const score = Number(scoretext.textContent);
|
||||||
|
@ -30,8 +30,8 @@ function option_vote_1(oid, parentid, kind) {
|
||||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||||
el.classList.remove('d-none');
|
el.classList.remove('d-none');
|
||||||
}
|
}
|
||||||
const full_oid = kind + '-' + oid
|
const full_oid = `option-${kind}-${oid}`
|
||||||
let curr = document.getElementById(`current-${kind}-${parentid}`)
|
let curr = document.getElementById(`current-option-${kind}-${parentid}`)
|
||||||
if (curr && curr.value)
|
if (curr && curr.value)
|
||||||
{
|
{
|
||||||
const scoretext = document.getElementById('score-' + curr.value);
|
const scoretext = document.getElementById('score-' + curr.value);
|
||||||
|
|
|
@ -37,9 +37,9 @@ def add_options(self, body, v):
|
||||||
|
|
||||||
if self.options:
|
if self.options:
|
||||||
curr = [x for x in self.options if x.exclusive and x.voted(v)]
|
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 = ''
|
else: curr = ''
|
||||||
body += f'<input class="d-none" id="current-{kind}-{self.id}"{curr}>'
|
body += f'<input class="d-none" id="current-option-{kind}-{self.id}"{curr}>'
|
||||||
winner = [x for x in self.options if x.exclusive == 3]
|
winner = [x for x in self.options if x.exclusive == 3]
|
||||||
|
|
||||||
for o in self.options:
|
for o in self.options:
|
||||||
|
@ -66,7 +66,7 @@ def add_options(self, body, v):
|
||||||
option_body += "</div>"
|
option_body += "</div>"
|
||||||
else:
|
else:
|
||||||
input_type = 'radio' if o.exclusive else 'checkbox'
|
input_type = 'radio' if o.exclusive else 'checkbox'
|
||||||
option_body += f'<div class="custom-control mt-2"><input type="{input_type}" class="custom-control-input" id="{kind}-{o.id}" name="option-{self.id}"'
|
option_body += f'<div class="custom-control mt-2"><input type="{input_type}" class="custom-control-input" id="option-{kind}-{o.id}" name="option-{self.id}"'
|
||||||
if o.voted(v): option_body += " checked"
|
if o.voted(v): option_body += " checked"
|
||||||
|
|
||||||
disabled = False
|
disabled = False
|
||||||
|
@ -87,10 +87,10 @@ def add_options(self, body, v):
|
||||||
else:
|
else:
|
||||||
option_body += f''' data-nonce="{g.nonce}" data-onclick="option_vote_no_v()"'''
|
option_body += f''' data-nonce="{g.nonce}" data-onclick="option_vote_no_v()"'''
|
||||||
|
|
||||||
option_body += f'''><label class="custom-control-label" for="{kind}-{o.id}">{o.body_html}<span class="presult-{self.id}'''
|
option_body += f'''><label class="custom-control-label" for="option-{kind}-{o.id}">{o.body_html}<span class="presult-{self.id}'''
|
||||||
if not disabled and not self.total_poll_voted(v):
|
if not disabled and not self.total_poll_voted(v):
|
||||||
option_body += ' d-none'
|
option_body += ' d-none'
|
||||||
option_body += f'"> - <a href="/votes/{kind}/option/{o.id}"><span id="score-{kind}-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
|
option_body += f'"> - <a href="/votes/{kind}/option/{o.id}"><span id="score-option-{kind}-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
|
||||||
|
|
||||||
if o.exclusive > 1: s = '##'
|
if o.exclusive > 1: s = '##'
|
||||||
elif o.exclusive: s = '&&'
|
elif o.exclusive: s = '&&'
|
||||||
|
|
Loading…
Reference in New Issue