2020-02-16 19:30:00 +01:00
|
|
|
import Vue from 'vue'
|
2020-08-05 05:44:34 +02:00
|
|
|
import { mapActions } from 'vuex'
|
2020-02-16 19:30:00 +01:00
|
|
|
import FtCard from '../ft-card/ft-card.vue'
|
|
|
|
import FtButton from '../ft-button/ft-button.vue'
|
|
|
|
import FtListDropdown from '../ft-list-dropdown/ft-list-dropdown.vue'
|
|
|
|
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
|
2020-06-06 05:15:44 +02:00
|
|
|
import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
|
2020-06-17 14:15:36 +02:00
|
|
|
import FtShareButton from '../ft-share-button/ft-share-button.vue'
|
2020-03-24 14:22:29 +01:00
|
|
|
// import { shell } from 'electron'
|
2020-02-16 19:30:00 +01:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'WatchVideoInfo',
|
|
|
|
components: {
|
|
|
|
'ft-card': FtCard,
|
|
|
|
'ft-button': FtButton,
|
|
|
|
'ft-list-dropdown': FtListDropdown,
|
2020-06-06 05:15:44 +02:00
|
|
|
'ft-flex-box': FtFlexBox,
|
2020-06-17 14:15:36 +02:00
|
|
|
'ft-icon-button': FtIconButton,
|
|
|
|
'ft-share-button': FtShareButton
|
2020-02-16 19:30:00 +01:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
channelId: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
channelName: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
channelThumbnail: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
2020-06-16 23:42:38 +02:00
|
|
|
published: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
2020-02-16 19:30:00 +01:00
|
|
|
viewCount: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
subscriptionCountText: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
likeCount: {
|
|
|
|
type: Number,
|
2020-05-17 22:12:58 +02:00
|
|
|
default: 0
|
2020-02-16 19:30:00 +01:00
|
|
|
},
|
|
|
|
dislikeCount: {
|
|
|
|
type: Number,
|
2020-05-17 22:12:58 +02:00
|
|
|
default: 0
|
2020-02-16 19:30:00 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
formatTypeLabel: 'VIDEO FORMATS',
|
|
|
|
formatTypeValues: [
|
|
|
|
'dash',
|
|
|
|
'legacy',
|
2020-06-01 04:47:22 +02:00
|
|
|
'audio'
|
2020-02-16 19:30:00 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
invidiousInstance: function () {
|
|
|
|
return this.$store.getters.getInvidiousInstance
|
|
|
|
},
|
|
|
|
|
2020-05-17 22:12:58 +02:00
|
|
|
usingElectron: function () {
|
|
|
|
return this.$store.getters.getUsingElectron
|
|
|
|
},
|
|
|
|
|
2020-08-07 02:20:42 +02:00
|
|
|
formatTypeNames: function () {
|
|
|
|
return [
|
|
|
|
this.$t('Change Format.Use Dash Formats').toUpperCase(),
|
|
|
|
this.$t('Change Format.Use Legacy Formats').toUpperCase(),
|
|
|
|
this.$t('Change Format.Use Audio Formats').toUpperCase()
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2020-02-16 19:30:00 +01:00
|
|
|
totalLikeCount: function () {
|
|
|
|
return this.likeCount + this.dislikeCount
|
|
|
|
},
|
|
|
|
|
|
|
|
likePercentageRatio: function () {
|
|
|
|
return parseInt(this.likeCount / this.totalLikeCount * 100)
|
|
|
|
},
|
|
|
|
|
|
|
|
parsedViewCount: function () {
|
2020-08-07 02:20:42 +02:00
|
|
|
return this.viewCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ` ${this.$t('Video.Views').toLowerCase()}`
|
2020-02-16 19:30:00 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
subscribedText: function () {
|
2020-08-24 17:01:09 +02:00
|
|
|
return `${this.$t('Channel.Subscribe').toUpperCase()} ${this.subscriptionCountText}`
|
2020-06-19 15:43:08 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
dateString() {
|
|
|
|
const date = new Date(this.published)
|
|
|
|
const dateSplit = date.toDateString().split(' ')
|
2020-08-07 02:20:42 +02:00
|
|
|
const localeDateString = `Video.Published.${dateSplit[1]}`
|
|
|
|
return `${this.$t(localeDateString)} ${dateSplit[2]}, ${dateSplit[3]}`
|
2020-02-16 19:30:00 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
goToChannel: function () {
|
2020-05-17 22:12:58 +02:00
|
|
|
this.$router.push({ path: `/channel/${this.channelId}` })
|
2020-02-16 19:30:00 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
handleSubscription: function () {
|
2020-08-05 05:44:34 +02:00
|
|
|
this.showToast({
|
|
|
|
message: 'Subscriptions have not yet been implemented'
|
|
|
|
})
|
2020-02-16 19:30:00 +01:00
|
|
|
},
|
|
|
|
|
2020-02-19 04:31:10 +01:00
|
|
|
handleFormatChange: function (format) {
|
|
|
|
switch (format) {
|
|
|
|
case 'dash':
|
|
|
|
this.$parent.enableDashFormat()
|
|
|
|
break
|
|
|
|
case 'legacy':
|
|
|
|
this.$parent.enableLegacyFormat()
|
|
|
|
break
|
2020-06-01 04:47:22 +02:00
|
|
|
case 'audio':
|
|
|
|
this.$parent.enableAudioFormat()
|
|
|
|
break
|
2020-02-19 04:31:10 +01:00
|
|
|
}
|
2020-08-05 05:44:34 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
...mapActions([
|
|
|
|
'showToast'
|
|
|
|
])
|
2020-02-16 19:30:00 +01:00
|
|
|
}
|
|
|
|
})
|