summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html1102
1 files changed, 1102 insertions, 0 deletions
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..70d3125
--- /dev/null
+++ b/index.html
@@ -0,0 +1,1102 @@
+<html>
+ <head>
+ <script type="text/javascript" src="settings.js" />
+ <script type="text/javascript" src="settings2.js" />
+ <script type="text/javascript" src="channels.js" />
+ </head>
+<script language="Javascript">
+
+//
+// Javascript VDR client for Motorola VIP19x0 & VIP19x3
+//
+// Martin Voerman Rekordc@gmail.com
+//
+// TODO
+//
+// Sound mapping for AC3
+// auto epg switch language for EIT Cache
+// show full epg if avaible (atm only now/next)
+//
+// make VDR connection
+// get/set/create/edit timers
+// make/view recordings
+//
+// Mainmenu
+// set/save changes to cfg.custom.xxx
+// change IP server
+//
+
+var Version = "0.03 2012/12/xx"
+var nrChannels = channels.length;
+
+window.onkeydown = onKeyDown;
+
+function onLoad() {
+ createPlayer();
+ embedTeletextPlugin();
+// AUDIO_CONNECTION_TYPE_ANALOG = 0;
+// AUDIO_CONNECTION_TYPE_SPDIF = 1;
+// AUDIO_CONNECTION_TYPE_HDMI = 2;
+// AUDIO_CONNECTION_TYPE_DECODER = 3;
+// AUDIO_CONNECTION_TYPE_BUFFER = 4;
+// AUDIO_CONNECTION_TYPE_I2S = 5;
+ toi.audioOutputService.setVolume(0, 100);
+ toi.audioOutputService.setVolume(3, StartVolume);
+ toi.audioOutputService.setMuteState(3, false);
+ showDisplay((currChan.toString()), false, 100, 0 );
+ play(channels[currChan]);
+ eitCache = toi.dvbEitService.createInstance();
+ eitCache.setFilterMode(eitCache.FILTER_MODE_PF_AND_SCHEDULE);
+// eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY);
+ showOSD();
+}
+
+function onUnload() {
+ try {
+ mediaPlayer.close();
+ mediaPlayer.releaseInstance();
+ } catch(e) {
+ alert(e);
+ }
+}
+
+function incChan(step) {
+ currChan = currChan + step;
+ if (currChan == nrChannels) {
+ currChan = 1;
+ }
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(currChan);
+}
+
+function decChan(step) {
+ currChan = currChan - step;
+ if (currChan == 0) {
+ currChan = nrChannels - 1;
+ }
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(currChan);
+}
+
+function createPlayer() {
+ try {
+ mediaPlayer = toi.mediaService.createPlayerInstance();
+ } catch(e) {
+ alert("Failed creating player: " + e);
+ }
+}
+
+function play(uri) {
+ try {
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ mediaPlayer.close();
+ }
+ uri=ServerAdres+uri;
+ mediaPlayer.open(uri);
+ mediaPlayer.play(1000);
+ if(isFullscreen) {
+ showOSD();
+ }
+ showDisplay((currChan.toString()), false, 100, 0 );
+ showChannelList();
+ } catch (e) {
+ alert("Failed opening stream: " + e);
+ return;
+ }
+}
+
+function preview(urip) {
+ if(SwitchGuide) {
+ play(urip);
+ }
+ showChannelList();
+}
+
+
+function FullScreen() {
+ videoplane.style.width = "100%";
+ videoplane.style.height = "100%";
+ videoplane.style.left = "0px";
+ videoplane.style.top = "0px";
+}
+
+
+function onKeyDown(event) {
+ if(isVisible) {
+ onKeyTeletext(event.keyIdentifier);
+ } else if(isSetupMenu) {
+ onKeyMenu(event.keyIdentifier);
+ } else {
+
+ switch(event.keyIdentifier) {
+ case "Up":
+ if(isFullscreen) {
+ count = 0;
+ prevChan = currChan;
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ play(channels[currChan]);
+ } else {
+ // swap up <> down in guide mode
+ count = 0;
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ preview(channels[currChan]);
+ }
+ break;
+ case "Down":
+ if(isFullscreen) {
+ count = 0;
+ prevChan = currChan;
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ play(channels[currChan]);
+ } else {
+ // swap up <> down in guide mode
+ count = 0;
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ preview(channels[currChan]);
+ }
+ break;
+ case "Left":
+ count = 0;
+ prevChan = currChan;
+ if (currChan > 9) {
+ decChan(9);
+ } else {
+ currChan = nrChannels - currChan;
+ }
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ break;
+ case "Right":
+ count = 0;
+ prevChan = currChan;
+ if (currChan < (nrChannels - 9 )) {
+ incChan(9);
+ } else {
+ currChan = nrChannels - currChan;
+ }
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ break;
+ case "Red":
+ if(isFullscreen) {
+ if(showClock == 0 ) {
+ showDisplay("", true, 80, 1 );
+ showClock = 1;
+ } else if(showClock == 1 ) {
+ showClock = 0;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ } else {
+ if(NowNext) {
+ settimer();
+ switchtimer.style.opacity = 1;
+ timerId = setTimeout("switchtimer.style.opacity = 0; ", 2000);
+ } else {
+ switchtimer.innerHTML = "<font color=black size=4><center> Program is running use OK to switch </center></font>";
+ switchtimer.style.opacity = 1;
+ timerId = setTimeout("switchtimer.style.opacity = 0; ", 2000);
+ }
+ }
+ break;
+ case "Green":
+ if(isFullscreen) {
+ if(!epgactive) {
+ audio = audio + 1;
+ is = toi.informationService;
+ if(audio == 1) {
+ is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE);
+ osdlang1.style.opacity = 1;
+ osdlang2.style.opacity = 0;
+ osdlang3.style.opacity = 0;
+ timerId = setTimeout("osdlang1.style.opacity = 0; ", 3000);
+ } else if(audio == 2) {
+ is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE);
+ osdlang1.style.opacity = 0;
+ osdlang2.style.opacity = 1;
+ osdlang3.style.opacity = 0;
+ timerId = setTimeout("osdlang2.style.opacity = 0; ", 3000);
+ } else if(audio == 3) {
+ is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE);
+ osdlang1.style.opacity = 0;
+ osdlang2.style.opacity = 0;
+ osdlang3.style.opacity = 1;
+ timerId = setTimeout("osdlang3.style.opacity = 0; ", 3000);
+ audio = 0;
+ }
+ } else {
+ osdepginfo.style.opacity = 0.9;
+ osdepginfonext.style.opacity = 0;
+ }
+ } else {
+ NowNext = 0;
+ showChannelList();
+ }
+
+ break;
+ case "Yellow":
+ if(isFullscreen) {
+ if(!epgactive) {
+ } else {
+ osdepginfo.style.opacity = 0;
+ osdepginfonext.style.opacity = 0.9;
+ }
+ } else {
+ NowNext = 1;
+ showChannelList();
+ }
+ break;
+ case "Blue":
+ if(isFullscreen) {
+ RestartPortal();
+ } else {
+ SetOsdInfo();
+ osdepginfo.style.opacity = 1 - NowNext;
+ osdepginfonext.style.opacity = NowNext;
+ timerId = setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000);
+ }
+ break;
+ case "BrowserBack":
+ if(count) {
+ count = 0;
+ osdnr.style.opacity = 0;
+ if(isFullscreen) {
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ Change = 0;
+ } else {
+ if(isFullscreen) {
+ //SHOW epg info
+ SetOsdInfo();
+ osdepginfo.style.opacity = 0.9;
+ osdepginfonext.style.opacity = 0;
+ epgactive = 1;
+ timerId = setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000);
+ } else if(!isFullscreen){
+ isFullscreen = 1;
+ FullScreen();
+ currChan = preChan;
+ }
+ }
+ break;
+
+ case "Enter":
+ // OK key on frontpanel
+ case "Accept":
+ if(isFullscreen) {
+ // fullscreen
+ if(!count) {
+ showOSD();
+ } else {
+ CheckChannel(Change);
+ count = 0;
+ if(ChangeOK) {
+ play(channels[currChan]);
+ ChangeOK = 0;
+ }
+ }
+ } else {
+ // if not fullscreen
+ if(count){
+ CheckChannel(Change);
+ count = 0;
+ if(ChangeOK) {
+ preview(channels[currChan]);
+ ChangeOK = 0;
+ }
+ } else {
+ isFullscreen = 1;
+ FullScreen();
+ play(channels[currChan]);
+ }
+ }
+ break;
+
+ case "Menu":
+ if(isFullscreen) {
+ isSetupMenu = 1;
+ mainmenu.style.opacity = 1;
+ InitMenu();
+// timerId = setTimeout("mainmenu.style.opacity = 0;", 5000);
+ }
+ break;
+ case "Scroll":
+ if(isFullscreen) {
+ NowNext = 0;
+ showChannelList();
+ videoplane.style.width = "320px";
+ videoplane.style.height = "240px";
+ videoplane.style.left = "380px";
+ videoplane.style.top = "300px";
+ isFullscreen = 0;
+ if(!SwitchGuide) {
+ preChan = currChan;
+ }
+ } else {
+ isFullscreen = 1;
+ FullScreen();
+ if(!SwitchGuide) {
+ currChan = preChan;
+ }
+ }
+ break;
+ case "TV":
+ currChan = prevChan;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ play(channels[currChan]);
+ break;
+
+ case KEY_0:
+ digit = 0;
+ Makedigit();
+ break;
+ case KEY_1:
+ digit = 1;
+ Makedigit();
+ break;
+ case KEY_2:
+ digit = 2;
+ Makedigit();
+ break;
+ case KEY_3:
+ digit = 3;
+ Makedigit();
+ break;
+ case KEY_4:
+ digit = 4;
+ Makedigit();
+ break;
+ case KEY_5:
+ digit = 5;
+ Makedigit();
+ break;
+ case KEY_6:
+ digit = 6;
+ Makedigit();
+ break;
+ case KEY_7:
+ digit = 7;
+ Makedigit();
+ break;
+ case KEY_8:
+ digit = 8;
+ Makedigit();
+ break;
+ case KEY_9:
+ digit = 9;
+ Makedigit();
+ break;
+ case "Teletext":
+ if(isFullscreen) {
+ isVisible = 1;
+ setVisible(isVisible);
+ }
+ break;
+ case "VolumeMute":
+ state = toi.audioOutputService.getMuteState(3);
+ toi.audioOutputService.setMuteState(3, !state);
+ mute = 1 - state;
+ osdmute.style.opacity = mute;
+ break;
+ case "VolumeUp":
+ Volume = Volume + 10;
+ if (Volume > 100) {
+ Volume = 100;
+ }
+ toi.audioOutputService.setVolume(3, Volume);
+ break;
+ case "VolumeDown":
+ Volume = Volume - 10;
+ if (Volume < 0) {
+ Volume = 0;
+ }
+ toi.audioOutputService.setVolume(3, Volume);
+ break;
+
+ case "MediaRewind":
+ break;
+ case "MediaForward":
+ break;
+ case "MediaPlayPause":
+ break;
+ case "MediaStop":
+
+ case "MediaRecord":
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+function Makedigit() {
+ prevChan = currChan;
+ Change = (Change*10) + digit;
+ count = count + 1;
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(Change);
+ if(isFullscreen) {
+ showDisplay((Change.toString()), false, 100, 0 );
+ }
+
+ if (count>2) {
+ CheckChannel(Change);
+ count = 0;
+ }
+ if(ChangeOK) {
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ ChangeOK = 0;
+ }
+}
+
+function CheckChannel(CheckThis) {
+// function to check if channel exists
+ if(channels[CheckThis]) {
+ ChangeOK = 1;
+ currChan = CheckThis;
+ } else {
+ ChangeOK = 0;
+ }
+ if(prevChan == currChan) {
+ ChangeOK = 0 ;
+ }
+ osdnr.style.opacity = 0;
+ if(isFullscreen) {
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ Change = 0;
+
+}
+
+
+function showDisplay(showtxt,colonState,intensity,currentMode) {
+ if(!showClock){
+ toi.frontPanelService.setSegmentDisplayState(toi.statics.ToiFrontPanelServiceSegmentDisplayState.create(showtxt,colonState,intensity,currentMode));
+ }
+}
+
+function SetLed(NumLed,color,blinkfreq){
+ var fps = toi.frontPanelService;
+ var state = toi.statics.ToiFrontPanelServiceLedState.create(color, blinkfreq);
+ fps.setLedState(NumLed, state);
+}
+
+
+function showOSD() {
+ SetOsdInfo();
+ opacity = 1;
+ osd.style.opacity = opacity;
+ osdnr.style.opacity = opacity;
+ osdtime.style.opacity = opacity;
+ osdname.style.opacity = opacity;
+ osdepg.style.opacity = opacity;
+ timerId = setTimeout("fadeOut()", 3000);
+
+}
+
+function SetOsdInfo() {
+ OSDchannr(currChan);
+ date_time();
+ osdtime.innerHTML = "<font color=white size=2>" + result +"</font>";
+ osdname.innerHTML = "<font color=black size=5>" + Left(channelsnames[currChan],25) + "</font>";
+ GetEPG(currChan);
+ osdepg.innerHTML = "<font color=white size=4><p>" + EPGNow + "</p>\n<p>" + EPGNext + "<\p></font>";
+ osdepginfo.innerHTML = "<center><font color=white size=4><p>" + EPGNow + "</p>\n<p>" + EPGShortnow + "</p>\n<p>" + Left(EPGExtnow,750) + "<\p></font></center>";
+ osdepginfonext.innerHTML = "<center><font color=white size=4><p>" + EPGNext + "</p>\n<p>" + EPGShortnext + "</p>\n<p>" + Left(EPGExtnext,750) + "<\p></font></center>";
+ return;
+}
+
+function OSDchannr(channr) {
+ osdnr.innerHTML = "<center><font color=black size=6>" + channr + "</font></center>";
+}
+
+
+function settimer() {
+ if(SwitchTimer) {
+ tijd = EPG[NowNext][2][currChan];
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10) {
+ th = "0"+th;
+ }
+ if(tm<10) {
+ tm = "0"+tm;
+ }
+ dateCurrent = new Date();
+ var StartTime = Math.floor((date.getTime() - dateCurrent.getTime()));
+ timerChan = currChan;
+ TimerActions = "isVisible = 0; isFullscreen = 1; FullScreen(); setVisible(isVisible); currChan = timerChan; play(timerChan); osdtimer.innerHTML = '';SetLed(0,0,0);"
+ // only 1 switch timer possible
+ if(switchtimerID) {
+ clearTimeout(switchtimerID);
+ }
+ switchtimerID = setTimeout(TimerActions, StartTime);
+ switchtimer.innerHTML = "<font color=black size=4><p> Name : " + EPG[NowNext][1][currChan] + "</p><p> channel : " + channelsnames[currChan] + "</p><p> Starttime : " + th + ":" + tm + "</p></font>";
+ osdtimer.innerHTML = "<font color=black size=3><p>" + th + ":" + tm + "</p></font>";
+ SetLed(0,2,0);
+ } else {
+ //
+ // No Switch timer so send timer info to Server
+ //
+ }
+}
+
+// linker n tekens van string
+function Left(str, n){
+ if (n <= 0)
+ return "";
+ else if (n > String(str).length)
+ return str;
+ else
+ return String(str).substring(0,n);
+}
+
+// rechter n tekens van string
+function Right(str, n){
+ if (n <= 0)
+ return "";
+ else if (n > String(str).length)
+ return str;
+ else {
+ var iLen = String(str).length;
+ return String(str).substring(iLen, iLen - n);
+ }
+}
+
+function fadeIn() {
+ opacity += 0.2;
+ osd.style.opacity = opacity;
+ osdnr.style.opacity = opacity;
+// osdtime.style.opacity = opacity;
+// osdname.style.opacity = opacity;
+// osdepg.style.opacity = opacity;
+ if (osd.style.opacity >= 1) {
+ timerId = setTimeout("fadeOut()", 200);
+ return;
+ }
+ timerId = setTimeout("fadeIn()", 100);
+}
+
+function fadeOut() {
+ opacity -= 0.2;
+ osd.style.opacity = opacity;
+ osdnr.style.opacity = opacity;
+// osdtime.style.opacity = opacity;
+// osdname.style.opacity = opacity;
+// osdepg.style.opacity = opacity;
+ if (osd.style.opacity <= 0) {
+ return;
+ }
+ timerId = setTimeout("fadeOut()", 100);
+}
+
+function RestartPortal(){
+
+ try {
+ ids = toi.applicationService.getApplicationIds();
+ for ( i = 0; i < ids.length; ++i ){
+ info = toi.applicationService.getInfo(ids[i]);
+ if (info.applicationName == "WebKit Portal"){
+ dump("Killing app " + ids[i] + ": " + info.applicationName);
+ toi.applicationService.kill(ids[i]);
+ }
+ }
+ }
+ catch(e) { dump(e) };
+}
+
+function date_time()
+{
+ date = new Date;
+ year = date.getFullYear();
+ month = date.getMonth();
+ d = date.getDate();
+ day = date.getDay();
+ h = date.getHours();
+ if(h<10)
+ {
+ h = "0"+h;
+ }
+ m = date.getMinutes();
+ if(m<10)
+ {
+ m = "0"+m;
+ }
+ s = date.getSeconds();
+ if(s<10)
+ {
+ s = "0"+s;
+ }
+ result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m;
+ return;
+}
+
+// EPG Section
+
+function GetEPG(epgchan)
+{
+ EPGNow = "";
+ EPGShortnow = "";
+ EPGExtnow = "";
+ EPGNext = "";
+ EPGShortnext = "";
+ EPGExtnext = "";
+ cds = 0;
+ try {
+ // streaminfo
+ // SI[x] 0-sat,1-NID,2-TID,3-SID
+ SI=channels[epgchan].split("-");
+ is = toi.informationService;
+ is.setObject("cfg.locale.ui","ger",is.STORAGE_VOLATILE);
+ if(SI[0]=="S28.2E") {
+ is.setObject("cfg.locale.ui","eng",is.STORAGE_VOLATILE);
+ }
+ if((SI[0]=="S23.5E" && SI[1]=="3") || SI[2]=="1026" || SI[2]=="1097" || SI[2]=="1105" || SI[2]=="1119") {
+ is.setObject("cfg.locale.ui","dut",is.STORAGE_VOLATILE);
+ cds = 1;
+ }
+ if (SI[0]=="T" ) {
+ is.setObject("cfg.locale.ui","ned",is.STORAGE_VOLATILE);
+ }
+ if(epgchan > 419 && epgchan < 550)
+ {
+ is.setObject("cfg.locale.ui","Deu",is.STORAGE_VOLATILE);
+ cds = 0;
+ }
+
+
+ eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]);
+ eitCache.addService(eitService);
+ event = eitCache.getPresentEvent(eitService);
+ if (event.name)
+ {
+ events = eitCache.getEvents(eitService, 1000000000, 2000000000);
+ extEventsnow = eitCache.getExtendedEventInfo(eitService, events.infoSequence[0].eventId);
+ extEventsnext = eitCache.getExtendedEventInfo(eitService, events.infoSequence[1].eventId);
+ EPGShortnow = extEventsnow.shortInfo;
+ EPGShortnext = extEventsnext.shortInfo;
+ EPGExtnow = extEventsnow.extendedInfo;
+ EPGExtnext = extEventsnext.extendedInfo;
+ }
+
+ EPG[0][1][epgchan] = event.name;
+ EPG[0][2][epgchan] = event.time;
+ EPG[0][3][epgchan] = (event.duration/60);
+ EPG[0][4][epgchan] = "";
+ EPG[0][5][epgchan] = "";
+ if(EPGShortnow) {
+ EPG[0][4][epgchan] = EPGShortnow;
+ }
+ if(EPGExtnow) {
+ EPG[0][5][epgchan] = EPGExtnow;
+ }
+
+ tijd = event.time;
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ dateCurrent = new Date();
+ var EPGminutes = Math.floor((dateCurrent.getTime() - date.getTime()) /1000/60);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10)
+ {
+ th = "0"+th;
+ }
+ if(tm<10)
+ {
+ tm = "0"+tm;
+ }
+ if(cds){
+ // CDS has short info, other providers, a little longer.
+ EPGNow = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes) + ")" + " " + event.name + " " + EPGShortnow;
+ } else {
+ EPGNow = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes) + ")" + " " + event.name + " ";
+ }
+ if (!event.time)
+ {
+ EPGNow = " ";
+ }
+
+ event = eitCache.getFollowingEvent(eitService);
+
+ EPG[1][1][epgchan] = event.name;
+ EPG[1][2][epgchan] = event.time;
+ EPG[1][3][epgchan] = (event.duration/60);
+ EPG[1][4][epgchan] = "";
+ EPG[1][5][epgchan] = "";
+
+ if(EPGExtnext) {
+ EPG[1][4][epgchan] = EPGShortnext;
+ }
+ if(EPGExtnext) {
+ EPG[1][5][epgchan] = EPGExtnext;
+ }
+
+ tijd = event.time;
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10)
+ {
+ th = "0"+th;
+ }
+ if(tm<10)
+ {
+ tm = "0"+tm;
+ }
+
+ if(cds){
+ // CDS has short info, other providers, a little longer.
+ EPGNext = th + ":" + tm + " (" + (event.duration/60) + ")" + " " + event.name + " " + EPGShortnext;
+ } else {
+ EPGNext = th + ":" + tm + " (" + (event.duration/60) + ")" + " " + event.name + " ";
+ }
+ if (!event.time)
+ {
+ EPGNext = " ";
+ }
+ } catch(e) {
+ alert("Get EPG problem: " + e);
+ }
+}
+
+// End of EPG section
+
+// Channelslist / EPG Guide
+//
+// show currchan - 5
+// highlite currchan
+// show currchan + 5
+//
+// check if chan is OK
+//
+function showChannelList() {
+ var liststyle = "";
+ var htmlstring = "<table border='0'><tr>";
+ listChan = currChan-5;
+ for(var i=currChan-5; i<=currChan+5; i++) {
+ if (listChan<1) {
+ listChan=nrChannels-2;
+ }
+ if (listChan>nrChannels-2) {
+ listChan=0;
+ }
+ do
+ {
+ listChan = listChan + 1;
+ }
+ while (!channels[listChan] && (listChan<nrChannels));
+
+ GetEPG(listChan);
+ if ( listChan == currChan) {
+ liststyle = " style='background:#fc5;'";
+ } else {
+ liststyle = "";
+ }
+ EpgInfo[0] = EPGNow;
+ EpgInfo[1] = EPGNext;
+ htmlstring = htmlstring + "<td" + liststyle + ">" + listChan + "</td><td" +liststyle + ">" + Left(channelsnames[listChan],15) + "</td><td" +liststyle + ">" + Left(EpgInfo[NowNext],64) + "</td></tr>";
+ }
+ htmlstring = htmlstring + "</table>";
+ channelList.innerHTML = htmlstring;
+ chanlistepg.innerHTML = "<center><font color=black size=4><p>" + EPG[NowNext][1][currChan] + "</p></font><font color=black size=3><p>" + Left(EPG[NowNext][4][currChan],250) + "<\p></font></center>" ;
+
+}
+
+// END of Channelslist / EPG Guide
+
+// TeleTXT section
+
+function embedTeletextPlugin() {
+ teletext = document.createElement("embed");
+ teletext.id = "teletext";
+ teletext.type = "application/motorola-teletext-plugin";
+ teletext.style.position = "absolute";
+ teletext.style.width = "100%";
+ teletext.style.height = "100%";
+ teletext.style.top = "10px"; // has to be 1 rather than 0
+ teletext.style.left = "10px"; // has to be 1 rather than 0
+ teletext.style.zIndex = "501";
+ return teletext;
+}
+
+
+function setVisible(isVisible) {
+ if (isVisible) {
+ document.body.appendChild(teletext);
+ videoplane.style.width = "50%";
+ videoplane.style.left = "50%";
+ teletext.style.width = "50%";
+ teletext.style.visibility = "visible";
+ channelList.style.visibility = "hidden";
+ colorkeys.style.visibility = "hidden";
+ } else {
+ teletext.style.visibility = "hidden";
+ channelList.style.visibility = "visible";
+ colorkeys.style.visibility = "visible";
+ }
+}
+
+
+function onKeyTeletext(keyCode) {
+ switch(keyCode) {
+ case "Left":
+ teletext.api.gotoNextPage();
+ break;
+ case "Right":
+ teletext.api.gotoPreviousPage();
+ break;
+ case "Red":
+ teletext.api.inputRedKey();
+ break;
+ case "Green":
+ teletext.api.inputGreenKey();
+ break;
+ case "Yellow":
+ teletext.api.inputYellowKey();
+ break;
+ case "Blue":
+ teletext.api.inputCyanKey();
+ break;
+ case "MediaRewind":
+ teletext.api.gotoPreviousSubpage();
+ break;
+ case "MediaForward":
+ teletext.api.gotoNextSubpage();
+ break;
+ case "MediaStop":
+ teletext.style.width = "100%";
+ teletext.api.transparent = !teletext.api.transparent;
+ FullScreen();
+ break;
+ case "BrowserBack":
+ case "Teletext":
+ isVisible = 0;
+ FullScreen();
+ setVisible(isVisible);
+ break;
+
+ case "TV":
+ teletext.api.gotoIndexPage();
+ break;
+
+ case KEY_0:
+ teletext.api.inputDigit(0);
+ break;
+ case KEY_1:
+ teletext.api.inputDigit(1);
+ break;
+ case KEY_2:
+ teletext.api.inputDigit(2);
+ break;
+ case KEY_3:
+ teletext.api.inputDigit(3);
+ break;
+ case KEY_4:
+ teletext.api.inputDigit(4);
+ break;
+ case KEY_5:
+ teletext.api.inputDigit(5);
+ break;
+ case KEY_6:
+ teletext.api.inputDigit(6);
+ break;
+ case KEY_7:
+ teletext.api.inputDigit(7);
+ break;
+ case KEY_8:
+ teletext.api.inputDigit(8);
+ break;
+ case KEY_9:
+ teletext.api.inputDigit(9);
+ break;
+
+
+
+ }
+}
+
+// end of TeleTXT section
+
+
+// Menu section
+
+function onKeyMenu(keyCode) {
+ switch(keyCode) {
+ case "Menu":
+ case "BrowserBack":
+ isSetupMenu = 0;
+ mainmenu.style.opacity = 0;
+ break;
+ case "Left":
+ break;
+ case "Right":
+ break;
+ case "Red":
+ if(showClock == 0 ) {
+ showDisplay("", true, 80, 1 );
+ showClock = 1;
+ } else if(showClock == 1 ) {
+ showClock = 0;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ InitMenu();
+ break;
+ case "Green":
+ audio = audio + 1;
+ is = toi.informationService;
+ if(audio == 1) {
+ is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE);
+ } else if(audio == 2) {
+ is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE);
+ } else if(audio == 3) {
+ is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE);
+ audio = 0;
+ }
+ InitMenu();
+ break;
+ case "Yellow":
+ clearTimeout(switchtimerID);
+ switchtimerID = 0;
+ InitMenu();
+ osdtimer.innerHTML = "";
+ SetLed(0,0,0);
+ break;
+ case "Blue":
+ if(SwitchGuide == 0 ) {
+ SwitchGuide = 1;
+ } else if(SwitchGuide == 1 ) {
+ SwitchGuide = 0;
+ }
+ InitMenu();
+ break;
+ case "MediaRewind":
+ break;
+ case "MediaForward":
+ break;
+ case "MediaStop":
+ break;
+ case "Teletext":
+ break;
+ case "TV":
+ break;
+ case KEY_0:
+ break;
+ case KEY_1:
+ break;
+ case KEY_2:
+ break;
+ case KEY_3:
+ break;
+ case KEY_4:
+ break;
+ case KEY_5:
+ break;
+ case KEY_6:
+ break;
+ case KEY_7:
+ break;
+ case KEY_8:
+ break;
+ case KEY_9:
+ break;
+ }
+}
+
+function InitMenu() {
+ mainmenu.innerHTML = "<center><font size=7 color=white><p> SETTINGS </p><font color=red size=5><p>Frontdisplay Clock : " + showClock + "</p></font><font color=green size=5><p>Prio audio track : " + (toi.informationService.getObject("cfg.media.audio.languagepriority")) + "</p></font><font color=yellow size=5><p>Switch timer : " + Boolean(switchtimerID) + "</p></font><font color=blue size=5><p>Preview guide : " + SwitchGuide + "</p></font></center>";
+}
+
+
+
+// End of Menu section
+
+
+</script>
+
+
+ <body style="background:#ccc;" onload="onLoad()" onunload="onUnload()">
+ <embed type="application/x-motorola-toi" hidden="true">
+
+ <div id="channelList" style="background:#bbb; width:100%; position:absolute; left:50px; top:25px;"></div>
+ <div id="colorkeys" style="width:100%; position:absolute; left:75px; top:485px;">
+ <font color=red size=3> Switchtimer </font>
+ <font color=green size=3> NOW </font>
+ <font color=yellow size=3> NEXT </font>
+ <font color=blue size=3> INFO </font>
+ </div>
+ <div id="chanlistepg" style="width:300; position:absolute; left:50px; top:290px;"> </div>
+ <div id="switchtimer" style="background:#3366ff;width:300; position:absolute; left:150px; top:150px;z-index:10;opacity:0;"></div>
+
+
+ <videoplane id='videoplane' style='position:absolute; left:0px; top:0px; height: 100%; width: 100%; z-index:500;'>
+ </videoplane>
+
+ <div id="osd" style ="opacity:0;">
+ <div id="osdmain" style="background:#3366ff;width:550px; position:absolute; left:75px; top:350px; bottom:50px;z-index:505;"></div>
+ <div id="osdtime" style="width:300px; position:absolute; left:375px; top:360px;z-index:505;"></div>
+ <div id="osdname" style="width:250px;height:25px; position:absolute; left:85px; top:375px;z-index:505;"></div>
+ <div id="osdepg" style="width:450px; position:absolute; left:150px; top:400px;z-index:505;"></div>
+ <div id="osdtimer" style="width:50px; position:absolute; left:85px; top:400px;z-index:505;"></div>
+ </div>
+
+ <div id="osdnr" style="background:#CC0000;width:75px;height:50px; position:absolute; left:85px; top:320px;z-index:505;opacity:0;"></div>
+
+ <div id="osdepginfo" style="background:#3366ff;width:550px; position:absolute; left:100px; top:100px;z-index:510;opacity:0;"></div>
+ <div id="osdepginfonext" style="background:#3366ff;width:550px; position:absolute; left:100px; top:100px;z-index:510;opacity:0;"></div>
+
+ <div id="osdmute" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"><img src="mute.png"></div>
+ <div id="osdlang1" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"><img src="unmute.png"><font color=white size=3>Nederlands</font></div>
+ <div id="osdlang2" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"><img src="unmute.png"><font color=white size=3>Deutsch</font></div>
+ <div id="osdlang3" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"><img src="unmute.png"><font color=white size=3>English</font></div>
+
+ <div id="mainmenu" style="background:#3366ff;width:550px; position:absolute; left:75px; top:50px; bottom:50px;z-index:520;opacity:0;">
+ </div>
+
+</body>
+</html>
+
+