ts: format finally
formatted with biome, a config file is provided.
This commit is contained in:
+56
-44
@@ -20,7 +20,7 @@ loadLangSelector("admin");
|
||||
// _get(`/lang/admin/${window.language}.json`, null, (req: XMLHttpRequest) => {
|
||||
// if (req.readyState == 4 && req.status == 200) {
|
||||
// langLoaded = true;
|
||||
// window.lang = new lang(req.response as LangFile);
|
||||
// window.lang = new lang(req.response as LangFile);
|
||||
// }
|
||||
// });
|
||||
|
||||
@@ -34,35 +34,37 @@ window.availableProfiles = window.availableProfiles || [];
|
||||
(() => {
|
||||
window.modals = {} as Modals;
|
||||
|
||||
window.modals.login = new Modal(document.getElementById('modal-login'), true);
|
||||
window.modals.login = new Modal(document.getElementById("modal-login"), true);
|
||||
|
||||
window.modals.addUser = new Modal(document.getElementById('modal-add-user'));
|
||||
window.modals.addUser = new Modal(document.getElementById("modal-add-user"));
|
||||
|
||||
window.modals.about = new Modal(document.getElementById('modal-about'));
|
||||
(document.getElementById('setting-about') as HTMLSpanElement).onclick = window.modals.about.toggle;
|
||||
window.modals.about = new Modal(document.getElementById("modal-about"));
|
||||
(document.getElementById("setting-about") as HTMLSpanElement).onclick = window.modals.about.toggle;
|
||||
|
||||
window.modals.modifyUser = new Modal(document.getElementById('modal-modify-user'));
|
||||
window.modals.modifyUser = new Modal(document.getElementById("modal-modify-user"));
|
||||
|
||||
window.modals.deleteUser = new Modal(document.getElementById('modal-delete-user'));
|
||||
window.modals.deleteUser = new Modal(document.getElementById("modal-delete-user"));
|
||||
|
||||
window.modals.settingsRestart = new Modal(document.getElementById('modal-restart'));
|
||||
window.modals.settingsRestart = new Modal(document.getElementById("modal-restart"));
|
||||
|
||||
window.modals.settingsRefresh = new Modal(document.getElementById('modal-refresh'));
|
||||
window.modals.settingsRefresh = new Modal(document.getElementById("modal-refresh"));
|
||||
|
||||
window.modals.ombiProfile = new Modal(document.getElementById('modal-ombi-profile'));
|
||||
document.getElementById('form-ombi-defaults').addEventListener('submit', window.modals.ombiProfile.close);
|
||||
|
||||
window.modals.jellyseerrProfile = new Modal(document.getElementById('modal-jellyseerr-profile'));
|
||||
document.getElementById('form-jellyseerr-defaults').addEventListener('submit', window.modals.jellyseerrProfile.close);
|
||||
window.modals.ombiProfile = new Modal(document.getElementById("modal-ombi-profile"));
|
||||
document.getElementById("form-ombi-defaults").addEventListener("submit", window.modals.ombiProfile.close);
|
||||
|
||||
window.modals.jellyseerrProfile = new Modal(document.getElementById("modal-jellyseerr-profile"));
|
||||
document
|
||||
.getElementById("form-jellyseerr-defaults")
|
||||
.addEventListener("submit", window.modals.jellyseerrProfile.close);
|
||||
|
||||
window.modals.profiles = new Modal(document.getElementById("modal-user-profiles"));
|
||||
|
||||
window.modals.addProfile = new Modal(document.getElementById("modal-add-profile"));
|
||||
|
||||
|
||||
window.modals.editProfile = new Modal(document.getElementById("modal-edit-profile"));
|
||||
|
||||
window.modals.announce = new Modal(document.getElementById("modal-announce"));
|
||||
|
||||
|
||||
window.modals.editor = new Modal(document.getElementById("modal-editor"));
|
||||
|
||||
window.modals.customizeEmails = new Modal(document.getElementById("modal-customize"));
|
||||
@@ -74,7 +76,7 @@ window.availableProfiles = window.availableProfiles || [];
|
||||
window.modals.matrix = new Modal(document.getElementById("modal-matrix"));
|
||||
|
||||
window.modals.logs = new Modal(document.getElementById("modal-logs"));
|
||||
|
||||
|
||||
window.modals.tasks = new Modal(document.getElementById("modal-tasks"));
|
||||
|
||||
window.modals.backedUp = new Modal(document.getElementById("modal-backed-up"));
|
||||
@@ -111,7 +113,7 @@ var settings = new settingsList();
|
||||
|
||||
var profiles = new ProfileEditor();
|
||||
|
||||
window.notifications = new notificationBox(document.getElementById('notification-box') as HTMLDivElement, 5);
|
||||
window.notifications = new notificationBox(document.getElementById("notification-box") as HTMLDivElement, 5);
|
||||
|
||||
/*const modifySettingsSource = function () {
|
||||
const profile = document.getElementById('radio-use-profile') as HTMLInputElement;
|
||||
@@ -131,46 +133,47 @@ let isInviteURL = window.invites.isInviteURL();
|
||||
let isAccountURL = accounts.isAccountURL();
|
||||
|
||||
// load tabs
|
||||
const tabs: { id: string, url: string, reloader: () => void, unloader?: () => void }[] = [
|
||||
const tabs: { id: string; url: string; reloader: () => void; unloader?: () => void }[] = [
|
||||
{
|
||||
id: "invites",
|
||||
url: "",
|
||||
reloader: () => window.invites.reload(() => {
|
||||
if (isInviteURL) {
|
||||
window.invites.loadInviteURL();
|
||||
// Don't keep loading the same item on every tab refresh
|
||||
isInviteURL = false;
|
||||
}
|
||||
}),
|
||||
reloader: () =>
|
||||
window.invites.reload(() => {
|
||||
if (isInviteURL) {
|
||||
window.invites.loadInviteURL();
|
||||
// Don't keep loading the same item on every tab refresh
|
||||
isInviteURL = false;
|
||||
}
|
||||
}),
|
||||
},
|
||||
{
|
||||
id: "accounts",
|
||||
url: "accounts",
|
||||
reloader: () => accounts.reload(() => {
|
||||
if (isAccountURL) {
|
||||
accounts.loadAccountURL();
|
||||
// Don't keep loading the same item on every tab refresh
|
||||
isAccountURL = false;
|
||||
}
|
||||
accounts.bindPageEvents();
|
||||
}),
|
||||
unloader: accounts.unbindPageEvents
|
||||
|
||||
reloader: () =>
|
||||
accounts.reload(() => {
|
||||
if (isAccountURL) {
|
||||
accounts.loadAccountURL();
|
||||
// Don't keep loading the same item on every tab refresh
|
||||
isAccountURL = false;
|
||||
}
|
||||
accounts.bindPageEvents();
|
||||
}),
|
||||
unloader: accounts.unbindPageEvents,
|
||||
},
|
||||
{
|
||||
id: "activity",
|
||||
url: "activity",
|
||||
reloader: () => {
|
||||
activity.reload()
|
||||
activity.reload();
|
||||
activity.bindPageEvents();
|
||||
},
|
||||
unloader: activity.unbindPageEvents
|
||||
unloader: activity.unbindPageEvents,
|
||||
},
|
||||
{
|
||||
id: "settings",
|
||||
url: "settings",
|
||||
reloader: settings.reload
|
||||
}
|
||||
reloader: settings.reload,
|
||||
},
|
||||
];
|
||||
|
||||
const defaultTab = tabs[0];
|
||||
@@ -178,10 +181,16 @@ const defaultTab = tabs[0];
|
||||
window.tabs = new Tabs();
|
||||
|
||||
for (let tab of tabs) {
|
||||
window.tabs.addTab(tab.id, window.pages.Base + window.pages.Admin + "/" + tab.url, null, tab.reloader, tab.unloader || null);
|
||||
window.tabs.addTab(
|
||||
tab.id,
|
||||
window.pages.Base + window.pages.Admin + "/" + tab.url,
|
||||
null,
|
||||
tab.reloader,
|
||||
tab.unloader || null,
|
||||
);
|
||||
}
|
||||
|
||||
let matchedTab = false
|
||||
let matchedTab = false;
|
||||
for (const tab of tabs) {
|
||||
if (window.location.pathname.startsWith(window.pages.Base + window.pages.Current + "/" + tab.url)) {
|
||||
window.tabs.switch(tab.url, true);
|
||||
@@ -199,10 +208,13 @@ login.onLogin = () => {
|
||||
window.updater = new Updater();
|
||||
// FIXME: Decide whether to autoload activity or not
|
||||
reloadProfileNames();
|
||||
setInterval(() => { window.invites.reload(); accounts.reloadIfNotInScroll(); }, 30*1000);
|
||||
setInterval(() => {
|
||||
window.invites.reload();
|
||||
accounts.reloadIfNotInScroll();
|
||||
}, 30 * 1000);
|
||||
// Triggers pre and post funcs, even though we're already on that page
|
||||
window.tabs.switch(window.tabs.current);
|
||||
}
|
||||
};
|
||||
|
||||
bindManualDropdowns();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user