peertube-theme-nctv-dark/peertube-plugin-hello-world/client/video-watch-client-plugin.js

43 lines
870 B
JavaScript
Raw Normal View History

2019-07-16 09:53:38 +00:00
function register ({ registerHook, peertubeHelpers }) {
registerHook({
2019-07-22 12:08:20 +00:00
target: 'action:video-watch.init',
2019-07-16 09:53:38 +00:00
handler: () => console.log('Hello video watch world')
})
2019-07-22 13:38:26 +00:00
registerHook({
target: 'action:video-watch.video.loaded',
handler: () => 'video loaded'
})
registerHook({
target: 'filter:api.video-watch.video.get.result',
handler: video => {
video.name += ' \o/'
return video
}
})
registerHook({
target: 'filter:api.video-watch.video-threads.list.result',
handler: result => {
result.comments.forEach(c => c.text += ' THREAD')
return result
}
})
registerHook({
target: 'filter:api.video-watch.video-thread-replies.list.result',
handler: result => {
result.children.forEach(c => c.comment.text += ' REPLY DEEP 1')
return result
}
})
2019-07-16 09:53:38 +00:00
}
export {
register
}