Right click on play button in track list to copy link

This commit is contained in:
RemixDev 2021-10-05 12:23:23 +02:00
parent 78d9b2decd
commit 0db34c11da
3 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="download-object" :data-cm-link="generateLink"> <div class="download-object" :data-link-only="generateLink">
<div class="download-info"> <div class="download-info">
<img width="75px" class="rounded coverart" :src="queueItem.cover" :alt="`Cover ${queueItem.title}`" /> <img width="75px" class="rounded coverart" :src="queueItem.cover" :alt="`Cover ${queueItem.title}`" />

View File

@ -139,6 +139,7 @@ export default {
const { pageX, pageY, target: elementClicked } = contextMenuEvent const { pageX, pageY, target: elementClicked } = contextMenuEvent
const path = generatePath(elementClicked) const path = generatePath(elementClicked)
let deezerLink = null let deezerLink = null
let isLinkOnly = false
// Searching for the first element with a data-link attribute // Searching for the first element with a data-link attribute
// let deezerLink = this.searchForDataLink(...) // let deezerLink = this.searchForDataLink(...)
@ -154,6 +155,12 @@ export default {
deezerLink = path[i].dataset.cmLink deezerLink = path[i].dataset.cmLink
break break
} }
if (path[i].matches('[data-link-only]')) {
deezerLink = path[i].dataset.linkOnly
isLinkOnly = true
break
}
} }
const isLink = elementClicked.matches('a') const isLink = elementClicked.matches('a')
@ -182,7 +189,7 @@ export default {
if (deezerLink) { if (deezerLink) {
// Show 'Copy Deezer Link' option // Show 'Copy Deezer Link' option
this.deezerHref = deezerLink this.deezerHref = deezerLink
this.showDeezerOptions(isSearchbar) this.showDeezerOptions(isSearchbar, isLinkOnly)
} }
}, },
hideMenu() { hideMenu() {
@ -225,10 +232,10 @@ export default {
} }
}) })
}, },
showDeezerOptions(isSearchbar) { showDeezerOptions(isSearchbar, isLinkOnly) {
if (!isSearchbar) this.options.copyDeezerLink.show = true if (!isSearchbar) this.options.copyDeezerLink.show = true
downloadQualities.forEach(quality => { if (!isLinkOnly) downloadQualities.forEach(quality => {
this.options[quality.objName].show = true this.options[quality.objName].show = true
}) })
} }

View File

@ -47,6 +47,7 @@
disabled: !track.preview disabled: !track.preview
}" }"
:data-preview="track.preview" :data-preview="track.preview"
:data-link-only="track.link"
:title="$t('globals.play_hint')" :title="$t('globals.play_hint')"
class="material-icons" class="material-icons"
v-on="{ click: track.preview ? playPausePreview : false }" v-on="{ click: track.preview ? playPausePreview : false }"