peertube-plugin-livechat/conversejs/lib/dom.ts
John Livingston d33795f7a1
Code refactoring WIP:
Cleaning the way ConverseJS parameters are given to the full page.
2023-08-01 17:01:09 +02:00

26 lines
704 B
TypeScript

import type { InitConverseJSParams } from 'shared/lib/types'
function initDom ({ forceReadonly, transparent }: InitConverseJSParams, isInIframe: boolean): void {
const body = document.querySelector('body')
if (isInIframe) {
if (body) {
body.classList.add('livechat-iframe')
// prevent horizontal scrollbar when in iframe. (don't know why, but does not work if done by CSS)
body.style.overflowX = 'hidden'
}
}
if (forceReadonly) {
body?.classList.add('livechat-readonly')
if (forceReadonly === 'noscroll') {
body?.classList.add('livechat-noscroll')
}
}
if (transparent) {
body?.classList.add('livechat-transparent')
}
}
export {
initDom
}