2020-06-17 12:15:36 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
|
|
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
|
|
|
|
import FtButton from '../ft-button/ft-button.vue'
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'FtShareButton',
|
|
|
|
components: {
|
|
|
|
'ft-icon-button': FtIconButton,
|
|
|
|
'ft-button': FtButton
|
2020-06-17 13:36:44 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
invidiousInstance: function () {
|
|
|
|
return this.$store.getters.getInvidiousInstance
|
|
|
|
},
|
|
|
|
|
|
|
|
usingElectron: function () {
|
|
|
|
return this.$store.getters.getUsingElectron
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
copy(text) {
|
|
|
|
navigator.clipboard.writeText(text)
|
|
|
|
},
|
|
|
|
|
|
|
|
open(url) {
|
|
|
|
if (this.usingElectron) {
|
|
|
|
const shell = require('electron').shell
|
|
|
|
shell.openExternal(url)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getInvidiousURL() {
|
|
|
|
return `${this.invidiousInstance}/watch?v=${this.id}`
|
|
|
|
},
|
|
|
|
|
|
|
|
getYoutubeURL() {
|
|
|
|
return `https://www.youtube.com/watch?v=${this.id}`
|
|
|
|
},
|
|
|
|
|
|
|
|
getYoutubeEmbedURL() {
|
|
|
|
return `https://www.youtube-nocookie.com/embed/${this.id}`
|
|
|
|
},
|
|
|
|
|
|
|
|
openInvidious() {
|
|
|
|
this.open(this.getInvidiousURL())
|
|
|
|
},
|
|
|
|
|
|
|
|
copyInvidious() {
|
|
|
|
this.copy(this.getInvidiousURL())
|
|
|
|
},
|
|
|
|
|
|
|
|
openYoutube() {
|
|
|
|
this.open(this.getYoutubeURL())
|
|
|
|
},
|
|
|
|
|
|
|
|
copyYoutube() {
|
|
|
|
this.copy(this.getYoutubeURL())
|
|
|
|
},
|
|
|
|
|
|
|
|
openYoutubeEmbed() {
|
|
|
|
this.open(this.getYoutubeEmbedURL())
|
|
|
|
},
|
|
|
|
|
|
|
|
copyYoutubeEmbed() {
|
|
|
|
this.copy(this.getYoutubeEmbedURL())
|
|
|
|
}
|
2020-06-17 12:15:36 +00:00
|
|
|
}
|
|
|
|
})
|