Browse Source

add gitignore; add sound for switching

modals-to-spa
stingl 4 years ago
parent
commit
7e0fdc94c0
  1. 1
      .gitignore
  2. BIN
      assets/audio/whoosh.mp3
  3. 19
      js/app.js

1
.gitignore vendored

@ -0,0 +1 @@
/temp

BIN
assets/audio/whoosh.mp3

Binary file not shown.

19
js/app.js

@ -20,8 +20,8 @@ const TimeTrack = {
publicDB: false, publicDB: false,
fun: false, fun: false,
sounds: [ sounds: [
// 'psycho.mp3', // 'psycho',
'alert.mp3' 'alert'
], ],
} }
}, },
@ -112,8 +112,7 @@ const TimeTrack = {
let noNoTickets = ['#1920', '#3110', '#2492', '#2419', '#1256']; let noNoTickets = ['#1920', '#3110', '#2492', '#2419', '#1256'];
if (this.fun && noNoTickets.includes(ticket.number)) { if (this.fun && noNoTickets.includes(ticket.number)) {
let psycho = new Audio('/timetrack/assets/audio/' + oneOf(this.sounds)); playSound(oneOf(this.sounds))
psycho.play();
} }
this.$forceUpdate(); this.$forceUpdate();
@ -321,11 +320,11 @@ const TimeTrack = {
setTimeout(() => { setTimeout(() => {
let historyModal = new bootstrap.Modal(document.getElementById('historyModal')); let historyModal = new bootstrap.Modal(document.getElementById('historyModal'));
historyModal.toggle(); historyModal.toggle();
}, 50) }, 50);
}, },
getPortalLink (test = false) { getPortalLink (test = false) {
let finalPortalName = this.portal.replace('_', '-'); let finalPortalName = this.portal.replaceAll('_', '-');
finalPortalName.replace('-test', ''); finalPortalName.replaceAll('-test', '');
finalPortalName += test ? '-test' : ''; finalPortalName += test ? '-test' : '';
return 'https://' + finalPortalName + '.vemap.com'; return 'https://' + finalPortalName + '.vemap.com';
@ -356,6 +355,7 @@ const TimeTrack = {
message: 'Portal-Wechsel erfolgreich', message: 'Portal-Wechsel erfolgreich',
color: 'green' color: 'green'
}); });
playSound('whoosh');
vue.updateStorage(); vue.updateStorage();
}) })
}, },
@ -409,4 +409,9 @@ function oneOf(collection) {
return collection[Math.floor(Math.random()*collection.length)]; 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'); Vue.createApp(TimeTrack).mount('#root');