1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 01:06:48 +02:00

[ticket/12363] Mark winning (most votes) results bar

PHPBB3-12363
This commit is contained in:
PayBas
2014-04-06 16:43:25 +02:00
parent 0e88f0db4a
commit 3384e87b6f
4 changed files with 6 additions and 2 deletions

View File

@@ -244,10 +244,12 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var option = $(this);
var option_id = option.attr('data-poll-option-id');
var voted = (typeof res.user_votes[option_id] !== 'undefined') ? true : false;
var winner = (res.vote_counts[option_id] == most_votes) ? true : false;
var percent = (!res.total_votes) ? 0 : Math.round((res.vote_counts[option_id] / res.total_votes) * 100);
var percent_rel = (most_votes == 0) ? 0 : Math.round((res.vote_counts[option_id] / most_votes) * 100);
option.toggleClass('voted', voted);
option.toggleClass('winner', winner);
// Update the bars
var bar = option.find('.resultbar div');