Check if element exists before trying to change message

This commit is contained in:
Pavel Djundik 2018-07-13 10:37:39 +03:00 committed by Pavel Djundik
parent 77947b46c8
commit d9206c1087

View File

@ -9,7 +9,15 @@
*/ */
(function() { (function() {
document.getElementById("loading-page-message").textContent = "Loading the app…"; const msg = document.getElementById("loading-page-message");
if (msg) {
msg.textContent = "Loading the app…";
document.getElementById("loading-reload").addEventListener("click", function() {
location.reload(true);
});
}
var displayReload = function displayReload() { var displayReload = function displayReload() {
var loadingReload = document.getElementById("loading-reload"); var loadingReload = document.getElementById("loading-reload");
@ -32,10 +40,6 @@
} }
}, 5000); }, 5000);
document.getElementById("loading-reload").addEventListener("click", function() {
location.reload();
});
window.g_LoungeErrorHandler = function LoungeErrorHandler(e) { window.g_LoungeErrorHandler = function LoungeErrorHandler(e) {
var message = document.getElementById("loading-page-message"); var message = document.getElementById("loading-page-message");
message.textContent = "An error has occurred that prevented the client from loading correctly."; message.textContent = "An error has occurred that prevented the client from loading correctly.";