forked from stasm/timeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
186 lines (161 loc) · 6.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!doctype html>
<html>
<head>
<title>Mozilla localization calendar</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="main.css" />
<script src="http://api.simile-widgets.org/timeline/2.3.1/timeline-api.js?bundle=true"
type="text/javascript"></script>
<script type="text/javascript" src="filter.js"></script>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery.icalendar.js"></script>
<script type="text/javascript" src="projects-holder.js"></script>
<script type="text/javascript">
const ONEDAY = 1000 * 60 * 60 * 24;
var tl;
function convert(ical_obj) { // {{{
var source = {
'events' : [],
};
var events = ical_obj.vevent;
for (var i=0, ev; ev = events[i]; i++) {
var summary = ev.summary.split(' ');
var event = {
'start': ev.dtstart._value,
'end': ev.dtend._value,
'durationEvent': ev.dtstart._value.getTime() + ONEDAY !=
ev.dtend._value.getTime(),
'classname': summary.shift().toLowerCase(),
'title': summary.join(' '),
};
event.description = 'Project: ' + projects[event.classname];
source.events.push(event);
}
return source;
} // }}}
function onLoad() { // {{{
var theme = Timeline.ClassicTheme.create();
theme.firstDayOfWeek = 1;
theme.event.bubble.width = 350;
theme.event.bubble.height = 300;
theme.event.track.height = 30;
theme.event.tape.height = 20;
theme.event.overviewTrack.gap = 1;
theme.event.overviewTrack.offset = 30;
theme.event.overviewTrack.height = 10;
theme.event.overviewTrack.tickHeight = 10;
theme.ether.interval.weekend.opacity = 50;
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
eventSource: eventSource,
date: new Date(Date.now() + ONEDAY * 7),
width: "80%",
intervalUnit: Timeline.DateTime.WEEK,
intervalPixels: 300,
theme: theme,
}),
Timeline.createBandInfo({
overview: true,
eventSource: eventSource,
width: "20%",
intervalUnit: Timeline.DateTime.MONTH,
intervalPixels: 500,
theme: theme,
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
bandInfos[1].eventPainter.paintDurationEvent = function(evt, metrics, theme, highlightIndex) {
var latestStartDate = evt.getLatestStart();
var earliestEndDate = evt.getEarliestEnd();
var latestStartPixel = Math.round(this._band.dateToPixelOffset(latestStartDate));
var earliestEndPixel = Math.round(this._band.dateToPixelOffset(earliestEndDate));
var tapeTrack = 0;
for (; tapeTrack < this._tracks.length; tapeTrack++) {
if (earliestEndPixel < this._tracks[tapeTrack]) {
break;
}
}
this._tracks[tapeTrack] = latestStartPixel;
var color = evt.getColor(),
klassName = evt.getClassName();
if (klassName) {
color = null;
} else {
color = color != null ? color : theme.event.duration.color;
}
var tapeElmtData = this._paintEventTape(evt, tapeTrack, latestStartPixel, earliestEndPixel,
color, 100, metrics, theme, klassName);
this._createHighlightDiv(highlightIndex, tapeElmtData, theme);
};
var now = new Date(Date.now());
var today = [
now.getFullYear(),
now.getMonth(),
now.getDate(),
]
for (var i = 0; i < bandInfos.length; i++) {
bandInfos[i].decorators = [
new Timeline.SpanHighlightDecorator({
startDate: new Date(today[0], today[1], today[2]),
endDate: new Date(today[0], today[1], today[2] + 1),
color: "#FFC080",
opacity: 50,
startLabel: "today",
theme: theme
}),
];
}
tl = Timeline.create(document.getElementById("timeline"), bandInfos);
$.get('proxy.php', function(data) {
var ical_obj = $.icalendar.parse(data);
var simile_obj = convert(ical_obj);
eventSource.loadJSON(simile_obj,
'http://l10n.mozilla.org/~milos/l10n-calendar/');
getFilter();
});
setupFilterHighlightControls($("#controls")[0], tl, [0,1], theme);
} // }}}
var resizeTimerID = null; // {{{
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
} // }}}
function getFilter() { // {{{
$('#filter').val(location.hash.substring(1));
performFiltering(tl, [0,1]);
} // }}}
</script>
</head>
<body onload="onLoad();" onresize="onResize();" onhashchange="getFilter();">
<h1>Localization calendar timeline</h1>
<div class="controls" id="controls">
<div>
<input type="text" id="filter"/>
<button id="clear"/>
</div>
<div id="help">
e.g. <a href="#localization">localization</a>,
<a href="#freeze">freeze</a>,
<a href="#launch">launch</a>,
<a href="#desktop">release</a>
</div>
</div>
<div id="timeline"></div>
<noscript>
This page uses Javascript to show you the Mozilla's calendar for
localization projects. Please enable Javascript in your browser to
see the full page. Thank you.
</noscript>
<div id="footnotes">
You can download the <a href="https://mail.mozilla.com/home/smalolepszy@mozilla.com/timeline">ICS</a> file, or view it in <a href="https://mail.mozilla.com/home/smalolepszy@mozilla.com/timeline.html">HTML</a>, too.
</div>
</body>
</html>
<!-- vim: set fdm=marker nowrap: -->