From 29f2d98d304da64d71ea0f4eb5706cc58098c5a9 Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sun, 14 Aug 2016 23:35:31 +0200 Subject: [PATCH] timeline: set weekday css class on high zoom levels; fixes #2014; code cleanup; --- lib/timeline/TimeStep.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/timeline/TimeStep.js b/lib/timeline/TimeStep.js index f01aaefc..c5a9bfc2 100644 --- a/lib/timeline/TimeStep.js +++ b/lib/timeline/TimeStep.js @@ -588,37 +588,47 @@ TimeStep.prototype.getClassName = function() { switch (this.scale) { case 'millisecond': - return even(current.milliseconds()).trim(); + return today(current) + + even(current.milliseconds()).trim(); case 'second': - return even(current.seconds()).trim(); + return today(current) + + even(current.seconds()).trim(); case 'minute': - return even(current.minutes()).trim(); + return today(current) + + even(current.minutes()).trim(); case 'hour': - var hours = current.hours(); - if (this.step == 4) { - hours = hours + '-h' + (hours + 4); - } - return 'vis-h' + hours + today(current) + even(current.hours()); + return 'vis-h' + current.hours() + (this.step == 4 ? '-h' + (current.hours() + 4) : '') + + today(current) + + even(current.hours()); case 'weekday': return 'vis-' + current.format('dddd').toLowerCase() + - today(current) + currentWeek(current) + even(current.date()); + today(current) + + currentWeek(current) + + even(current.date()); case 'day': - var day = current.date(); - var month = current.format('MMMM').toLowerCase(); - return 'vis-day' + day + ' vis-' + month + currentMonth(current) + even(day - 1) + (this.step <= 2 ? today(current) +' vis-' + current.format('dddd').toLowerCase() : ''); + return 'vis-day' + current.date() + + ' vis-' + current.format('MMMM').toLowerCase() + + today(current) + + currentMonth(current) + + this.step <= 2 ? today(current) : '' + + this.step <= 2 ? ' vis-' + current.format('dddd').toLowerCase() : '' + + even(current.date() - 1); case 'month': return 'vis-' + current.format('MMMM').toLowerCase() + - currentMonth(current) + even(current.month()); + currentMonth(current) + + even(current.month()); case 'year': var year = current.year(); - return 'vis-year' + year + currentYear(current)+ even(year); + return 'vis-year' + year + + currentYear(current) + + even(year); default: return '';