Moderation configuration screen: WIP.
This commit is contained in:
29
client/common/moderation/logic/channel.ts
Normal file
29
client/common/moderation/logic/channel.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
||||
|
||||
/**
|
||||
* Adds the front-end logic on the generated html for the channel moderation options.
|
||||
* @param clientOptions Peertube client options
|
||||
* @param rootEl The root element in which the template was rendered
|
||||
*/
|
||||
async function vivifyModerationChannel (
|
||||
clientOptions: RegisterClientOptions,
|
||||
rootEl: HTMLElement
|
||||
): Promise<void> {
|
||||
const form = rootEl.querySelector('form[livechat-moderation-channel-options]') as HTMLFormElement
|
||||
if (!form) { return }
|
||||
const enableBotCB = form.querySelector('input[name=bot]') as HTMLInputElement
|
||||
const botEnabledEl = form.querySelector('[livechat-moderation-channel-options-bot-enabled]') as HTMLElement
|
||||
|
||||
const refresh: Function = () => {
|
||||
botEnabledEl.style.display = enableBotCB.checked ? 'initial' : 'none'
|
||||
}
|
||||
|
||||
enableBotCB.onclick = () => refresh()
|
||||
form.onsubmit = () => false
|
||||
form.onreset = () => refresh()
|
||||
refresh()
|
||||
}
|
||||
|
||||
export {
|
||||
vivifyModerationChannel
|
||||
}
|
Reference in New Issue
Block a user