diff --git a/src/renderer/components/ft-share-button/ft-share-button.js b/src/renderer/components/ft-share-button/ft-share-button.js index 35e5f57c..bc757c83 100644 --- a/src/renderer/components/ft-share-button/ft-share-button.js +++ b/src/renderer/components/ft-share-button/ft-share-button.js @@ -1,19 +1,32 @@ import Vue from 'vue' +import FtFlexBox from '../ft-flex-box/ft-flex-box.vue' import FtIconButton from '../ft-icon-button/ft-icon-button.vue' import FtButton from '../ft-button/ft-button.vue' +import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue' import { mapActions } from 'vuex' export default Vue.extend({ name: 'FtShareButton', components: { + 'ft-flex-box': FtFlexBox, 'ft-icon-button': FtIconButton, - 'ft-button': FtButton + 'ft-button': FtButton, + 'ft-toggle-switch': FtToggleSwitch }, props: { id: { type: String, required: true + }, + getTimestamp: { + type: Function, + required: true + } + }, + data: function () { + return { + includeTimestamp: false } }, computed: { @@ -40,7 +53,6 @@ export default Vue.extend({ youtubeEmbedURL() { return `https://www.youtube-nocookie.com/embed/${this.id}` } - }, methods: { copy(text) { @@ -55,7 +67,7 @@ export default Vue.extend({ }, openInvidious() { - this.open(this.invidiousURL) + this.open(this.getFinalUrl(this.invidiousURL)) this.$refs.iconButton.toggleDropdown() }, @@ -63,12 +75,12 @@ export default Vue.extend({ this.showToast({ message: this.$t('Share.Invidious URL copied to clipboard') }) - this.copy(this.invidiousURL) + this.copy(this.getFinalUrl(this.invidiousURL)) this.$refs.iconButton.toggleDropdown() }, openYoutube() { - this.open(this.youtubeURL) + this.open(this.getFinalUrl(this.youtubeURL)) this.$refs.iconButton.toggleDropdown() }, @@ -76,12 +88,12 @@ export default Vue.extend({ this.showToast({ message: this.$t('Share.YouTube URL copied to clipboard') }) - this.copy(this.youtubeURL) + this.copy(this.getFinalUrl(this.youtubeURL)) this.$refs.iconButton.toggleDropdown() }, openYoutubeEmbed() { - this.open(this.youtubeEmbedURL) + this.open(this.getFinalUrl(this.youtubeEmbedURL)) this.$refs.iconButton.toggleDropdown() }, @@ -89,12 +101,12 @@ export default Vue.extend({ this.showToast({ message: this.$t('Share.YouTube Embed URL copied to clipboard') }) - this.copy(this.youtubeEmbedURL) + this.copy(this.getFinalUrl(this.youtubeEmbedURL)) this.$refs.iconButton.toggleDropdown() }, openInvidiousEmbed() { - this.open(this.invidiousEmbedURL) + this.open(this.getFinalUrl(this.invidiousEmbedURL)) this.$refs.iconButton.toggleDropdown() }, @@ -102,10 +114,18 @@ export default Vue.extend({ this.showToast({ message: this.$t('Share.Invidious Embed URL copied to clipboard') }) - this.copy(this.invidiousEmbedURL) + this.copy(this.getFinalUrl(this.invidiousEmbedURL)) this.$refs.iconButton.toggleDropdown() }, + updateincludeTimestamp() { + this.includeTimestamp = !this.includeTimestamp + }, + + getFinalUrl(url) { + return this.includeTimestamp ? `${url}&t=${this.getTimestamp()}` : url + }, + ...mapActions([ 'showToast' ]) diff --git a/src/renderer/components/ft-share-button/ft-share-button.vue b/src/renderer/components/ft-share-button/ft-share-button.vue index 8022ae78..c87e5ed2 100644 --- a/src/renderer/components/ft-share-button/ft-share-button.vue +++ b/src/renderer/components/ft-share-button/ft-share-button.vue @@ -7,6 +7,14 @@ dropdown-position-x="left" :force-dropdown="true" > + + +