More preparations to place race infos later

This commit is contained in:
Jan Philipp Timme 2017-12-30 00:35:25 +01:00
parent 6b315b3b2b
commit 7d7f35d3ca
2 changed files with 9 additions and 5 deletions

View File

@ -77,7 +77,7 @@
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body" id="race-infobox">
TODO: Put diagram details here. TODO: Put diagram details here.
</div> <!-- card-body --> </div> <!-- card-body -->

View File

@ -54,15 +54,19 @@ preprocessor.load(function(data) {
"<div class=\"courseimagecontainer\"></div>" + raceD.raceInfo.date.toLocaleDateString("de-DE") + "</li>"); "<div class=\"courseimagecontainer\"></div>" + raceD.raceInfo.date.toLocaleDateString("de-DE") + "</li>");
$("#courseSelection li").click(function(event) { $("#courseSelection li").click(function(event) {
var raceI = event.currentTarget.attributes.data.value;
// Internal check if element was already selected
if(slyelement.curRaceId == raceI){ return true; }
slyelement.curRaceId = raceI;
// Clear previously selected courses // Clear previously selected courses
$("#courseSelection .selected").removeClass("selected"); $("#courseSelection .selected").removeClass("selected");
// Mark selected course // Mark selected course
$(event.currentTarget).addClass("selected"); $(event.currentTarget).addClass("selected");
// Hand off to diagram rendering // Fetch race data
var raceI = event.currentTarget.attributes.data.value;
if(slyelement.curRaceId == raceI){ return; }
slyelement.curRaceId = raceI;
var rdata = slyelement.curRaces.filter(r => r.raceInfo.raceId == raceI)[0]; var rdata = slyelement.curRaces.filter(r => r.raceInfo.raceId == raceI)[0];
// Put information about race into info box
$("#race-infobox").html("joah");
// Hand off to diagram rendering
$("#lineGraphBox").empty(); $("#lineGraphBox").empty();
createLineGraph("#lineGraphBox", rdata); createLineGraph("#lineGraphBox", rdata);
}); });