summaryrefslogtreecommitdiff
path: root/js/istreamdev.js
diff options
context:
space:
mode:
authorAlib <aliboba@free.fr>2010-03-25 15:53:12 +0100
committerAlib <aliboba@free.fr>2010-03-25 15:53:12 +0100
commit33b554b18a52991dff6d095158002aee8290e1b0 (patch)
tree89777c57ac92ee4d7ead3303cf48a0456e0d1ad4 /js/istreamdev.js
parent84042aa476d9a89f5e96fec39e41f5eea93aa8d7 (diff)
downloadistreamdev-33b554b18a52991dff6d095158002aee8290e1b0.tar.gz
istreamdev-33b554b18a52991dff6d095158002aee8290e1b0.tar.bz2
epg works
Diffstat (limited to 'js/istreamdev.js')
-rw-r--r--js/istreamdev.js115
1 files changed, 71 insertions, 44 deletions
diff --git a/js/istreamdev.js b/js/istreamdev.js
index 565ae69..5307b28 100644
--- a/js/istreamdev.js
+++ b/js/istreamdev.js
@@ -966,7 +966,7 @@ function showStatus( timeout, message ) {
// [/TIMER SECTION]
// [EPG SECTION]
-//buttons
+//buttons & events
$('.submit_epg').tap(function(event) {
event.preventDefault();
json_start(this);
@@ -992,6 +992,7 @@ get_epg("all","now","0","2");
});
+
//functions
function gen_epgmenu() {
gen_epgchanlist();
@@ -1032,59 +1033,85 @@ var dayname = new Array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
}
function get_epg(channel,time,day,programs) {
-$('#epglist #ul_epglist').html('');
var dataString = 'action=getEpg&channel=' + channel + '&time=' + time + '&day=' + day + '&programs=' + programs;
$.getJSON("bin/backend.php",
dataString,
function(data) {
$('#jqt').data("epg",data);
- $('#epglist #epg_selector').html('');
- if ( data.category.length > 1 )
- {
- $('#epglist #epg_selector').append('<select id="epglist_cat"></select>');
- $.each(data.category, function(i,category){
- $('#epglist #epg_selector #epglist_cat').append('<option value="' + i + '">' + category.name + '</option>');
- });
+ if ( data.category.length > 1 ) {
+ type = 'cat';
+ } else {
+ type = 'chan';
}
- else {
- $('#epglist #epg_selector').append('<select id="epglist_chan"></select>');
- data = $('#jqt').data('channellist');
- $.each(data.category, function(i,category){
- $('#epglist #epg_selector #epglist_chan').append('<optgroup label="' + category.name + '">');
- var catname = category.name;
- $.each(category.channel, function(j, channel){
- $('#epglist #epg_selector #epglist_chan optgroup[label="' + catname +'"]').append('<option value="' + channel.number + '">' + channel.name +'</option>');
- });
- $('#epg_chan').append('</optgroup>');
+ parse_epg(data,0,type);
+ $('#epglist li[rel="toggle"]').hide();
+ json_complete('#epglist','cube');
+ });
+}
+
+function parse_epg(data,selectedvalue,type){
+ $('#epglist #epg_selector').html('');
+ $('#epglist #ul_epglist').html('');
+ if ( data.category.length > 1 )
+ {
+ $('#epglist #epg_selector').append('<select id="epglist_cat"></select>');
+ $.each(data.category, function(i,category){
+ $('#epglist #epg_selector #epglist_cat').append('<option value="' + i + '">' + category.name + '</option>');
});
- }
- var k=1;
- $.each(data.category[0].channel, function(i,channel){
- if ( k > 10 ) {
- togglestatus = 'toggle';
- }
- else
- {
- togglestatus = '';
- }
+ $('#epglist #epg_selector select option[value=' + selectedvalue + ']').attr("selected", "selected");
+ }
+ else {
+ $('#epglist #epg_selector').append('<select id="epglist_chan"></select>');
+ data = $('#jqt').data('channellist');
+ $.each(data.category, function(i,category){
+ $('#epglist #epg_selector #epglist_chan').append('<optgroup label="' + category.name + '">');
+ var catname = category.name;
+ $.each(category.channel, function(j, channel){
+ $('#epglist #epg_selector #epglist_chan optgroup[label="' + catname +'"]').append('<option value="' + channel.number + '">' + channel.name +'</option>');
+ });
+ $('#epg_chan').append('</optgroup>');
+ });
+ $('#epglist #epg_selector select option[value=' + selectedvalue + ']').attr("selected", "selected");
+ }
+ var k=1;
+ if ( type == "cat" ) {
+ arrayvalue = selectedvalue;
+ } else {
+ arrayvalue = 0;
+ }
+ $.each(data.category[arrayvalue].channel, function(i,channel){
+ if ( k > 10 ) {
+ togglestatus = 'toggle';
+ }
+ else
+ {
+ togglestatus = '';
+ }
+ k++;
+ $('#epglist #ul_epglist').append('<li rel="' + togglestatus + '" class="sep">' + channel.name + '</li>');
+ $.each(channel.epg, function(j,epg){
+ if ( k > 10 ) {
+ togglestatus = 'toggle';
+ }
+ else
+ {
+ togglestatus = '';
+ }
+ $('#epglist #ul_epglist').append('<li rel="' + togglestatus + '"><a href="#"><span class="epgtime">' + epg.time + '</span><span class="epgname">' + epg.title + '</span></a></li>');
+
k++;
- $('#epglist #ul_epglist').append('<li rel="' + togglestatus + '" class="sep">' + channel.name + '</li>');
- $.each(channel.epg, function(j,epg){
- if ( k > 10 ) {
- togglestatus = 'toggle';
- }
- else
- {
- togglestatus = '';
- }
- $('#epglist #ul_epglist').append('<li rel="' + togglestatus + '"><a href="#"><span class="epgtime">' + epg.time + '</span><span class="epgname">' + epg.title + '</span></a></li>');
-
- k++;
- });
});
- $('#epglist li[rel="toggle"]').hide();
- json_complete('#epglist','cube');
});
+$("#epglist #epg_selector select").change(function () {
+epgdata = $('#jqt').data("epg");
+selectedvalue = $("#epglist #epg_selector select option:selected").val();
+if ($("#epglist #epg_selector select").attr("id") == 'epglist_cat') {
+type = 'cat';
+} else {
+type = 'chan';
+}
+parse_epg(epgdata,selectedvalue,type);
+});
}
// [/EPG SECTION]