mirror of
https://github.com/zadam/trilium.git
synced 2026-01-11 09:04:28 +01:00
refactor(client): handle everything in bootstrap
This commit is contained in:
parent
2e845a9faa
commit
7a088c5b7d
@ -13,11 +13,6 @@
|
||||
<body id="trilium-app">
|
||||
<noscript><%= t("javascript-required") %></noscript>
|
||||
|
||||
<script>
|
||||
// hide body to reduce flickering on the startup. This is done through JS and not CSS to not hide <noscript>
|
||||
document.getElementsByTagName("body")[0].style.display = "none";
|
||||
</script>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container" style="display: none"></div>
|
||||
|
||||
<!-- Required for match the PWA's top bar color with the theme -->
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import $ from "jquery";
|
||||
|
||||
async function bootstrap() {
|
||||
(window as any).$ = $;
|
||||
(window as any).jQuery = $;
|
||||
|
||||
showSplash();
|
||||
await initJQuery();
|
||||
await setupGlob();
|
||||
await loadBootstrapCss();
|
||||
loadStylesheets();
|
||||
@ -13,6 +10,12 @@ async function bootstrap() {
|
||||
hideSplash();
|
||||
}
|
||||
|
||||
async function initJQuery() {
|
||||
const $ = (await import("jquery")).default;
|
||||
(window as any).$ = $;
|
||||
(window as any).jQuery = $;
|
||||
}
|
||||
|
||||
async function setupGlob() {
|
||||
const response = await fetch(`/bootstrap${window.location.search}`);
|
||||
const json = await response.json();
|
||||
@ -93,8 +96,13 @@ async function loadScripts() {
|
||||
}
|
||||
}
|
||||
|
||||
function showSplash() {
|
||||
// hide body to reduce flickering on the startup. This is done through JS and not CSS to not hide <noscript>
|
||||
document.body.style.display = "none";
|
||||
}
|
||||
|
||||
function hideSplash() {
|
||||
$("body").show();
|
||||
document.body.style.display = "block";
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user