Skip to content

Commit 78ccaf3

Browse files
authored
Add resource loading bar (#246)
- Use separate divs for status text and progress bar - Format CSS file
1 parent 64577a6 commit 78ccaf3

File tree

3 files changed

+51
-23
lines changed

3 files changed

+51
-23
lines changed

JetStreamDriver.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,12 @@ class Driver {
552552

553553
updateCounterUI() {
554554
const counter = browserFileLoader.counter;
555-
const statusElement = document.getElementById("status");
556-
statusElement.innerHTML = `Loading ${counter.loadedResources} of ${counter.totalResources} ...`;
555+
const statusElement = document.getElementById("status-text");
556+
statusElement.innerText = `Loading ${counter.loadedResources} of ${counter.totalResources} ...`;
557+
558+
const percent = (counter.loadedResources / counter.totalResources) * 100;
559+
const progressBar = document.getElementById("status-progress-bar");
560+
progressBar.style.width = `${percent}%`;
557561
}
558562

559563
resultsObject(format = "run-benchmark") {

index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ <h2>Non-standard Parameters</h2>
118118
<p class="summary" id="mode-description"></p>
119119

120120
<div id="result-summary"></div>
121-
<div id="status" class="loading">Loading Benchmark...</div>
121+
<div id="status" class="loading">
122+
<div id="status-text">Loading Benchmark...</div>
123+
<div id="status-progress-container">
124+
<div id="status-progress-bar" style="width: 0%"></div>
125+
</div>
126+
</div>
122127

123128
<div id="results"></div>
124129
</main>

resources/JetStream.css

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
*/
2525

2626
:root {
27-
--color-primary: #34AADC;
28-
--color-secondary: #86D9FF;
27+
--color-primary: #34aadc;
28+
--color-secondary: #86d9ff;
2929
--text-color-inverse: white;
3030
--text-color-primary: black;
3131
--text-color-secondary: #555555;
3232
--text-color-tertiary: #444444;
3333
--text-color-subtle: #6c6c71;
34-
--text-color-very-subtle: #8E8E93;
35-
--heading-color: #2C98D1;
36-
--link-hover-color: #0086BF;
34+
--text-color-very-subtle: #8e8e93;
35+
--heading-color: #2c98d1;
36+
--link-hover-color: #0086bf;
3737
--button-color-primary: rgb(52, 170, 220);
3838
--error-text-color: #d24a59;
3939
--benchmark-heading-color: rgb(183, 183, 183);
4040
--benchmark-error-text-color: #ff8686;
41-
--benchmark-done-result-color: #4A4A4A;
41+
--benchmark-done-result-color: #4a4a4a;
4242
--gap: 3rem;
4343
--width: 200px;
4444
--nonDefaultRotate: 152deg;
@@ -64,7 +64,7 @@ body {
6464
background-position: center -5vw;
6565
background-size: 100vw;
6666
padding-bottom: 0px;
67-
background-image: url('clouds.svg');
67+
background-image: url("clouds.svg");
6868
overflow-y: hidden;
6969
height: 100%;
7070
}
@@ -92,7 +92,7 @@ body.nonDefaultParams {
9292

9393
& h2 {
9494
text-align: center;
95-
}
95+
}
9696

9797
& p {
9898
text-align: center;
@@ -131,7 +131,6 @@ body.nonDefaultParams {
131131
color: var(--highlight);
132132
}
133133

134-
135134
.overflow-scroll {
136135
overflow-y: auto;
137136
}
@@ -140,7 +139,6 @@ body.nonDefaultParams {
140139
overflow: visible;
141140
}
142141

143-
144142
::selection {
145143
background-color: var(--color-primary);
146144
color: var(--text-color-inverse);
@@ -179,15 +177,15 @@ img {
179177
box-sizing: border-box;
180178
background-repeat: no-repeat;
181179
background-position: center;
182-
background-image: url('JetStream3Logo.svg');
180+
background-image: url("JetStream3Logo.svg");
183181
color: transparent;
184182
animation: swingin 350ms ease-out forwards;
185183
will-change: transform, opacity;
186184
height: 75px;
187185
}
188186

189187
#jetstreams {
190-
background-image: url('jetstreams.svg');
188+
background-image: url("jetstreams.svg");
191189
background-repeat: no-repeat;
192190
background-size: contain;
193191
background-position: center;
@@ -237,7 +235,6 @@ h1 {
237235
margin-bottom: 0;
238236
}
239237

240-
241238
h2,
242239
h3,
243240
h4,
@@ -247,7 +244,6 @@ h6 {
247244
text-align: left;
248245
}
249246

250-
251247
h4,
252248
h5,
253249
h6 {
@@ -318,6 +314,19 @@ a.button {
318314
background-image: none;
319315
}
320316

317+
#status.loading,
318+
#status-progress-bar {
319+
background-image: linear-gradient(
320+
132deg,
321+
#96e5ff 0%,
322+
#96e5ff 2%,
323+
#86d9ff 42%,
324+
#8bdaff 84%,
325+
#96e5ff 98%,
326+
#96e5ff 100%
327+
);
328+
}
329+
321330
#status.loading {
322331
position: absolute;
323332
top: 0;
@@ -328,9 +337,8 @@ a.button {
328337
font-size: 4rem;
329338
font-style: italic;
330339
font-weight: 500;
331-
letter-spacing: -0.10rem;
340+
letter-spacing: -0.1rem;
332341
color: transparent;
333-
background-image: linear-gradient(132deg, #96E5FF 0%, #96E5FF 2%, #86D9FF 42%, #8BDAFF 84%, #96E5FF 98%, #96E5FF 100%);
334342
-webkit-background-clip: text;
335343
background-repeat: no-repeat;
336344
-webkit-touch-callout: none;
@@ -342,6 +350,18 @@ a.button {
342350
margin: 0 auto 1rem;
343351
}
344352

353+
#status-progress-container {
354+
height: 2.4rem;
355+
width: 80%;
356+
margin: 1rem auto;
357+
overflow: hidden;
358+
}
359+
360+
#status-progress-bar {
361+
height: 100%;
362+
width: 0%;
363+
}
364+
345365
.error h2,
346366
.error p {
347367
color: var(--error-text-color);
@@ -422,7 +442,8 @@ a.button {
422442
.benchmark h4,
423443
.benchmark .result,
424444
.benchmark label,
425-
.benchmark .plot {
445+
.benchmark .plot,
446+
#status-progress-container {
426447
color: transparent;
427448
background: linear-gradient(160deg, rgba(249, 249, 249, 1) 0%, rgba(238, 238, 238, 1) 100%);
428449
border-radius: 3px;
@@ -441,7 +462,6 @@ a.button {
441462
background-image: none;
442463
}
443464

444-
445465
.benchmark-done h3,
446466
.benchmark-done h4,
447467
.benchmark-done .result,
@@ -494,10 +514,9 @@ a.button {
494514
vertical-align: middle;
495515
font-style: italic;
496516
font-weight: bold;
497-
font-family: 'Times New Roman', Times, serif;
517+
font-family: "Times New Roman", Times, serif;
498518
line-height: 1.6rem;
499519
margin-top: -0.2rem;
500-
501520
}
502521

503522
.benchmark-running a.info {

0 commit comments

Comments
 (0)