WIP new full screen chat
This commit is contained in:
parent
bd695bdb27
commit
22a675e915
@ -169,3 +169,11 @@ table.peertube-plugin-livechat-prosody-list-rooms td {
|
||||
min-height: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
.livechat-embed-fullpage {
|
||||
converse-root {
|
||||
display: block;
|
||||
height: 90vh;
|
||||
min-height: 400px;
|
||||
}
|
||||
}
|
||||
|
@ -39,11 +39,15 @@ async function registerConfiguration (clientOptions: RegisterClientOptions): Pro
|
||||
const converseJSParams: InitConverseJSParams = await (response).json()
|
||||
await loadConverseJS(converseJSParams)
|
||||
|
||||
rootEl.innerHTML = `<div class="converse-fullscreen theme-peertube">
|
||||
<div id="conversejs-bg" class="theme-peertube">
|
||||
</div>`
|
||||
const container = document.createElement('div')
|
||||
container.classList.add('margin-content')
|
||||
container.classList.add('livechat-embed-fullpage')
|
||||
rootEl.append(container)
|
||||
const converseRoot = document.createElement('converse-root')
|
||||
converseRoot.classList.add('theme-peertube')
|
||||
container.append(converseRoot)
|
||||
|
||||
window.initConverse(converseJSParams)
|
||||
window.initConverse(converseJSParams, 'embedded')
|
||||
} catch (err) {
|
||||
console.error('[peertube-plugin-livechat] ' + (err as string))
|
||||
rootEl.innerText = await peertubeHelpers.translate(LOC_NOT_FOUND)
|
||||
|
@ -24,7 +24,10 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
window.initConverse = async function initConverse (initConverseParams: InitConverseJSParams): Promise<void> {
|
||||
window.initConverse = async function initConverse (
|
||||
initConverseParams: InitConverseJSParams,
|
||||
viewMode: 'fullscreen' | 'embedded' = 'fullscreen'
|
||||
): Promise<void> {
|
||||
// First, fixing relative websocket urls.
|
||||
if (initConverseParams.localWebsocketServiceUrl?.startsWith('/')) {
|
||||
initConverseParams.localWebsocketServiceUrl = new URL(
|
||||
@ -47,6 +50,8 @@ window.initConverse = async function initConverse (initConverseParams: InitConve
|
||||
const isInIframe = inIframe()
|
||||
initDom(initConverseParams, isInIframe)
|
||||
const params = defaultConverseParams(initConverseParams, isInIframe)
|
||||
params.view_mode = viewMode
|
||||
params.allow_url_history_change = viewMode === 'fullscreen'
|
||||
|
||||
let isAuthenticated: boolean = false
|
||||
let isRemoteWithNicknameSet: boolean = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user