Add user hooks in hello world

This commit is contained in:
Chocobozzz
2021-03-26 08:30:43 +01:00
parent 72c21f0b98
commit 93d7b30cad
2 changed files with 48 additions and 2 deletions

View File

@ -1,4 +1,4 @@
function register ({ registerVideoField }) {
function register ({ registerHook, registerVideoField }) {
console.log('loading video edit stuff')
{
@ -13,6 +13,35 @@ function register ({ registerVideoField }) {
registerVideoField(commonOptions, { type })
}
}
{
const hooks = [
'action:video-upload.init',
'action:video-url-import.init',
'action:video-torrent-import.init',
'action:go-live.init'
]
for (const h of hooks) {
registerHook({
target: h,
handler: () => {
const event = new Event('change', {
bubbles: true,
cancelable: true,
});
const selects = document.querySelectorAll('label[for=first-step-privacy] + my-select-options')
console.log(selects)
selects.forEach(s => {
s.value = 2 // Unlisted
s.dispatchEvent(event)
})
}
})
}
}
}
export {