Skip to content

Commit a631721

Browse files
committed
Merge branch 'feature-loading-messages'
2 parents 3ee6792 + 347adf6 commit a631721

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

src/web/App.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ App.prototype.loaded = function() {
7070
document.getElementById("loader-wrapper").remove();
7171
document.body.classList.remove("loaded");
7272
}, 1000);
73+
74+
// Clear the loading message interval
75+
clearInterval(window.loadingMsgInt);
7376
};
7477

7578

src/web/html/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,37 @@
3434
<script type="application/javascript">
3535
// Load theme before the preloader is shown
3636
document.querySelector(":root").className = JSON.parse(localStorage.getItem("options")).theme;
37+
38+
// Cycle loading messages
39+
const loadingMsgs = [
40+
"Proving P = NP...",
41+
"Computing 6 x 9...",
42+
"Mining bitcoin...",
43+
"Dividing by 0...",
44+
"Initialising Skynet...",
45+
"[REDACTED]",
46+
"Downloading more RAM...",
47+
"Loading more loading messages...",
48+
"Ordering 1s and 0s...",
49+
"Navigating neural network...",
50+
"Importing machine learning..."
51+
];
52+
function changeLoadingMsg() {
53+
try {
54+
const el = document.getElementById("preloader-msg");
55+
el.className = "loading"; // Causes CSS transition on first message
56+
el.innerHTML = loadingMsgs[Math.floor(Math.random()*loadingMsgs.length)];
57+
} catch (err) {}
58+
}
59+
changeLoadingMsg();
60+
window.loadingMsgsInt = setInterval(changeLoadingMsg, (Math.random()*500) + 500);
3761
</script>
3862
</head>
3963
<body>
4064
<!-- Preloader overlay -->
4165
<div id="loader-wrapper">
4266
<div id="preloader"></div>
67+
<div id="preloader-msg"></div>
4368
</div>
4469
<!-- End preloader overlay -->
4570
<span id="edit-favourites" class="btn btn-default btn-sm"><img aria-hidden="true" src="<%- require('../static/images/favourite-16x16.png') %>" alt="Star Icon"/> Edit</span>

src/web/stylesheets/preloader.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,26 @@
5555
animation: spin 1.5s linear infinite;
5656
}
5757

58+
#preloader-msg {
59+
display: block;
60+
position: relative;
61+
width: 300px;
62+
left: calc(50% - 150px);
63+
top: calc(50% + 50px);
64+
text-align: center;
65+
margin-top: 50px;
66+
opacity: 0;
67+
}
68+
69+
#preloader-msg.loading {
70+
opacity: 1;
71+
transition: all 0.1s ease-in;
72+
}
73+
5874

5975
/* Loaded */
60-
.loaded #preloader {
76+
.loaded #preloader,
77+
.loaded #preloader-msg {
6178
opacity: 0;
6279
transition: all 0.3s ease-out;
6380
}

0 commit comments

Comments
 (0)