mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-05 00:37:10 +02:00
changes
This commit is contained in:
@@ -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), '.')
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user