forked from rDrama/rDrama
sfdsfd
parent
d88054e668
commit
dc3a4d1ec7
|
@ -1,82 +1,4 @@
|
|||
<script src="/assets/js/award_modal4.js"></script>
|
||||
|
||||
<script>
|
||||
function vote(type, id, dir) {
|
||||
var upvote = document.getElementById(type + '-' + id + '-up');
|
||||
var downvote = document.getElementById(type + '-' + id + '-down');
|
||||
var scoretext = document.getElementById(type + '-score-' + id);
|
||||
|
||||
var score = Number(scoretext.textContent);
|
||||
|
||||
if (dir == "1") {
|
||||
if (upvote.classList.contains('active')) {
|
||||
upvote.classList.remove('active')
|
||||
scoretext.textContent = score - 1
|
||||
votedirection = "0"
|
||||
} else if (downvote.classList.contains('active')) {
|
||||
upvote.classList.add('active')
|
||||
downvote.classList.remove('active')
|
||||
scoretext.textContent = score + 2
|
||||
votedirection = "1"
|
||||
} else {
|
||||
upvote.classList.add('active')
|
||||
scoretext.textContent = score + 1
|
||||
votedirection = "1"
|
||||
}
|
||||
|
||||
if (upvote.classList.contains('active')) {
|
||||
scoretext.classList.add('score-up')
|
||||
scoretext.classList.remove('score-down')
|
||||
scoretext.classList.remove('score')
|
||||
} else if (downvote.classList.contains('active')) {
|
||||
scoretext.classList.add('score-down')
|
||||
scoretext.classList.remove('score-up')
|
||||
scoretext.classList.remove('score')
|
||||
} else {
|
||||
scoretext.classList.add('score')
|
||||
scoretext.classList.remove('score-up')
|
||||
scoretext.classList.remove('score-down')
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (downvote.classList.contains('active')) {
|
||||
downvote.classList.remove('active')
|
||||
scoretext.textContent = score + 1
|
||||
votedirection = "0"
|
||||
} else if (upvote.classList.contains('active')) {
|
||||
downvote.classList.add('active')
|
||||
upvote.classList.remove('active')
|
||||
scoretext.textContent = score - 2
|
||||
votedirection = "-1"
|
||||
} else {
|
||||
downvote.classList.add('active')
|
||||
scoretext.textContent = score - 1
|
||||
votedirection = "-1"
|
||||
}
|
||||
|
||||
if (upvote.classList.contains('active')) {
|
||||
scoretext.classList.add('score-up')
|
||||
scoretext.classList.remove('score-down')
|
||||
scoretext.classList.remove('score')
|
||||
} else if (downvote.classList.contains('active')) {
|
||||
scoretext.classList.add('score-down')
|
||||
scoretext.classList.remove('score-up')
|
||||
scoretext.classList.remove('score')
|
||||
} else {
|
||||
scoretext.classList.add('score')
|
||||
scoretext.classList.remove('score-up')
|
||||
scoretext.classList.remove('score-down')
|
||||
}
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/vote/" + type.replace('-mobile','') + "/" + id + "/" + votedirection, true);
|
||||
var form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
xhr.withCredentials=true;
|
||||
xhr.send(form);
|
||||
}
|
||||
</script>
|
||||
<script src="/assets/js/award_modal.js?v=1"></script>
|
||||
|
||||
<div class="modal fade" id="awardModal" tabindex="-1" role="dialog" aria-labelledby="awardModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered" role="document">
|
||||
|
|
Loading…
Reference in New Issue