2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2015-08-10 10:37:50 -07:00
|
|
|
|
|
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-12-14 08:43:03 -07:00
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
|
xhr.open('GET', 'components/tvproviders/' + type + '.template.html', true);
|
2015-08-10 10:37:50 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
xhr.onload = function (e) {
|
2015-08-10 10:37:50 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
var html = this.response;
|
2015-08-21 19:59:10 -07:00
|
|
|
|
var elem = page.querySelector('.providerTemplate');
|
2016-03-05 12:07:58 -07:00
|
|
|
|
elem.innerHTML = Globalize.translateDocument(html);
|
2015-08-10 10:37:50 -07:00
|
|
|
|
|
2015-08-21 19:59:10 -07:00
|
|
|
|
init(page, type, providerId);
|
2015-12-14 08:43:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xhr.send();
|
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
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|