add plugins
This commit is contained in:
parent
2f11658ba2
commit
aad79bc79c
@ -47,7 +47,9 @@ export default {
|
||||
{ src: '~plugins/video.js', ssr: false },
|
||||
{ src: '~plugins/scrollbar.js', ssr: false },
|
||||
{ src: '~plugins/splitpanes.js', ssr: false },
|
||||
{ src: '~plugins/loading.js', ssr: false }
|
||||
{ src: '~plugins/loading.js', ssr: false },
|
||||
{ src: '~/plugins/helpers.js' },
|
||||
{ src: '~plugins/draggable.js', ssr: false }
|
||||
],
|
||||
/*
|
||||
** Nuxt.js dev-modules
|
||||
|
5
ffplayout/frontend/plugins/draggable.js
Normal file
5
ffplayout/frontend/plugins/draggable.js
Normal file
@ -0,0 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import draggable from 'vuedraggable'
|
||||
|
||||
Vue.use(draggable)
|
||||
Vue.component('draggable', draggable)
|
34
ffplayout/frontend/plugins/helpers.js
Normal file
34
ffplayout/frontend/plugins/helpers.js
Normal file
@ -0,0 +1,34 @@
|
||||
export default ({ app }, inject) => {
|
||||
inject('processPlaylist', (day, list) => {
|
||||
const [h, m, s] = day.split(':')
|
||||
let begin = parseFloat(h) * 3600 + parseFloat(m) * 60 + parseFloat(s)
|
||||
|
||||
for (const item of list) {
|
||||
item.begin = begin
|
||||
|
||||
if (!item.category) {
|
||||
item.category = ''
|
||||
}
|
||||
|
||||
begin += (item.out - item.in)
|
||||
}
|
||||
return list
|
||||
})
|
||||
// convert time (00:00:00) string to seconds
|
||||
inject('timeToSeconds', (time) => {
|
||||
const t = time.split(':')
|
||||
return parseInt(t[0]) * 3600 + parseInt(t[1]) * 60 + parseInt(t[2])
|
||||
})
|
||||
|
||||
inject('secToHMS', (sec) => {
|
||||
let hours = Math.floor(sec / 3600)
|
||||
sec %= 3600
|
||||
let minutes = Math.floor(sec / 60)
|
||||
let seconds = sec % 60
|
||||
|
||||
minutes = String(minutes).padStart(2, '0')
|
||||
hours = String(hours).padStart(2, '0')
|
||||
seconds = String(parseInt(seconds)).padStart(2, '0')
|
||||
return hours + ':' + minutes + ':' + seconds
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user