Select current day tab by default
On the room tables, preselect the tabs corresponding to the current day, rather than always Monday. If the day doesn't exist, find the first available day tab and select those. Change-Id: I3c0bc58f35cd39a8c5291d1d6da4547283479e2d
This commit is contained in:
parent
c637840754
commit
750bcebbd4
19
html/ptg.js
19
html/ptg.js
@ -18,9 +18,22 @@ Handlebars.registerHelper('hashtag', function(options) {
|
||||
return new Handlebars.SafeString(sentence);
|
||||
});
|
||||
|
||||
// What is the day today ?
|
||||
var now = new Date();
|
||||
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
|
||||
var day = days[ now.getDay() ];
|
||||
|
||||
$.getJSON("ptg.json", function(json) {
|
||||
console.log(json);
|
||||
document.getElementById("PTGsessions").innerHTML = template(json);
|
||||
$('#stMonday').tab('show');
|
||||
$('#atMonday').tab('show');
|
||||
// if the current day doesn't exist, default to first existing one
|
||||
if ($('#st'+day).length == 0) {
|
||||
for (var i = 0; i < days.length; i++) {
|
||||
if ($('#st'+days[i]).length) {
|
||||
day = days[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#st'+day).tab('show');
|
||||
$('#at'+day).tab('show');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user