Controllers+Views+Routes: Add ScriptAfterLoad functionality

This commit is contained in:
Riyyi
2024-11-22 21:32:49 +01:00
parent 7f1e78fa08
commit f0cb958ea2
8 changed files with 88 additions and 14 deletions
+9 -3
View File
@@ -1,11 +1,17 @@
window.web = {};
// -----------------------------------------
// Activate Bootstrap tooltips
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(element => new bootstrap.Tooltip(element))
web.tooltips = function() {
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(element => new bootstrap.Tooltip(element))
}
// -----------------------------------------
// HTMX events
function runOnceAfterSettle(func) {
web.afterLoad = function(func) {
// https://htmx.org/docs/#request-operations
document.addEventListener("htmx:afterSettle", function handler(event) {
func();