You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/packages/ui-default/entry.js

49 lines
1.4 KiB
JavaScript

window.Hydro = {
extraPages: [],
preload: [],
components: {},
utils: {},
node_modules: {},
};
console.log(
'%c%s%c%s',
'color:red;font-size:24px;',
' Welcome to\n',
'color:blue;font-weight:bold;', `\
__ __ __
/ / / /_ ______/ /________
/ /_/ / / / / __ / ___/ __ \\
/ __ / /_/ / /_/ / / / /_/ /
/_/ /_/\\__, /\\__,_/_/ \\____/
/____/
3 years ago
`,
);
3 years ago
document.addEventListener('DOMContentLoaded', async () => {
window.UiContext = JSON.parse(window.UiContext);
const PageLoader = '<div class="page-loader nojs--hide" style="display:none;"><div class="loader"></div></div>';
$('body').prepend(PageLoader);
$('.page-loader').fadeIn(500);
// eslint-disable-next-line camelcase
try { __webpack_public_path__ = UiContext.cdn_prefix; } catch (e) { }
// Locale & langs
const { version, payload } = JSON.parse(localStorage.getItem('hydro-constant') || '{}');
if (version === UiContext.constantVersion) {
eval(payload[0]); // eslint-disable-line no-eval
payload.shift();
window.Hydro.preload = payload;
} else {
3 years ago
const res = await fetch(`/constant?version=${UiContext.constantVersion}`);
const data = await res.json();
eval(data.payload[0]); // eslint-disable-line no-eval
localStorage.setItem('hydro-constant', JSON.stringify(data));
data.payload.shift();
window.Hydro.preload = data.payload;
}
3 years ago
import('./hydro');
}, false);