1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/wizardlivetvguide.js
Luke Pulverenti 6b85af3c7e update search
2015-08-21 22:59:10 -04:00

77 lines
1.8 KiB
JavaScript

(function ($, document) {
var guideController;
function init(page, type, providerId) {
var url = 'tvproviders/' + type + '.js';
require([url], function (factory) {
var instance = new factory(page, providerId, {
showCancelButton: false,
showSubmitButton: false
});
instance.init();
guideController = instance;
});
}
function loadTemplate(page, type, providerId) {
guideController = null;
ApiClient.ajax({
type: 'GET',
url: 'tvproviders/' + type + '.template.html'
}).done(function (html) {
var elem = page.querySelector('.providerTemplate');
elem.innerHTML = Globalize.translateDocument(html);
$(elem).trigger('create');
init(page, type, providerId);
});
}
function skip() {
var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('Startup/Info')).done(function (info) {
if (info.SupportsRunningAsService) {
Dashboard.navigate('wizardservice.html');
} else {
Dashboard.navigate('wizardagreement.html');
}
});
}
function next() {
guideController.submit();
}
$(document).on('pageinitdepends', "#wizardGuidePage", function () {
var page = this;
$('#selectType', page).on('change', function () {
loadTemplate(page, this.value);
});
$('.btnSkip', page).on('click', skip);
$('.btnNext', page).on('click', next);
}).on('pageshowready', "#wizardGuidePage", function () {
var page = this;
$('#selectType', page).trigger('change');
});
})(jQuery, document, window);