|
10 | 10 | <link href="<%- data.bundle.css[s] %>" rel="stylesheet"> |
11 | 11 | <% }); %> |
12 | 12 | <script src="js/require.js"></script> |
13 | | - <noscript> |
14 | | - <style> |
15 | | - #enable-js-banner { |
16 | | - display: flex; |
17 | | - flex-direction: row; |
18 | | - justify-content: center; |
19 | | - padding: 0.5rem; |
20 | | - background-color: #467391; |
21 | | - } |
22 | | - #banner-content { |
23 | | - color: white; |
24 | | - } |
25 | | - </style> |
26 | | - </noscript> |
| 13 | + <style> |
| 14 | + .splash-banner { |
| 15 | + display: flex; |
| 16 | + flex-direction: row; |
| 17 | + justify-content: center; |
| 18 | + align-items: center; |
| 19 | + padding: 0.5rem; |
| 20 | + height: 100%; |
| 21 | + } |
| 22 | + #splash-loading{ |
| 23 | + height: 100%; |
| 24 | + } |
| 25 | + .splash-loading-hide { |
| 26 | + display: none; |
| 27 | + } |
| 28 | + </style> |
27 | 29 | </head> |
28 | 30 | <body> |
| 31 | + <div id="splash-loading" class="splash-banner splash-loading splash-loading-hide"><h3>Loading... Please wait.</h3></div> |
29 | 32 | <div id="owncloud"></div> |
30 | 33 | <noscript> |
31 | | - <div id="enable-js-banner"><h3 id="banner-content">Please enable JavaScript</h3></div> |
| 34 | + <div class="splash-banner"><h3>Please enable JavaScript</h3></div> |
32 | 35 | </noscript> |
33 | 36 | <script> |
34 | | - requirejs.config({ |
35 | | - baseUrl: <%- JSON.stringify(data.roots.js) %>, |
36 | | - paths: <%- JSON.stringify(data.bundle.js) %> |
37 | | - }) |
| 37 | + var loader = document.getElementById('splash-loading') |
| 38 | + var loaderTimer = setTimeout(function () { |
| 39 | + loader.classList.remove('splash-loading-hide') |
| 40 | + }, 1000); |
| 41 | +
|
| 42 | + function displayError() { |
| 43 | + loader.classList.remove('splash-loading-hide') |
| 44 | + loader.innerHTML = "<h3>Oops. Something went wrong.</h3>" |
| 45 | + } |
| 46 | +
|
| 47 | + if (typeof requirejs === 'undefined') { |
| 48 | + displayError() |
| 49 | + } else { |
| 50 | + requirejs.config({ |
| 51 | + baseUrl: <%- JSON.stringify(data.roots.js) %>, |
| 52 | + paths: <%- JSON.stringify(data.bundle.js) %> |
| 53 | + }) |
38 | 54 |
|
39 | | - requirejs(['web-runtime'], function (runtime) { |
40 | | - runtime.bootstrap('config.json').then(runtime.renderSuccess).catch(runtime.renderFailure) |
41 | | - }) |
| 55 | + requirejs(['web-runtime'], function (runtime) { |
| 56 | + clearTimeout(loaderTimer) |
| 57 | + document.getElementById('splash-loading').classList.add('splash-loading-hide') |
| 58 | + runtime.bootstrap('config.json').then(runtime.renderSuccess).catch(runtime.renderFailure) |
| 59 | + }, function(e) { |
| 60 | + displayError() |
| 61 | + throw e |
| 62 | + }) |
| 63 | + } |
| 64 | + |
42 | 65 | </script> |
43 | 66 | </body> |
44 | 67 | </html> |
0 commit comments