diff --git a/assets/audio/alert.mp3 b/assets/audio/alert.mp3 new file mode 100644 index 0000000..714c414 Binary files /dev/null and b/assets/audio/alert.mp3 differ diff --git a/js/app.js b/js/app.js index 372d48d..066b935 100644 --- a/js/app.js +++ b/js/app.js @@ -18,7 +18,11 @@ const TimeTrack = { portals: null, importStringForPortals: '', publicDB: false, - fun: false + fun: false, + sounds: [ + // 'psycho.mp3', + 'alert.mp3' + ], } }, mounted() { @@ -108,7 +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/psycho.mp3'); + let psycho = new Audio('/timetrack/assets/audio/' + oneOf(this.sounds)); psycho.play(); } @@ -320,7 +324,11 @@ const TimeTrack = { }, 50) }, getPortalLink (test = false) { - return 'https://' + this.portal.replace('_', '-').replace('_test', '') + (test ? '-test' : '') + '.vemap.com'; + let finalPortalName = this.portal.replace('_', '-'); + finalPortalName.replace('-test', ''); + finalPortalName += test ? '-test' : ''; + + return 'https://' + finalPortalName + '.vemap.com'; }, collectDataForDay() { let collection = []; @@ -397,4 +405,8 @@ const TimeTrack = { } }; +function oneOf(collection) { + return collection[Math.floor(Math.random()*collection.length)]; +} + Vue.createApp(TimeTrack).mount('#root');