• The forum software that supports hummy.tv has been upgraded to XenForo 2.3!

    Please bear with us as we continue to tweak things, and feel free to post any questions, issues or suggestions in the upgrade thread.

[portal-xtra1] Custom TV Portal Alternative

If you feel adventurous and know how to edit these files then do so. If you're not confident enough then don't bother!!!

Here's the code for portal.js (Completely replace with what's already there):

Code:
// 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 twitterRSS=null;
var twitterCount=0;
var twitterInterval=4750;
var twitterCurrent=0;
 
var twitterq1="https://api.twitter.com/1/statuses/following_timeline.json?user_id=15439395&callback=twitterCB"; //here we are changing the XXXXXXXX in the user_id=XXXXXXX (this may be more than 8 numbers!)
var twitterq2="http://search.twitter.com/search.json?lang=en&q=f1&callback=twitterCB"; //here we are searching for f1 - look at the part where q=f1 change it to what you want
var twitterq3="http://search.twitter.com/search.json?lang=en&q=QT&callback=twitterCB";
var twitterq4="http://search.twitter.com/search.json?lang=en&q=xfactor&callback=twitterCB";
var twitterq5="http://search.twitter.com/search.json?lang=en&q=runcorn&callback=twitterCB";
var twitterq6="http://search.twitter.com/search.json?lang=en&q=lfc&callback=twitterCB";
 
var twitterq="";
var twittertype=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_world.rss", name:"CNN World 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=8;
 
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("&bull; Apps");
  $("#blue").html("&bull; <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==2) startTwitter(twitterq1,0);
  if(n==3) startTwitter(twitterq2,1);
  if(n==4) startTwitter(twitterq3,1);
  if(n==5) startTwitter(twitterq4,1);
  if(n==6) startTwitter(twitterq5,1);
  if(n==7) startTwitter(twitterq6,1);
  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();
  $('#twitterticker').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<br />"
    x += "2. Twitter Timeline<br />";
    x += "3. Twitter F1<br />";
    x += "4. Twitter QT<br />";
    x += "5. Twitter X-Factor<br />";
    x += "6. Twitter Runcorn<br />";
    x += "7. Twitter LFC";
 
    for(var i=0;1<plugins.length;i++)
    { x+="<br />"+(i+appStart)+". ";
      x+=plugins[i].name;
    }
 
    x += "</p><p class='cgray centre small' style='margin:0px;'>"
          + "Mini-Apps &amp; 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");
  $('#twitterticker').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 &amp; 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 + "&nbsp;"
          + 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();
  $('#twitterticker').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();
$('#twitterticker').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>';
}
 
function startTwitter(whichtwitter,whattype)
{
  $('#twitterticker').remove();
  hideInfobox();
  twitterq = whichtwitter;
  twittertype = whattype;
  $('.item').addClass("hidden");
  //create ticker box
  $('body').append("<div id='twitterticker'><div class='twitterlist'>"
      +"<div id='twitteritem1' class='twitteritem'>Loading Twitterfeed</div>"
      +"<div id='twitteritem2' class='twitteritem'></div></div></div>");
  infobox="appNews";
  $.getScript(twitterq);
  setVPos(parseInt(getValue('footerTop')));
}
function selectTwitter(n)
{ if((n>=0) && (n<rssfeeds.length))
  { setValue("rssURL",n);
    uriNo=n;
    setDebug(rssfeeds[uriNo].name);
    setTimeout("setDebug('');",2000);
 
    if(infobox=="appNews")
    {
      $.getScript("https://api.twitter.com/1/statuses/following_timeline.json?user_id=55927602&callback=twitterChange");
    }
    else
    { startTwitter();
    }
  }
}
function twitterChange(data)
{ if(twittertype = 0 )
    {
    twitterCount=data.length;
    twitterRSS=data;
    }
    else
    {
    twitterCount=data.results.length;
    twitterRSS=data.results;
    }
}
function twitterCB(data)
{
  {
  if(twittertype==0)
    {
    twitterCount=data.length;
    twitterRSS=data;
    }
    else
    {
    twitterCount=data.results.length;
    twitterRSS=data.results;
    }
  if((twitterCurrent<0) || (twitterCurrent>=twitterCount)) twitterCurrent=0;
  var newTwitter=fromInfoTwitter() + twitterRSS[twitterCurrent].text;
  $('#twitteritem1').html(newTwitter);
  $('#twitteritem2').html(newTwitter);
  setTimeout("nextTwitter();",newsInterval);
  }
}
function nextTwitter()
{ if(infobox=='appNews')
  { $('#twitteritem1').html($('#twitteritem2').html())
    $("#twitterlist").css("top","0px");
    twitterCurrent++;
    if((twitterCurrent<0) || (twitterCurrent>=twitterCount)) $.getScript(twitterq);
    var newTwitter=fromInfoTwitter() + twitterRSS[twitterCurrent].text;
    $('#twitteritem2').html(newTwitter);
    //scrollUp(0);
    if(infobox=='appNews') setTimeout("nextTwitter();",newsInterval);
  }
  // if menu is not appNews, then abandon the update process
}
function fromInfoTwitter()
{
if(twittertype==0)
    {
    var imager = twitterRSS[twitterCurrent].user.profile_image_url;
    var imagerep = imager.replace('_normal','_bigger');
    var twitteruser = twitterRSS[twitterCurrent].user.name;
    }
    else
    {
    var imager = twitterRSS[twitterCurrent].profile_image_url;
    var imagerep = imager.replace('_normal','_bigger');
    var twitteruser = twitterRSS[twitterCurrent].from_user;
    }
 
    return "<div class='twittersource'>"
      +"<div id='twittertext'>"+twitteruser+"</div>"
      +"<div id='twitterpic'><img src='"+imagerep+"' height='80px'></div>"
      +"</div>"
}

