Update "Open Link" button to include playlist ID (#1258)

* ! Fix app unable to load due to missing `getLocale` in `mapActions`

* $ Update a function's name with incorrect name casing

* Update "open youtube link" button to open with playlist when playing a video with an active playlist
This commit is contained in:
PikachuEXE 2021-05-26 01:39:34 +08:00 committed by GitHub
parent 81d9484111
commit 70aa159bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 5 deletions

View File

@ -399,7 +399,8 @@ export default Vue.extend({
'grabHistory',
'grabAllPlaylists',
'getRegionData',
'getYoutubeUrlInfo'
'getYoutubeUrlInfo',
'getLocale'
]),
...mapMutations([

View File

@ -19,6 +19,10 @@ export default Vue.extend({
type: String,
required: true
},
playlistId: {
type: String,
required: true
},
getTimestamp: {
type: Function,
required: true
@ -35,7 +39,13 @@ export default Vue.extend({
},
invidiousURL() {
return `${this.invidiousInstance}/watch?v=${this.id}`
let videoUrl = `${this.invidiousInstance}/watch?v=${this.id}`
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
videoUrl += `&list=${this.playlistId}`
}
return videoUrl
},
invidiousEmbedURL() {
@ -43,10 +53,21 @@ export default Vue.extend({
},
youtubeURL() {
return `https://www.youtube.com/watch?v=${this.id}`
let videoUrl = `https://www.youtube.com/watch?v=${this.id}`
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
videoUrl += `&list=${this.playlistId}`
}
return videoUrl
},
youtubeShareURL() {
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
return `https://www.youtube.com/watch?v=${this.id}&list=${this.playlistId}`
}
return `https://youtu.be/${this.id}`
},
@ -111,7 +132,7 @@ export default Vue.extend({
this.$refs.iconButton.focusOut()
},
updateincludeTimestamp() {
updateIncludeTimestamp() {
this.includeTimestamp = !this.includeTimestamp
},

View File

@ -12,7 +12,7 @@
:label="$t('Share.Include Timestamp')"
:compact="true"
:default-value="includeTimestamp"
@change="updateincludeTimestamp"
@change="updateIncludeTimestamp"
/>
</ft-flex-box>
<div class="shareLinks">

View File

@ -82,6 +82,10 @@ export default Vue.extend({
type: Boolean,
required: true
},
playlistId: {
type: String,
required: true
},
theatrePossible: {
type: Boolean,
required: true

View File

@ -101,6 +101,7 @@
<ft-share-button
:id="id"
:get-timestamp="getTimestamp"
:playlist-id="playlistId"
class="option"
/>
</div>

View File

@ -83,6 +83,7 @@
:is-upcoming="isUpcoming"
:download-links="downloadLinks"
:watching-playlist="watchingPlaylist"
:playlist-id="playlistId"
:theatre-possible="theatrePossible"
:length-seconds="videoLengthSeconds"
:video-thumbnail="thumbnail"