Changeset 35114


Ignore:
Timestamp:
2021-04-24T15:05:10+12:00 (3 years ago)
Author:
davidb
Message:

Voting layout now responds to resizing window event

Location:
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js

    r35092 r35114  
    44
    55// The following needs to be kept in sync with the .voting-countries & .voting-points widths in css/eurovision.css
    6 var glob_voting_country_and_points_width = (180+35);
     6var glob_voting_country_and_points_width = (180+35);  
    77
    88
     
    7777
    7878
     79
     80function voting_mode(year)
     81{
     82
     83    var vote_mode = undefined;
     84
     85    if (year>=2013) {
     86    // Separate voting: Jury and Tele
     87        vote_mode = "Separated";
     88    }
     89    else if ((year>=2001) && (year<=2012)) {
     90        vote_mode = "Combined";
     91    }
     92    else {
     93        vote_mode = "Single";
     94    }
     95   
     96    return vote_mode;
     97}
     98
     99
     100function nuanced_voting_type(country,year)
     101{
     102    var vote_type = undefined;
     103
     104    if (year>=2013) {
     105        // Separate voting: Jury and Tele
     106        vote_type = "JT";
     107    }
     108    else if ((year>=2009) && (year<=2012)) {
     109        if (country=="San Marino") {
     110            vote_type = "J";
     111    }
     112        else {
     113            // Combined Jury and Tele
     114            vote_type = "C";
     115    }
     116    }
     117    else if ((year>=2003) && (year<=2008)) {
     118        vote_type = "T";
     119    }
     120    else if (year==2002) {
     121        var jury_list = [ "Bosnia and Herzegovina", "Turkey", "Russia", "FYR Macedonia", "Romania"];
     122        var comb_list = [ "Cyprus", "Greece", "Spain", "Croatia", "Finland", "Malta", "Slovenia", "Lithuania" ];
     123        if (country in jury_list) {
     124            vote_type = "J";
     125    }
     126        else if (country in comb_list) {
     127            vote_type = "C";
     128    }
     129        else {
     130            vote_type = "T";
     131    }
     132    }
     133    else if (year==2001) {
     134        var jury_list = [ "Bosnia and Herzegovina", "Turkey", "Russia" ];
     135        var comb_list = [ "Croatia", "Greece", "Malta" ];
     136        if (country in jury_list) {
     137            vote_type = "J";
     138    }
     139        else if (country in comb_list) {
     140            vote_type = "C";
     141    }
     142        else {
     143            vote_type = "T";
     144    }
     145    }
     146    else if ((year>=1998) && (year<=2000)) {
     147        vote_type = "T";
     148    }
     149    else if (year==1997) {
     150        var tele_list = [ "Austria", "Germany", "Sweeden", "Switzerland", "United Kingdom" ];
     151        if (country in tele_list) {
     152            vote_type = "T";
     153    }
     154        else {
     155            vote_type = "J";
     156    }
     157    }
     158    else {
     159        vote_type = "J";
     160    }
     161
     162    return vote_type;
     163}
     164
     165
     166
    79167function create_array2d(num_cols,num_rows)
    80168{
     
    177265
    178266    var sorted_results_mapping = create_i_to_yx_mapping(num_cols,num_rows,num_countries)
    179 
     267   
    180268    for (var y=0; y<num_rows; y++) {
    181269        for (var x=0; x<num_cols; x++) {
     
    230318        }
    231319       
    232     }
    233 
    234     $('#to-country-votes').append($vote_points_div);
     320        $('#to-country-votes')
     321        .append("<br />");
     322    }
     323
     324    //$('#to-country-votes').append($vote_points_div);
    235325
    236326    }
    237327}
    238328     
     329function append_all_to_country_votes()
     330{
     331    $('#to-country-votes').html("");
     332   
     333    append_to_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal");
     334    append_to_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal");
     335   
     336    append_to_country_votes("Combined Jury & Tele Votes","CombVotesJSON","CombVotesTotal");
     337    append_to_country_votes("Voting Exclusively by Jury","SingVotesJSON","SingVotesTotal");
     338}
    239339
    240340function compare_countries(a,b)
     
    341441            .append($a_to_country);
    342442        }
     443        $('#from-country-votes')
     444        .append("<br />");
    343445    }
    344446    }
     
    346448     
    347449
     450function append_all_from_country_votes()
     451{
     452    $('#from-country-votes').html("");
     453
     454    append_from_country_votes(gs.documentMetadata["FromCountryType"]);
     455}
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl

    r35102 r35114  
    5555        </td>
    5656        <td>
     57          <!--
    5758          <gsf:switch>
    5859        <gsf:metadata name='FromCountryType'/> 
     
    6768        </gsf:otherwise>
    6869          </gsf:switch>
     70
     71          -->
     72
     73          <gsf:switch>
     74        <gsf:metadata name='FromCountryNuancedType'/>   
     75        <gsf:when test="equals" test-value="J">
     76          Jury
     77        </gsf:when>
     78        <gsf:when test="equals" test-value="T">
     79          Televotes
     80        </gsf:when>
     81        <gsf:when test="equals" test-value="C">
     82          Combined Jury and Televotes
     83        </gsf:when>
     84        <gsf:otherwise>
     85
     86          <gsf:switch>
     87            <gsf:metadata name='FromCountryType'/>
     88            <gsf:when test="equals" test-value="J">
     89              Jury
     90            </gsf:when>
     91            <gsf:when test="equals" test-value="T">
     92              Televotes
     93            </gsf:when>
     94            <gsf:otherwise> <!-- JT -->
     95              Separate Jury and Televotes Added Together
     96            </gsf:otherwise>
     97          </gsf:switch>
     98         
     99        </gsf:otherwise>
     100          </gsf:switch>
     101
     102         
    69103        </td>
    70104      </tr>   
     
    148182        </td>
    149183        <td>
     184
     185          <gsf:switch>
     186        <gsf:metadata name='FlagImg'/>
     187        <gsf:when test='exists'>
     188          <span style="padding-right: 6px;"><gsf:metadata name="FlagImg"/></span>
     189        </gsf:when>
     190          </gsf:switch>
     191
    150192          <gsf:metadata name="Country" highlight="highlight" />
     193
    151194        </td>
    152195      </tr>
     
    162205        </td>
    163206        <td>
    164           <gsf:metadata name="Year" highlight="highlight" />
     207          <xsl:variable name="escyear"><gsf:metadata name="Year"/></xsl:variable>
     208          <a target="_blank" href="https://en.wikipedia.org/wiki/Eurovision_Song_Contest_{$escyear}">
     209        Eurovision <gsf:metadata name="Year" highlight="highlight" />
     210        @ Wikipedia
     211        <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAVklEQVR4Xn3PgQkAMQhDUXfqTu7kTtkpd5RA8AInfArtQ2iRXFWT2QedAfttj2FsPIOE1eCOlEuoWWjgzYaB/IkeGOrxXhqB+uA9Bfcm0lAZuh+YIeAD+cAqSz4kCMUAAAAASUVORK5CYII=" alt="external link" />
     212          </a>
    165213        </td>
    166214      </tr>
     
    174222  <xsl:template name="documentContentFromCountry">
    175223    <div id="from-country-votes">
    176       <gsf:script> 
    177     append_from_country_votes(gs.documentMetadata["FromCountryType"]);
     224      <gsf:script>
     225    $(document).ready(function() {
     226      append_all_from_country_votes();
     227    });
     228
     229    window.addEventListener("resize", function() { append_all_from_country_votes() });
    178230      </gsf:script>
    179231    </div>   
     
    201253     
    202254      <gsf:script>
    203     append_to_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal");
    204     append_to_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal");
    205 
    206     append_to_country_votes("Combined Jury &amp; Tele Votes","CombVotesJSON","CombVotesTotal");
    207     append_to_country_votes("Voting Exclusively by Jury","SingVotesJSON","SingVotesTotal");
     255    $(document).ready(function() {
     256      append_all_to_country_votes();
     257    });
     258
     259    window.addEventListener("resize", function() { append_all_to_country_votes() });
    208260      </gsf:script>
    209261
Note: See TracChangeset for help on using the changeset viewer.