From cc12b95c987f26df5c0d1fef1471c4576a109cca Mon Sep 17 00:00:00 2001 From: Andrew K Date: Fri, 9 Jan 2026 13:30:36 +0900 Subject: [PATCH] use bootstrap style alerts, progress bars --- static/script.js | 23 +++++++-- static/styles.css | 7 ++- templates/upload.html | 105 ++++++++++++++++++++++++++++-------------- 3 files changed, 93 insertions(+), 42 deletions(-) diff --git a/static/script.js b/static/script.js index 8ed8f96..caef571 100644 --- a/static/script.js +++ b/static/script.js @@ -19,6 +19,7 @@ document.addEventListener('DOMContentLoaded', function() { const fileInput = document.getElementById('fileUpload'); const progress = document.getElementById('uploadProgress'); + const progressContainer = document.getElementById('uploadProgressContainer'); const progressText = document.getElementById('uploadProgressText'); const uploadBtn = document.getElementById('uploadBtn'); @@ -42,8 +43,10 @@ document.addEventListener('DOMContentLoaded', function() { if (ev.lengthComputable) { const percent = Math.round((ev.loaded / ev.total) * 100); if (progress) { - progress.style.display = 'block'; - progress.value = percent; + if (progressContainer) progressContainer.style.display = 'block'; + progress.style.width = percent + '%'; + progress.setAttribute('aria-valuenow', percent); + progress.textContent = percent + '%'; } if (progressText) { progressText.style.display = 'block'; @@ -76,13 +79,18 @@ document.addEventListener('DOMContentLoaded', function() { } catch (e) { window.location.href = '/upload'; return; - } finally { + } finally { if (uploadBtn) { uploadBtn.disabled = false; uploadBtn.classList.remove('yellowBtn'); uploadBtn.value = 'Upload'; } - if (progress) { progress.style.display = 'none'; progress.value = 0; } + if (progress) { + if (progressContainer) progressContainer.style.display = 'none'; + progress.style.width = '0%'; + progress.setAttribute('aria-valuenow', 0); + progress.textContent = '0%'; + } if (progressText) { progressText.style.display = 'none'; progressText.textContent = '0%'; } // clear file input and reusable checkbox after successful upload if (fileInput) fileInput.value = ''; @@ -110,7 +118,12 @@ document.addEventListener('DOMContentLoaded', function() { uploadBtn.value = 'Upload'; } if (fileInput) fileInput.value = ''; - if (progress) { progress.style.display = 'none'; progress.value = 0; } + if (progress) { + if (progressContainer) progressContainer.style.display = 'none'; + progress.style.width = '0%'; + progress.setAttribute('aria-valuenow', 0); + progress.textContent = '0%'; + } if (progressText) progressText.style.display = 'none'; }); diff --git a/static/styles.css b/static/styles.css index 93ec7d3..6efaaf4 100644 --- a/static/styles.css +++ b/static/styles.css @@ -35,14 +35,15 @@ body,html { display: flex; flex-direction: column; align-items: flex-start; - width: 50%; + width: 80%; border: 1px solid rgb(40, 40, 40); padding-bottom: 40px; + padding: 50px; } .form-section { padding: 15px 0 0 15px; - width: 50%; + width: 100%; color: var(--light); flex-shrink: 0; } @@ -116,6 +117,8 @@ button[type='button']:hover, display: flex; flex-direction: column; gap: 15px; + padding: 10px; + } .flashes li { list-style-type: none; diff --git a/templates/upload.html b/templates/upload.html index a1cee0e..acc780d 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -1,5 +1,6 @@ + @@ -7,58 +8,87 @@ ADrive Share + +
{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} - + {% endif %} {% endwith %}
{% if loggedIn %} -

You are currently logged in as {{ username }}.

+

ADrive File Sharing {{ username }}

{% else %} -

You are currently not logged in.

+

ADrive File Sharing Guest

{% endif %} - - Finding Nearby Mirror + + Finding Nearby Mirror - + Location Not Found - + - - -
- - Reusable? + + +
+
+ + +
- + - +
- +
{% if not loggedIn %} - -
-

Signing in is not required. You can at any time register and sign in to manage your existing codes for free. You can manage up to 1GB of files.

+ +

+

Signing in is not required. You can at any time + register and sign in to manage your existing codes for free. You can manage up to 1GB of files.

{% else %} - - + + {% endif %}
@@ -69,7 +99,7 @@ + - \ No newline at end of file + + +