37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
export default function (view) {
|
|
view.addEventListener("viewshow", () => import(
|
|
ApiClient.getUrl("web/ConfigurationPage", {
|
|
name: "Xtream.js",
|
|
})
|
|
).then((Xtream) => Xtream.default
|
|
).then((Xtream) => {
|
|
const pluginId = Xtream.pluginConfig.UniqueId;
|
|
Xtream.setTabs(1);
|
|
|
|
const getConfig = ApiClient.getPluginConfiguration(pluginId);
|
|
const visible = view.querySelector("#Visible");
|
|
getConfig.then((config) => visible.checked = config.IsCatchupVisible);
|
|
const table = view.querySelector('#LiveContent');
|
|
Xtream.populateCategoriesTable(
|
|
table,
|
|
() => getConfig.then((config) => config.LiveTv),
|
|
() => Xtream.fetchJson('Xtream/LiveCategories'),
|
|
(categoryId) => Xtream.fetchJson(`Xtream/LiveCategories/${categoryId}`),
|
|
).then((data) => {
|
|
view.querySelector('#XtreamLiveForm').addEventListener('submit', (e) => {
|
|
Dashboard.showLoadingMsg();
|
|
|
|
ApiClient.getPluginConfiguration(pluginId).then((config) => {
|
|
config.IsCatchupVisible = visible.checked;
|
|
config.LiveTv = data;
|
|
ApiClient.updatePluginConfiguration(pluginId, config).then((result) => {
|
|
Dashboard.processPluginConfigurationUpdateResult(result);
|
|
});
|
|
});
|
|
|
|
e.preventDefault();
|
|
return false;
|
|
});
|
|
});
|
|
}));
|
|
} |