(function ($, document, window) { function loadPage(page, liveTvInfo) { if (liveTvInfo.IsEnabled) { $('.liveTvStatusContent', page).show(); $('.noLiveTvServices', page).hide(); } else { $('.liveTvStatusContent', page).hide(); $('.noLiveTvServices', page).show(); } var service = liveTvInfo.Services.filter(function (s) { return s.Name == liveTvInfo.ActiveServiceName; })[0] || {}; var serviceUrl = service.HomePageUrl || '#'; $('#activeServiceName', page).html('' + liveTvInfo.ActiveServiceName + '').trigger('create'); var versionHtml = service.Version || 'Unknown'; if (service.HasUpdateAvailable) { versionHtml += ' (Update available)'; } else { versionHtml += ' Up to date!'; } $('#activeServiceVersion', page).html(versionHtml); var status = liveTvInfo.Status; if (liveTvInfo.Status == 'Ok') { status = '' + status + ''; } else { if (liveTvInfo.StatusMessage) { status += ' (' + liveTvInfo.StatusMessage + ')'; } status = '' + status + ''; } $('#activeServiceStatus', page).html(status); Dashboard.hideLoadingMsg(); } $(document).on('pageshow', "#liveTvStatusPage", function () { Dashboard.showLoadingMsg(); var page = this; ApiClient.getLiveTvInfo().done(function (liveTvInfo) { loadPage(page, liveTvInfo); }); }); })(jQuery, document, window);