Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ts: Convert trivial portico modules to TypeScript.
Anders Kaseorg96fadb3d66f8
diff --git a/web/src/portico/communities.js b/web/src/portico/communities.tssimilarity index 91%rename from web/src/portico/communities.jsrename to web/src/portico/communities.tsindex 83fbbeee67f..37c216d1851 100644--- a/web/src/portico/communities.js+++ b/web/src/portico/communities.ts@@ -1,6 +1,6 @@import $ from "jquery";-function sync_open_organizations_page_with_current_hash() {+function sync_open_organizations_page_with_current_hash(): void {const hash = window.location.hash;if (!hash || hash === "#all" || hash === "#undefined") {$(".eligible_realm").show();diff --git a/web/src/portico/confirm-preregistrationuser.js b/web/src/portico/confirm-preregistrationuser.tssimilarity index 100%rename from web/src/portico/confirm-preregistrationuser.jsrename to web/src/portico/confirm-preregistrationuser.tsdiff --git a/web/src/portico/desktop-redirect.js b/web/src/portico/desktop-redirect.tssimilarity index 53%rename from web/src/portico/desktop-redirect.jsrename to web/src/portico/desktop-redirect.tsindex 3d5c4e245d6..b57eb21211a 100644--- a/web/src/portico/desktop-redirect.js+++ b/web/src/portico/desktop-redirect.ts@@ -1,4 +1,4 @@import ClipboardJS from "clipboard";new ClipboardJS("#copy");-document.querySelector("#copy").focus();+document.querySelector<HTMLElement>("#copy")!.focus();diff --git a/web/src/portico/dev-login.js b/web/src/portico/dev-login.tssimilarity index 83%rename from web/src/portico/dev-login.jsrename to web/src/portico/dev-login.tsindex fcf11c6192e..523f7346fb6 100644--- a/web/src/portico/dev-login.js+++ b/web/src/portico/dev-login.ts@@ -3,12 +3,12 @@ import $ from "jquery";$(() => {// This code will be executed when the user visits /login and// dev_login.html is rendered.- if ($("[data-page-id='dev-login']").length > 0 && window.location.hash.slice(0, 1) === "#") {+ if ($("[data-page-id='dev-login']").length > 0 && window.location.hash.startsWith("#")) {/* We append the location.hash to the input field with name next so that URL can bepreserved after user is logged in. See this:https://stackoverflow.com/questions/5283395/url-hash-is-persisting-between-redirects */$("input[name='next']").each(function () {- const new_value = $(this).attr("value") + window.location.hash;+ const new_value = $(this).attr("value")! + window.location.hash;$(this).attr("value", new_value);});}diff --git a/web/src/portico/header.js b/web/src/portico/header.tssimilarity index 100%rename from web/src/portico/header.jsrename to web/src/portico/header.tsdiff --git a/web/src/portico/tippyjs.js b/web/src/portico/tippyjs.tssimilarity index 92%rename from web/src/portico/tippyjs.jsrename to web/src/portico/tippyjs.tsindex e021b4e89c6..e8aae7010f7 100644--- a/web/src/portico/tippyjs.js+++ b/web/src/portico/tippyjs.ts@@ -1,7 +1,7 @@import $ from "jquery";import tippy from "tippy.js";-function initialize() {+function initialize(): void {tippy("[data-tippy-content]", {// Same defaults as set in web app tippyjs module.maxWidth: 300,