2017-02-08 14:36:28 +01:00
|
|
|
$(document).ready( function() {
|
|
|
|
performTranslation();
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
function newsCont(t,e,l)
|
|
|
|
{
|
|
|
|
var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">';
|
|
|
|
h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>';
|
|
|
|
h += e;
|
|
|
|
h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>';
|
|
|
|
h += '</div><hr/>';
|
|
|
|
$('#dash_news').append(h);
|
|
|
|
}
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
function createNews(d)
|
|
|
|
{
|
|
|
|
for(var i = 0; i<d.length; i++)
|
|
|
|
{
|
|
|
|
if(i > 5)
|
|
|
|
break;
|
|
|
|
|
|
|
|
title = d[i].title.rendered;
|
|
|
|
excerpt = d[i].excerpt.rendered;
|
2017-03-18 00:05:04 +01:00
|
|
|
link = d[i].link+'?pk_campaign=WebUI&pk_kwd=news_'+d[i].slug;
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
newsCont(title,excerpt,link);
|
|
|
|
}
|
|
|
|
}
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
function getNews()
|
|
|
|
{
|
|
|
|
var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
|
|
|
|
$.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);
|
|
|
|
});
|
|
|
|
}
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
//getNews();
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
function updateComponents()
|
|
|
|
{
|
2018-12-27 23:11:32 +01:00
|
|
|
var components = comps;
|
2017-02-08 14:36:28 +01:00
|
|
|
components_html = "";
|
|
|
|
for ( idx=0; idx<components.length;idx++)
|
|
|
|
{
|
2018-12-27 23:11:32 +01:00
|
|
|
if(components[idx].name != "ALL")
|
|
|
|
components_html += '<tr><td>'+$.i18n('general_comp_'+components[idx].name)+'</td><td><i class="fa fa-circle component-'+(components[idx].enabled?"on":"off")+'"></i></td></tr>';
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
|
|
|
$("#tab_components").html(components_html);
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-03-24 10:17:36 +01:00
|
|
|
//info
|
2018-12-31 00:21:44 +01:00
|
|
|
hyperion_enabled = true;
|
|
|
|
|
|
|
|
components.forEach( function(obj) {
|
|
|
|
if (obj.name == "ALL")
|
|
|
|
{
|
|
|
|
hyperion_enabled = obj.enabled
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#dash_statush').html(hyperion_enabled ? '<span style="color:green">'+$.i18n('general_btn_on')+'</span>' : '<span style="color:red">'+$.i18n('general_btn_off')+'</span>');
|
|
|
|
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh')+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh')+'</button>');
|
2017-02-08 14:36:28 +01:00
|
|
|
}
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
// add more info
|
2017-03-18 00:05:04 +01:00
|
|
|
$('#dash_leddevice').html(serverInfo.ledDevices.active);
|
2017-02-28 17:53:41 +01:00
|
|
|
$('#dash_currv').html(currentVersion);
|
|
|
|
$('#dash_instance').html(serverConfig.general.name);
|
2018-12-31 00:21:44 +01:00
|
|
|
$('#dash_ports').html(serverConfig.flatbufServer.port);
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
$.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, '');
|
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
// $('#dash_latev').html(latestVersion);
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-04-07 21:33:40 +02:00
|
|
|
// if ( cleanCurrentVersion < cleanLatestVersion )
|
|
|
|
// $('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'</div>');
|
|
|
|
// else
|
|
|
|
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
|
2017-02-08 14:36:28 +01:00
|
|
|
});
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-28 17:53:41 +01:00
|
|
|
//determine platform
|
2017-03-18 00:05:04 +01:00
|
|
|
var grabbers = serverInfo.grabbers.available;
|
2017-02-28 17:53:41 +01:00
|
|
|
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';
|
2018-12-27 23:11:32 +01:00
|
|
|
|
|
|
|
$('#dash_platform').html(html);
|
|
|
|
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
//interval update
|
|
|
|
updateComponents();
|
2018-12-27 23:11:32 +01:00
|
|
|
$(hyperion).on("components-updated",updateComponents);
|
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
if(showOptHelp)
|
|
|
|
createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro");
|
2018-12-27 23:11:32 +01:00
|
|
|
|
2017-02-08 14:36:28 +01:00
|
|
|
removeOverlay();
|
2018-12-27 23:11:32 +01:00
|
|
|
});
|