diff options
Diffstat (limited to 'http/src')
-rw-r--r-- | http/src/js/pages.magazine.js | 137 |
1 files changed, 73 insertions, 64 deletions
diff --git a/http/src/js/pages.magazine.js b/http/src/js/pages.magazine.js index f5769e2..f413c51 100644 --- a/http/src/js/pages.magazine.js +++ b/http/src/js/pages.magazine.js @@ -30,10 +30,10 @@ epgd.pages.magazine = { }; }); }, - initQT: function () {
- var qt = {};
- epgd.profile.quickTimes.replace(/=([0-9]{1,2}):([0-9]{1,2})/g, function (a, h, m) {
- qt[parseInt(h,10)] = '<p' + (m ? ' style="margin-top:' + (m * 2) + 'px"' : '') + '> </p>';
+ initQT: function () { + var qt = {}; + epgd.profile.quickTimes.replace(/=([0-9]{1,2}):([0-9]{1,2})/g, function (a, h, m) { + qt[parseInt(h,10)] = '<p' + (m ? ' style="margin-top:' + (m * 2) + 'px"' : '') + '> </p>'; }); this.qt= qt; }, @@ -99,8 +99,8 @@ epgd.pages.magazine = { epgd.$menu.parent().offset({ 'left': l }); this.pages_magazine.$nav.offset({ 'left': l }); return false; - })
- .bind("datepicker.pages_magazine", function () {
+ }) + .bind("datepicker.pages_magazine", function () { this.pages_magazine.setTime(epgd.utils.unixTime(epgd.$dtPicker.datetimepicker('getDate') || epgd.utils.now()), true); })[0].pages_magazine = this; @@ -176,13 +176,13 @@ epgd.pages.magazine = { this._initWinBindings(); epgd.$con.empty(); this.$nav.appendTo(epgd.$con).bind("click", this.actionHead); - this.$head.appendTo(epgd.$con).bind('click', function (ev) {
+ this.$head.appendTo(epgd.$con).bind('click', function (ev) { if (ev.target.className == 'i-tv') - epgd.vdrs.current.switchChannel(ev.target.parentNode.id);
+ epgd.vdrs.current.switchChannel(ev.target.parentNode.id); }); this.$con.appendTo(epgd.$con).bind("click", this.actionCon).bind("touchend",this.actionConOpen); - if (!$.support.touch && epgd.profile.magazinePan > 0)
- this._pan();
+ if (!$.support.touch && epgd.profile.magazinePan > 0) + this._pan(); } $(window).trigger("resize.pages_magazine"); if (channel) @@ -193,37 +193,46 @@ epgd.pages.magazine = { $(window).trigger("resize.pages_magazine"); }, _pan: function(){ - var pan = false,
- tp = $('<div style="width:90%; height:35px; margin-top:15px; position:fixed;z-index:99;left:5%"></div>').prependTo(epgd.$con)[0],
- bot = $('<div style="width:90%; height:35px; position:fixed;z-index:99;bottom:0;left:5%"></div>').appendTo(epgd.$con)[0];
- this.timeLineL.pan = -1;
- this.timeLineR.pan = 1;
- tp.pan = epgd.profile.magazinePan * -30;
- bot.pan = epgd.profile.magazinePan * 30;
-
- window.tp = tp;
- window.bp = bot;
- window.p = pan;
- $([this.timeLineL, this.timeLineR, tp, bot]).mouseover(function (ev) {
- if (pan) return;
- pan = this.pan;
- window.setTimeout(function () {
- if (pan) {
- var checkPan = window.setInterval(function () {
- if (!pan || !window.pages_magazine)
- return window.clearInterval(checkPan);
- if (pan < -1 || pan > 1)
- window.pages_magazine.setTime((window.pages_magazine.$con.scrollTop() + 15) * 30 + epgd.profile.minEventTime + pan, true);
- else
- window.pages_magazine.setMain(pan);
- }, (pan < -1 || pan > 1 ? 100 : 1200));
- }
- }, epgd.profile.magazinePanDelay);
- }).mouseout(function () {
- pan = false;
- });
+ var pan = false, + tp = $('<div style="width:90%; height:35px; margin-top:15px; position:fixed;z-index:99;left:5%"></div>').prependTo(epgd.$con)[0], + bot = $('<div style="width:90%; height:35px; position:fixed;z-index:99;bottom:0;left:5%"></div>').appendTo(epgd.$con)[0]; + this.timeLineL.pan = -1; + this.timeLineR.pan = 1; + tp.pan = epgd.profile.magazinePan * -30; + bot.pan = epgd.profile.magazinePan * 30; + + window.tp = tp; + window.bp = bot; + window.p = pan; + $([this.timeLineL, this.timeLineR, tp, bot]).mouseover(function (ev) { + if (pan) return; + pan = this.pan; + window.setTimeout(function () { + if (pan) { + var checkPan = window.setInterval(function () { + if (!pan || !window.pages_magazine) + return window.clearInterval(checkPan); + if (pan < -1 || pan > 1) + window.pages_magazine.setTime((window.pages_magazine.$con.scrollTop() + 15) * 30 + epgd.profile.minEventTime + pan, true); + else + window.pages_magazine.setMain(pan); + }, (pan < -1 || pan > 1 ? 100 : 1200)); + } + }, epgd.profile.magazinePanDelay); + }).mouseout(function () { + pan = false; + }); + }, + setChannel: function (channel) { + if (this.list.lengt > 0) + this.setMain(0, this.list[channel].index); + else{ + var self= this; + $(window).one("resize.pages_magazine",function(){ + self.setMain(0, self.list[channel].index); + }) + } }, - setChannel: function (channel) { this.setMain(0, this.list[channel].index); }, setMain: function (delta, baseIndex, dontScroll) { var optList = this.select, i = isNaN(baseIndex) ? optList.selectedIndex : baseIndex; @@ -273,12 +282,12 @@ epgd.pages.magazine = { this.scrollEnd = (this.endTime - epgd.profile.minEventTime - 43200) / 30; // 60 * 60 *12 } insHtml && this.update(); - doScroll && this.$con.scrollTop((start - epgd.profile.minEventTime) / 30 - 15);
+ doScroll && this.$con.scrollTop((start - epgd.profile.minEventTime) / 30 - 15); }, actionHead: function (ev) { var self = epgd.pages.magazine, c; - if (ev.target.nodeName == 'SPAN') {
+ if (ev.target.nodeName == 'SPAN') { c = ev.target.className; if (c.indexOf('i-left-dir') > -1) self.setMain(-1); @@ -287,7 +296,7 @@ epgd.pages.magazine = { else if (c.indexOf('i-right-dir') > -1) self.setMain(1); else if (c.indexOf('i-forward') > -1) - self.setMain(self.viewCnt);
+ self.setMain(self.viewCnt); } }, actionConOpen: function (ev) { @@ -355,26 +364,26 @@ epgd.pages.magazine.channel.prototype = { $col = $(self.col), desc,h,d, eTime; - if (first) {
- if (insAfter) {
- $dt = $col.find('dt:last');
- eTime = $dt[0].eTime;
+ if (first) { + if (insAfter) { + $dt = $col.find('dt:last'); + eTime = $dt[0].eTime; if ($dt.attr('title') == first.id) - delete data.events[0];
- } else {
- eTime = first.starttime;
- $dt = $col.find('dt:first');
+ delete data.events[0]; + } else { + eTime = first.starttime; + $dt = $col.find('dt:first'); if ($dt.attr('title') == data.events[data.events.length - 1].id) - delete data.events[data.events.length-1];
- }
- for (i = 0; i < data.events.length; i++) {
- event = data.events[i];
+ delete data.events[data.events.length-1]; + } + for (i = 0; i < data.events.length; i++) { + event = data.events[i]; desc = event.shortdescription || event.shorttext; h = event.duration; d = parseInt(h / 60, 10);/*, fav = epgd.profile.fav ? ';border-color:' + epgd.profile.fav(event) : ''*/; h += (event.starttime - eTime); - h = h < 600 ? 20 : parseInt(h / 30, 10); // 20px = 10 Minuten
+ h = h < 600 ? 20 : parseInt(h / 30, 10); // 20px = 10 Minuten eTime += h * 30; insHtml += '<dt title="' + event.id + '" style="height:' + h + 'px;min-height:' + h + 'px">' //' + fav + ' + '<div class="title">' + event.title + '</div>' @@ -383,8 +392,8 @@ epgd.pages.magazine.channel.prototype = { + (event.numrating ? '<span class="rate rate' + event.numrating + '"> </span>' : '') + (event.tipp ? '<b class="tipp">' + event.tipp + '</b>' : '') + '<div class="desc">' + (event.genre ? '<span>' + event.genre + '</span> ' : '') + (desc ? desc.replace(/\n/g, '<br />') : '') - + '</div></dt>';
- };
+ + '</div></dt>'; + }; } else { h = (endTime - startTime) / 30; insHtml = '<div style="height:' + h + 'px;min-height:' + h + 'px"></div>'; @@ -396,13 +405,13 @@ epgd.pages.magazine.channel.prototype = { $col.find('dt:last')[0].eTime = eTime; } else { $col.prepend(insHtml); - if ($dt && $dt.length) {
- $dt.css('margin-top', '');
+ if ($dt && $dt.length) { + $dt.css('margin-top', ''); h = $dt[0].starttime - eTime; - if (h) {
- h = parseInt(h/30,10) + parseInt($dt.css('min-height'), 10);
- $dt.css({ "height": h + 'px', "min-height": h + 'px' })
- }
+ if (h) { + h = parseInt(h/30,10) + parseInt($dt.css('min-height'), 10); + $dt.css({ "height": h + 'px', "min-height": h + 'px' }) + } } else $col.find('dt:last')[0].eTime = eTime; $col.find('dt:first').css('margin-top', parseInt((first.starttime - startTime) / 30, 10))[0].starttime= first; |