fix pagevote score not true
This commit is contained in:
parent
7174fc1066
commit
03db2db899
1 changed files with 14 additions and 10 deletions
|
@ -41,12 +41,14 @@
|
||||||
if ($votes.downvote.hasClass('voted')) {
|
if ($votes.downvote.hasClass('voted')) {
|
||||||
delta = 2;
|
delta = 2;
|
||||||
}
|
}
|
||||||
ajax_vote('{{ url('pagevote_upvote') }}', id, delta, function () {
|
for (let i = 0; i < delta; i++) {
|
||||||
|
ajax_vote('{{ url('pagevote_upvote') }}', id, 1, function () {
|
||||||
if ($votes.downvote.hasClass('voted'))
|
if ($votes.downvote.hasClass('voted'))
|
||||||
$votes.downvote.removeClass('voted');
|
$votes.downvote.removeClass('voted');
|
||||||
$votes.upvote.addClass('voted');
|
$votes.upvote.addClass('voted');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.pagevote_downvote = function (id) {
|
window.pagevote_downvote = function (id) {
|
||||||
|
@ -61,12 +63,14 @@
|
||||||
if ($votes.upvote.hasClass('voted')) {
|
if ($votes.upvote.hasClass('voted')) {
|
||||||
delta = -2;
|
delta = -2;
|
||||||
}
|
}
|
||||||
ajax_vote('{{ url('pagevote_downvote') }}', id, delta, function () {
|
for (let i = 0; i > delta; i--) {
|
||||||
|
ajax_vote('{{ url('pagevote_downvote') }}', id, -1, function () {
|
||||||
if ($votes.upvote.hasClass('voted'))
|
if ($votes.upvote.hasClass('voted'))
|
||||||
$votes.upvote.removeClass('voted');
|
$votes.upvote.removeClass('voted');
|
||||||
$votes.downvote.addClass('voted');
|
$votes.downvote.addClass('voted');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue