This commit is contained in:
Herculino Trotta
2024-10-09 00:31:21 -03:00
parent e78e4cc5e1
commit 3dde44b1cd
139 changed files with 4965 additions and 1004 deletions

View File

@@ -26,17 +26,34 @@ if (modalEle) {
});
}
let successAudio = new Audio("/static/sounds/success.mp3");
let popAudio = new Audio("/static/sounds/pop.mp3");
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("paid", () => {
// successAudio.pause();
// successAudio.currentTime = 0;
// successAudio.play();
// });
//
// htmx.on("unpaid", () => {
// popAudio.pause();
// popAudio.currentTime = 0;
// popAudio.play();
// });
htmx.on("unpaid", () => {
popAudio.pause();
popAudio.currentTime = 0;
popAudio.play();
});
/**
* Parse a localized number to a float.
* @param {string} stringNumber - the localized number
* @param {string} locale - [optional] the locale that the number is represented in. Omit this parameter to use the current locale.
*/
window.parseLocaleNumber = function parseLocaleNumber(stringNumber, locale) {
let thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, '');
let decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, '');
return parseFloat(stringNumber
.replace(new RegExp('\\' + thousandSeparator, 'g'), '')
.replace(new RegExp('\\' + decimalSeparator), '.')
);
};