$(document).ready( function() {
performTranslation();
// function newsCont(t,e,l)
// {
// var h = '
';
// $('#dash_news').append(h);
// }
// function createNews(d)
// {
// for(var i = 0; i 5)
// break;
//
// var title = d[i].title.rendered;
// var excerpt = d[i].excerpt.rendered;
// var link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug;
//
// newsCont(title,excerpt,link);
// }
// }
// function getNews()
// {
// var h = ''+$.i18n('dashboard_newsbox_noconn')+'';
// $.ajax({
// url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
// dataType: 'json',
// type: 'GET',
// timeout: 2000
// })
// .done( function( data, textStatus, jqXHR ) {
// if(jqXHR.status == 200)
// createNews(data);
// else
// $('#dash_news').html(h);
// })
// .fail( function( jqXHR, textStatus ) {
// $('#dash_news').html(h);
// });
// }
// getNews();
function updateComponents()
{
var components = window.comps;
var components_html = "";
for (var idx=0; idx'+$.i18n('general_comp_'+components[idx].name)+' | | ';
}
$("#tab_components").html(components_html);
//info
var hyperion_enabled = true;
components.forEach( function(obj) {
if (obj.name == "ALL")
{
hyperion_enabled = obj.enabled
}
});
$('#dash_statush').html(hyperion_enabled ? ''+$.i18n('general_btn_on')+'' : ''+$.i18n('general_btn_off')+'');
$('#btn_hsc').html(hyperion_enabled ? '' : '');
}
// add more info
$('#dash_leddevice').html(window.serverInfo.ledDevices.active);
$('#dash_currv').html(window.currentChannel+' '+window.currentVersion);
$('#dash_instance').html(window.currentHyperionInstanceName);
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$('#dash_watchedversionbranch').html(window.serverConfig.general.watchedVersionBranch);
getReleases(function(callback){
if(callback)
{
var cleanLatestVersion = window.latestVersion.tag_name.replace(/\./g, '');
var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
$('#dash_latev').html(window.currentVersion);
$('#dash_latev').html(window.latestVersion.tag_name + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')');
if ( cleanCurrentVersion < cleanLatestVersion )
$('#versioninforesult').html(''+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.tag_name) + ' (' + (window.latestVersion.prerelease == true ? "Beta" : "Stable") + ')
');
else
$('#versioninforesult').html(''+$.i18n('dashboard_infobox_message_updatesuccess')+'
');
}
});
//determine platform
var grabbers = window.serverInfo.grabbers.available;
var html = "";
if(grabbers.indexOf('dispmanx') > -1)
html += 'Raspberry Pi';
else if(grabbers.indexOf('x11') > -1)
html += 'X86';
else if(grabbers.indexOf('osx') > -1)
html += 'OSX';
else if(grabbers.indexOf('amlogic') > -1)
html += 'Amlogic';
else
html += 'Framebuffer';
$('#dash_platform').html(html);
//interval update
updateComponents();
$(window.hyperion).on("components-updated",updateComponents);
if(window.showOptHelp)
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
removeOverlay();
});