2025-01-23 17:24:58 -05:00
|
|
|
import loading from 'components/loading/loading';
|
|
|
|
import globalize from 'lib/globalize';
|
|
|
|
import Dashboard, { pageIdOn } from 'utils/dashboard';
|
|
|
|
import { getParameterByName } from 'utils/url';
|
|
|
|
import Events from 'utils/events';
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function onListingsSubmitted() {
|
2023-09-25 00:00:36 -04:00
|
|
|
Dashboard.navigate('dashboard/livetv');
|
2020-08-01 14:52:15 +02:00
|
|
|
}
|
2018-10-23 01:05:09 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function init(page, type, providerId) {
|
2025-01-23 17:24:58 -05:00
|
|
|
import(`components/tvproviders/${type}`).then(({ default: ProviderFactory }) => {
|
2023-07-06 11:49:55 -04:00
|
|
|
const instance = new ProviderFactory(page, providerId, {});
|
2020-09-08 02:05:02 -04:00
|
|
|
Events.on(instance, 'submitted', onListingsSubmitted);
|
2020-08-01 14:52:15 +02:00
|
|
|
instance.init();
|
|
|
|
});
|
|
|
|
}
|
2019-11-06 13:43:39 +03:00
|
|
|
|
2020-08-01 14:52:15 +02:00
|
|
|
function loadTemplate(page, type, providerId) {
|
2025-01-23 17:24:58 -05: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
|
|
|
});
|