source: main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js@ 34893

Last change on this file since 34893 was 34893, checked in by davidb, 3 years ago

Voting totals added in

File size: 1.1 KB
Line 
1
2function append_from_country_votes(vote_label, votes_json_type, votes_type_total)
3{
4 // TODO
5 // Figure out why "United Kingdom-J" and not "UnitedKingdom-J"
6
7 if (gs.documentMetadata[votes_json_type]) {
8 var $vote_div = $('<div>').attr("class","voting-label").append(vote_label);
9 $vote_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")");
10 $('#from-country-votes').append($vote_div);
11
12 var JuryVotesJSON = eval(gs.documentMetadata[votes_json_type]);
13 var num_countries = JuryVotesJSON.length;
14
15 for (var i=0; i<num_countries; i++) {
16 var from_country = JuryVotesJSON[i];
17 var from_country_points = gs.documentMetadata[from_country];
18
19 if (typeof from_country_points !== 'undefined') {
20 var pp_from_country = from_country.replace(/-(T|J)$/,"");
21
22 var $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":");
23 var $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points);
24
25 $('#from-country-votes')
26 .append($from_country_name)
27 .append($from_country_points);
28 }
29 }
30 }
31}
32
Note: See TracBrowser for help on using the repository browser.