mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
fix go to channel or playlist
This commit is contained in:
parent
47f53bb238
commit
65d01f870a
4 changed files with 30 additions and 16 deletions
|
@ -35,7 +35,7 @@
|
|||
<font-awesome-icon icon="rss" />
|
||||
</a>
|
||||
|
||||
<WatchOnYouTubeButton :link="`https://youtube.com/channel/${this.channel.id}`" />
|
||||
<WatchOnYouTubeButton :id="`${this.channel.id}`" :type="'channel'" />
|
||||
|
||||
<div class="flex mt-4 mb-2">
|
||||
<button
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<a class="btn mr-1" :href="getRssUrl">
|
||||
<font-awesome-icon icon="rss" />
|
||||
</a>
|
||||
<WatchOnYouTubeButton :link="`https://www.youtube.com/playlist?list=${this.$route.query.list}`" />
|
||||
<WatchOnYouTubeButton :id="`${this.$route.query.list}`" :type="'playlist'" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,21 +1,34 @@
|
|||
<script>
|
||||
export default {
|
||||
props: {
|
||||
videoId: String,
|
||||
currentTime: Number,
|
||||
playlistId: String,
|
||||
playlistIndex: String,
|
||||
id: String, // The id of the content.
|
||||
type: String, // The type of the content (video, channel, playlist).
|
||||
|
||||
// The below parameters are only evaluated if `type` is video.
|
||||
videoTimestamp: Number,
|
||||
videoPlaylistId: String,
|
||||
videoPlaylistIndex: Number,
|
||||
},
|
||||
|
||||
computed: {
|
||||
generatedLink() {
|
||||
let url = `https://youtu.be/watch?v=${this.videoId}`;
|
||||
if (this.playlistId != undefined) {
|
||||
// If this.playlistId is defined then this.playlistIndex is too.
|
||||
url += `&list=${this.playlistId}&index=${this.playlistIndex}`;
|
||||
switch (String(this.type)) {
|
||||
case "video": {
|
||||
let url = `https://youtu.be/watch?v=${this.id}`;
|
||||
if (this.videoPlaylistId != undefined) {
|
||||
// If the playlist id is defined then the playlist index is too.
|
||||
url += `&list=${this.videoPlaylistId}&index=${this.videoPlaylistIndex}`;
|
||||
}
|
||||
url += `&t=${parseInt(this.currentTime)}`;
|
||||
url += `&t=${parseInt(this.videoTimestamp)}`;
|
||||
return url;
|
||||
}
|
||||
case "playlist":
|
||||
return `https://youtu.be/playlist?list=${this.id}`;
|
||||
case "channel":
|
||||
return `https://youtu.be/channel/${this.id}`;
|
||||
default:
|
||||
return `https://youtu.be/${this.id}`;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -109,10 +109,11 @@
|
|||
<font-awesome-icon icon="rss" />
|
||||
</a>
|
||||
<WatchOnYouTubeButton
|
||||
:video-id="getVideoId()"
|
||||
:current-time="currentTime"
|
||||
:playlist-id="playlistId"
|
||||
:playlist-index="index"
|
||||
:id="getVideoId()"
|
||||
:type="'video'"
|
||||
:videoTimestamp="currentTime"
|
||||
:videoPlaylistId="playlistId"
|
||||
:videoPlaylistIndex="index"
|
||||
/>
|
||||
<!-- Share Dialog -->
|
||||
<button class="btn" @click="showShareModal = !showShareModal">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue