diff options
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/main.js | 50 | ||||
-rw-r--r-- | javascript/settings.js | 7 | ||||
-rw-r--r-- | javascript/weather.js | 118 |
3 files changed, 136 insertions, 39 deletions
diff --git a/javascript/main.js b/javascript/main.js index 87ff833..e797dc2 100644 --- a/javascript/main.js +++ b/javascript/main.js @@ -601,7 +601,7 @@ for(x=0; x<cList.length;x++) { // AUDIO_CHANNEL_MODE_DUAL_MONO_MIXED = 4 if (lang_prio_dyn[xx] !== "NAR") { - xx += 1; + xx++; } else { lang_prio_dyn.length = xx; } @@ -620,7 +620,7 @@ for(x=0; x<cList.length;x++) { if (xs == 0) { subs = " SUBS : " } else { subs += " , ";} subs_prio_dyn[xs] = mediaPlayer.getSubtitleStreamInfo(cList[x]).language; subs = subs + subs_prio_dyn[xs]; - xs += 1; + xs++; } if(cList[x].type == 3) { @@ -827,7 +827,7 @@ function onKeyDown(event) { do { do - ChanGroup += 1; + ChanGroup++; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup > 9) { ChanGroup = 0; @@ -1193,7 +1193,7 @@ function onKeyDown(event) { defChan[ChanGroup] = currChan; do{ do - ChanGroup += 1; + ChanGroup++; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup > 9) { ChanGroup = 0; @@ -1308,7 +1308,7 @@ function GotoFav(ChanID) { function AddtoFav() { - Fav_max_channel += 1; + Fav_max_channel++; maxChan[Fav_group] = Fav_base + Fav_max_channel; channelsnames[(Fav_base + Fav_max_channel)] = channelsnames[currChan]; channels[(Fav_base + Fav_max_channel)] = channels[currChan]; @@ -1334,7 +1334,7 @@ function Makedigit() { oldChan = prevChan; // used for swap last channels with 0 prevChan = currChan; Change = (Change*10) + digit; - count += 1; + count++; osdmain.style.opacity = isFullscreen; OSDchannr(Change); if(isFullscreen) { @@ -2335,11 +2335,11 @@ function onKeyMenu(keyCode) { break; case KEY_DOWN: if (menu == 2) { - timerID += 1; + timerID++; var x = ss.getBookingIds("*", 0, 0); if (timerID > x.length ) { timerID = x.length; } } else if (menu == 5 || menu == 7 || menu == 10) { - timerID += 1; + timerID++; if (timerID > (maxTimers - 1) && maxTimers !== 0) { timerID = maxTimers - 1; } } epg_unactive(); @@ -2460,7 +2460,7 @@ function onKeyMenu(keyCode) { menu = 11; // Weather menu InitMenu(menu); } else if (menu == 1) { - Set_Res = Set_Res + 1; + Set_Res++; if (Set_Res > (VideoOutputModes.length-1)) { Set_Res = 0;} // save the info is.setObject("vip.resolution",Set_Res.toString(),is.STORAGE_PERMANENT) @@ -2523,7 +2523,7 @@ function onKeyMenu(keyCode) { channels[x] = x2; channelsnames[(x + 1)] = y1; channels[(x + 1)] = x1; - timerID += 1; + timerID++; setTimeout("InitMenu(menu);",100); } } @@ -2532,7 +2532,7 @@ function onKeyMenu(keyCode) { if (menu == 0) { RestartPortal(); } else if (menu == 1) { - css_nr += 1; + css_nr++; if (css_nr > (cssfile.length - 1)) { css_nr = 0;} loadcss(cssfile[css_nr]); is.setObject("vip.css_nr",css_nr.toString(),is.STORAGE_PERMANENT) @@ -2931,7 +2931,7 @@ if(menu == 2) { // Timers menu var y = ss.getBookingIds("*", 0, 0); if (y.length !== 0) { for (var i=0;i<10;i++) { - if (timer.length !== 0) { do { x += 1; } while (!timer[x] && (x < timer.length)) } + if (timer.length !== 0) { do { x++; } while (!timer[x] && (x < timer.length)) } if (i == 0) { booking += "<span class=select" + cssres[css_nr][Set_Res] + ">"; @@ -3002,7 +3002,7 @@ if(menu == 5) { // Timers from Server booking = "<span class=select" + cssres[css_nr][Set_Res] + ">"; var x = timerID - 1; for (var i=0;i<10;i++) { - if (maxTimers !== 0) { do { x += 1; } while (!timers[x] && (x < maxTimers)) } + if (maxTimers !== 0) { do { x++; } while (!timers[x] && (x < maxTimers)) } if (maxTimers > x) { booking += timers[x]; } else { booking += "\n"; } if (i == 0) { booking += "</span>"; } } @@ -3020,7 +3020,7 @@ if(menu == 7) { // SearchTimers from Server booking = "<span class=select" + cssres[css_nr][Set_Res] + ">"; var x = timerID - 1; for (var i=0;i<10;i++) { - if (maxTimers !== 0) { do { x += 1; } while (!searchtimers[x] && (x < maxTimers)) } + if (maxTimers !== 0) { do { x++; } while (!searchtimers[x] && (x < maxTimers)) } if (maxTimers > x) { booking += searchtimers[x]; } else { booking += "\n"; } if (i == 0) { booking += "</span>"; } } @@ -3093,7 +3093,7 @@ if(menu == 10) { // Favorite edit Menu htmltext += "<span class=select" + cssres[css_nr][Set_Res] + ">"; var x = timerID; for (var i=0;i<10;i++) { - if (maxTimers !== 0) { x += 1;} + if (maxTimers !== 0) { x++;} if (maxTimers >= x && x !== 0) { htmltext += " \u0003\u0003 " + x + " \u0003\u0003 " + channelsnames[(x + Fav_base)] + " \u0003\u0003\u0003 \n"; } else { htmltext += "\n"; } if (i == 0) { htmltext += "</span>"; } } @@ -3978,7 +3978,7 @@ if (DelisOK) { case KEY_8: if (localRecording != 1 ) { if (recMark[posMark+1] && get_recordings == 1) { - posMark += 1; + posMark++; position = recMark[posMark]; playRec(recLink[currMed] + "?mode=streamtoend&time=" + position); } @@ -4495,7 +4495,7 @@ function MakeRecList2() { if (recTitl[i][1]) { if (recTitl[i][0] != x) { recList[i] = "\uE002\uE003" + recTitl[i][0]; - xx += 1; + xx++; } else { recList[i] = "" ; } @@ -4544,7 +4544,7 @@ function MakeRecList3(GroupID) { recList[i] = "\uE003" + result + tmp; //recTitl[i]; } - MaxInGroup = MaxInGroup + 1; + MaxInGroup++; if ((recProt[i] == 1) && (ShowProtectedChannels == 1)) { recList[i] = "";} } else { @@ -4573,7 +4573,7 @@ function MakeRecList_sublevel(GroupID) { if (recTitl[i][1] != x) { recList[i] = "\uE002\uE003" + recTitl[i][1]; - xx += 1; + xx++; } else { recList[i] = "" ; } @@ -4598,7 +4598,7 @@ function MakeRecList_sublevel(GroupID) { } } if ((recProt[i] == 1) && (ShowProtectedChannels == 1)) { recList[i] = "";} - if (recList[i] != "") { MaxInGroup = MaxInGroup + 1; } + if (recList[i] != "") { MaxInGroup++; } x = recTitl[i][1]; } } @@ -4633,7 +4633,7 @@ function MakeRecList_sublevel2(GroupID,SubGroupID) { recList[i] = "\uE003" + result + tmp; //recTitl[i]; } - MaxInGroup = MaxInGroup + 1; + MaxInGroup++; if ((recProt[i] == 1) && (ShowProtectedChannels == 1)) { recList[i] = "";} } else { @@ -4685,7 +4685,7 @@ function showMediaList() { } if (!subgroup) { for(var i=0; i<=nrMedia; i++) { - if (recList[i]) { MaxMed += 1;} + if (recList[i]) { MaxMed++;} } } @@ -4705,7 +4705,7 @@ function showMediaList() { do { - listMed += 1; + listMed++; } while (!recList[listMed] && (listMed<=nrMedia)); @@ -4816,7 +4816,7 @@ function getSchedule(schchan){ // Double info or scrollbar twice on the screen if nrMedia < 14 while ((i > 0) && (events.infoSequence[i].eventId == events.infoSequence[(i-1)].eventId) && (nrMedia > 14)) { recList[i] = ""; - i += 1; + i++; } recTitl[i] = events.infoSequence[i].name; @@ -5094,7 +5094,7 @@ if (get_recordings == 1) { var pos2 = (pos / Number(recDura[currMed])) * 100; if (pos2 < 1) { pos2 = 1;} if (pos2 >100) {pos2 = 100;} // in case of viewing while still recording. - if (pos>recMark[posMark] && recMark.length-1>posMark) { posMark += 1;} + if (pos>recMark[posMark] && recMark.length-1>posMark) { posMark++;} pos2 = ((pos2 * 140) / 100).toFixed(0); // make it 40% bigger var pos5 = "\uE007" + new Array(pos2 - 1).join("\uE008") + new Array(140 - pos2).join("\uE009") + "\uE00A" var pos4 = ""; diff --git a/javascript/settings.js b/javascript/settings.js index 0d27771..9a564bf 100644 --- a/javascript/settings.js +++ b/javascript/settings.js @@ -2,7 +2,10 @@ // Default settings // -var Version = "0.27.1"; +var Version = "0.27.2"; + +//weather +var city = "Almelo"; server_ip_array = new Array("http://192.168.1.15","http://192.168.3.15","http://192.168.178.56","http://192.168.3.100","http://192.168.178.19","http://192.168.1.21","http://192.168.2.100","http://192.168.3.225"); //server_ip_array[0] isn't used, when set to 0 script tries to find the server @@ -11,7 +14,7 @@ var server_ip; // default server var PowerDownServer = 0; // Power Down server from menu by sending cmds. (0 = no /1 = yes) var PowerDown = 9; //With Easyvdr 0.806 it is cmds 9. var StartVolume = 15; // Volume on (re)start of the portal. -var currChan = 10; // default channel +var currChan = 1; // default channel var Global_Server = 1;// 1 = old style. 0 = every channel needs server_address[channel_number] var Server_Address = new Array(); var Global_Multicast = 0;// 1 = use only MultiCast diff --git a/javascript/weather.js b/javascript/weather.js index 5ff2953..d0c9c2c 100644 --- a/javascript/weather.js +++ b/javascript/weather.js @@ -1,19 +1,10 @@ -function WeatherInfo() { - -//weather -//http://www.latlong.net/ -// find long lan -// -// - -var lat=52.41; -var lon=6.61; +function WeatherInfo_current() { xmlhttp=new XMLHttpRequest(); - xmlhttp.open("GET","http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&mode=xml&units=metric&lang=nl",false); + xmlhttp.open("GET","http://api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + lon + "&type=accurate&mode=xml&units=metric",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; - var htmltext = "<h1 class=mainmenu" + cssres[css_nr][Set_Res] + ">" + " Current Weather </h1><pre class=mainmenu" + cssres[css_nr][Set_Res] +">"; + htmltext = "<h1 class=mainmenu" + cssres[css_nr][Set_Res] + ">" + " Current Weather </h1><pre class=mainmenu" + cssres[css_nr][Set_Res] +">"; htmltext += " Plaats : " + xmlDoc.getElementsByTagName("city")[0].getAttribute("name") + ","; htmltext += xmlDoc.getElementsByTagName("country")[0].childNodes[0].nodeValue + "\n"; htmltext += " Temperatuur : " + Math.round(xmlDoc.getElementsByTagName("temperature")[0].getAttribute("value")*10)/10; @@ -31,3 +22,106 @@ var lon=6.61; mainmenu.innerHTML = htmltext; } + +function WeatherInfo() { + + var htmltext = "<h1 class=mainmenu" + cssres[css_nr][Set_Res] + "> Weather Forecast </h1>"; + htmltext += "\n\n" + + xmlhttp=new XMLHttpRequest(); + xmlhttp.open('GET','http://api.openweathermap.org/data/2.5/forecast/daily?q=' + city + '&type=accurate&mode=xml&units=metric&cnt=7',false); + xmlhttp.send(); + xmlDoc=xmlhttp.responseXML; + try { + var x=xmlDoc.getElementsByTagName("time"); + + htmltext += "<table class='center weather" + cssres[css_nr][Set_Res] + "'><tr>"; + +var date = new Date(); +var y = date.getDay(); + for (var i=0;i<x.length;i++) { + htmltext += "<th>" + days[y] + "</th>"; + y++;if (y > 6) {y = 0} ; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + + for (var i=0;i<x.length;i++) { + htmltext += "<th>" + x[i].getAttribute('day') + "</th>"; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + for (var i=0;i<x.length;i++) { + htmltext += "<th><img class='imgsize" + cssres[css_nr][Set_Res] + "' src='http://openweathermap.org/img/w/" + x[i].getElementsByTagName("symbol")[0].getAttribute('var') + ".png' /></th>"; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + for (var i=0;i<x.length;i++) { + htmltext += "<th> Day: " + x[i].getElementsByTagName("temperature")[0].getAttribute('day') + "</th>"; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + for (var i=0;i<x.length;i++) { + htmltext += "<th> Night: " + x[i].getElementsByTagName("temperature")[0].getAttribute('night') + "</th>"; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + for (var i=0;i<x.length;i++) { + htmltext += "<th>"; + if (x[i].getElementsByTagName("precipitation")[0].getAttribute('value')) { + htmltext += x[i].getElementsByTagName("precipitation")[0].getAttribute('value'); + htmltext += " mm " + x[i].getElementsByTagName("precipitation")[0].getAttribute('type') + "</th>"; + } + htmltext += "</th>"; + } + htmltext += "</tr>"; + + htmltext += "<tr>"; + for (var i=0;i<x.length;i++) { + htmltext += "<th> Wind: " + x[i].getElementsByTagName("windDirection")[0].getAttribute('code'); + htmltext += "<br> " + x[i].getElementsByTagName("windSpeed")[0].getAttribute('mps') + " m/s </th>"; + } + htmltext += "</tr>"; + + htmltext += "</table><br><br>"; + + var x=xmlDoc.getElementsByTagName("location"); + htmltext += "<table class='center weather" + cssres[css_nr][Set_Res] + "'><tr>"; + htmltext += "<th>"; + htmltext += "Location"; + htmltext += "</th><th> : "; + htmltext += x[0].getElementsByTagName("name")[0].childNodes[0].nodeValue; + htmltext += "," + x[0].getElementsByTagName("country")[0].childNodes[0].nodeValue; + htmltext += "</th></tr><tr><th>"; + htmltext += "latitude"; + htmltext += "</th><th> : "; + htmltext += x[0].getElementsByTagName("location")[0].getAttribute('latitude'); + htmltext += "</th></tr><tr><th>"; + htmltext += "longitude"; + htmltext += "</th><th> : "; + htmltext += x[0].getElementsByTagName("location")[0].getAttribute('longitude'); + htmltext += "</th></tr><tr><th>"; + htmltext += "Sun rise"; + htmltext += "</th><th> : "; + htmltext += Right(xmlDoc.getElementsByTagName("sun")[0].getAttribute('rise'),8); + htmltext += "</th></tr><tr><th>"; + htmltext += "Sun set"; + htmltext += "</th><th> : "; + htmltext += Right(xmlDoc.getElementsByTagName("sun")[0].getAttribute('set'),8); + htmltext += "</th></tr></table>"; + + } catch(e) { + htmltext = "<h1 class=mainmenu" + cssres[css_nr][Set_Res] + "><pre>\n\n\n" + Lang[67] + "\n\n\n</pre></h1>"; + alert(e); + } + + mainmenu.innerHTML = htmltext; + +} + + |