change poll- and choice- and -bet to -option

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-06 00:54:05 +02:00
parent 73dbb2dd7e
commit 62d077576f
6 changed files with 19 additions and 19 deletions

View File

@ -83,7 +83,7 @@ function post(url) {
function poll_vote(cid, kind) {
var type = document.getElementById(cid).checked;
var scoretext = document.getElementById('poll-' + cid);
var scoretext = document.getElementById('option-' + cid);
var score = Number(scoretext.textContent);
if (type == true) scoretext.textContent = score + 1;
else scoretext.textContent = score - 1;
@ -94,12 +94,12 @@ function choice_vote(cid, parentid, kind) {
let curr = document.getElementById(`current-${parentid}`)
if (curr && curr.value)
{
var scoretext = document.getElementById('choice-' + curr.value);
var scoretext = document.getElementById('option-' + curr.value);
var score = Number(scoretext.textContent);
scoretext.textContent = score - 1;
}
var scoretext = document.getElementById('choice-' + cid);
var scoretext = document.getElementById('option-' + cid);
var score = Number(scoretext.textContent);
scoretext.textContent = score + 1;
@ -114,7 +114,7 @@ function bet_vote(cid) {
for(let el of document.getElementsByClassName('cost')) {
el.classList.add('d-none')
}
var scoretext = document.getElementById('bet-' + cid);
var scoretext = document.getElementById('option-' + cid);
var score = Number(scoretext.textContent);
scoretext.textContent = score + 1;
post(`/vote/post/option/${cid}`);

View File

@ -90,7 +90,7 @@ function markdown(t) {
var option = options[i][0];
var option2 = option.replace(/&&/g, '').replace(/\n/g, '')
input = input.replace(option, '');
input += `<div class="custom-control"><input type="radio" name="choice" class="custom-control-input" id="choice-${i}"><label class="custom-control-label" for="choice-${i}">${option2} - <a>0 votes</a></label></div>`;
input += `<div class="custom-control"><input type="radio" name="choice" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`;
}
}

View File

@ -371,10 +371,10 @@ class Comment(Base):
for c in self.options:
if c.exclusive:
body += f'''<div class="custom-control"><input name="choice-{self.id}" autocomplete="off" class="custom-control-input" type="radio" id="{c.id}" onchange="choice_vote('{c.id}','{self.id}','comment')"'''
body += f'''<div class="custom-control"><input name="option-{self.id}" autocomplete="off" class="custom-control-input" type="radio" id="{c.id}" onchange="choice_vote('{c.id}','{self.id}','comment')"'''
if c.voted(v): body += " checked "
body += f'''><label class="custom-control-label" for="{c.id}">{c.body_html}<span class="presult-{self.id}'''
body += f'"> - <a href="/votes/comment/option/{c.id}"><span id="choice-{c.id}">{c.upvotes}</span> votes</a></span></label></div>'
body += f'"> - <a href="/votes/comment/option/{c.id}"><span id="option-{c.id}">{c.upvotes}</span> votes</a></span></label></div>'
else:
body += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{c.id}" name="option"'
if c.voted(v): body += " checked"
@ -383,7 +383,7 @@ class Comment(Base):
body += f''' onchange="poll_vote('{c.id}', 'comment')"'''
else: body += f''' onchange="poll_vote_no_v('{c.id}', '{self.id}')"'''
body += f'''><label class="custom-control-label" for="{c.id}">{c.body_html}<span class="presult-{self.id}'''
body += f'"> - <a href="/votes/comment/option/{c.id}"><span id="poll-{c.id}">{c.upvotes}</span> votes</a></span></label></div>'
body += f'"> - <a href="/votes/comment/option/{c.id}"><span id="option-{c.id}">{c.upvotes}</span> votes</a></span></label></div>'
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))):
body += f"<hr>{self.author.sig_html}"

View File

