Skip to content

Commit 0317869

Browse files
committed
Cleaned up code
1 parent fd7bf4f commit 0317869

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

source/javascripts/main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
//= require_tree .
22

3-
/* global console, Lib */
3+
/* global Lib, Timeline */
44

55
(function(){
66
'use strict';
77

88
Lib.ready(function() {
9-
new Timeline("timeline", [
9+
/* jshint -W031 */
10+
new Timeline('timeline', [
1011
['2002', '05/2007', 'Lorem ipsum dolor sit amet #1', 'lorem'],
1112
['2002', '06/2006', 'Lorem ipsum dolor sit amet #2', 'lorem'],
1213
['05/2004', '07/2004', 'Lorem ipsum dolor sit amet #3', 'ipsum'],
1314
['06/2007', 'Lorem ipsum dolor sit amet #4'],
1415
['11/2007', '03/2009', 'Lorem ipsum dolor sit amet #5', 'dolor'],
1516
['07/2008', '07/2009', 'Lorem ipsum dolor sit amet #6', 'lorem'],
1617
['01/2009', '03/2012', 'Lorem ipsum dolor sit amet #7', 'sit'],
17-
['2010', '10/2011', 'Lorem ipsum dolor sit amet #8', 'ipsum'],
18+
['2010', '10/2011', 'Lorem ipsum dolor sit amet #8', 'ipsum']
1819
]);
1920

2021
});

source/javascripts/timesheet.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@
2525
var html = [];
2626

2727
for (var n = 0, m = this.data.length; n < m; n++) {
28-
var lne = [];
2928
var cur = this.data[n];
3029

31-
console.log(cur)
32-
33-
var line = '<span class="bubble bubble-' + (cur.type || 'default') + '" data-duration="' + (cur.end ? Math.round((cur.end-cur.start)/1000/60/60/24/39) : '') + '"></span>'
34-
+ '<span class="date">'
35-
+ (cur.start.hasMonth ? this.formatMonth(cur.start.getMonth() + 1) + '/' : '' ) + cur.start.getFullYear()
36-
+ (cur.end ? '-' + ((cur.end.hasMonth ? this.formatMonth(cur.end.getMonth() + 1) + '/' : '' ) + cur.end.getFullYear()) : '')
37-
+ '</span> '
38-
+ '<span class="label">'
39-
+ cur.label
40-
+ '</span>';
30+
var line = [
31+
'<span class="bubble bubble-' + (cur.type || 'default') + '" data-duration="' + (cur.end ? Math.round((cur.end-cur.start)/1000/60/60/24/39) : '') + '"></span>',
32+
'<span class="date">',
33+
(cur.start.hasMonth ? this.formatMonth(cur.start.getMonth() + 1) + '/' : '' ) + cur.start.getFullYear(),
34+
(cur.end ? '-' + ((cur.end.hasMonth ? this.formatMonth(cur.end.getMonth() + 1) + '/' : '' ) + cur.end.getFullYear()) : ''),
35+
'</span> ',
36+
'<span class="label">',
37+
cur.label,
38+
'</span>'
39+
];
4140

4241
html.push('<li>' + line + '</li>');
4342
}
@@ -74,7 +73,7 @@
7473
var beg = this.parseDate(data[n][0]);
7574
var end = data[n].length === 4 ? this.parseDate(data[n][1]) : null;
7675
var lbl = data[n][2] || data[n][1];
77-
var cat = data[n][3] || 'default'
76+
var cat = data[n][3] || 'default';
7877

7978
if (beg.getFullYear() < this.year.min) {
8079
this.year.min = beg.getFullYear();
@@ -88,7 +87,7 @@
8887

8988
this.data.push({start: beg, end: end, label: lbl, type: cat});
9089
}
91-
}
90+
};
9291

9392
window.Timeline = Timeline;
9493
})();

0 commit comments

Comments
 (0)