Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

import Page from "./page";
import { whichChild } from "../lib/utils";
import lottieLoader from "../lib/lottieLoader";
import { horizontalMenu } from "../components/horizontalMenu";
class PagesManager {
private pageID = -1;
private selectTab: ReturnType<typeof horizontalMenu>;
public pagesDiv: HTMLDivElement;
constructor() {
this.pagesDiv = document.getElementById('auth-pages') as HTMLDivElement;
this.selectTab = horizontalMenu(null, this.pagesDiv.firstElementChild as HTMLDivElement, null, null, 420);
}
public setPage(page: Page) {
if(page.isAuthPage) {
this.pagesDiv.style.display = '';
let id = whichChild(page.pageEl);
if(this.pageID == id) return;
this.selectTab(id);
if(this.pageID != -1 && id > 1) {
lottieLoader.loadLottieWorkers();
}
this.pageID = id;
} else {
this.pagesDiv.style.display = 'none';
page.pageEl.style.display = '';
this.pageID = -1;
}
}
}
const pagesManager = new PagesManager();
4 years ago
// @ts-ignore
if(process.env.NODE_ENV != 'production') {
(window as any).pagesManager = pagesManager;
}
export default pagesManager;