bigbluebutton-Github/bigbluebutton-html5/imports/utils/dom-utils.js

28 lines
760 B
JavaScript

const TITLE_WITH_VIEW = 3;
const getTitleData = () => {
const title = document.getElementsByTagName('title')[0];
return { title, data: title?.text?.split(' - ') };
}
export const registerTitleView = (v) => {
const { title, data } = getTitleData();
if (data.length < TITLE_WITH_VIEW) data.push(`${v}`);
else data.splice(TITLE_WITH_VIEW - 1, TITLE_WITH_VIEW, v);
title.text = data.join(' - ');
};
export const unregisterTitleView = () => {
const { title, data } = getTitleData();
if (data.length === TITLE_WITH_VIEW) {
data.splice(TITLE_WITH_VIEW - 1, TITLE_WITH_VIEW, 'Default');
}
title.text = data.join(' - ');
};
export default {
registerTitleView,
unregisterTitleView,
};