Convert a few files to TS
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
0ed325c628
commit
2760a36f47
3 changed files with 9 additions and 7 deletions
|
@ -1,19 +1,21 @@
|
||||||
import { getVectorConfig } from '../getconfig';
|
import { getVectorConfig } from '../getconfig';
|
||||||
|
|
||||||
function onBackToElementClick() {
|
function onBackToElementClick(): void {
|
||||||
// Cookie should expire in 4 hours
|
// Cookie should expire in 4 hours
|
||||||
document.cookie = 'element_mobile_redirect_to_guide=false;path=/;max-age=14400';
|
document.cookie = 'element_mobile_redirect_to_guide=false;path=/;max-age=14400';
|
||||||
window.location.href = '../';
|
window.location.href = '../';
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEVER pass user-controlled content to this function! Hardcoded strings only please.
|
// NEVER pass user-controlled content to this function! Hardcoded strings only please.
|
||||||
function renderConfigError(message) {
|
function renderConfigError(message: string): void {
|
||||||
const contactMsg = "If this is unexpected, please contact your system administrator " +
|
const contactMsg = "If this is unexpected, please contact your system administrator " +
|
||||||
"or technical support representative.";
|
"or technical support representative.";
|
||||||
message = `<h2>Error loading Element</h2><p>${message}</p><p>${contactMsg}</p>`;
|
message = `<h2>Error loading Element</h2><p>${message}</p><p>${contactMsg}</p>`;
|
||||||
|
|
||||||
const toHide = document.getElementsByClassName("mx_HomePage_container");
|
const toHide = document.getElementsByClassName("mx_HomePage_container");
|
||||||
const errorContainers = document.getElementsByClassName("mx_HomePage_errorContainer");
|
const errorContainers = document.getElementsByClassName(
|
||||||
|
"mx_HomePage_errorContainer",
|
||||||
|
) as HTMLCollectionOf<HTMLDialogElement>;
|
||||||
|
|
||||||
for (const e of toHide) {
|
for (const e of toHide) {
|
||||||
// We have to clear the content because .style.display='none'; doesn't work
|
// We have to clear the content because .style.display='none'; doesn't work
|
||||||
|
@ -26,7 +28,7 @@ function renderConfigError(message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initPage() {
|
async function initPage(): Promise<void> {
|
||||||
document.getElementById('back_to_element_button').onclick = onBackToElementClick;
|
document.getElementById('back_to_element_button').onclick = onBackToElementClick;
|
||||||
|
|
||||||
const config = await getVectorConfig('..');
|
const config = await getVectorConfig('..');
|
||||||
|
@ -92,7 +94,7 @@ async function initPage() {
|
||||||
if (isUrl && !isUrl.endsWith('/')) isUrl += '/';
|
if (isUrl && !isUrl.endsWith('/')) isUrl += '/';
|
||||||
|
|
||||||
if (hsUrl !== 'https://matrix.org/') {
|
if (hsUrl !== 'https://matrix.org/') {
|
||||||
document.getElementById('configure_element_button').href =
|
(document.getElementById('configure_element_button') as HTMLAnchorElement).href =
|
||||||
"https://mobile.element.io?hs_url=" + encodeURIComponent(hsUrl) +
|
"https://mobile.element.io?hs_url=" + encodeURIComponent(hsUrl) +
|
||||||
"&is_url=" + encodeURIComponent(isUrl);
|
"&is_url=" + encodeURIComponent(isUrl);
|
||||||
document.getElementById('step1_heading').innerHTML= '1: Install the app';
|
document.getElementById('step1_heading').innerHTML= '1: Install the app';
|
|
@ -55,8 +55,8 @@ module.exports = (env, argv) => {
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
"bundle": "./src/vector/index.ts",
|
"bundle": "./src/vector/index.ts",
|
||||||
"indexeddb-worker": "./src/vector/indexeddb-worker.js",
|
"indexeddb-worker": "./src/vector/indexeddb-worker.ts",
|
||||||
"mobileguide": "./src/vector/mobile_guide/index.js",
|
"mobileguide": "./src/vector/mobile_guide/index.ts",
|
||||||
"jitsi": "./src/vector/jitsi/index.ts",
|
"jitsi": "./src/vector/jitsi/index.ts",
|
||||||
"usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js",
|
"usercontent": "./node_modules/matrix-react-sdk/src/usercontent/index.js",
|
||||||
"recorder-worklet": "./node_modules/matrix-react-sdk/src/voice/RecorderWorklet.ts",
|
"recorder-worklet": "./node_modules/matrix-react-sdk/src/voice/RecorderWorklet.ts",
|
||||||
|
|
Loading…
Reference in a new issue