ti
This commit is contained in:
parent
dde892d8c3
commit
76c72d42b2
7 changed files with 61 additions and 76 deletions
|
@ -39,3 +39,58 @@ document.addEventListener("click", function(){
|
|||
}
|
||||
else document.querySelectorAll('.popover').forEach(e => e.remove());
|
||||
});
|
||||
|
||||
function post(url) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
var form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
xhr.send(form);
|
||||
};
|
||||
|
||||
function poll_vote(cid, parentid) {
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('d-none');
|
||||
}
|
||||
var type = document.getElementById(cid).checked;
|
||||
var scoretext = document.getElementById('poll-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
if (type == true) scoretext.textContent = score + 1;
|
||||
else scoretext.textContent = score - 1;
|
||||
post('/vote/poll/' + cid + '?vote=' + type);
|
||||
}
|
||||
|
||||
function choice_vote(cid, parentid) {
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('d-none');
|
||||
}
|
||||
|
||||
let curr = document.getElementById(`current-${parentid}`)
|
||||
if (curr && curr.value)
|
||||
{
|
||||
var scoretext = document.getElementById('choice-' + curr.value);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score - 1;
|
||||
}
|
||||
|
||||
var scoretext = document.getElementById('choice-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score + 1;
|
||||
post('/vote/choice/' + cid);
|
||||
curr.value = cid
|
||||
}
|
||||
|
||||
function bet_vote(cid) {
|
||||
for(let el of document.getElementsByClassName('bet')) {
|
||||
el.disabled = true;
|
||||
}
|
||||
for(let el of document.getElementsByClassName('cost')) {
|
||||
el.classList.add('d-none')
|
||||
}
|
||||
var scoretext = document.getElementById('bet-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score + 1;
|
||||
post('/bet/' + cid);
|
||||
document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - 200;
|
||||
}
|
|
@ -1,12 +1,3 @@
|
|||
function post(url) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
var form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
xhr.send(form);
|
||||
};
|
||||
|
||||
function post_toast3(t, url, button1, button2) {
|
||||
t.disabled=true;
|
||||
t.classList.add("disabled");
|
||||
|
@ -306,38 +297,6 @@ document.onpaste = function(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function poll_vote(cid, parentid) {
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('d-none');
|
||||
}
|
||||
var type = document.getElementById(cid).checked;
|
||||
var scoretext = document.getElementById('poll-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
if (type == true) scoretext.textContent = score + 1;
|
||||
else scoretext.textContent = score - 1;
|
||||
post('/vote/poll/' + cid + '?vote=' + type);
|
||||
}
|
||||
|
||||
function choice_vote(cid, parentid) {
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('d-none');
|
||||
}
|
||||
|
||||
let curr = document.getElementById(`current-${parentid}`)
|
||||
if (curr && curr.value)
|
||||
{
|
||||
var scoretext = document.getElementById('choice-' + curr.value);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score - 1;
|
||||
}
|
||||
|
||||
var scoretext = document.getElementById('choice-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score + 1;
|
||||
post('/vote/choice/' + cid);
|
||||
curr.value = cid
|
||||
}
|
||||
|
||||
function handle_action(type, cid, thing) {
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
function bet_vote(cid) {
|
||||
for(let el of document.getElementsByClassName('bet')) {
|
||||
el.disabled = true;
|
||||
}
|
||||
for(let el of document.getElementsByClassName('cost')) {
|
||||
el.classList.add('d-none')
|
||||
}
|
||||
var scoretext = document.getElementById('bet-' + cid);
|
||||
var score = Number(scoretext.textContent);
|
||||
scoretext.textContent = score + 1;
|
||||
post('/bet/' + cid);
|
||||
document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - 200;
|
||||
}
|
|
@ -848,7 +848,7 @@
|
|||
|
||||
{% if v %}
|
||||
<script src="/assets/js/marked.js?v=250"></script>
|
||||
<script src="/assets/js/comments_v.js?v=265"></script>
|
||||
<script src="/assets/js/comments_v.js?v=266"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="/assets/js/clipboard.js?v=250"></script>
|
||||
|
@ -859,7 +859,7 @@
|
|||
|
||||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
<script src="/assets/js/comments+submission_listing.js?v=256"></script>
|
||||
<script src="/assets/js/comments+submission_listing.js?v=257"></script>
|
||||
<script src="/assets/js/comments.js?v=256"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -237,18 +237,6 @@
|
|||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
function post(url) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
var form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
xhr.onload = function() {location.reload()}
|
||||
xhr.send(form);
|
||||
};
|
||||
</script>
|
||||
|
||||
{% if PUSHER_ID != 'blahblahblah' and v %}
|
||||
<div class="d-none" id="strid">{{request.host}}{{v.id}}</div>
|
||||
<div class="d-none" id="pusherid">{{PUSHER_ID}}</div>
|
||||
|
|
|
@ -1059,10 +1059,6 @@
|
|||
<script src="/assets/js/togglePostEdit.js?v=240"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
<script src="/assets/js/submission.js?v=240"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if not v or v.highlightcomments %}
|
||||
<script src="/assets/js/new_comments_count.js?v=242"></script>
|
||||
{% endif %}
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
|
||||
<div class="post-actions mt-2 d-none d-md-block">
|
||||
<ul class="list-inline text-right d-flex">
|
||||
{% if p.body %}
|
||||
{% if p.realbody(v) %}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
<li class="list-inline-item">
|
||||
|
@ -244,7 +244,7 @@
|
|||
|
||||
</li>
|
||||
|
||||
{% if p.body and request.path != "/changelog"%}
|
||||
{% if p.realbody(v) and request.path != "/changelog"%}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
|
@ -443,5 +443,5 @@
|
|||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
<script src="/assets/js/clipboard.js?v=240"></script>
|
||||
<script src="/assets/js/comments+submission_listing.js?v=256"></script>
|
||||
<script src="/assets/js/comments+submission_listing.js?v=257"></script>
|
||||
<script src="/assets/js/submission_listing.js?v=240"></script>
|
Loading…
Add table
Add a link
Reference in a new issue