/*##########################################################################*/ /* Utility functions */ /*##########################################################################*/ function W(s) { document.write(s); } function Div(x, y) { return (x - x % y) / y; } function Translation(_now, _o_clock, _to, _sunday, _monday, _tuesday, _wednesday, _thursday, _friday, _saturday) { this.now = _now; this.o_clock = _o_clock; this.to = _to; this.week_day = new Array(_sunday, _monday, _tuesday, _wednesday, _thursday, _friday, _saturday); } function ChannelInfo(vdr_id, name, url, events) { this.vdr_id = vdr_id; this.name = name; this.url = url; this.events = events; } function EPGEvent(epg_id, start_sec, stop_sec, title, timer, summary) { this.epg_id = epg_id; this.start_sec = start_sec; this.stop_sec = stop_sec; this.start_str = format_date('%H:%M', start_sec); this.stop_str = format_date('%H:%M', stop_sec); this.title = title; this.timer = timer; this.summary = summary; } function format_date(fmt, time) { var date = new Date(time * 1000); switch (fmt) { case "%H:%M": { var h = '0' + date.getHours(); var m = '0' + date.getMinutes(); return h.substr(h.length-2, 2) + ':' + m.substr(m.length-2, 2); } case "%A, %H:%M": { var d = trans.week_day[date.getDay()]; var h = '0' + date.getHours(); var m = '0' + date.getMinutes(); return d + ", " + h.substr(h.length-2, 2) + ':' + m.substr(m.length-2, 2); } } return "[WRONG_FMT:" + fmt + "]"; } function TimeLine(_req_sec, _now_url, _px_per_min, _end_min) { this.now_url = _now_url; this.name_w = 100; var tab = document.getElementById("heading"); if (tab) { this.table_w = tab.clientWidth; } else { this.table_w = this.innerWidth - 8; } this.px_per_min = _px_per_min; this.end_min = Div(this.table_w - this.name_w, this.px_per_min); if (this.end_min > _end_min) { this.end_min = _end_min; } this.end_min -= this.end_min % 30; this.event_w = this.end_min * this.px_per_min; this.name_w = this.table_w - this.event_w; this.min5_h = 10; var d = new Date(); this.now_sec = Div(d.getTime(), 1000); this.req_sec = _req_sec; this.start_sec = _req_sec - _req_sec % 1800; this.end_sec = this.start_sec + this.end_min * 60; this.first_sec = this.now_sec + 1799 - this.end_min * 60; this.first_sec -= this.first_sec % 1800; this.last_sec = this.first_sec + 86400; } /*##########################################################################*/ /* Build the HTML code */ /*##########################################################################*/ function BuildContent() { W('
![]() | ');
for (var min = 0; min < tl.end_min; min += 30)
{
var c = min % 60 ? 'color1' : 'color2';
var w = tl.px_per_min * (tl.end_min - min < 30) ? tl.end_min - min : 30;
var t = tl.start_sec + min * 60;
W('');
W('![]() '); W('' + format_date('%H:%M', t) + ''); W(' | ');
}
W('|||||
![]() | ');
for (var min = 0; min < tl.end_min; min += 5)
{
var c = min % 10 ? 'color1' : 'color2';
var w = tl.px_per_min * 5;
W('');
W('![]() '); W(' | ');
}
W('
');
W('![]() '); W(' ![]() | ');
W('
');
W('![]() '); W(' | ');
W('