Refactored CSS and HTML templates and polished UI (#10), changed JavaScript variable names to camelCase, adjusted filenames and some url parameter names in urlpatterns, and more.

This commit is contained in:
W13R 2022-11-04 20:35:28 +01:00
parent 1e32e2b5dd
commit 8599f49857
30 changed files with 401 additions and 403 deletions

View file

@ -2,21 +2,21 @@ document.addEventListener("DOMContentLoaded", () => {
// elements
let deposit_form = document.getElementById("depositForm");
let status_info = document.getElementById("statusInfo");
let deposit_submit_button = document.getElementById("depositSubmitBtn");
let depositForm = document.getElementById("depositform");
let statusInfo = document.getElementById("statusinfo");
let depositSubmitButton = document.getElementById("depositsubmitbtn");
// event listener for deposit form
// this implements a custom submit method
deposit_form.addEventListener("submit", (event) => {
depositForm.addEventListener("submit", (event) => {
deposit_submit_button.disabled = true;
depositSubmitButton.disabled = true;
event.preventDefault(); // Don't do the default submit action!
let xhr = new XMLHttpRequest();
let formData = new FormData(deposit_form);
let formData = new FormData(depositForm);
xhr.addEventListener("load", (event) => {
@ -24,20 +24,20 @@ document.addEventListener("DOMContentLoaded", () => {
response_ = event.target.responseText;
if (status_ == 200 && response_ == "success") {
status_info.innerText = "Success. Redirecting soon.";
statusInfo.innerText = "Success. Redirecting soon.";
window.location.replace("/");
}
else {
status_info.classList.add("errorText");
status_info.innerText = "An error occured. Redirecting in 5 seconds...";
statusInfo.classList.add("errortext");
statusInfo.innerText = "An error occured. Redirecting in 5 seconds...";
window.setTimeout(() => { window.location.replace("/") }, 5000);
}
})
xhr.addEventListener("error", (event) => {
status_info.classList.add("errorText");
status_info.innerText = "An error occured. Redirecting in 5 seconds...";
statusInfo.classList.add("errortext");
statusInfo.innerText = "An error occured. Redirecting in 5 seconds...";
window.setTimeout(() => { window.location.replace("/") }, 5000);
})