diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue
index 10b6c74d..cf23a438 100644
--- a/src/components/ShareModal.vue
+++ b/src/components/ShareModal.vue
@@ -9,11 +9,17 @@
+
@@ -34,6 +40,14 @@ export default {
type: Number,
required: true,
},
+ playlistId: {
+ type: String,
+ required: true,
+ },
+ playlistIndex: {
+ type: Number,
+ required: true,
+ },
},
components: {
ModalComponent,
@@ -42,13 +56,17 @@ export default {
return {
withTimeCode: true,
pipedLink: true,
+ withPlaylist: true,
timeStamp: null,
+ hasPlaylist: false,
};
},
mounted() {
this.timeStamp = parseInt(this.currentTime);
this.withTimeCode = this.getPreferenceBoolean("shareWithTimeCode", true);
this.pipedLink = this.getPreferenceBoolean("shareAsPipedLink", true);
+ this.withPlaylist = this.getPreferenceBoolean("shareWithPlaylist", true);
+ this.hasPlaylist = this.playlistId != undefined && !isNaN(this.playlistIndex);
},
methods: {
followLink() {
@@ -68,6 +86,7 @@ export default {
onChange() {
this.setPreference("shareWithTimeCode", this.withTimeCode, true);
this.setPreference("shareAsPipedLink", this.pipedLink, true);
+ this.setPreference("shareWithPlaylist", this.withPlaylist, true);
},
},
computed: {
@@ -77,6 +96,10 @@ export default {
: "https://youtu.be/" + this.videoId;
var url = new URL(baseUrl);
if (this.withTimeCode && this.timeStamp > 0) url.searchParams.append("t", this.timeStamp);
+ if (this.hasPlaylist && this.withPlaylist) {
+ url.searchParams.append("list", this.playlistId);
+ url.searchParams.append("index", this.playlistIndex);
+ }
return url.href;
},
},
diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue
index e436d4f0..6b8d989d 100644
--- a/src/components/WatchVideo.vue
+++ b/src/components/WatchVideo.vue
@@ -92,6 +92,8 @@
v-if="showShareModal"
:video-id="getVideoId()"
:current-time="currentTime"
+ :playlist-id="playlistId"
+ :playlist-index="index"
@close="showShareModal = !showShareModal"
/>
diff --git a/src/locales/en.json b/src/locales/en.json
index 8d3782a1..318f1bcf 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -119,7 +119,8 @@
"source_code": "Source code",
"instance_donations": "Instance donations",
"reply_count": "{count} replies",
- "no_valid_playlists": "The file doesn't contain valid playlists!"
+ "no_valid_playlists": "The file doesn't contain valid playlists!",
+ "with_playlist": "Share with playlist"
},
"comment": {
"pinned_by": "Pinned by {author}",