Share buttons use computed for URLs

This commit is contained in:
Cadence Ember 2020-06-19 02:53:54 +12:00
parent e98d8a21d1
commit 0bf29a4e61
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
1 changed files with 25 additions and 24 deletions

View File

@ -23,6 +23,23 @@ export default Vue.extend({
usingElectron: function () { usingElectron: function () {
return this.$store.getters.getUsingElectron return this.$store.getters.getUsingElectron
}, },
invidiousURL() {
return `${this.invidiousInstance}/watch?v=${this.id}`
},
invidiousEmbedURL() {
return `${this.invidiousInstance}/embed/${this.id}`
},
youtubeURL() {
return `https://www.youtube.com/watch?v=${this.id}`
},
youtubeEmbedURL() {
return `https://www.youtube-nocookie.com/embed/${this.id}`
},
}, },
methods: { methods: {
copy(text) { copy(text) {
@ -36,52 +53,36 @@ export default Vue.extend({
} }
}, },
getInvidiousURL() {
return `${this.invidiousInstance}/watch?v=${this.id}`
},
getInvidiousEmbedURL() {
return `${this.invidiousInstance}/embed/${this.id}`
},
getYoutubeURL() {
return `https://www.youtube.com/watch?v=${this.id}`
},
getYoutubeEmbedURL() {
return `https://www.youtube-nocookie.com/embed/${this.id}`
},
openInvidious() { openInvidious() {
this.open(this.getInvidiousURL()) this.open(this.invidiousURL)
}, },
copyInvidious() { copyInvidious() {
this.copy(this.getInvidiousURL()) this.copy(this.invidiousURL)
}, },
openYoutube() { openYoutube() {
this.open(this.getYoutubeURL()) this.open(this.youtubeURL)
}, },
copyYoutube() { copyYoutube() {
this.copy(this.getYoutubeURL()) this.copy(this.youtubeURL)
}, },
openYoutubeEmbed() { openYoutubeEmbed() {
this.open(this.getYoutubeEmbedURL()) this.open(this.youtubeEmbedURL)
}, },
copyYoutubeEmbed() { copyYoutubeEmbed() {
this.copy(this.getYoutubeEmbedURL()) this.copy(this.youtubeEmbedURL)
}, },
openInvidiousEmbed() { openInvidiousEmbed() {
this.open(this.getInvidiousEmbedURL()) this.open(this.invidiousEmbedURL)
}, },
copyInvidiousEmbed() { copyInvidiousEmbed() {
this.copy(this.getInvidiousEmbedURL()) this.copy(this.invidiousEmbedURL)
}, },
} }
}) })