2020-08-14 08:46:34 +02:00
|
|
|
import events from 'jellyfin-apiclient';
|
|
|
|
import loading from '../components/loading/loading';
|
|
|
|
import globalize from '../scripts/globalize';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function onListingsSubmitted() {
|
|
|
|
Dashboard.navigate('livetvstatus.html');
|
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function init(page, type, providerId) {
|
|
|
|
const url = 'components/tvproviders/' + type + '.js';
|
2019-11-06 13:43:39 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
import(url).then(({default: factory}) => {
|
|
|
|
const instance = new factory(page, providerId, {});
|
|
|
|
events.on(instance, 'submitted', onListingsSubmitted);
|
|
|
|
instance.init();
|
|
|
|
});
|
|
|
|
}
|
2019-11-06 13:43:39 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function loadTemplate(page, type, providerId) {
|
2020-08-14 08:46:34 +02:00
|
|
|
import('./../components/tvproviders/' + type + '.template.html').then(({default: html}) => {
|
2020-08-01 14:52:15 +02:00
|
|
|
page.querySelector('.providerTemplate').innerHTML = globalize.translateHtml(html);
|
|
|
|
init(page, type, providerId);
|
2019-11-06 13:43:39 +03:00
|
|
|
});
|
2020-08-01 14:52:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
pageIdOn('pageshow', 'liveTvGuideProviderPage', function () {
|
|
|
|
loading.show();
|
|
|
|
const providerId = getParameterByName('id');
|
|
|
|
loadTemplate(this, getParameterByName('type'), providerId);
|
2019-11-06 13:43:39 +03:00
|
|
|
});
|