$(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;
title = d[i].title.rendered;
excerpt = d[i].excerpt.rendered;
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 = serverInfo.components;
components_html = "";
for ( idx=0; idx'+$.i18n('general_comp_'+components[idx].name)+' | | ';
}
$("#tab_components").html(components_html);
//info
$('#dash_statush').html(serverInfo.hyperion.off? ''+$.i18n('general_btn_off')+'':''+$.i18n('general_btn_on')+'');
$('#btn_hsc').html(serverInfo.hyperion.off? '' : '');
}
// add more info
$('#dash_leddevice').html(serverInfo.ledDevices.active);
$('#dash_currv').html(currentVersion);
$('#dash_instance').html(serverConfig.general.name);
$('#dash_ports').html(jsonPort+' | '+serverConfig.protoServer.port);
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
parsedUpdateJSON = JSON.parse(data);
latestVersion = parsedUpdateJSON[0].versionnr;
var cleanLatestVersion = latestVersion.replace(/\./g, '');
var cleanCurrentVersion = currentVersion.replace(/\./g, '');
// $('#dash_latev').html(latestVersion);
// if ( cleanCurrentVersion < cleanLatestVersion )
// $('#versioninforesult').html(''+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'
');
// else
$('#versioninforesult').html(''+$.i18n('dashboard_infobox_message_updatesuccess')+'
');
});
//determine platform
var grabbers = 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();
$(hyperion).on("cmd-serverinfo",updateComponents);
if(showOptHelp)
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
removeOverlay();
});