admin: add setting to hide background on login

for #288.
This commit is contained in:
Harvey Tindall
2023-10-02 10:34:14 +01:00
parent ff1ea8549a
commit 9956bbd974
9 changed files with 50 additions and 5 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ window.onpopstate = (event: PopStateEvent) => {
window.tabs.switch(event.state);
}
const login = new Login(window.modals.login as Modal, "/");
const login = new Login(window.modals.login as Modal, "/", window.loginAppearance);
login.onLogin = () => {
console.log("Logged in.");
window.updater = new Updater();
+10 -1
View File
@@ -8,13 +8,21 @@ export class Login {
private _endpoint: string;
private _onLogin: (username: string, password: string) => void;
private _logoutButton: HTMLElement = null;
private _wall: HTMLElement;
private _hasOpacityWall: boolean = false;
constructor(modal: Modal, endpoint: string) {
constructor(modal: Modal, endpoint: string, appearance: string) {
this._endpoint = endpoint;
this._url = window.URLBase + endpoint;
if (this._url[this._url.length-1] != '/') this._url += "/";
this._modal = modal;
if (appearance == "opaque") {
this._hasOpacityWall = true;
this._wall = document.createElement("div");
this._wall.classList.add("wall");
this._modal.asElement().parentElement.appendChild(this._wall);
}
this._form = this._modal.asElement().querySelector(".form-login") as HTMLFormElement;
this._form.onsubmit = (event: SubmitEvent) => {
event.preventDefault();
@@ -86,6 +94,7 @@ export class Login {
if (this._onLogin) {
this._onLogin(username, password);
}
if (this._hasOpacityWall) this._wall.remove();
this._modal.close();
if (this._logoutButton != null)
this._logoutButton.classList.remove("unfocused");
+1
View File
@@ -41,6 +41,7 @@ declare interface Window {
jfAdminOnly: boolean;
jfAllowAll: boolean;
referralsEnabled: boolean;
loginAppearance: string;
}
declare interface Update {
+1 -1
View File
@@ -644,7 +644,7 @@ document.addEventListener("details-reload", () => {
});
});
const login = new Login(window.modals.login as Modal, "/my/");
const login = new Login(window.modals.login as Modal, "/my/", "opaque");
login.onLogin = () => {
console.log("Logged in.");
document.querySelector(".page-container").classList.remove("unfocused");