diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abe251a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/temp \ No newline at end of file diff --git a/assets/audio/whoosh.mp3 b/assets/audio/whoosh.mp3 new file mode 100644 index 0000000..02498c8 Binary files /dev/null and b/assets/audio/whoosh.mp3 differ diff --git a/js/app.js b/js/app.js index 066b935..82d3957 100644 --- a/js/app.js +++ b/js/app.js @@ -20,8 +20,8 @@ const TimeTrack = { publicDB: false, fun: false, sounds: [ - // 'psycho.mp3', - 'alert.mp3' + // 'psycho', + 'alert' ], } }, @@ -112,8 +112,7 @@ const TimeTrack = { let noNoTickets = ['#1920', '#3110', '#2492', '#2419', '#1256']; if (this.fun && noNoTickets.includes(ticket.number)) { - let psycho = new Audio('/timetrack/assets/audio/' + oneOf(this.sounds)); - psycho.play(); + playSound(oneOf(this.sounds)) } this.$forceUpdate(); @@ -321,11 +320,11 @@ const TimeTrack = { setTimeout(() => { let historyModal = new bootstrap.Modal(document.getElementById('historyModal')); historyModal.toggle(); - }, 50) + }, 50); }, getPortalLink (test = false) { - let finalPortalName = this.portal.replace('_', '-'); - finalPortalName.replace('-test', ''); + let finalPortalName = this.portal.replaceAll('_', '-'); + finalPortalName.replaceAll('-test', ''); finalPortalName += test ? '-test' : ''; return 'https://' + finalPortalName + '.vemap.com'; @@ -356,6 +355,7 @@ const TimeTrack = { message: 'Portal-Wechsel erfolgreich', color: 'green' }); + playSound('whoosh'); vue.updateStorage(); }) }, @@ -409,4 +409,9 @@ function oneOf(collection) { return collection[Math.floor(Math.random()*collection.length)]; } +function playSound(sound, extension = null) { + let audio = new Audio('/timetrack/assets/audio/' + sound + (extension ?? '.mp3')); + audio.play(); +} + Vue.createApp(TimeTrack).mount('#root');