created javascript modules

This commit is contained in:
Simon-Martens
2024-01-25 15:26:15 +01:00
parent e033bd23f3
commit 065246acdc
12 changed files with 66 additions and 24 deletions

View File

@@ -20,5 +20,25 @@
@* Styles *@
<link rel="stylesheet" href="/dist/style.css" asp-append-version="true" />
@* JavaScript *@
@await Html.PartialAsync("/Views/Shared/_JavaScript.cshtml")
<script type="module">
import { startup_clipboard, startup_markanchor, startup_mobilemenu, startup_scrollbutton, startup_marginals, startup_theme, startup_menu } from "/dist/scripts.js";
startup_marginals();
startup_theme();
startup_scrollbutton();
startup_menu();
startup_mobilemenu();
startup_markanchor();
startup_clipboard();
</script>
<script type="module">
import "/js/mark.min.js";
document.addEventListener("DOMContentLoaded", (event) => {
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
});
</script>