$(document).ready( function() { performTranslation(); function newsCont(t,e,l) { var h = '
'; h += '

'+t+'

'; h += e; h += ''+$.i18n('dashboard_newsbox_readmore')+''; 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 = comps; components_html = ""; for ( idx=0; idx'; } $("#tab_components").html(components_html); //info 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(serverInfo.ledDevices.active); $('#dash_currv').html(currentVersion); $('#dash_instance').html(serverConfig.general.name); $('#dash_ports').html(serverConfig.flatbufServer.port+' | '+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("components-updated",updateComponents); if(showOptHelp) createHintH("intro", $.i18n('dashboard_label_intro'), "dash_intro"); removeOverlay(); });