1 |
|
2 | "use strict";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | (function() {
|
12 | var displayReload = function displayReload() {
|
13 | var loadingReload = document.getElementById("loading-reload");
|
14 | if (loadingReload) {
|
15 | loadingReload.style.display = "block";
|
16 | }
|
17 | };
|
18 |
|
19 | var loadingSlowTimeout = setTimeout(function() {
|
20 | var loadingSlow = document.getElementById("loading-slow");
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | if (loadingSlow) {
|
27 | loadingSlow.style.display = "block";
|
28 | displayReload();
|
29 | }
|
30 | }, 5000);
|
31 |
|
32 | document.getElementById("loading-reload").addEventListener("click", function() {
|
33 | location.reload();
|
34 | });
|
35 |
|
36 | window.g_LoungeErrorHandler = function LoungeErrorHandler(e) {
|
37 | var title = document.getElementById("loading-title");
|
38 | title.textContent = "An error has occured";
|
39 |
|
40 | var message = document.getElementById("loading-page-message");
|
41 | message.textContent = "An error has occured that prevented the client from loading correctly.";
|
42 |
|
43 | var summary = document.createElement("summary");
|
44 | summary.textContent = "More details";
|
45 |
|
46 | var data = document.createElement("pre");
|
47 | data.textContent = e.message;
|
48 |
|
49 | var info = document.createElement("p");
|
50 | info.textContent = "Open the developer tools of your browser for more information.";
|
51 |
|
52 | var details = document.createElement("details");
|
53 | details.appendChild(summary);
|
54 | details.appendChild(data);
|
55 | details.appendChild(info);
|
56 | message.parentNode.insertBefore(details, message.nextSibling);
|
57 |
|
58 | window.clearTimeout(loadingSlowTimeout);
|
59 | displayReload();
|
60 | };
|
61 |
|
62 | window.addEventListener("error", window.g_LoungeErrorHandler);
|
63 | })();
|