From 1099a1ef232efb8c0d0b9d1787c133578fb0b412 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 29 Dec 2017 17:17:21 +0100 Subject: [PATCH] Only re-create the graph if the target race id has changed --- js/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/main.js b/js/main.js index dca3e5e..68f711b 100644 --- a/js/main.js +++ b/js/main.js @@ -7,6 +7,7 @@ var slyelement = { obj: {}, curRaces: {}, + curRaceId: 0, el: '.frame', options: { horizontal: 1, @@ -62,6 +63,8 @@ preprocessor.load(function(data) { ""); $("#courseSelection li").click(function(event) { 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]; $("#lineGraphBox").empty(); createLineGraph("#lineGraphBox", rdata);