mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-03-24 10:21:27 +01:00
refactor(frontend): remove unused modal code and expose htmx to window
This commit is contained in:
@@ -2,47 +2,19 @@ import htmx from "htmx.org";
|
||||
import _hyperscript from 'hyperscript.org/dist/_hyperscript.min';
|
||||
import Alpine from "alpinejs";
|
||||
import mask from '@alpinejs/mask';
|
||||
|
||||
window.htmx = htmx;
|
||||
window.Alpine = Alpine;
|
||||
|
||||
Alpine.start();
|
||||
Alpine.plugin(mask);
|
||||
_hyperscript.browserInit();
|
||||
|
||||
let modalEle = document.getElementById("modal");
|
||||
|
||||
if (modalEle) {
|
||||
const modal = new bootstrap.Modal(modalEle); // eslint-disable-line no-undef
|
||||
|
||||
htmx.on("htmx:beforeSwap", (e) => {
|
||||
// Empty response targeting #dialog => hide the modal
|
||||
if (e.detail.target.id === "dialog" && !e.detail.xhr.response) {
|
||||
modal.hide();
|
||||
e.detail.shouldSwap = false;
|
||||
}
|
||||
});
|
||||
|
||||
htmx.on("hidden.bs.modal", () => {
|
||||
document.getElementById("dialog").innerHTML = "";
|
||||
});
|
||||
}
|
||||
|
||||
const successAudio = new Audio("/static/sounds/success.mp3");
|
||||
const popAudio = new Audio("/static/sounds/pop.mp3");
|
||||
window.paidSound = successAudio;
|
||||
window.unpaidSound = popAudio;
|
||||
|
||||
// htmx.on("paid", () => {
|
||||
// successAudio.pause();
|
||||
// successAudio.currentTime = 0;
|
||||
// successAudio.play();
|
||||
// });
|
||||
//
|
||||
// htmx.on("unpaid", () => {
|
||||
// popAudio.pause();
|
||||
// popAudio.currentTime = 0;
|
||||
// popAudio.play();
|
||||
// });
|
||||
|
||||
/**
|
||||
* Parse a localized number to a float.
|
||||
* @param {string} stringNumber - the localized number
|
||||
|
||||
Reference in New Issue
Block a user