add timestamp to link generated by watchOnYt button

This commit is contained in:
gmnsii 2022-11-28 13:25:29 -08:00
parent e38a9b4414
commit e0290203eb
No known key found for this signature in database
GPG key ID: 13B5ECF7DDFDA0DC
2 changed files with 12 additions and 4 deletions

View file

@ -1,7 +1,15 @@
<script> <script>
export default { export default {
props: { props: {
link: String, videoId: String,
currentTime: Number,
},
computed: {
generatedLink() {
let timestamp = parseInt(this.currentTime);
return `https://youtu.be/watch?v=${this.videoId}&t=${timestamp}`;
},
}, },
}; };
</script> </script>
@ -9,13 +17,13 @@ export default {
<template> <template>
<template v-if="this.getPreferenceBoolean('showWatchOnYouTube', false)"> <template v-if="this.getPreferenceBoolean('showWatchOnYouTube', false)">
<!-- For large screens --> <!-- For large screens -->
<a :href="link" class="btn lt-lg:hidden"> <a :href="generatedLink" class="btn lt-lg:hidden">
<i18n-t keypath="player.watch_on" tag="strong"> <i18n-t keypath="player.watch_on" tag="strong">
<font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" /> <font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" />
</i18n-t> </i18n-t>
</a> </a>
<!-- For small screens --> <!-- For small screens -->
<a :href="link" class="btn lg:hidden"> <a :href="generatedLink" class="btn lg:hidden">
<font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" /> <font-awesome-icon class="mx-1.5" :icon="['fab', 'youtube']" />
</a> </a>
</template> </template>

View file

@ -108,7 +108,7 @@
> >
<font-awesome-icon icon="rss" /> <font-awesome-icon icon="rss" />
</a> </a>
<WatchOnYouTubeButton :link="`https://youtu.be/${getVideoId()}`" /> <WatchOnYouTubeButton :video-id="getVideoId()" :current-time="currentTime" />
<!-- Share Dialog --> <!-- Share Dialog -->
<button class="btn" @click="showShareModal = !showShareModal"> <button class="btn" @click="showShareModal = !showShareModal">
<i18n-t class="lt-lg:hidden" keypath="actions.share" tag="strong"></i18n-t> <i18n-t class="lt-lg:hidden" keypath="actions.share" tag="strong"></i18n-t>