Browse Source

timeline: set weekday css class on high zoom levels; fixes #2014;

code cleanup;
codeClimate
Alexander Wunschik 8 years ago
parent
commit
29f2d98d30
1 changed files with 24 additions and 14 deletions
  1. +24
    -14
      lib/timeline/TimeStep.js

+ 24
- 14
lib/timeline/TimeStep.js View File

@ -588,37 +588,47 @@ TimeStep.prototype.getClassName = function() {
switch (this.scale) { switch (this.scale) {
case 'millisecond': case 'millisecond':
return even(current.milliseconds()).trim();
return today(current) +
even(current.milliseconds()).trim();
case 'second': case 'second':
return even(current.seconds()).trim();
return today(current) +
even(current.seconds()).trim();
case 'minute': case 'minute':
return even(current.minutes()).trim();
return today(current) +
even(current.minutes()).trim();
case 'hour': 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': case 'weekday':
return 'vis-' + current.format('dddd').toLowerCase() + return 'vis-' + current.format('dddd').toLowerCase() +
today(current) + currentWeek(current) + even(current.date());
today(current) +
currentWeek(current) +
even(current.date());
case 'day': 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': case 'month':
return 'vis-' + current.format('MMMM').toLowerCase() + return 'vis-' + current.format('MMMM').toLowerCase() +
currentMonth(current) + even(current.month());
currentMonth(current) +
even(current.month());
case 'year': case 'year':
var year = current.year(); var year = current.year();
return 'vis-year' + year + currentYear(current)+ even(year);
return 'vis-year' + year +
currentYear(current) +
even(year);
default: default:
return ''; return '';

Loading…
Cancel
Save