"use strict";
/*
* This file contains the main control flow.
*/
var slyelement = {
obj: {},
curRaces: {},
curRaceId: 0,
el: '.frame',
options: {
horizontal: 1,
itemNav: 'basic',
smart: 1,
//activateOn: 'click',
//activatePageOn: 'click',
mouseDragging: 0,
touchDragging: 1,
releaseSwing: 0,
startAt: 3,
scrollBar: $('.strecken-selector').parent().find('.scrollbar'),
scrollBy: 1,
pagesBar: $('.strecken-selector').parent().find('.pages'),
speed: 300,
elasticBounds: 1,
dragHandle: 1,
dynamicHandle: 1,
clickBar: 1,
}
};
preprocessor.load(function(data) {
slyelement.obj = new Sly($(slyelement.el), slyelement.options);
slyelement.obj.init();
// Create list of available years in descending order
var yearSelector = $("#seasonByYearSelector");
var seasons = processor.getSeasonsWithLapData();
for(var season in seasons){ yearSelector.prepend(""); }
// Someone chose a year
yearSelector.change(function(event) {
var selectedYear = $(event.target).val();
slyelement.curRaces = processor.getRacesByYear(selectedYear);
// Empty the course selector
$("#courseSelection").empty();
// ... and fill it with fresh races to choose from
for(var race in slyelement.curRaces) {
var raceD = slyelement.curRaces[race];
$("#courseSelection").append("