Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

hello: Write better variable names.

Aman Agrawalb9dd4a14c944
diff --git a/web/src/portico/hello.js b/web/src/portico/hello.js
index ac64d3211df..ae761f21e04 100644
--- a/web/src/portico/hello.js
+++ b/web/src/portico/hello.js
@@ -1,16 +1,16 @@
// Mark this as a module for ESLint and Webpack.
export {};
-function get_new_rand(oldRand, max) {
- const newRand = Math.floor(Math.random() * max);
- return newRand === oldRand ? get_new_rand(newRand, max) : newRand;
+function get_new_rand(old_random_int, max) {
+ const random_int = Math.floor(Math.random() * max);
+ return random_int === old_random_int ? get_new_rand(random_int, max) : random_int;
}
function get_random_item_from_array(array) {
return array[Math.floor(Math.random() * array.length)];
}
-const current_clint_logo_class_names = new Set([
+const current_client_logo_class_names = new Set([
"client-logos__logo_akamai",
"client-logos__logo_tum",
"client-logos__logo_wikimedia",
@@ -18,7 +18,7 @@ const current_clint_logo_class_names = new Set([
"client-logos__logo_dr_on_demand",
"client-logos__logo_maria",
]);
-const future_logo_class_names = new Set([
+const future_client_logo_class_names = new Set([
"client-logos__logo_pilot",
"client-logos__logo_recurse",
"client-logos__logo_level_up",
@@ -29,26 +29,28 @@ const future_logo_class_names = new Set([
"client-logos__logo_lean",
"client-logos__logo_asciidoc",
]);
-let current_clint_logo_class_namesIndex = 0;
+let current_client_logo_class_names_index = 0;
function update_client_logo() {
if (document.hidden) {
return;
}
- const logos = [...document.querySelectorAll("[class^='client-logos__']")];
- current_clint_logo_class_namesIndex = get_new_rand(
- current_clint_logo_class_namesIndex,
- logos.length,
+ const client_logos = [...document.querySelectorAll("[class^='client-logos__']")];
+ current_client_logo_class_names_index = get_new_rand(
+ current_client_logo_class_names_index,
+ client_logos.length,
);
- const el = logos[current_clint_logo_class_namesIndex];
+ const client_logo_elt = client_logos[current_client_logo_class_names_index];
- const oldClass = el.className;
- el.className = "";
- current_clint_logo_class_names.delete(oldClass);
- const newClass = get_random_item_from_array([...future_logo_class_names.values()]);
- future_logo_class_names.delete(newClass);
- el.className = newClass;
- current_clint_logo_class_names.add(newClass);
- future_logo_class_names.add(oldClass);
+ const current_logo_class = client_logo_elt.className;
+ current_client_logo_class_names.delete(current_logo_class);
+
+ const next_logo_class = get_random_item_from_array([
+ ...future_client_logo_class_names.values(),
+ ]);
+ future_client_logo_class_names.delete(next_logo_class);
+ client_logo_elt.className = next_logo_class;
+ current_client_logo_class_names.add(next_logo_class);
+ future_client_logo_class_names.add(current_logo_class);
}
setInterval(update_client_logo, 2500);