mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
36 lines
1.8 KiB
Plaintext
36 lines
1.8 KiB
Plaintext
@* Javascript gets inlined because it ain't much (but it's honest work) *@
|
|
|
|
@* Mark searched term *@
|
|
@if(ViewData.ContainsKey("Mark")) {
|
|
<script src="~/js/mark.min.js" asp-append-version="true"></script>
|
|
<script>
|
|
var instancesearch = new Mark(document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-comment"));
|
|
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, "debug": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"]});
|
|
</script>
|
|
}
|
|
<script>
|
|
function markanchor() {
|
|
var currentUrl = document.URL,
|
|
urlParts = currentUrl.split('#');
|
|
var anchor = (urlParts.length > 1) ? urlParts[1] : null;
|
|
if (anchor != null) {
|
|
var element = document.getElementById(anchor);
|
|
if (element !== null && element.classList.contains("ha-linecount")) {
|
|
element.classList.add("ha-location");
|
|
element.classList.add("font-bold");
|
|
element.classList.add("mr-3");
|
|
element.prepend("● ");
|
|
} else if (element !== null && element.classList.contains("ha-commenthead")) {
|
|
element.classList.add("ha-location");
|
|
element.classList.add("font-bold");
|
|
element.prepend("● ");
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener("load", function () {
|
|
markanchor();
|
|
});
|
|
</script> |