-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented loading animation during requests
- Loading branch information
Showing
6 changed files
with
178 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const form = document.querySelector("form"); | ||
const loadingScreen = document.querySelector(".loading-screen"); | ||
const loadingMsg = loadingScreen.querySelector("h2"); | ||
const spinner = loadingScreen.querySelector(".spinner"); | ||
const reloadBtn = loadingScreen.querySelector(".reload"); | ||
|
||
export function showLoadingScreen(msg) { | ||
hide(form, reloadBtn); | ||
show(loadingScreen, spinner); | ||
loadingMsg.classList.remove("error"); | ||
loadingMsg.textContent = msg; | ||
} | ||
|
||
export function showError(msg) { | ||
showLoadingScreen(msg); | ||
loadingMsg.innerHTML += | ||
"<br/>Stelle sicher, dass du mit dem DMX-Interface verbunden bist und die IP-Adresse stimmt."; | ||
show(reloadBtn); | ||
hide(spinner); | ||
loadingMsg.classList.add("error"); | ||
} | ||
|
||
export function hideLoadingScreen() { | ||
hide(loadingScreen, reloadBtn); | ||
show(form); | ||
loadingMsg.classList.remove("error"); | ||
loadingMsg.textContent = ""; | ||
} | ||
|
||
function show(...elements) { | ||
for (const element of elements) { | ||
element.classList.remove("hidden"); | ||
} | ||
} | ||
|
||
function hide(...elements) { | ||
for (const element of elements) { | ||
element.classList.add("hidden"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters