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', 'grabHistory',
'grabAllPlaylists', 'grabAllPlaylists',
'getRegionData', 'getRegionData',
'getYoutubeUrlInfo' 'getYoutubeUrlInfo',
'getLocale'
]), ]),
...mapMutations([ ...mapMutations([

View File

@ -19,6 +19,10 @@ export default Vue.extend({
type: String, type: String,
required: true required: true
}, },
playlistId: {
type: String,
required: true
},
getTimestamp: { getTimestamp: {
type: Function, type: Function,
required: true required: true
@ -35,7 +39,13 @@ export default Vue.extend({
}, },
invidiousURL() { 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() { invidiousEmbedURL() {
@ -43,10 +53,21 @@ export default Vue.extend({
}, },
youtubeURL() { 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() { 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}` return `https://youtu.be/${this.id}`
}, },
@ -111,7 +132,7 @@ export default Vue.extend({
this.$refs.iconButton.focusOut() this.$refs.iconButton.focusOut()
}, },
updateincludeTimestamp() { updateIncludeTimestamp() {
this.includeTimestamp = !this.includeTimestamp this.includeTimestamp = !this.includeTimestamp
}, },

View File

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

View File

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

View File

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

View File

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