mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
created javascript modules
This commit is contained in:
@@ -20,5 +20,25 @@
|
|||||||
@* Styles *@
|
@* Styles *@
|
||||||
<link rel="stylesheet" href="/dist/style.css" asp-append-version="true" />
|
<link rel="stylesheet" href="/dist/style.css" asp-append-version="true" />
|
||||||
|
|
||||||
@* JavaScript *@
|
<script type="module">
|
||||||
@await Html.PartialAsync("/Views/Shared/_JavaScript.cshtml")
|
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>
|
||||||
|
|||||||
13
HaWeb/package-lock.json
generated
13
HaWeb/package-lock.json
generated
@@ -10,6 +10,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^10.4.7",
|
"autoprefixer": "^10.4.7",
|
||||||
"cssnano": "^5.1.11",
|
"cssnano": "^5.1.11",
|
||||||
|
"mark.js": "^8.11.1",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"postcss-cli": "^9.1.0",
|
"postcss-cli": "^9.1.0",
|
||||||
"postcss-import": "^14.1.0",
|
"postcss-import": "^14.1.0",
|
||||||
@@ -1480,6 +1481,12 @@
|
|||||||
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==",
|
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/mark.js": {
|
||||||
|
"version": "8.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz",
|
||||||
|
"integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/mdn-data": {
|
"node_modules/mdn-data": {
|
||||||
"version": "2.0.14",
|
"version": "2.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
||||||
@@ -3601,6 +3608,12 @@
|
|||||||
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==",
|
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"mark.js": {
|
||||||
|
"version": "8.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz",
|
||||||
|
"integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"mdn-data": {
|
"mdn-data": {
|
||||||
"version": "2.0.14",
|
"version": "2.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz",
|
||||||
|
|||||||
@@ -9,12 +9,13 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^5.0.8",
|
|
||||||
"autoprefixer": "^10.4.7",
|
"autoprefixer": "^10.4.7",
|
||||||
"cssnano": "^5.1.11",
|
"cssnano": "^5.1.11",
|
||||||
|
"mark.js": "^8.11.1",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"postcss-cli": "^9.1.0",
|
"postcss-cli": "^9.1.0",
|
||||||
"postcss-import": "^14.1.0",
|
"postcss-import": "^14.1.0",
|
||||||
"tailwindcss": "^3.0.24"
|
"tailwindcss": "^3.0.24",
|
||||||
|
"vite": "^5.0.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default defineConfig({
|
|||||||
lib: {
|
lib: {
|
||||||
entry: resolve(__dirname, 'wwwroot/js/main.js'),
|
entry: resolve(__dirname, 'wwwroot/js/main.js'),
|
||||||
name: 'HaWeb',
|
name: 'HaWeb',
|
||||||
fileName: 'scripts'
|
fileName: 'scripts',
|
||||||
},
|
},
|
||||||
outDir: resolve(__dirname, 'wwwroot/dist/'),
|
outDir: resolve(__dirname, 'wwwroot/dist/'),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ const startup_markanchor = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startup_markanchor();
|
export { startup_markanchor };
|
||||||
@@ -9,5 +9,4 @@ const startup_clipboard = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { startup_clipboard };
|
||||||
startup_clipboard();
|
|
||||||
@@ -1 +1,10 @@
|
|||||||
import "../css/site.css";
|
import "../css/site.css";
|
||||||
|
import { startup_marginals } from "./marginals.mjs";
|
||||||
|
import { startup_theme } from "./theme.mjs";
|
||||||
|
import { startup_menu } from "./menu.js";
|
||||||
|
import { startup_markanchor } from "./anchor.mjs";
|
||||||
|
import { startup_mobilemenu } from "./mobilemenu.js";
|
||||||
|
import { startup_scrollbutton } from "./scrollbutton.mjs";
|
||||||
|
import { startup_clipboard } from "./clipboard.mjs";
|
||||||
|
|
||||||
|
export { startup_clipboard, startup_mobilemenu, startup_markanchor, startup_menu, startup_scrollbutton, startup_marginals, startup_theme };
|
||||||
@@ -154,10 +154,10 @@ const startup_marginals = function () {
|
|||||||
overlappingcollapsebox(".ha-text .ha-marginalbox", true);
|
overlappingcollapsebox(".ha-text .ha-marginalbox", true);
|
||||||
};
|
};
|
||||||
|
|
||||||
var collapsedboxes = [];
|
let collapsedboxes = [];
|
||||||
|
|
||||||
const clearcollapsedboxes = function () {
|
const clearcollapsedboxes = function () {
|
||||||
var elements = document.querySelectorAll(".ha-text .ha-marginalbox");
|
let elements = document.querySelectorAll(".ha-text .ha-marginalbox");
|
||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
element.removeAttribute("style");
|
element.removeAttribute("style");
|
||||||
});
|
});
|
||||||
@@ -167,7 +167,7 @@ const startup_marginals = function () {
|
|||||||
element.outerHTML = element.outerHTML;
|
element.outerHTML = element.outerHTML;
|
||||||
});
|
});
|
||||||
collapsedboxes = [];
|
collapsedboxes = [];
|
||||||
var elements = document.querySelectorAll(".ha-btn-collapsed-box");
|
elements = document.querySelectorAll(".ha-btn-collapsed-box");
|
||||||
elements.forEach(element => {
|
elements.forEach(element => {
|
||||||
element.remove();
|
element.remove();
|
||||||
});
|
});
|
||||||
@@ -184,10 +184,10 @@ const startup_marginals = function () {
|
|||||||
collapseboxes();
|
collapseboxes();
|
||||||
|
|
||||||
var doit;
|
var doit;
|
||||||
this.window.addEventListener("resize", function () {
|
window.addEventListener("resize", function () {
|
||||||
this.clearTimeout(doit);
|
clearTimeout(doit);
|
||||||
doit = this.setTimeout(resetall, 17);
|
doit = setTimeout(resetall, 17);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
startup_marginals();
|
export { startup_marginals };
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const startup_active = function () {
|
const startup_menu = function () {
|
||||||
// Gives active classes to links with active URLs
|
// Gives active classes to links with active URLs
|
||||||
// Marks links as active which target URL starts with the current URL
|
// Marks links as active which target URL starts with the current URL
|
||||||
const markactive_startswith = function (element) {
|
const markactive_startswith = function (element) {
|
||||||
@@ -65,9 +65,9 @@ const startup_active = function () {
|
|||||||
markactive_menu(document.getElementById("ha-topnav"));
|
markactive_menu(document.getElementById("ha-topnav"));
|
||||||
if (document.getElementById("ha-register-nav") !== null)
|
if (document.getElementById("ha-register-nav") !== null)
|
||||||
markactive_exact(document.getElementById("ha-register-nav"));
|
markactive_exact(document.getElementById("ha-register-nav"));
|
||||||
if (this.document.getElementById("ha-adminuploadfields") !== null)
|
if (document.getElementById("ha-adminuploadfields") !== null)
|
||||||
markactive_exact(document.getElementById("ha-adminuploadfields"));
|
markactive_exact(document.getElementById("ha-adminuploadfields"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
startup_active();
|
export { startup_menu };
|
||||||
@@ -32,4 +32,4 @@ const startup_mobilemenu = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
startup_mobilemenu();
|
export { startup_mobilemenu };
|
||||||
@@ -2,7 +2,7 @@ const startup_scrollbutton = function () {
|
|||||||
|
|
||||||
// Script for showing and acting upon the "scroll to top button"
|
// Script for showing and acting upon the "scroll to top button"
|
||||||
const scrollFunction = function () {
|
const scrollFunction = function () {
|
||||||
button = document.getElementById("ha-scrollbutton");
|
let button = document.getElementById("ha-scrollbutton");
|
||||||
if (button !== null) {
|
if (button !== null) {
|
||||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
|
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
|
||||||
// button.style.display = "block";
|
// button.style.display = "block";
|
||||||
@@ -28,4 +28,4 @@ const startup_scrollbutton = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
startup_scrollbutton();
|
export { startup_scrollbutton };
|
||||||
@@ -20,7 +20,7 @@ const startup_theme = function () {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
document.getElementById("ha-togglebright") !== null &&
|
document.getElementById("ha-togglebright") !== null &&
|
||||||
this.document.getElementById("ha-toggledark") !== null
|
document.getElementById("ha-toggledark") !== null
|
||||||
) {
|
) {
|
||||||
document
|
document
|
||||||
.getElementById("ha-togglebright")
|
.getElementById("ha-togglebright")
|
||||||
@@ -32,4 +32,4 @@ const startup_theme = function () {
|
|||||||
get_theme_settings("ha-togglebright");
|
get_theme_settings("ha-togglebright");
|
||||||
};
|
};
|
||||||
|
|
||||||
startup_theme();
|
export { startup_theme };
|
||||||
Reference in New Issue
Block a user