2020-07-06 18:46:25 +00:00
|
|
|
<template>
|
|
|
|
<div id="modal_quality" class="smallmodal" v-show="open" @click="tryToDownloadTrack($event)" ref="modal">
|
2020-07-06 16:34:43 +00:00
|
|
|
<div class="smallmodal-content">
|
2020-10-10 18:03:19 +00:00
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="9">
|
|
|
|
{{ $t('globals.download', { thing: 'FLAC' }) }}
|
2020-07-18 16:06:07 +00:00
|
|
|
</button>
|
2020-10-10 18:03:19 +00:00
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="3">
|
|
|
|
{{ $t('globals.download', { thing: 'MP3 320kbps' }) }}
|
2020-07-18 16:06:07 +00:00
|
|
|
</button>
|
2020-10-10 18:03:19 +00:00
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="1">
|
|
|
|
{{ $t('globals.download', { thing: 'MP3 128kbps' }) }}
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="15">
|
|
|
|
{{ $t('globals.download', { thing: '360 Reality Audio [HQ]' }) }}
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="14">
|
|
|
|
{{ $t('globals.download', { thing: '360 Reality Audio [MQ]' }) }}
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-primary quality-button" data-quality-value="13">
|
|
|
|
{{ $t('globals.download', { thing: '360 Reality Audio [LQ]' }) }}
|
2020-07-18 16:06:07 +00:00
|
|
|
</button>
|
2020-07-06 16:34:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<style>
|
|
|
|
.smallmodal {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 1250;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
overflow: auto;
|
2020-07-06 18:46:25 +00:00
|
|
|
background-color: hsla(0, 0%, 0%, 0.4);
|
2020-07-06 16:34:43 +00:00
|
|
|
animation-duration: 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.smallmodal-content {
|
|
|
|
background-color: transparent;
|
|
|
|
margin: auto;
|
|
|
|
width: var(--modal-content-width);
|
|
|
|
position: relative;
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
}
|
|
|
|
|
|
|
|
.smallmodal-content button {
|
|
|
|
width: 100%;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
}
|
2020-07-06 18:46:25 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
2020-07-16 22:11:28 +00:00
|
|
|
import Downloads from '@/utils/downloads'
|
2020-07-06 18:46:25 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
open: false,
|
|
|
|
url: ''
|
|
|
|
}),
|
|
|
|
mounted() {
|
|
|
|
this.$root.$on('QualityModal:open', this.openModal)
|
|
|
|
this.$refs.modal.addEventListener('webkitAnimationEnd', this.handleAnimationEnd)
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
tryToDownloadTrack(event) {
|
|
|
|
const { target } = event
|
|
|
|
|
|
|
|
this.$refs.modal.classList.add('animated', 'fadeOut')
|
|
|
|
|
|
|
|
// If true, the click did not happen on a button but outside
|
|
|
|
if (!target.matches('.quality-button')) return
|
|
|
|
|
|
|
|
Downloads.sendAddToQueue(this.url, target.dataset.qualityValue)
|
|
|
|
},
|
|
|
|
openModal(link) {
|
|
|
|
this.url = link
|
|
|
|
this.open = true
|
|
|
|
this.$refs.modal.classList.add('animated', 'fadeIn')
|
|
|
|
},
|
|
|
|
handleAnimationEnd(event) {
|
|
|
|
const { animationName } = event
|
|
|
|
|
|
|
|
this.$refs.modal.classList.remove('animated', animationName)
|
|
|
|
|
|
|
|
if (animationName === 'fadeIn') return
|
|
|
|
|
|
|
|
this.open = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-20 20:31:54 +00:00
|
|
|
</script>
|