From a8a1f8f133aed777680f35ac83180ac4ce713a2c Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sat, 30 Dec 2017 00:02:06 +0100 Subject: [PATCH] Invert year list, select most recent by default --- js/main.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index 2c6f790..19358aa 100644 --- a/js/main.js +++ b/js/main.js @@ -35,12 +35,10 @@ preprocessor.load(function(data) { slyelement.obj = new Sly($(slyelement.el), slyelement.options); slyelement.obj.init(); - // Some sample code for a year selector - TODO: Improve a lot and move somewhere else + // Create list of available years in descending order var yearSelector = $("#seasonByYearSelector"); - var seasons = processor.getSeasonsWithLapData(); - - for(var season in seasons){ yearSelector.append(""); } + for(var season in seasons){ yearSelector.prepend(""); } // Someone chose a year yearSelector.change(function(event) { @@ -106,6 +104,7 @@ preprocessor.load(function(data) { } }); - $("#seasonByYearSelector").trigger("change"); + // Select most recent year by default + $("#seasonByYearSelector").val($("#seasonByYearSelector option").first().val()).change(); });