mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
define(["quickConnectSettings", "dom", "globalize", "loading", "userSettings", "autoFocuser", "listViewStyle"], function (QuickConnectSettings, dom, globalize, loading, userSettings, autoFocuser) {
|
|
"use strict";
|
|
|
|
return function (view) {
|
|
var quickConnectSettingsInstance = null;
|
|
|
|
view.addEventListener("viewshow", function () {
|
|
quickConnectSettingsInstance = new QuickConnectSettings({
|
|
page: view,
|
|
interval: 0
|
|
});
|
|
|
|
view.querySelector("#btnQuickConnectActivate").addEventListener("click", () => {
|
|
quickConnectSettingsInstance.activate(quickConnectSettingsInstance);
|
|
});
|
|
|
|
quickConnectSettingsInstance.loadData();
|
|
|
|
ApiClient.getQuickConnect("Status").then((status) => {
|
|
let btn = view.querySelector("#btnQuickConnectActivate");
|
|
|
|
if (status === "Unavailable") {
|
|
btn.textContent = "Quick connect is not available on this server";
|
|
btn.disabled = true;
|
|
return false;
|
|
} else if (status === "Available") {
|
|
return false;
|
|
}
|
|
|
|
btn.style.display = "none";
|
|
return true;
|
|
}).catch((e) => {
|
|
throw e;
|
|
});
|
|
});
|
|
view.addEventListener("viewbeforehide", function () {
|
|
if (quickConnectSettingsInstance) {
|
|
quickConnectSettingsInstance.submit();
|
|
}
|
|
onDestroy();
|
|
});
|
|
view.addEventListener("viewdestroy", function () {
|
|
onDestroy();
|
|
});
|
|
|
|
function onDestroy() {
|
|
if (quickConnectSettingsInstance) {
|
|
quickConnectSettingsInstance.destroy();
|
|
quickConnectSettingsInstance = null;
|
|
}
|
|
}
|
|
};
|
|
});
|