fixed preview not working

This commit is contained in:
Roberto Tonino 2020-06-02 15:41:51 +02:00
parent 3f1ca5a75c
commit b33a3115b0
4 changed files with 9 additions and 10 deletions

View File

@ -1236,7 +1236,7 @@ <h2 class="inline-flex"><span v-if="metadata">{{ metadata }}</span><span class="
<div class="table__cell-content table__cell-content--vertical-center"> <div class="table__cell-content table__cell-content--vertical-center">
<i class="material-icons" <i class="material-icons"
:class="{ 'preview_playlist_controls' : track.preview, disabled: !track.preview }" :class="{ 'preview_playlist_controls' : track.preview, disabled: !track.preview }"
@click='track.preview ? playPausePreview : null' :data-preview="track.preview"> v-on="{ click: track.preview ? playPausePreview : null }" :data-preview="track.preview">
play_arrow play_arrow
</i> </i>
</div> </div>
@ -1285,7 +1285,7 @@ <h2 class="inline-flex"><span v-if="metadata">{{ metadata }}</span><span class="
<template v-else> <template v-else>
<tr v-for="(track, i) in body"> <tr v-for="(track, i) in body">
<td> <td>
<i v-if="track.preview_url" @click=playPausePreview <i v-if="track.preview_url" @click="playPausePreview"
:class="'material-icons' + (track.preview_url ? ' preview_playlist_controls' : '')" :class="'material-icons' + (track.preview_url ? ' preview_playlist_controls' : '')"
:data-preview="track.preview_url">play_arrow</i> :data-preview="track.preview_url">play_arrow</i>
<i v-else class="material-icons disabled">play_arrow</i> <i v-else class="material-icons disabled">play_arrow</i>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,6 @@ function stopStackedTabsPreview() {
// on hover event // on hover event
function previewMouseEnter(e) { function previewMouseEnter(e) {
console.log('mouse Enter')
$(e.currentTarget).css({ opacity: 1 }) $(e.currentTarget).css({ opacity: 1 })
} }
@ -68,17 +67,17 @@ function playPausePreview(e) {
const { currentTarget: obj } = event const { currentTarget: obj } = event
var icon = obj.tagName == 'I' ? $(obj) : $(obj).children('i') var $icon = obj.tagName == 'I' ? $(obj) : $(obj).children('i')
if ($(obj).attr('playing')) { if ($(obj).attr('playing')) {
if (preview_track.paused) { if (preview_track.paused) {
preview_track.play() preview_track.play()
preview_stopped = false preview_stopped = false
icon.text('pause') $icon.text('pause')
$(preview_track).animate({ volume: vol.preview_max_volume / 100 }, 500) $(preview_track).animate({ volume: vol.preview_max_volume / 100 }, 500)
} else { } else {
preview_stopped = true preview_stopped = true
icon.text('play_arrow') $icon.text('play_arrow')
$(preview_track).animate({ volume: 0 }, 250, 'swing', () => { $(preview_track).animate({ volume: 0 }, 250, 'swing', () => {
preview_track.pause() preview_track.pause()
}) })
@ -89,8 +88,8 @@ function playPausePreview(e) {
$('.preview_controls').text('play_arrow') $('.preview_controls').text('play_arrow')
$('.preview_playlist_controls').text('play_arrow') $('.preview_playlist_controls').text('play_arrow')
$('.preview_controls').css({ opacity: 0 }) $('.preview_controls').css({ opacity: 0 })
icon.text('pause') $icon.text('pause')
icon.css({ opacity: 1 }) $icon.css({ opacity: 1 })
preview_stopped = false preview_stopped = false
$(preview_track).animate({ volume: 0 }, 250, 'swing', () => { $(preview_track).animate({ volume: 0 }, 250, 'swing', () => {
preview_track.pause() preview_track.pause()