Spaces:
Sleeping
Sleeping
Update templates/forecaster.html
Browse files- templates/forecaster.html +37 -23
templates/forecaster.html
CHANGED
|
@@ -125,13 +125,24 @@
|
|
| 125 |
</form>
|
| 126 |
|
| 127 |
<!-- this will animate once the form starts submitting -->
|
| 128 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
<div
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
| 133 |
></div>
|
| 134 |
</div>
|
|
|
|
| 135 |
</div>
|
| 136 |
</div>
|
| 137 |
</div>
|
|
@@ -146,25 +157,28 @@
|
|
| 146 |
<script src="{{ url_for('static', filename='assets/js/custom.js') }}"></script>
|
| 147 |
|
| 148 |
<script>
|
| 149 |
-
document.
|
| 150 |
-
|
| 151 |
-
const
|
| 152 |
-
const bar
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
| 167 |
});
|
| 168 |
-
|
| 169 |
</body>
|
| 170 |
</html>
|
|
|
|
| 125 |
</form>
|
| 126 |
|
| 127 |
<!-- this will animate once the form starts submitting -->
|
| 128 |
+
<!-- Loader bar only -->
|
| 129 |
+
<div
|
| 130 |
+
id="loaderWrapper"
|
| 131 |
+
style="display:none;
|
| 132 |
+
position:relative;
|
| 133 |
+
width:100%;
|
| 134 |
+
height:4px;
|
| 135 |
+
background:#e9ecef;
|
| 136 |
+
margin-top:1rem;"
|
| 137 |
+
>
|
| 138 |
<div
|
| 139 |
+
id="loaderBar"
|
| 140 |
+
style="width:0%;
|
| 141 |
+
height:100%;
|
| 142 |
+
background:#0d6efd;"
|
| 143 |
></div>
|
| 144 |
</div>
|
| 145 |
+
|
| 146 |
</div>
|
| 147 |
</div>
|
| 148 |
</div>
|
|
|
|
| 157 |
<script src="{{ url_for('static', filename='assets/js/custom.js') }}"></script>
|
| 158 |
|
| 159 |
<script>
|
| 160 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 161 |
+
const form = document.getElementById('forecastForm');
|
| 162 |
+
const wrapper = document.getElementById('loaderWrapper');
|
| 163 |
+
const bar = document.getElementById('loaderBar');
|
| 164 |
+
|
| 165 |
+
form.addEventListener('submit', () => {
|
| 166 |
+
// show & reset the bar
|
| 167 |
+
wrapper.style.display = 'block';
|
| 168 |
+
bar.style.width = '0%';
|
| 169 |
+
|
| 170 |
+
// animate 0→100% in 45s
|
| 171 |
+
let pct = 0;
|
| 172 |
+
const intervalId = setInterval(() => {
|
| 173 |
+
pct = Math.min(100, pct + 1);
|
| 174 |
+
bar.style.width = pct + '%';
|
| 175 |
+
if (pct === 100) clearInterval(intervalId);
|
| 176 |
+
}, 450);
|
| 177 |
+
|
| 178 |
+
// short delay to ensure paint, then submit
|
| 179 |
+
setTimeout(() => form.submit(), 50);
|
| 180 |
+
});
|
| 181 |
});
|
| 182 |
+
</script>
|
| 183 |
</body>
|
| 184 |
</html>
|