Then add these to portal.css:

Code:
#twittertext{
float:left;
font-size:18px;
margin-top:10px;
}
 
 
#twitterpic{
float:right;
margin-left: 5px;
margin-top:10px;
}
 
#twitterticker
{ position:absolute;
  width:96%;
  height:96px;
  left;10%;
  /*margin-top:0.2em;*/
  padding-left:10px;
  padding-right:10px;
  /*background:#200;*/
background:rgba(34, 0, 0, 0.25);
  /*border-radius:10px;*/
  /*border: solid 2px #000;*/
  text-align:center;
  overflow:hidden;
  font-size:34px;
text-shadow:
  -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}
 
.twitterlist
{ position:relative;
}
.twitteritem
{ width:100%;
  position:relative;
  text-align:center;
  overflow:hidden;
  margin:0px;
  padding:0px;
  border:none 0px;
}
.twittersource
{ float:right;
  font-size:48%;
  margin:0px 5px 0px 0px;
}


Hope you have fun and enjoy!!!!
 
Just be glad you don't live there! There's a couple of things i've been thinking about adding in, perhaps a menu for current trends. I think maybe a wget cron job might be good here and then the queries can be dynamically updated, but for now I think I might sleep!
 
I've been busy with the day job,
and messing with Raspberry Pi recently.

But I do have plans...
- modularise the whole of the code
so that the menus are pulled from a more customisable source

- add a second plugin architecture
so that a second type of plugin is loaded into the custom portal
(the current plugin system is separate apps that are loaded)

- add a software keyboard for more flexibility

but as ever I have no idea when I will get to it

All of this involves a rewrite of the code structure,
which I have just started - using a Raspberry Pi as my coding machine now
--yay! for Linux--

Keep the mods and ideas coming, I will try to incorporate as many as I can, when I can.
Or Chris, as he has already updated the code as I am busy.
 
Guys,

I've just upgraded to the latest version of CFW and Portal-Extra1.

Before the upgrade the Portal-Extra1 menu options would appear at the bottom of the screen and the menus would open up the screen. Since the upgrade, the menu options now appear across the middle of the screen and open down. This causes the number 8 to be very close to the bottom of the screen and option 9 tobe overlapping the edge. Is this by design or is it an issue?

Thanks.
 
When the menu bar is displayed, try moving the bar back to the bottom of the screen using the down arrow on the remote. Should fix the problem. I think the menu actually moves up the screen each time you use it which, if I'm right, is a bug.
 
Looking back at the code, i think its this section:
Code:
$(document).ready(function()
{ $(".item").addClass("hidden");
  $("body").removeClass("hidden");
 
  setVPos(getValue('footerTop')-10);
  upTime();

Change the line
Code:
setVPos(getValue('footerTop')-10);
to
Code:
setVPos(getValue('footerTop'));
 
Just incase anyone wonders, the majority of additional links in the Xtra Portal are broken due to Humax moving stuff around.
This does not affect the normal Humax TV Portal.
 
To what extent is the format of the custom portal affected by the changes to the standard portal? Is all the source data held locally?
 
eh? The Xtra-portal code is local if thats what you mean. so the links can only be updated by updating the package.

There is an option under Red to go to the Original Humax TV Portal, so everything works fine from there.
 
What I was really wondering (I don't use the custom portal myself) is whether its appearance has been changed because of the standard portal change, if it uses any CSS (or whatever) imported from the standard portal. There has been no firmware update and yet the standard portal is completely different right down to the "loading" animation. So just as curiosity I wondered how much of the custom portal's structure is downloaded from the standard portal data source, whether it gets downloaded from an alternate web source, or some HTML (or whatever) held entirely locally.
 
Internet Radio is no longer available via TV Portal : Red Button : Option 3 (I think it used to be).
But can still get it via TV Portal : Red Button : Option 1, then choose from the displayed options.

Am I mistaken? Or has something changed?
 
I presume that is the custom portal? The standard portal was rearranged a few weeks ago, which might explain it.
 
I presume that is the custom portal? The standard portal was rearranged a few weeks ago, which might explain it.

Under Portal, the Red Button selects 'Humax', then the menu invites options by number, no 3 being 'Internet Radio' which does not work. However option no 1 is the Non-custom option, which then presents options including 'Internet Radio', and that does work. So I think the answer to your question is 'yes', it is the custom portal which is not working for 'Internet Radio', although presumably it would not take much to bring it into line with the Humax version which now works :oops: :)
 
Back
Top