55 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-07-16 11:53:38 +02:00
function register ({ registerHook, peertubeHelpers }) {
registerHook({
2019-07-22 14:08:20 +02:00
target: 'action:video-watch.init',
2019-07-16 11:53:38 +02:00
handler: () => console.log('Hello video watch world')
})
2019-07-22 15:38:26 +02: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 => {
2019-07-22 16:40:52 +02:00
result.data.forEach(c => c.text += ' THREAD')
2019-07-22 15:38:26 +02:00
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
}
})
registerHook({
target: 'filter:internal.video-watch.player.build-options.result',
handler: (result, params) => {
console.log('Running player build options hook for video %s.', params.video.name)
result.playerOptions.common.inactivityTimeout = 10000
return result
}
})
2020-04-15 16:13:04 +02:00
peertubeHelpers.notifier.info('you are on the watch page', 'useless', 1000)
2019-07-16 11:53:38 +02:00
}
export {
register
}