@ -361,12 +361,12 @@ class Submission(Base):
for o in self.options:
if o.exclusive == 2:
body += f'''<div class="custom-control"><input name="bet-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" onchange="bet_vote('{o.id}','{self.id}')"'''
body += f'''<div class="custom-control"><input name="option-{self.id}" autocomplete="off" class="custom-control-input bet" type="radio" id="{o.id}" onchange="bet_vote('{o.id}','{self.id}')"'''
if o.voted(v): body += " checked "
if not (v and v.coins >= 200) or self.total_bet_voted(v): body += " disabled "
body += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="bet-{o.id}">{o.upvotes}</span> bets</a>'
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="option-{o.id}">{o.upvotes}</span> bets</a>'
if not self.total_bet_voted(v):
body += '''<span class="cost"> (cost of entry: 200 coins)</span>'''
body += "</label>"
@ -375,10 +375,10 @@ class Submission(Base):
body += "</div>"
elif o.exclusive == 1:
body += f'''<div class="custom-control"><input name="choice-{self.id}" autocomplete="off" class="custom-control-input" type="radio" id="{o.id}" onchange="choice_vote('{o.id}','{self.id}','post')"'''
body += f'''<div class="custom-control"><input name="option-{self.id}" autocomplete="off" class="custom-control-input" type="radio" id="{o.id}" onchange="choice_vote('{o.id}','{self.id}','post')"'''
if o.voted(v): body += " checked "
body += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="choice-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="option-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'
else:
body += f'<div class="custom-control"><input type="checkbox" class="custom-control-input" id="{o.id}" name="option"'
if o.voted(v): body += " checked"
@ -387,7 +387,7 @@ class Submission(Base):
body += f''' onchange="poll_vote('{o.id}', 'post')"'''
else: body += f''' onchange="poll_vote_no_v('{o.id}', '{self.id}')"'''
body += f'''><label class="custom-control-label" for="{o.id}">{o.body_html}<span class="presult-{self.id}'''
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="poll-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'
body += f'"> - <a href="/votes/post/option/{o.id}"><span id="option-{o.id}">{o.upvotes}</span> votes</a></span></label></div>'

View File

@ -149,11 +149,11 @@ Text 2
<td>
<div class="custom-control">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="422741">
<label class="custom-control-label" for="422741">bussy - <a href="/votes/t3_422741"><span id="poll-422741">0</span> votes</a></label>
<label class="custom-control-label" for="422741">bussy - <a href="/votes/t3_422741"><span id="option-422741">0</span> votes</a></label>
</div>
<div class="custom-control">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="422742">
<label class="custom-control-label" for="422742">gussy - <a href="/votes/t3_422742"><span id="poll-422742">0</span> votes</a></label>
<label class="custom-control-label" for="422742">gussy - <a href="/votes/t3_422742"><span id="option-422742">0</span> votes</a></label>
</div>
</td>
</tr>
@ -168,11 +168,11 @@ Text 2
<td>
<div class="custom-control">
<input name="choice" autocomplete="off" type="radio" class="custom-control-input" id="1338113">
<label class="custom-control-label" for="1338113">bussy - <a href="/votes/t3_1338113"><span id="choice-1338113">0</span> votes</a></label>
<label class="custom-control-label" for="1338113">bussy - <a href="/votes/t3_1338113"><span id="option-1338113">0</span> votes</a></label>
</div>
<div class="custom-control">
<input name="choice" autocomplete="off" type="radio" class="custom-control-input" id="1338114">
<label class="custom-control-label" for="1338114">gussy - <a href="/votes/t3_1338114"><span id="choice-1338114">0</span> votes</a></label>
<label class="custom-control-label" for="1338114">gussy - <a href="/votes/t3_1338114"><span id="option-1338114">0</span> votes</a></label>
</div>
</td>
</tr>

View File

@ -18,14 +18,14 @@ set CACHE_VER = {
'js/award_modal.js': 4000,
'js/bootstrap.js': 4000,
'js/category_modal.js': 4000,
'js/comments+submission_listing.js': 4002,
'js/comments+submission_listing.js': 4006,
'js/comments_admin.js': 4000,
'js/comments_v.js': 4000,
'js/submission_listing.js': 4000,
'js/emoji_modal.js': 4001,
'js/formatting.js': 4000,
'js/lottery.js': 4000,
'js/marked.js': 4000,
'js/marked.js': 4006,
'js/search.js': 4000,
'js/submit.js': 4000,
'js/userpage.js': 4000,