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

28 lines
760 B
JavaScript
Raw Normal View History

2021-09-05 06:36:48 +08:00
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,
2022-01-24 00:18:09 +08:00
};