jellyfin-web/dashboard-ui/scripts/livetvguideprovider.js

44 lines
1.0 KiB
JavaScript
Raw Normal View History

2015-08-10 10:37:50 -07:00
(function ($, document, window) {
2015-08-21 19:59:10 -07:00
function init(page, type, providerId) {
2015-08-10 10:37:50 -07:00
2015-10-17 09:29:42 -07:00
var url = 'components/tvproviders/' + type + '.js';
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
require([url], function (factory) {
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
var instance = new factory(page, providerId, {
2015-08-10 10:37:50 -07:00
});
2015-08-21 19:59:10 -07:00
instance.init();
2015-08-10 10:37:50 -07:00
});
}
2015-08-21 19:59:10 -07:00
function loadTemplate(page, type, providerId) {
2015-08-10 10:37:50 -07:00
2015-10-17 09:29:42 -07:00
HttpClient.send({
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
type: 'GET',
2015-10-17 09:29:42 -07:00
url: 'components/tvproviders/' + type + '.template.html'
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
}).done(function (html) {
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
var elem = page.querySelector('.providerTemplate');
elem.innerHTML = Globalize.translateDocument(html);
$(elem).trigger('create');
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
init(page, type, providerId);
2015-08-10 10:37:50 -07:00
});
}
2015-09-24 10:08:10 -07:00
$(document).on('pageshow', "#liveTvGuideProviderPage", function () {
2015-08-10 10:37:50 -07:00
2015-08-21 19:59:10 -07:00
Dashboard.showLoadingMsg();
2015-08-10 10:37:50 -07:00
var providerId = getParameterByName('id');
2015-08-21 19:59:10 -07:00
var type = getParameterByName('type');
2015-08-10 10:37:50 -07:00
var page = this;
2015-08-21 19:59:10 -07:00
loadTemplate(page, type, providerId);
2015-08-10 10:37:50 -07:00
});
})(jQuery, document, window);