Michaelnuk
Member
Sorry, no idea - probably if they run the same firmware.
Dont suppose theres a fix for this yet?
Sorry, no idea - probably if they run the same firmware.
Yes - just uploaded version 1.1 of the package which works for me. Sorry for the delay - it's been a busy week!Dont suppose theres a fix for this yet?
Yes - just uploaded version 1.1 of the package which works for me. Sorry for the delay - it's been a busy week!
Oh - mine isn't leaving the TV on behind it.. it should!
The images that are being displayed are just snapshots so it should be possible to rotate them - there are jquery plugins that do this but it depends on whether the Ant browser has enough support for it.
I have no plans to spend a lot of time on the current package, but I could help you modify it to do what you need.
// Portal xTRa Web TV Portal
// =================== ethel
// HDRT2 User Agent--HbbTV/1.1.1 (+PVR;;;;avdn/humax.stb.2010) ANTGalio/3.1.5.24.04.09.04
var copyright="©MMXI tausoft.co.uk";
var version="1.12.064.300";
var rt1="";
var jt1="";
var debugFlag=0;
var menupos=0;
var infobox="";
var hummy=(navigator.userAgent.indexOf('HbbTV')>=0);
var yql="http://query.yahooapis.com/v1/public/yql?q=";
var newsRSS=null;
var newsCount=0;
var newsInterval=4750;
var newsCurrent=0;
var rssfeeds=new Array();
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/rss.xml", name:"BBC News"});
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/technology/rss.xml", name:"BBC Technology"});
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/science_and_environment/rss.xml", name:"BBC Science & Environment"});
rssfeeds.push({uri:"http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml", name:"BBC Sport"});
rssfeeds.push({uri:"http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml", name:"BBC Football"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_world.rss", name:"CNN World News"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_europe.rss", name:"CNN European News"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_technology.rss", name:"CNN Technology"});
//rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_space.rss", name:"CNN Science & Space"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_sport.rss", name:"CNN Sport"});
// how many builtin app?, plugin apps start at...
var plugins=new Array();
var appStart=2;
var appMan,ownerApp,ch;
//--to be removed, deprecated, use <embedded> objects in $.ready()
if(hummy)
{ var appMan = window.oipfObjectFactory.createApplicationManagerObject();
var ownerApp=appMan.getOwnerApplication(document);
var ch = ownerApp.privateData.currentChannel;
}
//---
if(typeof(rt1.toJSONString)=='undefined')
{ $.getScript("js/json2.js"); }
var uriNo=parseInt(getValue("rssURL"));
if(isNaN(uriNo))
{ setValue("rssURL",0);
uriNo=0;
}
if(getValue("iTime")==null)
{ setValue("iTime","hidden");
}
if(getValue("footerTop")==null)
{ setValue("footerTop",670);
}
$(document).ready(function()
{ $(".item").addClass("hidden");
$("body").removeClass("hidden");
setVPos(getValue('footerTop')-10);
upTime();
$(document).keypress(keyPress);
$("#yellow").html("• Apps");
$("#blue").html("• <span style='color:cyan;'>More Apps</span>");
$(".item").removeClass("hidden");
$("#loading").addClass("hidden");
if(hummy)
{ $('body').append(videoObject('video',0,0,1280,720));
//$('body').append(videoObject('pip',940,10,320,180));
$('#video').css('z-index',-99);
//$('#pip').css('z-index',-50);
//initApp();
initVideo();
//initPIP();
$('body').append(appmgrObject());
}
setDebug(chName());
setTimeout("setDebug('');",5500);
//load an array of the pugins
$.getScript("app/listplugins.jim");
setTimeout("initiTime();",2500);
});
function keyPress(event)
{ var kk=event.which;
var kc=event.keyCode;
var kb=(kk==kc) ? kk : 0;
if((kk == VK_RECORD) || (kk == VKA_QUESTION))
{ clickRecord();
event.preventDefault();
}
if(debugFlag)
{ $("#infobox").html("kk:" + kk + "/ kc:" + kc);
$("#infobox").removeClass("hidden");
setDebug(kk);
setTimeout("setDebug('--');",3500);
if(kk==VK_BACK) debugMode();
}
else
{ // key presses for active sub-menus
// numeric keys only kc==0 and kk==VK_1--VK_9
if(kc==0)
{ if(infobox=="red") redKeys(kk);
else if(infobox=="green") greenKeys(kk);
else if(infobox=="yellow") yellowKeys(kk);
else if(infobox=="blue") blueKeys(kk);
else if(infobox=="menu") menuKeys(kk);
else if((infobox=="selectRSSfeeds") && (kk>=VK_1) && (kk<=VK_9)) selectNews(kk-VK_1);
else if((infobox=="info") && (kk==VK_9)) clickInfo1();
else if(infobox=="appNews") appNewsKeys(kk);
else if(infobox=="info1") info1Keys(kk);
}
if((infobox=="") || (infobox=='appNews'))
{ if(kk==VK_UP) clickMoveUp();
if(kk==VK_DOWN) clickMoveDown();
}
mainKeys(kk,kc,kb);
}
event.preventDefault();
}
function redKeys(kk)
{ if (kk==VK_1) goURL("https://www.humaxtvportal.com/",1);
if (kk==VK_2)
{ goURL("http://www.humaxtvportal.com/Apps/iplayer/launcher.html",0);
//goURL("http://www.bbc.co.uk/iplayer/bigscreen@
// +"?avvp=ssl&avkb=pc,B:461&avui=tv@avdn=humax.stb.2010",0);
//goURL("file:/usr/browser/iplayer/portal_relay.html",0);
}
if (kk==VK_3) goURL("http://www.humaxtvportal.com:8094/PortalService/vTuner/index.htm?feed=favourite&level=top&siteLang=eng",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WikiTv",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/Flickr/",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/YouTube/",0);
if (kk==VK_7) goURL("https://www.humaxtvportal.com/Picasa/",0);
if (kk==VK_8) goURL("http://data.teletext.co.uk/iptv/index.html",0);
}
function greenKeys(kk)
{ if (kk==VK_1) goURL("file:/var/lib/humaxtv_backup/skyplayer/preset/init/init.html",0);
if (kk==VK_2) goURL("https://www.HumaxTVPortal.com/Twitter",0);
if (kk==VK_3) goURL("http://www.humaxtvportal.com/Facebook",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/metro_it/Index.html",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/HumaxDailyExpressSports/Index.html",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/humaxDday/Index.html",0);
if (kk==VK_7) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/humaxOkMagazine/Index.html",0);
if (kk==VK_8) goURL("http://test.humaxtvportal.com/SBS/",0);
if (kk==VK_9) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/HearingTest/Index.html",0);
}
function yellowKeys(kk)
{ var n= kk-VK_0;
if(n==1) startNews();
if((n>=appStart) && (n<appStart+plugins.length))
{ n=n-appStart;
goURL("plugin/"+encodeURI(plugins[n].name+'/'+plugins[n].file),0);
}
if (kk==VK_9) goURL("http://tv.tausoft.co.uk/chat/",1);
}
function blueKeys(kk)
{ if (kk==VK_1) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/ivid/Index.html",0);
if (kk==VK_2) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/FamilyMassage/Index.html",0);
if (kk==VK_3) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/CheckBody/Index.html",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/Metronome/Index.html",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/DoSquats/Index.html",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/GuitarChords/Index.html",0);
if (kk==VK_7) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/PushupMaster/Index.html",0);
if (kk==VK_8) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/SideBend/Index.html",0);
if (kk==VK_9) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/CoupleStretching/Index.html",0);
}
function menuKeys(kk)
{ if(kk==VK_1) selectRSSfeeds();
if(kk==VK_2) iTimeOnOff();
if(kk==VK_3) systemInfo();
if(kk==VK_4) goURL("http://localhost/index.shtml",1);
if(kk==VK_9) clickInfo();
}
function appNewsKeys(kk)
{ if (kk==VK_0)
{ endNews();
return;
}
else if((kk>=VK_1) && (kk<=VK_9)) selectNews(kk-VK_1);
}
function info1Keys(kk)
{ if(kk == VK_1) startTest();
else if(kk==VK_2) getGoURL();
else if(kk==VK_3) debugMode();
else if(kk==VK_7) goURL("http://tv.tausoft.co.uk/?random=" + swbeats(),1);
else if(kk==VK_8) goURL("http://192.168.0.10/tv/?random=" + swbeats(),1);
else if(kk==VK_9) clickReload();
}
function mainKeys(kk,kc,kb)
{ //main key presses
if((kk==VK_RED) || (kk==VKA_LCR) || (kk==VKA_UCR)
|| (kk==VKA_LCH)|| (kk==VKA_UCH)) clickRed();
else if((kk==VK_GREEN) || (kk==VKA_LCG) || (kk==VKA_UCG)
|| (kk==VKA_LCC) || (kk==VKA_UCC)) clickGreen();
else if((kk==VK_YELLOW) || (kk==VKA_LCY) || (kk==VKA_UCY)
|| (kk==VKA_LCA) || (kk==VKA_UCA)) clickYellow();
else if((kk==VK_BLUE) || (kk==VKA_LCB) || (kk==VKA_UCB)
|| (kk==VKA_LCB) || (kk==VKA_UCB)) clickBlue();
else if((kk==VK_MENU) || (kk==VKA_LCM) || (kk==VKA_UCM)) clickMenu();
else if((kk==VK_BACK) || (kk==VKA_BACKSPACE)) hideInfobox();
else if(kk==VK_0) clickZero();
else if(kk==VK_CHANNELUP) clickChannelUp();
else if(kk==VK_CHANNELDOWN) clickChannelDown();
}
function clickZero()
{ $(".item").toggleClass("hidden");
$("#time").removeClass("hidden");
hideInfobox();
$('#newsticker').remove();
}
function clickRed()
{ var obj="red";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:red;'>Humax Portal</p>"
+ "1. Original Humax Portal<br />"
+ "<hr />"
+ "2. BBC iPlayer<br/>"
+ "3. Internet Radio<br/>"
+ "4. WIKI @TV<br/>"
+ "5. flickr<br/>"
+ "6. YouTube<br/>"
+ "7. Picasa<br/>"
+ "8. teletext Holidays"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
//$(".red").removeClass("hidden");
}
function clickRecord()
{ //holding function
}
function debugMode()
{ // turn debug mode on/off
debugFlag= !debugFlag;
setDebug('');
}
function clickGreen()
{ var obj="green";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:green;'>Custom Portal</p>"
+ "1. Sky Player <span class='cgray small'>(0.9) (Now dead)</span><br />"
+ "2. Twitter<br />"
+ "3. Facebook <i class='cgray small'>fails to load</i><br />"
+ "4. Metro Newspaper<br />"
+ "5. Daily Express Newspapers<br />"
+ "6. DDay Tech News<br />"
+ "7. OK Magazine<br />"
+ "8. SBS on demand <i class='cgray small'>(Doesn't stream)</i><br />"
+ "9. Hearing Test<br />"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickYellow()
{ var obj="yellow";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
var x="<p style='color:yellow;'>Apps</p><p>";
x += "1. News Feed";
for(var i=0;i<plugins.length;i++)
{ x+="<br />"+(i+appStart)+". ";
x+=plugins[i].name;
}
x += "</p><p class='cgray centre small' style='margin:0px;'>"
+ "Mini-Apps & Plugins</p>";
$("#infobox").html(x);
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickBlue()
{ var obj="blue";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:cyan;'>More Apps</p>"
+ "1. iVid<br />"
+ "2. Family Massage<br />"
+ "3. Check Body<br />"
+ "4. Smart Metronome<br />"
+ "5. Do Squats<br />"
+ "6. Guitar Chords<br />"
+ "7. Push Up Master<br />"
+ "8. Side Bend<br />"
+ "9. Couples Stretching<br />"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickMenu()
{ var obj="menu";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:green;'>Menu</p>"
+ "1. Select Newsfeed<br />"
+ "2. Internet Time " + ((getValue("iTime")=="hidden") ? "ON" : "OFF")
+ "<br />"
+ "3. <span style='color:#222'>System Info</span><br />"
+ "4. Web IF <span class='cgray small'>(Not Working)</span><br />"
+ "<hr />"
+ "9. About... <i class='cgray small'>(formerly info)</i>"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function setVPos(v)
{ v=parseInt(v);
if(v>670) v=670;
if(v<10) v=10;
setValue("footerTop",v);
$('#footer').css('top',v+"px");
$('#newsticker').css('top',v+"px");
if(v>360)
$('#iTime').css('top',(v-35)+"px");
else
$('#iTime').css('top',(v+52)+"px");
}
function clickMoveUp()
{ setVPos(parseInt(getValue('footerTop'))-10);
}
function clickMoveDown()
{ setVPos(parseInt(getValue('footerTop'))+10);
}
function selectRSSfeeds()
{ var obj="menu";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox=="selectRSSfeeds") hideInfobox();
else
{ infobox="selectRSSfeeds";
var h="<p style='color:green;'>Select NewsFeed</p>";
for(var i=0;i<rssfeeds.length;i++)
{ h+=(i+1)+". ";
if(uriNo==i) h+="<span style='color:yellow'>";
h+=rssfeeds[i].name;
if(uriNo==i) h+="</span>";
h+="<br />";
}
$("#infobox").html(h);
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function systemInfo()
{ //nyi
}
function clickChannelUp()
{ var vid = document.getElementById('video');
try {
vid.onChannelChangeSucceeded = function() {
vid.onChannelChangeSucceeded = null;
if (vid.currentChannel)
{ var name=vid.currentChannel.name.substr(1);
if(name=='') clickChannelUp();
else
{ setDebug(name);
setTimeout("setDebug('');",5500);
}
} else {
setDebug('CH+ Fail');
}
};
vid.nextChannel();
} catch (e) {
setDebug('CH+ Failed');
return;
}
}
function clickChannelDown()
{ var vid = document.getElementById('video');
try {
vid.onChannelChangeSucceeded = function() {
vid.onChannelChangeSucceeded = null;
if (vid.currentChannel)
{ var name=vid.currentChannel.name.substr(1);
if(name=='') clickChannelDown();
else
{ setDebug(name);
setTimeout("setDebug('');",5500);
}
} else {
setDebug('CH- Fail');
}
};
vid.prevChannel();
} catch (e) {
setDebug('CH- Failed');
return;
}
}
function clickInfo1()
{ $("#infobox").html(
"1. Test App<br />"
+ "2. Enter Test URL<br />"
+ "3. Scancode Test Mode " + (debugFlag ? "Off" : "On") +"<br />"
+ "<hr />"
+ "7. tv.TauSoft.co.uk Portal<br />"
+ "8. Home Server 192.x.x.x<br />"
+ "9. Reload This Page<br />"
+ "<span class='small cgray'>"
+ window.location.href + "</span>");
positionInfobox("yellow");
infobox="info1";
}
function clickReload()
{ //clearCookies();
$("#loading").removeClass("hidden");
$(".item").addClass("hidden");
hideInfobox();
setDebug("Reload");
window.location.reload();
}
function clickInfo()
{ var obj="info";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:purple;'>Portal xTRa</p>"
+"<p style='text-align:center;color:#222;"
+ "font-size:66%;margin:0px;'>"
+ "'Portal xTRa', a Hummy Portal by spayz,<br />"
+ "Colour Coded Navigation, Apps,<br />"
+ "News Feed & Chat.<br />"
+ "Press '0' zero to hide/show controls.<br />"
+ "Up/Down to move controls.</p>"
+ "<p class='centre cgray small' style='margin:0px;'>"
+ "v." + version + " "
+ copyright +"</p>");
positionInfobox("menu");
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function getGoURL()
{ var u=prompt("Enter URL : http:////","");
if(u!='') goURL('http://'+u,0);
}
function startTest()
{ $("#infobox").html("<div id='test'></div>");
//apiCall("#test","testApp",0);
appendPS("#infobox",ch.toJSONString() );
$("#infobox").removeClass("hidden");
positionInfoboxRight();
//rssfeeds[0]={uri:"http://feeds.bbci.co.uk/news/rss.xml", name:"BBC News"};
//rssfeeds[1]={uri:"http://feeds.bbci.co.uk/news/technology/rss.xml";, name:"BBC Technology"};
var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 5";
var url=yql+encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=tcb";
//var url="app/api.jim?callback=?";
appendPS("#infobox","-----------");
//appendPS("#infobox","url:" + url);
//appendPS("#infobox","-----------");
$.getScript(url,function(data)
{ //appendPS("#infobox","iJSONP OK");
//appendPS("#infobox","itypeOf.data:" + typeof(data));
//appendPS("#infobox","itypeOf.data.2JSS:" + typeof(data.toJSONString() ) );
//appendPS("#infobox","idata.toJSS:" + data.toJSONString() );
//appendPS("#infobox","idata.count:" + data.count );
});
// .success(function() { alert("JSONP 2nd Success"); })
// .complete(function() { alert("JSONP Complete"); })
// .error(function() { alert("JSONP Error"); });
}
function tcb(data)
{ appendPS("#infobox","JSONP OK");
appendPS("#infobox","typeOf.data:" + typeof(data));
appendPS("#infobox","typeOf.data.2JSS:" + typeof(data.toJSONString() ) );
appendPS("#infobox","data.toJSS:" + data.toJSONString() );
appendPS("#infobox","data.count:" + data.count );
}
function appendPS(o,t)
{ $(o).append("<p class='small'>" + t + "</p>");
}
function startNews()
{ //$("#infobox").html("<div id='newsH1'>News Headlines</div>");
//$("#infobox").removeClass("hidden");
//positionInfoboxRight();
$('#newsticker').remove();
hideInfobox();
$('.item').addClass("hidden");
$("#time").removeClass("hidden");
//create ticker box
$('body').append("<div id='newsticker'><div class='newslist'>"
+"<div id='newsitem1' class='newsitem'>Loading Newsfeed</div>"
+"<div id='newsitem2' class='newsitem'></div></div></div>");
infobox="appNews";
//alert("uriNo "+uriNo);
//alert("uriNo.Name "+rssfeeds[uriNo].name);
//alert("uriNo.Name "+rssfeeds[uriNo].uri);
var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 9";
var url=yql+ encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=newsCB";
//alert(url);
$.getScript(url);
setVPos(parseInt(getValue('footerTop')));
}
function selectNews(n)
{ if((n>=0) && (n<rssfeeds.length))
{ setValue("rssURL",n);
uriNo=n;
setDebug(rssfeeds[uriNo].name);
setTimeout("setDebug('');",2000);
if(infobox=="appNews")
{ var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 9";
var url=yql+ encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=newsChange";
//alert(url);
$.getScript(url);
}
else
{ startNews();
}
}
}
function newsChange(data)
{ newsCount=data.query.count;
newsRSS=data;
}
function newsCB(data)
{ //save news to a global variable
//if((typeof(data.query.results)=="object") && (data.query.results!==null))
{ //alert(data.query.results);
// var yql="http://query.yahooapis.com/v1/public/yql?q=";
// var newsRSS=null;
// var newsCount=0;
// var newsInterval=3000;
// var newsCurrent=0;
// newsRSS.query.created);
// newsRSS.query.results.item[i].item
// newsRSS.query.results.item[i].description
newsRSS=data;
newsCount=data.query.count;
//for(var i=0;i<newsCount;i++)
{ //$.("#newsticker").append("<div class='newsitem'>"
// + newsRSS.query.results.item[i].title + "</div>");
}
if((newsCurrent<0) || (newsCurrent>=newsCount)) newsCurrent=0;
var newNews=fromInfo() + newsRSS.query.results.item[newsCurrent].title;
$('#newsitem1').html(newNews);
$('#newsitem2').html(newNews);
setTimeout("nextNews();",newsInterval);
}
}
function nextNews()
{ if(infobox=='appNews')
{ $('#newsitem1').html($('#newsitem2').html())
$("#newslist").css("top","0px");
newsCurrent++;
if((newsCurrent<0) || (newsCurrent>=newsCount)) newsCurrent=0;
var newNews=fromInfo() + newsRSS.query.results.item[newsCurrent].title;
$('#newsitem2').html(newNews);
scrollUp(0);
if(infobox=='appNews') setTimeout("nextNews();",newsInterval);
}
// if menu is not appNews, then abandon the update process
}
function fromInfo()
{ return "<div class='newssource'>"
+"(" + (1+uriNo) +") " +rssfeeds[uriNo].name+"<br />"
+"Updated " + newsRSS.query.created.substr(11,5)
+" " + newsRSS.query.created.substr(5,5)
+"</div>"
}
function scrollUp(i)
{ if(infobox=='appNews')
{ //var tp=$("#time").offset().top;
$(".newslist").css("top",i+"px");
if(i>=-36) setTimeout("scrollUp(" + (i-3) + ");",90);
}
}
function endNews()
{ infobox="";
clickZero();
$('#newsticker').remove();
}
function showNews(kk)
{ //TBA
}
function apiCall(o,c,h)
{ //alpha test
if(h==1) $(o).addClass("hidden");
$(o).html('');
var htt="app/api.jim?action=";
//var htt="http://localhost/portal/plugin/xtra1/app/api.jim?action=";
$(o).load(htt + c);
}
function apiCallinfobox(c)
{ apiCall('#infobox',c,1);
infobox="apiCall-" + c;
positionInfoboxRight();
$("#infobox").removeClass("hidden");
setDebug("Running App:" + c);
setTimeout("setDebug('');",2000);
}
function positionInfoboxRight()
{ $("#infobox").css("top","2%");
$("#infobox").css("left","75%");
$("#infobox").css("width","21%");
$("#infobox").css("height","80%");
}
function goURL(u,tv)
{ hideInfobox();
$(".item").addClass("hidden");
$("#iTime").addClass("hidden");
$("#loading").removeClass("hidden");
if(tv==0) document.getElementById('video').setTVOff();
window.location.href=u;
}
function initiTime()
{ //var tp=$("#time").offset().top;
var lf=$("#time").offset().left;
var wd=$("#time").width();
var ht=$("#iTime").outerHeight();
var iw=$("#iTime").outerWidth();
//$("#iTime").css("top",(tp-ht-6)+"px");
$("#iTime").css("left",(lf+10)+"px");
if(getValue("iTime")=="hidden")
$("#iTime").addClass("hidden");
else
$("#iTime").removeClass("hidden");
}
function iTimeOnOff()
{ hideInfobox();
var k=getValue("iTime");
if(k!="hidden")
{ setValue("iTime","hidden");
$("#iTime").addClass("hidden");
}
else
{ setValue("iTime","on");
$("#iTime").removeClass("hidden");
}
}
function hideInfobox()
{ infobox="";
$("#infobox").addClass("hidden");
$("#infobox").html("");
}
function positionInfobox(obj)
{ $('#newsticker').remove();
$("#infobox").css("width","auto");
$("#infobox").css("height","auto");
$("#infobox").removeClass("small");
$("#" + obj).css("position","absolute");
var tp=$("#footer").offset().top;
var lf=$("#" + obj).offset().left;
$("#" + obj).css("position","relative");
var ht=$("#infobox").outerHeight();
if(tp>360)
$("#infobox").css("top",(tp-ht-10)+"px");
else
$("#infobox").css("top",(tp+50)+"px");
$("#infobox").css("left",lf+"px");
}
function chName()
{ var xx="";
if(hummy)
try
{ //var conF = window.oipfObjectFactory.createConfigurationObject();
//var conL = conF.localSystem;
xx= ch.name.substr(1);
}
catch (e)
{ xx=e.name;
}
return xx;
}
// -- Library Functions --
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value)
+ ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{ var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{ x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{ return unescape(y);
}
}
return null ;
}
function setValue(k,v)
{ // localStorgae
// globalStroage
// cookies
// database - not yet implmented
// do not use sessionStorage, not persistent
var r=false;
if(typeof(localStorage)=='object')
{ localStorage.setItem(k,v);
r=true;
}
if(typeof(globalStorage)=='object')
{ eval("globalStorage['" + location.hostname + "']." + k + "='" + v + "';");
r=true;
}
setCookie(k,v,999);
if(typeof(openDatabase)=="function")
{ // NOT YET IMPLMENTED
}
return r
}
function getValue(k)
{ var v=null;
if(typeof(localStorage)=='object')
{ v=localStorage.getItem(k);
}
if((v==null) || (v=='')) if(typeof(globalStorage)=='object')
{ eval("v=globalStorage['" + location.hostname + "']." + k +";");
}
if((v==null) || (v=='')) v=getCookie(k);
return v;
}
function deleteValue(k)
{ if(typeof(localStorage)=='object')
{ localStorage.setItem(k,"");
r=true;
}
if(typeof(globalStorage)=='object')
{ eval("globalStorage['" + location.hostname + "']." + k + "='';");
r=true;
}
setCookie(k,"",-99);
}
function setDebug(a)
{ $("#debug").html(a);
}
function zPad(s,n)
{ var p="000"+s;
return p.slice(-1*n);
}
function swbeats()
{ var dt = new Date();
var cbt = dt.getUTCHours()*60 + dt.getUTCMinutes();
cbt = cbt + 60; // changes to BMT
cbt = cbt*60 + dt.getUTCSeconds();
cbt = cbt*1000 + dt.getUTCMilliseconds();
cbt = Math.floor(cbt / 864);
if (cbt<0) cbt = cbt + 100000;
if (cbt>=100000) cbt = cbt - 100000;
var bts = "00000" + cbt;
bts = bts.substring(bts.length-5,bts.length);
return (bts.substring(0,3) + "." + bts.substring(3,4));
}
function strJulian()
{ var dt = new Date()
var dt0= new Date(dt.getUTCFullYear(),0,1);
var jd=1+Math.floor((dt.getTime()-dt0.getTime())/1000/60/60/24);
var st= "" + dt.getUTCFullYear() + "-" + zPad(jd,3);
return st;
}
function strTime()
{ var dt = new Date();
return zPad(dt.getHours(),2) + ":" + zPad(dt.getMinutes(),2) +
":" + zPad(dt.getSeconds(),2) +
" " + zPad(dt.getDate(),2) +"/" + zPad(1+dt.getMonth(),2) ;
}
function upTime()
{ var st = strTime();
var jt = strJulian() + "@" + swbeats() ;
if((st != rt1) || (jt != jt1))
{ if(st != rt1)
{ $("#time").html(st);
rt1 = st;
}
if(jt != jt1)
{ $("#iTime").html(jt);
jt1 = st;
}
}
setTimeout("upTime();",490);
}
// -- Experimental Functions --
function chInfo()
{ var xx="iNA";
if(hummy)
try {
var obF = window.oipfObjectFactory;
xx=typeof(obF);
//var ch = // document.getElementById('appmgr')
//.getOwnerApplication(document).privateData.currentChannel;
//var type = ch.channelType;
//type = type==ch.TYPE_TV?'TV':(type==ch.TYPE_RADIO?'Radio':'unknown');
//var succ = type=='TV'
//&& ((ch.onid==service1[0]&&ch.tsid==service1[1]&&ch.sid==service1[2])
// || (ch.onid==service2[0]&&ch.tsid==service2[1]&&ch.sid==service2[2]));
//xx= '='+ch.onid+'.'+ch.tsid+'.'+ch.sid+' +' type='+type+', name='+ch.name ;
//xx=chCfg() + " " + ch.name.substr(1);
//document.getElementById('appmgr').getOwnerApplication(document).nextChannel();
} catch (e) {
xx="iEE";
}
return xx;
}
function chCfg()
{ var xx="cNA";
try {
var cfg = document.getElementById('oipfcfg');
xx=typeOf(cfg);
}
catch (e) {
xx='cEE';
}
return xx;
}
function getCookiesArray()
{ var cookies = { };
if (document.cookie && document.cookie != '')
{ var split = document.cookie.split(';');
for (var i = 0; i < split.length; i++)
{ var name_value = split[i].split("=");
name_value[0] = name_value[0].replace(/^ /, '');
cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
}
}
return cookies;
}
function clearCookies()
{ if (document.cookie && document.cookie != '')
{ var split = document.cookie.split(';');
for (var i = 0; i < split.length; i++)
{ var name_value = split[i].split("=");
name_value[0] = name_value[0].replace(/^ /, '');
var name=decodeURIComponent(name_value[0]);
setValue(name,"");
setCookie(name,"",-99);
}
}
}
function videoObject(n,left,top,width,height)
{ //left=0, top=0, width=1280, height=720
return '<object id="'+n+'" '
+'type="video/broadcast" style="position:absolute;'
+'left:'+left+'px;top:'+top+'px;width:'+width+'px;height:'+height+'px;">'
+'</object>';
}
function initVideo() {
try {
document.getElementById('video').setTVOn();
document.getElementById('video').bindToCurrentChannel();
} catch (e) {
// ignore
}
try {
document.getElementById('video').setTVOn();
document.getElementById('video').setFullScreen(false);
} catch (e) {
// ignore
}
}
function initPIP() {
try {
document.getElementById('pip').setTVOn();
//document.getElementById('video').bindToCurrentChannel();
} catch (e) {
// ignore
}
}
//-----
// from base.js
function initApp() {
try {
var app = document.getElementById('appmgr').getOwnerApplication(document);
app.show();
app.activate();
} catch (e) {
// ignore
}
//setKeyset(0x1+0x2+0x4+0x8+0x10);
//setKeyset(0x1);
}
function setKeyset(mask) {
// for HbbTV 0.5:
try {
var elemcfg = document.getElementById('oipfcfg');
elemcfg.keyset.value = mask;
} catch (e) {
// ignore
}
try {
var elemcfg = document.getElementById('oipfcfg');
elemcfg.keyset.setValue(mask);
} catch (e) {
// ignore
}
// for HbbTV 1.0:
try {
var app = document.getElementById('appmgr').getOwnerApplication(document);
app.privateData.keyset.setValue(mask);
app.privateData.keyset.value = mask;
} catch (e) {
// ignore
}
}
function appmgrObject()
{ return '<object id="appmgr" type="application/oipfApplicationManager" '
+'style="position:absolute;left:0px;top:0px;width:0px;height:0px;"></object>'
+'<object id="oipfcfg" type="application/oipfConfiguration" '
+'style="position:absolute;left:0px;top:0px;width:0px;height:0px;"></object>';
}
// Portal xTRa Web TV Portal
// =================== ethel
// HDRT2 User Agent--HbbTV/1.1.1 (+PVR;;;;avdn/humax.stb.2010) ANTGalio/3.1.5.24.04.09.04
var copyright="©MMXI tausoft.co.uk";
var version="1.12.064.300";
var rt1="";
var jt1="";
var debugFlag=0;
var menupos=0;
var infobox="";
var hummy=(navigator.userAgent.indexOf('HbbTV')>=0);
var yql="http://query.yahooapis.com/v1/public/yql?q=";
var newsRSS=null;
var newsCount=0;
var newsInterval=4750;
var newsCurrent=0;
var rssfeeds=new Array();
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/rss.xml", name:"BBC News"});
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/technology/rss.xml", name:"BBC Technology"});
rssfeeds.push({uri:"http://feeds.bbci.co.uk/news/science_and_environment/rss.xml", name:"BBC Science & Environment"});
rssfeeds.push({uri:"http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml", name:"BBC Sport"});
rssfeeds.push({uri:"http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml", name:"BBC Football"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_world.rss", name:"CNN World News"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_europe.rss", name:"CNN European News"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_technology.rss", name:"CNN Technology"});
//rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_space.rss", name:"CNN Science & Space"});
rssfeeds.push({uri:"http://rss.cnn.com/rss/edition_sport.rss", name:"CNN Sport"});
// how many builtin app?, plugin apps start at...
var plugins=new Array();
var appStart=2;
var appMan,ownerApp,ch;
//--to be removed, deprecated, use <embedded> objects in $.ready()
if(hummy)
{ var appMan = window.oipfObjectFactory.createApplicationManagerObject();
var ownerApp=appMan.getOwnerApplication(document);
var ch = ownerApp.privateData.currentChannel;
}
//---
if(typeof(rt1.toJSONString)=='undefined')
{ $.getScript("js/json2.js"); }
var uriNo=parseInt(getValue("rssURL"));
if(isNaN(uriNo))
{ setValue("rssURL",0);
uriNo=0;
}
if(getValue("iTime")==null)
{ setValue("iTime","hidden");
}
if(getValue("footerTop")==null)
{ setValue("footerTop",670);
}
$(document).ready(function()
{ $(".item").addClass("hidden");
$("body").removeClass("hidden");
setVPos(getValue('footerTop')-10);
upTime();
$(document).keypress(keyPress);
$("#yellow").html("• Apps");
$("#blue").html("• <span style='color:cyan;'>Xtra</span>");
$(".item").removeClass("hidden");
$("#loading").addClass("hidden");
if(hummy)
{ $('body').append(videoObject('video',0,0,1280,720));
//$('body').append(videoObject('pip',940,10,320,180));
$('#video').css('z-index',-99);
//$('#pip').css('z-index',-50);
//initApp();
initVideo();
//initPIP();
$('body').append(appmgrObject());
}
setDebug(chName());
setTimeout("setDebug('');",5500);
//load an array of the pugins
$.getScript("app/listplugins.jim");
setTimeout("initiTime();",2500);
});
function keyPress(event)
{ var kk=event.which;
var kc=event.keyCode;
var kb=(kk==kc) ? kk : 0;
if((kk == VK_RECORD) || (kk == VKA_QUESTION))
{ clickRecord();
event.preventDefault();
}
if(debugFlag)
{ $("#infobox").html("kk:" + kk + "/ kc:" + kc);
$("#infobox").removeClass("hidden");
setDebug(kk);
setTimeout("setDebug('--');",3500);
if(kk==VK_BACK) debugMode();
}
else
{ // key presses for active sub-menus
// numeric keys only kc==0 and kk==VK_1--VK_9
if(kc==0)
{ if(infobox=="red") redKeys(kk);
else if(infobox=="green") greenKeys(kk);
else if(infobox=="yellow") yellowKeys(kk);
else if(infobox=="blue") blueKeys(kk);
else if(infobox=="menu") menuKeys(kk);
else if((infobox=="selectRSSfeeds") && (kk>=VK_1) && (kk<=VK_9)) selectNews(kk-VK_1);
else if((infobox=="info") && (kk==VK_9)) clickInfo1();
else if(infobox=="appNews") appNewsKeys(kk);
else if(infobox=="info1") info1Keys(kk);
}
if((infobox=="") || (infobox=='appNews'))
{ if(kk==VK_UP) clickMoveUp();
if(kk==VK_DOWN) clickMoveDown();
}
mainKeys(kk,kc,kb);
}
event.preventDefault();
}
function redKeys(kk)
{ if (kk==VK_1) goURL("https://www.humaxtvportal.com/",1);
if (kk==VK_2)
{ goURL("http://www.humaxtvportal.com/Apps/iplayer/launcher.html",0);
//goURL("http://www.bbc.co.uk/iplayer/bigscreen@
// +"?avvp=ssl&avkb=pc,B:461&avui=tv@avdn=humax.stb.2010",0);
//goURL("file:/usr/browser/iplayer/portal_relay.html",0);
}
if (kk==VK_3) goURL("http://www.humaxtvportal.com:8094/PortalService/vTuner/index.htm?feed=favourite&level=top&siteLang=eng",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WikiTv",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/Flickr/",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/YouTube/",0);
if (kk==VK_7) goURL("https://www.humaxtvportal.com/Picasa/",0);
if (kk==VK_8) goURL("http://data.teletext.co.uk/iptv/index.html",0);
}
function greenKeys(kk)
{ if (kk==VK_1) goURL("file:/var/lib/humaxtv_backup/skyplayer/preset/init/init.html",0);
if (kk==VK_2) goURL("https://www.HumaxTVPortal.com/Twitter",0);
if (kk==VK_3) goURL("http://www.humaxtvportal.com/Facebook",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/metro_it/Index.html",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/HumaxDailyExpressSports/Index.html",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/humaxDday/Index.html",0);
if (kk==VK_7) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/humaxOkMagazine/Index.html",0);
if (kk==VK_8) goURL("http://test.humaxtvportal.com/SBS/",0);
if (kk==VK_9) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/HearingTest/Index.html",0);
}
function yellowKeys(kk)
{ var n= kk-VK_0;
if(n==1) startNews();
if((n>=appStart) && (n<appStart+plugins.length))
{ n=n-appStart;
goURL("plugin/"+encodeURI(plugins[n].name+'/'+plugins[n].file),0);
}
if (kk==VK_9) goURL("http://tv.tausoft.co.uk/chat/",1);
}
function blueKeys(kk)
{ if (kk==VK_1) goURL("http://test.humaxtvportal.com/WebApps/ObigoWebApps/ivid/Index.html",0);
if (kk==VK_2) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/FamilyMassage/Index.html",0);
if (kk==VK_3) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/CheckBody/Index.html",0);
if (kk==VK_4) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/Metronome/Index.html",0);
if (kk==VK_5) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/DoSquats/Index.html",0);
if (kk==VK_6) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/GuitarChords/Index.html",0);
if (kk==VK_7) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/PushupMaster/Index.html",0);
if (kk==VK_8) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/SideBend/Index.html",0);
if (kk==VK_9) goURL("http://test.humaxtvportal.com/WebApps/HandStudio/CoupleStretching/Index.html",0);
}
function menuKeys(kk)
{ if(kk==VK_1) selectRSSfeeds();
if(kk==VK_2) iTimeOnOff();
if(kk==VK_3) systemInfo();
if(kk==VK_4) goURL("http://localhost/index.shtml",1);
if(kk==VK_9) clickInfo();
}
function appNewsKeys(kk)
{ if (kk==VK_0)
{ endNews();
return;
}
else if((kk>=VK_1) && (kk<=VK_9)) selectNews(kk-VK_1);
}
function info1Keys(kk)
{ if(kk == VK_1) startTest();
else if(kk==VK_2) getGoURL();
else if(kk==VK_3) debugMode();
else if(kk==VK_7) goURL("http://tv.tausoft.co.uk/?random=" + swbeats(),1);
else if(kk==VK_8) goURL("http://192.168.0.10/tv/?random=" + swbeats(),1);
else if(kk==VK_9) clickReload();
}
function mainKeys(kk,kc,kb)
{ //main key presses
if((kk==VK_RED) || (kk==VKA_LCR) || (kk==VKA_UCR)
|| (kk==VKA_LCH)|| (kk==VKA_UCH)) clickRed();
else if((kk==VK_GREEN) || (kk==VKA_LCG) || (kk==VKA_UCG)
|| (kk==VKA_LCC) || (kk==VKA_UCC)) clickGreen();
else if((kk==VK_YELLOW) || (kk==VKA_LCY) || (kk==VKA_UCY)
|| (kk==VKA_LCA) || (kk==VKA_UCA)) clickYellow();
else if((kk==VK_BLUE) || (kk==VKA_LCB) || (kk==VKA_UCB)
|| (kk==VKA_LCB) || (kk==VKA_UCB)) clickBlue();
else if((kk==VK_MENU) || (kk==VKA_LCM) || (kk==VKA_UCM)) clickMenu();
else if((kk==VK_BACK) || (kk==VKA_BACKSPACE)) hideInfobox();
else if(kk==VK_0) clickZero();
else if(kk==VK_CHANNELUP) clickChannelUp();
else if(kk==VK_CHANNELDOWN) clickChannelDown();
}
function clickZero()
{ $(".item").toggleClass("hidden");
$("#time").removeClass("hidden");
hideInfobox();
$('#newsticker').remove();
}
function clickRed()
{ var obj="red";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:red;'>Humax Portal</p>"
+ "1. Original Humax Portal<br />"
+ "<hr />"
+ "2. BBC iPlayer<br/>"
+ "3. Internet Radio<br/>"
+ "4. WIKI @TV<br/>"
+ "5. flickr<br/>"
+ "6. YouTube<br/>"
+ "7. Picasa<br/>"
+ "8. teletext Holidays"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
//$(".red").removeClass("hidden");
}
function clickRecord()
{ //holding function
}
function debugMode()
{ // turn debug mode on/off
debugFlag= !debugFlag;
setDebug('');
}
function clickGreen()
{ var obj="green";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:green;'>Custom Portal</p>"
+ "1. Sky Player <span class='cgray small'>(0.9) (Working!)</span><br />"
+ "2. Twitter<br />"
+ "3. Facebook <i class='cgray small'>fails to load</i><br />"
+ "4. Metro Newspaper<br />"
+ "5. Daily Express Newspapers<br />"
+ "6. DDay Tech News<br />"
+ "7. OK Magazine<br />"
+ "8. SBS on demand <i class='cgray small'>(Doesn't stream)</i><br />"
+ "9. Hearing Test<br />"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickYellow()
{ var obj="yellow";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
var x="<p style='color:yellow;'>Apps</p><p>";
x += "1. News Feed";
for(var i=0;i<plugins.length;i++)
{ x+="<br />"+(i+appStart)+". ";
x+=plugins[i].name;
}
x += "</p><p class='cgray centre small' style='margin:0px;'>"
+ "Mini-Apps & Plugins</p>";
$("#infobox").html(x);
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickBlue()
{ var obj="blue";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:cyan;'>More Apps</p>"
+ "1. iVid<br />"
+ "2. Family Massage<br />"
+ "3. Check Body<br />"
+ "4. Smart Metronome<br />"
+ "5. Do Squats<br />"
+ "6. Guitar Chords<br />"
+ "7. Push Up Master<br />"
+ "8. Side Bend<br />"
+ "9. Couples Stretching<br />"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function clickMenu()
{ var obj="menu";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:green;'>Menu</p>"
+ "1. Select Newsfeed<br />"
+ "2. Internet Time " + ((getValue("iTime")=="hidden") ? "ON" : "OFF")
+ "<br />"
+ "3. <span style='color:#222'>System Info</span><br />"
+ "4. Web IF <span class='cgray small'>(Not Working)</span><br />"
+ "<hr />"
+ "9. About... <i class='cgray small'>(formerly info)</i>"
+ "");
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function setVPos(v)
{ v=parseInt(v);
if(v>670) v=670;
if(v<10) v=10;
setValue("footerTop",v);
$('#footer').css('top',v+"px");
$('#newsticker').css('top',v+"px");
if(v>360)
$('#iTime').css('top',(v-35)+"px");
else
$('#iTime').css('top',(v+52)+"px");
}
function clickMoveUp()
{ setVPos(parseInt(getValue('footerTop'))-10);
}
function clickMoveDown()
{ setVPos(parseInt(getValue('footerTop'))+10);
}
function selectRSSfeeds()
{ var obj="menu";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox=="selectRSSfeeds") hideInfobox();
else
{ infobox="selectRSSfeeds";
var h="<p style='color:green;'>Select NewsFeed</p>";
for(var i=0;i<rssfeeds.length;i++)
{ h+=(i+1)+". ";
if(uriNo==i) h+="<span style='color:yellow'>";
h+=rssfeeds[i].name;
if(uriNo==i) h+="</span>";
h+="<br />";
}
$("#infobox").html(h);
positionInfobox(obj);
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function systemInfo()
{ //nyi
}
function clickChannelUp()
{ var vid = document.getElementById('video');
try {
vid.onChannelChangeSucceeded = function() {
vid.onChannelChangeSucceeded = null;
if (vid.currentChannel)
{ var name=vid.currentChannel.name.substr(1);
if(name=='') clickChannelUp();
else
{ setDebug(name);
setTimeout("setDebug('');",5500);
}
} else {
setDebug('CH+ Fail');
}
};
vid.nextChannel();
} catch (e) {
setDebug('CH+ Failed');
return;
}
}
function clickChannelDown()
{ var vid = document.getElementById('video');
try {
vid.onChannelChangeSucceeded = function() {
vid.onChannelChangeSucceeded = null;
if (vid.currentChannel)
{ var name=vid.currentChannel.name.substr(1);
if(name=='') clickChannelDown();
else
{ setDebug(name);
setTimeout("setDebug('');",5500);
}
} else {
setDebug('CH- Fail');
}
};
vid.prevChannel();
} catch (e) {
setDebug('CH- Failed');
return;
}
}
function clickInfo1()
{ $("#infobox").html(
"1. Test App<br />"
+ "2. Enter Test URL<br />"
+ "3. Scancode Test Mode " + (debugFlag ? "Off" : "On") +"<br />"
+ "<hr />"
+ "7. tv.TauSoft.co.uk Portal<br />"
+ "8. Home Server 192.x.x.x<br />"
+ "9. Reload This Page<br />"
+ "<span class='small cgray'>"
+ window.location.href + "</span>");
positionInfobox("yellow");
infobox="info1";
}
function clickReload()
{ //clearCookies();
$("#loading").removeClass("hidden");
$(".item").addClass("hidden");
hideInfobox();
setDebug("Reload");
window.location.reload();
}
function clickInfo()
{ var obj="info";
$("#infobox").addClass("hidden");
$(".item").removeClass("hidden");
if(infobox==obj) hideInfobox();
else
{ infobox=obj;
$("#infobox").html("<p style='color:purple;'>Portal xTRa</p>"
+"<p style='text-align:center;color:#222;"
+ "font-size:66%;margin:0px;'>"
+ "'Portal xTRa', a Hummy Portal by spayz,<br />"
+ "Colour Coded Navigation, Apps,<br />"
+ "News Feed & Chat.<br />"
+ "Press '0' zero to hide/show controls.<br />"
+ "Up/Down to move controls.</p>"
+ "<p class='centre cgray small' style='margin:0px;'>"
+ "v." + version + " "
+ copyright +"</p>");
positionInfobox("menu");
$("#infobox").removeClass("hidden");
setDebug(obj);
setTimeout("setDebug('');",2000);
}
}
function getGoURL()
{ var u=prompt("Enter URL : http:////","");
if(u!='') goURL('http://'+u,0);
}
function startTest()
{ $("#infobox").html("<div id='test'></div>");
//apiCall("#test","testApp",0);
appendPS("#infobox",ch.toJSONString() );
$("#infobox").removeClass("hidden");
positionInfoboxRight();
//rssfeeds[0]={uri:"http://feeds.bbci.co.uk/news/rss.xml", name:"BBC News"};
//rssfeeds[1]={uri:"http://feeds.bbci.co.uk/news/technology/rss.xml";, name:"BBC Technology"};
var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 5";
var url=yql+encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=tcb";
//var url="app/api.jim?callback=?";
appendPS("#infobox","-----------");
//appendPS("#infobox","url:" + url);
//appendPS("#infobox","-----------");
$.getScript(url,function(data)
{ //appendPS("#infobox","iJSONP OK");
//appendPS("#infobox","itypeOf.data:" + typeof(data));
//appendPS("#infobox","itypeOf.data.2JSS:" + typeof(data.toJSONString() ) );
//appendPS("#infobox","idata.toJSS:" + data.toJSONString() );
//appendPS("#infobox","idata.count:" + data.count );
});
// .success(function() { alert("JSONP 2nd Success"); })
// .complete(function() { alert("JSONP Complete"); })
// .error(function() { alert("JSONP Error"); });
}
function tcb(data)
{ appendPS("#infobox","JSONP OK");
appendPS("#infobox","typeOf.data:" + typeof(data));
appendPS("#infobox","typeOf.data.2JSS:" + typeof(data.toJSONString() ) );
appendPS("#infobox","data.toJSS:" + data.toJSONString() );
appendPS("#infobox","data.count:" + data.count );
}
function appendPS(o,t)
{ $(o).append("<p class='small'>" + t + "</p>");
}
function startNews()
{ //$("#infobox").html("<div id='newsH1'>News Headlines</div>");
//$("#infobox").removeClass("hidden");
//positionInfoboxRight();
$('#newsticker').remove();
hideInfobox();
$('.item').addClass("hidden");
$("#time").removeClass("hidden");
//create ticker box
$('body').append("<div id='newsticker'><div class='newslist'>"
+"<div id='newsitem1' class='newsitem'>Loading Newsfeed</div>"
+"<div id='newsitem2' class='newsitem'></div></div></div>");
infobox="appNews";
//alert("uriNo "+uriNo);
//alert("uriNo.Name "+rssfeeds[uriNo].name);
//alert("uriNo.Name "+rssfeeds[uriNo].uri);
var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 9";
var url=yql+ encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=newsCB";
//alert(url);
$.getScript(url);
setVPos(parseInt(getValue('footerTop')));
}
function selectNews(n)
{ if((n>=0) && (n<rssfeeds.length))
{ setValue("rssURL",n);
uriNo=n;
setDebug(rssfeeds[uriNo].name);
setTimeout("setDebug('');",2000);
if(infobox=="appNews")
{ var uri="select title,description from rss where url="
+ '"' + rssfeeds[uriNo].uri + '"'
+ " limit 9";
var url=yql+ encodeURIComponent(uri)
+"&format=json&diagnostics=true&callback=newsChange";
//alert(url);
$.getScript(url);
}
else
{ startNews();
}
}
}
function newsChange(data)
{ newsCount=data.query.count;
newsRSS=data;
}
function newsCB(data)
{ //save news to a global variable
//if((typeof(data.query.results)=="object") && (data.query.results!==null))
{ //alert(data.query.results);
// var yql="http://query.yahooapis.com/v1/public/yql?q=";
// var newsRSS=null;
// var newsCount=0;
// var newsInterval=3000;
// var newsCurrent=0;
// newsRSS.query.created);
// newsRSS.query.results.item[i].item
// newsRSS.query.results.item[i].description
newsRSS=data;
newsCount=data.query.count;
//for(var i=0;i<newsCount;i++)
{ //$.("#newsticker").append("<div class='newsitem'>"
// + newsRSS.query.results.item[i].title + "</div>");
}
if((newsCurrent<0) || (newsCurrent>=newsCount)) newsCurrent=0;
var newNews=fromInfo() + newsRSS.query.results.item[newsCurrent].title;
$('#newsitem1').html(newNews);
$('#newsitem2').html(newNews);
setTimeout("nextNews();",newsInterval);
}
}
function nextNews()
{ if(infobox=='appNews')
{ $('#newsitem1').html($('#newsitem2').html())
$("#newslist").css("top","0px");
newsCurrent++;
if((newsCurrent<0) || (newsCurrent>=newsCount)) newsCurrent=0;
var newNews=fromInfo() + newsRSS.query.results.item[newsCurrent].title;
$('#newsitem2').html(newNews);
scrollUp(0);
if(infobox=='appNews') setTimeout("nextNews();",newsInterval);
}
// if menu is not appNews, then abandon the update process
}
function fromInfo()
{ return "<div class='newssource'>"
+"(" + (1+uriNo) +") " +rssfeeds[uriNo].name+"<br />"
+"Updated " + newsRSS.query.created.substr(11,5)
+" " + newsRSS.query.created.substr(5,5)
+"</div>"
}
function scrollUp(i)
{ if(infobox=='appNews')
{ //var tp=$("#time").offset().top;
$(".newslist").css("top",i+"px");
if(i>=-36) setTimeout("scrollUp(" + (i-3) + ");",90);
}
}
function endNews()
{ infobox="";
clickZero();
$('#newsticker').remove();
}
function showNews(kk)
{ //TBA
}
function apiCall(o,c,h)
{ //alpha test
if(h==1) $(o).addClass("hidden");
$(o).html('');
var htt="app/api.jim?action=";
//var htt="http://localhost/portal/plugin/xtra1/app/api.jim?action=";
$(o).load(htt + c);
}
function apiCallinfobox(c)
{ apiCall('#infobox',c,1);
infobox="apiCall-" + c;
positionInfoboxRight();
$("#infobox").removeClass("hidden");
setDebug("Running App:" + c);
setTimeout("setDebug('');",2000);
}
function positionInfoboxRight()
{ $("#infobox").css("top","2%");
$("#infobox").css("left","75%");
$("#infobox").css("width","21%");
$("#infobox").css("height","80%");
}
function goURL(u,tv)
{ hideInfobox();
$(".item").addClass("hidden");
$("#iTime").addClass("hidden");
$("#loading").removeClass("hidden");
if(tv==0) document.getElementById('video').setTVOff();
window.location.href=u;
}
function initiTime()
{ //var tp=$("#time").offset().top;
var lf=$("#time").offset().left;
var wd=$("#time").width();
var ht=$("#iTime").outerHeight();
var iw=$("#iTime").outerWidth();
//$("#iTime").css("top",(tp-ht-6)+"px");
$("#iTime").css("left",(lf+10)+"px");
if(getValue("iTime")=="hidden")
$("#iTime").addClass("hidden");
else
$("#iTime").removeClass("hidden");
}
function iTimeOnOff()
{ hideInfobox();
var k=getValue("iTime");
if(k!="hidden")
{ setValue("iTime","hidden");
$("#iTime").addClass("hidden");
}
else
{ setValue("iTime","on");
$("#iTime").removeClass("hidden");
}
}
function hideInfobox()
{ infobox="";
$("#infobox").addClass("hidden");
$("#infobox").html("");
}
function positionInfobox(obj)
{ $('#newsticker').remove();
$("#infobox").css("width","auto");
$("#infobox").css("height","auto");
$("#infobox").removeClass("small");
$("#" + obj).css("position","absolute");
var tp=$("#footer").offset().top;
var lf=$("#" + obj).offset().left;
$("#" + obj).css("position","relative");
var ht=$("#infobox").outerHeight();
if(tp>360)
$("#infobox").css("top",(tp-ht-10)+"px");
else
$("#infobox").css("top",(tp+50)+"px");
$("#infobox").css("left",lf+"px");
}
function chName()
{ var xx="";
if(hummy)
try
{ //var conF = window.oipfObjectFactory.createConfigurationObject();
//var conL = conF.localSystem;
xx= ch.name.substr(1);
}
catch (e)
{ xx=e.name;
}
return xx;
}
// -- Library Functions --
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value)
+ ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
function getCookie(c_name)
{ var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{ x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x==c_name)
{ return unescape(y);
}
}
return null ;
}
function setValue(k,v)
{ // localStorgae
// globalStroage
// cookies
// database - not yet implmented
// do not use sessionStorage, not persistent
var r=false;
if(typeof(localStorage)=='object')
{ localStorage.setItem(k,v);
r=true;
}
if(typeof(globalStorage)=='object')
{ eval("globalStorage['" + location.hostname + "']." + k + "='" + v + "';");
r=true;
}
setCookie(k,v,999);
if(typeof(openDatabase)=="function")
{ // NOT YET IMPLMENTED
}
return r
}
function getValue(k)
{ var v=null;
if(typeof(localStorage)=='object')
{ v=localStorage.getItem(k);
}
if((v==null) || (v=='')) if(typeof(globalStorage)=='object')
{ eval("v=globalStorage['" + location.hostname + "']." + k +";");
}
if((v==null) || (v=='')) v=getCookie(k);
return v;
}
function deleteValue(k)
{ if(typeof(localStorage)=='object')
{ localStorage.setItem(k,"");
r=true;
}
if(typeof(globalStorage)=='object')
{ eval("globalStorage['" + location.hostname + "']." + k + "='';");
r=true;
}
setCookie(k,"",-99);
}
function setDebug(a)
{ $("#debug").html(a);
}
function zPad(s,n)
{ var p="000"+s;
return p.slice(-1*n);
}
function swbeats()
{ var dt = new Date();
var cbt = dt.getUTCHours()*60 + dt.getUTCMinutes();
cbt = cbt + 60; // changes to BMT
cbt = cbt*60 + dt.getUTCSeconds();
cbt = cbt*1000 + dt.getUTCMilliseconds();
cbt = Math.floor(cbt / 864);
if (cbt<0) cbt = cbt + 100000;
if (cbt>=100000) cbt = cbt - 100000;
var bts = "00000" + cbt;
bts = bts.substring(bts.length-5,bts.length);
return (bts.substring(0,3) + "." + bts.substring(3,4));
}
function strJulian()
{ var dt = new Date()
var dt0= new Date(dt.getUTCFullYear(),0,1);
var jd=1+Math.floor((dt.getTime()-dt0.getTime())/1000/60/60/24);
var st= "" + dt.getUTCFullYear() + "-" + zPad(jd,3);
return st;
}
function strTime()
{ var dt = new Date();
return zPad(dt.getHours(),2) + ":" + zPad(dt.getMinutes(),2) +
":" + zPad(dt.getSeconds(),2) +
" " + zPad(dt.getDate(),2) +"/" + zPad(1+dt.getMonth(),2) ;
}
function upTime()
{ var st = strTime();
var jt = strJulian() + "@" + swbeats() ;
if((st != rt1) || (jt != jt1))
{ if(st != rt1)
{ $("#time").html(st);
rt1 = st;
}
if(jt != jt1)
{ $("#iTime").html(jt);
jt1 = st;
}
}
setTimeout("upTime();",490);
}
// -- Experimental Functions --
function chInfo()
{ var xx="iNA";
if(hummy)
try {
var obF = window.oipfObjectFactory;
xx=typeof(obF);
//var ch = // document.getElementById('appmgr')
//.getOwnerApplication(document).privateData.currentChannel;
//var type = ch.channelType;
//type = type==ch.TYPE_TV?'TV':(type==ch.TYPE_RADIO?'Radio':'unknown');
//var succ = type=='TV'
//&& ((ch.onid==service1[0]&&ch.tsid==service1[1]&&ch.sid==service1[2])
// || (ch.onid==service2[0]&&ch.tsid==service2[1]&&ch.sid==service2[2]));
//xx= '='+ch.onid+'.'+ch.tsid+'.'+ch.sid+' +' type='+type+', name='+ch.name ;
//xx=chCfg() + " " + ch.name.substr(1);
//document.getElementById('appmgr').getOwnerApplication(document).nextChannel();
} catch (e) {
xx="iEE";
}
return xx;
}
function chCfg()
{ var xx="cNA";
try {
var cfg = document.getElementById('oipfcfg');
xx=typeOf(cfg);
}
catch (e) {
xx='cEE';
}
return xx;
}
function getCookiesArray()
{ var cookies = { };
if (document.cookie && document.cookie != '')
{ var split = document.cookie.split(';');
for (var i = 0; i < split.length; i++)
{ var name_value = split[i].split("=");
name_value[0] = name_value[0].replace(/^ /, '');
cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]);
}
}
return cookies;
}
function clearCookies()
{ if (document.cookie && document.cookie != '')
{ var split = document.cookie.split(';');
for (var i = 0; i < split.length; i++)
{ var name_value = split[i].split("=");
name_value[0] = name_value[0].replace(/^ /, '');
var name=decodeURIComponent(name_value[0]);
setValue(name,"");
setCookie(name,"",-99);
}
}
}
function videoObject(n,left,top,width,height)
{ //left=0, top=0, width=1280, height=720
return '<object id="'+n+'" '
+'type="video/broadcast" style="position:absolute;'
+'left:'+left+'px;top:'+top+'px;width:'+width+'px;height:'+height+'px;">'
+'</object>';
}
function initVideo() {
try {
document.getElementById('video').setTVOn();
document.getElementById('video').bindToCurrentChannel();
} catch (e) {
// ignore
}
try {
document.getElementById('video').setTVOn();
document.getElementById('video').setFullScreen(false);
} catch (e) {
// ignore
}
}
function initPIP() {
try {
document.getElementById('pip').setTVOn();
//document.getElementById('video').bindToCurrentChannel();
} catch (e) {
// ignore
}
}
//-----
// from base.js
function initApp() {
try {
var app = document.getElementById('appmgr').getOwnerApplication(document);
app.show();
app.activate();
} catch (e) {
// ignore
}
//setKeyset(0x1+0x2+0x4+0x8+0x10);
//setKeyset(0x1);
}
function setKeyset(mask) {
// for HbbTV 0.5:
try {
var elemcfg = document.getElementById('oipfcfg');
elemcfg.keyset.value = mask;
} catch (e) {
// ignore
}
try {
var elemcfg = document.getElementById('oipfcfg');
elemcfg.keyset.setValue(mask);
} catch (e) {
// ignore
}
// for HbbTV 1.0:
try {
var app = document.getElementById('appmgr').getOwnerApplication(document);
app.privateData.keyset.setValue(mask);
app.privateData.keyset.value = mask;
} catch (e) {
// ignore
}
}
function appmgrObject()
{ return '<object id="appmgr" type="application/oipfApplicationManager" '
+'style="position:absolute;left:0px;top:0px;width:0px;height:0px;"></object>'
+'<object id="oipfcfg" type="application/oipfConfiguration" '
+'style="position:absolute;left:0px;top:0px;width:0px;height:0px;"></object>';
}