Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Replace deprecated jQuery event handler shorthand.
Anders Kaseorg4e42137bd9ba
diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.jsindex 6447ac0921b..e9221fc2ee7 100644--- a/frontend_tests/node_tests/components.js+++ b/frontend_tests/node_tests/components.js@@ -56,12 +56,12 @@ run_test("basics", () => {self.stub = true;- self.click = function (f) {- click_f = f;- };-- self.keydown = function (f) {- keydown_f = f;+ self.on = function (name, f) {+ if (name === "click") {+ click_f = f;+ } else if (name === "keydown") {+ keydown_f = f;+ }};self.removeClass = function (c) {diff --git a/frontend_tests/node_tests/zjquery.js b/frontend_tests/node_tests/zjquery.jsindex 7984d4e26bb..ef791e40faf 100644--- a/frontend_tests/node_tests/zjquery.js+++ b/frontend_tests/node_tests/zjquery.js@@ -116,11 +116,11 @@ run_test("clicks", () => {const state = {};function set_up_click_handlers() {- $("#widget1").click(() => {+ $("#widget1").on("click", () => {state.clicked = true;});- $(".some-class").keydown(() => {+ $(".some-class").on("keydown", () => {state.keydown = true;});}diff --git a/static/js/activity.js b/static/js/activity.jsindex 19353f50df0..c2c8ec4b6ff 100644--- a/static/js/activity.js+++ b/static/js/activity.js@@ -208,7 +208,7 @@ exports.initialize = function () {exports.new_user_input = true;});- $(window).focus(mark_client_active);+ $(window).on("focus", mark_client_active);$(window).idle({idle: DEFAULT_IDLE_TIMEOUT_MS,onIdle: mark_client_idle,diff --git a/static/js/analytics/activity.js b/static/js/analytics/activity.jsindex d5012c2fd80..5a17aff7f1f 100644--- a/static/js/analytics/activity.js+++ b/static/js/analytics/activity.js@@ -1,5 +1,5 @@$(() => {- $("a.envelope-link").click(function () {+ $("a.envelope-link").on("click", function () {common.copy_data_attribute_value($(this), "admin-emails");});});diff --git a/static/js/analytics/support.js b/static/js/analytics/support.jsindex f93f2202cf4..46aba1eda81 100644--- a/static/js/analytics/support.js+++ b/static/js/analytics/support.js@@ -12,7 +12,7 @@ $(() => {}});- $("a.copy-button").click(function () {+ $("a.copy-button").on("click", function () {common.copy_data_attribute_value($(this), "copytext");});});diff --git a/static/js/archive.js b/static/js/archive.jsindex c8acb1d79f5..89c687bf51f 100644--- a/static/js/archive.js+++ b/static/js/archive.js@@ -129,7 +129,8 @@ $(() => {$.fn.safeOuterWidth = function (...args) {return this.outerWidth(...args) || 0;};- $(".app").scroll(+ $(".app").on(+ "scroll",_.throttle(() => {scroll_finish();}, 50),diff --git a/static/js/buddy_list.js b/static/js/buddy_list.jsindex 7dd51ee39d8..27863b92e58 100644--- a/static/js/buddy_list.js+++ b/static/js/buddy_list.js@@ -315,7 +315,7 @@ function buddy_list_create() {// sure everything's in place.const scroll_container = ui.get_scroll_element($(self.scroll_container_sel));- scroll_container.scroll(() => {+ scroll_container.on("scroll", () => {self.fill_screen_with_content();});};diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 9360d885ea0..8ce7415f832 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -328,7 +328,7 @@ exports.initialize = function () {ui_util.blur_active_element();}});- $("#message_edit_form .send-status-close").click(function () {+ $("#message_edit_form .send-status-close").on("click", function () {const row_id = rows.id($(this).closest(".message_row"));const send_status = $("#message-edit-send-status-" + row_id);$(send_status).stop(true).fadeOut(200);@@ -604,7 +604,7 @@ exports.initialize = function () {$("#logout_form").submit();});- $(".restart_get_events_button").click(() => {+ $(".restart_get_events_button").on("click", () => {server_events.restart_get_events({dont_block: true});});@@ -629,18 +629,18 @@ exports.initialize = function () {// NB: This just binds to current elements, and won't bind to elements// created after ready() is called.- $("#compose-send-status .compose-send-status-close").click(() => {+ $("#compose-send-status .compose-send-status-close").on("click", () => {$("#compose-send-status").stop(true).fadeOut(500);});- $("#nonexistent_stream_reply_error .compose-send-status-close").click(() => {+ $("#nonexistent_stream_reply_error .compose-send-status-close").on("click", () => {$("#nonexistent_stream_reply_error").stop(true).fadeOut(500);});- $(".compose_stream_button").click(() => {+ $(".compose_stream_button").on("click", () => {popovers.hide_mobile_message_buttons_popover();compose_actions.start("stream", {trigger: "new topic button"});});- $(".compose_private_button").click(() => {+ $(".compose_private_button").on("click", () => {popovers.hide_mobile_message_buttons_popover();compose_actions.start("private");});@@ -654,15 +654,15 @@ exports.initialize = function () {compose_actions.start("private");});- $(".compose_reply_button").click(() => {+ $(".compose_reply_button").on("click", () => {compose_actions.respond_to_message({trigger: "reply button"});});- $(".empty_feed_compose_stream").click((e) => {+ $(".empty_feed_compose_stream").on("click", (e) => {compose_actions.start("stream", {trigger: "empty feed message"});e.preventDefault();});- $(".empty_feed_compose_private").click((e) => {+ $(".empty_feed_compose_private").on("click", (e) => {compose_actions.start("private", {trigger: "empty feed message"});e.preventDefault();});@@ -696,19 +696,19 @@ exports.initialize = function () {popovers.hide_all();}- $("#compose_buttons").click(handle_compose_click);- $(".compose-content").click(handle_compose_click);+ $("#compose_buttons").on("click", handle_compose_click);+ $(".compose-content").on("click", handle_compose_click);- $("#compose_close").click(() => {+ $("#compose_close").on("click", () => {compose_actions.cancel();});- $("#streams_inline_cog").click((e) => {+ $("#streams_inline_cog").on("click", (e) => {e.stopPropagation();hashchange.go_to_location("streams/subscribed");});- $("#streams_filter_icon").click((e) => {+ $("#streams_filter_icon").on("click", (e) => {e.stopPropagation();stream_list.toggle_filter_displayed(e);});diff --git a/static/js/components.js b/static/js/components.jsindex 6ee0121e455..70d33473fd8 100644--- a/static/js/components.js+++ b/static/js/components.js@@ -84,7 +84,7 @@ exports.toggle = function (opts) {}(function () {- meta.$ind_tab.click(function () {+ meta.$ind_tab.on("click", function () {const idx = $(this).data("tab-id");select_tab(idx);});diff --git a/static/js/compose.js b/static/js/compose.jsindex bf05acf353c..6359eb688e9 100644--- a/static/js/compose.js+++ b/static/js/compose.js@@ -1216,7 +1216,7 @@ exports.initialize = function () {mode: "compose",});- $("#compose-textarea").focus(() => {+ $("#compose-textarea").on("focus", () => {const opts = {message_type: compose_state.get_message_type(),stream: $("#stream_message_recipient_stream").val(),diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.jsindex 61e7e3a11ee..7616f797893 100644--- a/static/js/composebox_typeahead.js+++ b/static/js/composebox_typeahead.js@@ -266,7 +266,7 @@ function select_on_focus(field_id) {// conditions in Chrome so we need to protect against infinite// recursion.let in_handler = false;- $("#" + field_id).focus(() => {+ $("#" + field_id).on("focus", () => {if (in_handler) {return;}@@ -1063,10 +1063,10 @@ exports.initialize = function () {select_on_focus("private_message_recipient");// These handlers are at the "form" level so that they are called after typeahead- $("form#send_message_form").keydown(handle_keydown);- $("form#send_message_form").keyup(handle_keyup);+ $("form#send_message_form").on("keydown", handle_keydown);+ $("form#send_message_form").on("keyup", handle_keyup);- $("#enter_sends").click(() => {+ $("#enter_sends").on("click", () => {const send_button = $("#compose-send-button");page_params.enter_sends = $("#enter_sends").is(":checked");if (page_params.enter_sends) {@@ -1166,7 +1166,7 @@ exports.initialize = function () {exports.initialize_compose_typeahead("#compose-textarea");- $("#private_message_recipient").blur(function () {+ $("#private_message_recipient").on("blur", function () {const val = $(this).val();const recipients = typeahead_helper.get_cleaned_pm_recipients(val);$(this).val(recipients.join(", "));diff --git a/static/js/drafts.js b/static/js/drafts.jsindex f99b58113df..1cc7dc96ffe 100644--- a/static/js/drafts.js+++ b/static/js/drafts.js@@ -532,7 +532,7 @@ exports.initialize = function () {set_count(Object.keys(draft_model.get()).length);- $("#compose-textarea").focusout(exports.update_draft);+ $("#compose-textarea").on("focusout", exports.update_draft);$("body").on("focus", ".draft-info-box", (e) => {activate_element(e.target);diff --git a/static/js/dropdown_list_widget.js b/static/js/dropdown_list_widget.jsindex d5058643e66..6e0382ae25f 100644--- a/static/js/dropdown_list_widget.js+++ b/static/js/dropdown_list_widget.js@@ -60,7 +60,7 @@ const DropdownListWidget = function (opts) {const value = $(this).attr("data-value");update(value);});- $(`#${opts.container_id} .dropdown_list_reset_button`).click((e) => {+ $(`#${opts.container_id} .dropdown_list_reset_button`).on("click", (e) => {update(opts.null_value);e.preventDefault();});@@ -85,22 +85,22 @@ const DropdownListWidget = function (opts) {},simplebar_container: $(`#${opts.container_id} .dropdown-list-wrapper`),});- $(`#${opts.container_id} .dropdown-search`).click((e) => {+ $(`#${opts.container_id} .dropdown-search`).on("click", (e) => {e.stopPropagation();});- dropdown_toggle.click(() => {+ dropdown_toggle.on("click", () => {search_input.val("").trigger("input");});- dropdown_toggle.focus((e) => {+ dropdown_toggle.on("focus", (e) => {// On opening a Bootstrap Dropdown, the parent element recieves focus.// Here, we want our search input to have focus instead.e.preventDefault();search_input.focus();});- search_input.keydown((e) => {+ search_input.on("keydown", (e) => {if (!/(38|40|27)/.test(e.keyCode)) {return;}diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.jsindex 21a29d8326e..32d3f665510 100644--- a/static/js/emoji_picker.js+++ b/static/js/emoji_picker.js@@ -560,9 +560,9 @@ function register_popover_events(popover) {});$(".emoji-popover-filter").on("input", filter_emojis);- $(".emoji-popover-filter").keydown(process_enter_while_filtering);- $(".emoji-popover").keypress(process_keypress);- $(".emoji-popover").keydown((e) => {+ $(".emoji-popover-filter").on("keydown", process_enter_while_filtering);+ $(".emoji-popover").on("keypress", process_keypress);+ $(".emoji-popover").on("keydown", (e) => {// Because of cross-browser issues we need to handle backspace// key separately. Firefox fires `keypress` event for backspace// key but chrome doesn't so we need to trigger the logic fordiff --git a/static/js/feedback_widget.js b/static/js/feedback_widget.jsindex 3e8f52ea685..cbb7b98978d 100644--- a/static/js/feedback_widget.js+++ b/static/js/feedback_widget.js@@ -70,7 +70,7 @@ function set_up_handlers() {meta.handlers_set = true;// if the user mouses over the notification, don't hide it.- meta.$container.mouseenter(() => {+ meta.$container.on("mouseenter", () => {if (!meta.opened) {return;}@@ -79,7 +79,7 @@ function set_up_handlers() {});// once the user's mouse leaves the notification, restart the countdown.- meta.$container.mouseleave(() => {+ meta.$container.on("mouseleave", () => {if (!meta.opened) {return;}diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex c742e32c6ef..d0c1c328ef9 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -793,7 +793,7 @@ exports.process_keydown = function (e) {return exports.process_hotkey(e, hotkey);};-$(document).keydown((e) => {+$(document).on("keydown", (e) => {if (exports.process_keydown(e)) {e.preventDefault();}@@ -807,7 +807,7 @@ exports.process_keypress = function (e) {return exports.process_hotkey(e, hotkey);};-$(document).keypress((e) => {+$(document).on("keypress", (e) => {if (exports.process_keypress(e)) {e.preventDefault();}diff --git a/static/js/keydown_util.js b/static/js/keydown_util.jsindex 7244b75bada..0ebce061637 100644--- a/static/js/keydown_util.js+++ b/static/js/keydown_util.js@@ -11,7 +11,7 @@ const keys = {};exports.handle = function (opts) {- opts.elem.keydown((e) => {+ opts.elem.on("keydown", (e) => {const key = e.which || e.keyCode;if (e.altKey || e.ctrlKey || e.shiftKey) {diff --git a/static/js/lightbox.js b/static/js/lightbox.jsindex c22b2154a9b..d1e2c8e5bc5 100644--- a/static/js/lightbox.js+++ b/static/js/lightbox.js@@ -271,7 +271,7 @@ exports.initialize = function () {exports.open($img);});- $("#lightbox_overlay .download").click(function () {+ $("#lightbox_overlay .download").on("click", function () {this.blur();});diff --git a/static/js/message_edit.js b/static/js/message_edit.jsindex e059f4364e2..2d5ef2f822d 100644--- a/static/js/message_edit.js+++ b/static/js/message_edit.js@@ -312,7 +312,7 @@ function edit_message(row, raw_content) {currently_editing_messages.set(message.id, edit_obj);current_msg_list.show_edit_message(row, edit_obj);- form.keydown(handle_message_row_edit_keydown);+ form.on("keydown", handle_message_row_edit_keydown);upload.feature_check($("#attach_files_" + rows.id(row)));@@ -326,7 +326,7 @@ function edit_message(row, raw_content) {const copy_message = row.find(".copy_message");ui_util.decorate_stream_bar(message.stream, stream_header_colorblock, false);- message_edit_stream.change(function () {+ message_edit_stream.on("change", function () {const stream_name = stream_data.maybe_get_stream_name(parseInt(this.value, 10));ui_util.decorate_stream_bar(stream_name, stream_header_colorblock, false);});@@ -459,7 +459,7 @@ function edit_message(row, raw_content) {}if (!message.locally_echoed) {- message_edit_topic.keyup(() => {+ message_edit_topic.on("keyup", () => {set_propagate_selector_display();});@@ -518,7 +518,7 @@ exports.start = function (row, edit_box_open_callback) {exports.start_topic_edit = function (recipient_row) {const form = $(render_topic_edit_form());current_msg_list.show_edit_topic_on_recipient_row(recipient_row, form);- form.keydown(handle_inline_topic_edit_keydown);+ form.on("keydown", handle_inline_topic_edit_keydown);const msg_id = rows.id_for_recipient_row(recipient_row);const message = current_msg_list.get(msg_id);let topic = message.topic;diff --git a/static/js/message_scroll.js b/static/js/message_scroll.jsindex 2c3f89b94eb..d011b714e58 100644--- a/static/js/message_scroll.js+++ b/static/js/message_scroll.js@@ -152,7 +152,8 @@ function scroll_finish() {}exports.initialize = function () {- message_viewport.message_pane.scroll(+ message_viewport.message_pane.on(+ "scroll",_.throttle(() => {unread_ops.process_visible();scroll_finish();diff --git a/static/js/message_viewport.js b/static/js/message_viewport.jsindex c2627225751..2961a649ac6 100644--- a/static/js/message_viewport.js+++ b/static/js/message_viewport.js@@ -444,7 +444,7 @@ exports.initialize = function () {jwindow = $(window);exports.message_pane = $(".app");// This handler must be placed before all resize handlers in our application- jwindow.resize(() => {+ jwindow.on("resize", () => {dimensions.height.reset();dimensions.width.reset();top_of_feed.reset();diff --git a/static/js/notifications.js b/static/js/notifications.jsindex eeed7d799e3..89403b5fe7b 100644--- a/static/js/notifications.js+++ b/static/js/notifications.js@@ -64,7 +64,7 @@ function get_audio_file_path(audio_element, audio_file_without_extension) {exports.initialize = function () {$(window)- .focus(() => {+ .on("focus", () => {window_has_focus = true;for (const notice_mem_entry of notice_memory.values()) {@@ -76,7 +76,7 @@ exports.initialize = function () {// counts.unread_ops.process_visible();})- .blur(() => {+ .on("blur", () => {window_has_focus = false;});diff --git a/static/js/portico/email_log.js b/static/js/portico/email_log.jsindex 19edb1abaef..5899e852976 100644--- a/static/js/portico/email_log.js+++ b/static/js/portico/email_log.js@@ -1,7 +1,7 @@$(() => {// This code will be executed when the user visits /emails in// development mode and email_log.html is rendered.- $("#toggle").change(() => {+ $("#toggle").on("change", () => {if ($(".email-text").css("display") === "none") {$(".email-text").each(function () {$(this).css("display", "block");diff --git a/static/js/portico/header.js b/static/js/portico/header.jsindex 1329b4215d1..910150ded01 100644--- a/static/js/portico/header.js+++ b/static/js/portico/header.js@@ -4,7 +4,7 @@ $(() => {return false;});- $("body").click((e) => {+ $("body").on("click", (e) => {const $this = $(e.target);if (diff --git a/static/js/portico/help.js b/static/js/portico/help.jsindex 6c65df6f3c0..c7a05d243a9 100644--- a/static/js/portico/help.js+++ b/static/js/portico/help.js@@ -6,7 +6,7 @@ function registerCodeSection($codeSection) {const $li = $codeSection.find("ul.nav li");const $blocks = $codeSection.find(".blocks div");- $li.click(function () {+ $li.on("click", function () {const language = this.dataset.language;$li.removeClass("active");@@ -99,7 +99,7 @@ const update_page = function (html_map, path) {new SimpleBar($(".sidebar")[0]);-$(".sidebar.slide h2").click((e) => {+$(".sidebar.slide h2").on("click", (e) => {const $next = $(e.target).next();if ($next.is("ul")) {@@ -110,7 +110,7 @@ $(".sidebar.slide h2").click((e) => {}});-$(".sidebar a").click(function (e) {+$(".sidebar a").on("click", function (e) {const path = $(this).attr("href");const path_dir = path.split("/")[1];const current_dir = window.location.pathname.split("/")[1];@@ -150,11 +150,11 @@ $(document).on(},);-$(".hamburger").click(() => {+$(".hamburger").on("click", () => {$(".sidebar").toggleClass("show");});-$(".markdown").click(() => {+$(".markdown").on("click", () => {if ($(".sidebar.show").length) {$(".sidebar.show").toggleClass("show");}diff --git a/static/js/portico/integrations.js b/static/js/portico/integrations.jsindex bbf61db1dfc..c7c74221b4c 100644--- a/static/js/portico/integrations.js+++ b/static/js/portico/integrations.js@@ -323,7 +323,7 @@ function toggle_categories_dropdown() {}function integration_events() {- $('#integration-search input[type="text"]').keypress((e) => {+ $('#integration-search input[type="text"]').on("keypress", (e) => {const integrations = $(".integration-lozenges").children().toArray();if (e.which === 13 && e.target.value !== "") {for (let i = 0; i < integrations.length; i += 1) {@@ -337,7 +337,7 @@ function integration_events() {}});- $(".integration-categories-dropdown .dropdown-toggle").click(() => {+ $(".integration-categories-dropdown .dropdown-toggle").on("click", () => {toggle_categories_dropdown();});@@ -375,7 +375,7 @@ function integration_events() {dispatch("UPDATE_QUERY", {query: e.target.value.toLowerCase()});});- $(window).scroll(() => {+ $(window).on("scroll", () => {if (document.body.scrollTop > 330) {$(".integration-categories-sidebar").addClass("sticky");} else {diff --git a/static/js/portico/integrations_dev_panel.js b/static/js/portico/integrations_dev_panel.jsindex 419b902761d..351530a1813 100644--- a/static/js/portico/integrations_dev_panel.js+++ b/static/js/portico/integrations_dev_panel.js@@ -341,7 +341,7 @@ $(() => {potential_default_bot.selected = true;}- $("#integration_name").change(function () {+ $("#integration_name").on("change", function () {clear_elements(["custom_http_headers", "fixture_body", "fixture_name", "results_notice"]);const integration_name = $(this).children("option:selected").val();get_fixtures(integration_name);@@ -349,27 +349,27 @@ $(() => {return;});- $("#fixture_name").change(function () {+ $("#fixture_name").on("change", function () {clear_elements(["fixture_body", "results_notice"]);const fixture_name = $(this).children("option:selected").val();load_fixture_body(fixture_name);return;});- $("#send_fixture_button").click(() => {+ $("#send_fixture_button").on("click", () => {send_webhook_fixture_message();return;});- $("#send_all_fixtures_button").click(() => {+ $("#send_all_fixtures_button").on("click", () => {clear_elements(["results_notice"]);send_all_fixture_messages();return;});- $("#bot_name").change(update_url);+ $("#bot_name").on("change", update_url);- $("#stream_name").change(update_url);+ $("#stream_name").on("change", update_url);- $("#topic_name").change(update_url);+ $("#topic_name").on("change", update_url);});diff --git a/static/js/portico/landing-page.js b/static/js/portico/landing-page.jsindex a26aa2f1ac0..3ab57208e5b 100644--- a/static/js/portico/landing-page.js+++ b/static/js/portico/landing-page.js@@ -8,7 +8,7 @@ export function path_parts() {const hello_events = function () {let counter = 0;- $(window).scroll(function () {+ $(window).on("scroll", function () {if (counter % 2 === 0) {$(".screen.hero-screen .message-feed").css("transform",@@ -149,7 +149,7 @@ const apps_events = function () {google_analytics.config({page_path: window.location.pathname});});- $(".apps a .icon").click((e) => {+ $(".apps a .icon").on("click", (e) => {const next_version = $(e.target).closest("a").attr("href").replace("/apps/", "");version = next_version;@@ -175,7 +175,7 @@ const events = function () {$("[data-on-page='" + location + "']").addClass("active");- $("body").click((e) => {+ $("body").on("click", (e) => {const $e = $(e.target);if ($e.is("nav ul .exit")) {@@ -187,7 +187,7 @@ const events = function () {}});- $(".hamburger").click((e) => {+ $(".hamburger").on("click", (e) => {$("nav ul").addClass("show");e.stopPropagation();});@@ -209,7 +209,7 @@ const load = function () {});// Move to the next slide on clicking inside the carousel container- $(".carousel-inner .item-container").click(function (e) {+ $(".carousel-inner .item-container").on("click", function (e) {const get_tag_name = e.target.tagName.toLowerCase();const is_button = get_tag_name === "button";const is_link = get_tag_name === "a";diff --git a/static/js/portico/signup.js b/static/js/portico/signup.jsindex 8126b2ec049..7d45239eca2 100644--- a/static/js/portico/signup.js+++ b/static/js/portico/signup.js@@ -81,7 +81,7 @@ $(() => {// Code in this block will be executed when the /accounts/send_confirm// endpoint is visited i.e. accounts_send_confirm.html is rendered.if ($("[data-page-id='accounts-send-confirm']").length > 0) {- $("#resend_email_link").click(() => {+ $("#resend_email_link").on("click", () => {$(".resend_confirm").submit();});}@@ -134,7 +134,7 @@ $(() => {$("#subdomain_section")[action]();};- $("#realm_in_root_domain").change(function () {+ $("#realm_in_root_domain").on("change", function () {show_subdomain_section($(this).is(":checked"));});@@ -188,7 +188,7 @@ $(() => {}}- $("#source_realm_select").change(update_full_name_section);+ $("#source_realm_select").on("change", update_full_name_section);update_full_name_section();let timer;diff --git a/static/js/portico/team.js b/static/js/portico/team.jsindex 146a505eec5..2941078ca41 100644--- a/static/js/portico/team.js+++ b/static/js/portico/team.js@@ -58,7 +58,7 @@ export default function render_tabs() {// Set as the loading template for now, and load when clicked.$("#tab-" + repo).html($("#loading-template").html());- $("#" + repo).click(() => {+ $("#" + repo).on("click", () => {if (!loaded_repos.includes(repo)) {const html = _.chain(contributors_list).filter(repo)diff --git a/static/js/search.js b/static/js/search.jsindex 93111f52dca..001021b85bc 100644--- a/static/js/search.js+++ b/static/js/search.js@@ -121,7 +121,7 @@ exports.initialize = function () {});searchbox_form- .keydown((e) => {+ .on("keydown", (e) => {exports.update_button_visibility();const code = e.which;if (code === 13 && search_query_box.is(":focus")) {@@ -131,7 +131,7 @@ exports.initialize = function () {return false;}})- .keyup((e) => {+ .on("keyup", (e) => {if (exports.is_using_input_method) {exports.is_using_input_method = false;return;diff --git a/static/js/settings.js b/static/js/settings.jsindex 8bdd9f6f64d..99d956f78e1 100644--- a/static/js/settings.js+++ b/static/js/settings.js@@ -2,7 +2,7 @@ const settings_config = require("./settings_config");const render_settings_tab = require("../templates/settings_tab.hbs");$("body").ready(() => {- $("#settings_overlay_container").click((e) => {+ $("#settings_overlay_container").on("click", (e) => {if (!overlays.is_modal_open()) {return;}diff --git a/static/js/settings_account.js b/static/js/settings_account.jsindex f55fb7b87df..860f41fc661 100644--- a/static/js/settings_account.js+++ b/static/js/settings_account.js@@ -362,7 +362,7 @@ exports.set_up = function () {});});- $("#api_key_button").click((e) => {+ $("#api_key_button").on("click", (e) => {setup_api_key_modal();overlays.open_modal("#api_key_modal");e.preventDefault();diff --git a/static/js/settings_bots.js b/static/js/settings_bots.jsindex 4377d924c2d..b46747f325c 100644--- a/static/js/settings_bots.js+++ b/static/js/settings_bots.js@@ -227,7 +227,7 @@ exports.set_up = function () {$("#config_inputbox").children().hide();$("[name*='" + selected_embedded_bot + "']").show();- $("#download_botserverrc").click(function () {+ $("#download_botserverrc").on("click", function () {const OUTGOING_WEBHOOK_BOT_TYPE_INT = 3;let content = "";@@ -547,19 +547,19 @@ exports.set_up = function () {},});- $("#bots_lists_navbar .add-a-new-bot-tab").click((e) => {+ $("#bots_lists_navbar .add-a-new-bot-tab").on("click", (e) => {e.preventDefault();e.stopPropagation();focus_tab.add_a_new_bot_tab();});- $("#bots_lists_navbar .active-bots-tab").click((e) => {+ $("#bots_lists_navbar .active-bots-tab").on("click", (e) => {e.preventDefault();e.stopPropagation();focus_tab.active_bots_tab();});- $("#bots_lists_navbar .inactive-bots-tab").click((e) => {+ $("#bots_lists_navbar .inactive-bots-tab").on("click", (e) => {e.preventDefault();e.stopPropagation();focus_tab.inactive_bots_tab();diff --git a/static/js/settings_display.js b/static/js/settings_display.jsindex 6d9e15cdd10..b40afca53fb 100644--- a/static/js/settings_display.js+++ b/static/js/settings_display.js@@ -41,13 +41,13 @@ exports.set_up = function () {$(".emojiset_choice[value=" + page_params.emojiset + "]").prop("checked", true);- $("#default_language_modal [data-dismiss]").click(() => {+ $("#default_language_modal [data-dismiss]").on("click", () => {overlays.close_modal("#default_language_modal");});const all_display_settings = settings_config.get_all_display_settings();for (const setting of all_display_settings.settings.user_display_settings) {- $("#" + setting).change(function () {+ $("#" + setting).on("change", function () {const data = {};data[setting] = JSON.stringify($(this).prop("checked"));@@ -66,7 +66,7 @@ exports.set_up = function () {});}- $("#default_language_modal .language").click((e) => {+ $("#default_language_modal .language").on("click", (e) => {e.preventDefault();e.stopPropagation();overlays.close_modal("#default_language_modal");@@ -94,12 +94,12 @@ exports.set_up = function () {overlays.open_modal("#default_language_modal");});- $("#demote_inactive_streams").change(function () {+ $("#demote_inactive_streams").on("change", function () {const data = {demote_inactive_streams: this.value};change_display_setting(data, "#display-settings-status");});- $("#color_scheme").change(function () {+ $("#color_scheme").on("change", function () {const data = {color_scheme: this.value};change_display_setting(data, "#display-settings-status");});@@ -108,16 +108,16 @@ exports.set_up = function () {window.location.reload();});- $("#twenty_four_hour_time").change(function () {+ $("#twenty_four_hour_time").on("change", function () {const data = {twenty_four_hour_time: this.value};change_display_setting(data, "#time-settings-status");});- $("#user_timezone").change(function () {+ $("#user_timezone").on("change", function () {const data = {timezone: JSON.stringify(this.value)};change_display_setting(data, "#time-settings-status");});- $(".emojiset_choice").click(function () {+ $(".emojiset_choice").on("click", function () {const data = {emojiset: JSON.stringify($(this).val())};const current_emojiset = JSON.stringify(page_params.emojiset);if (current_emojiset === data.emojiset) {@@ -140,7 +140,7 @@ exports.set_up = function () {});});- $("#translate_emoticons").change(function () {+ $("#translate_emoticons").on("change", function () {const data = {translate_emoticons: JSON.stringify(this.checked)};change_display_setting(data, "#emoji-settings-status");});diff --git a/static/js/settings_invites.js b/static/js/settings_invites.jsindex 364c6190a21..540ee741b53 100644--- a/static/js/settings_invites.js+++ b/static/js/settings_invites.js@@ -162,7 +162,7 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {);$("#revoke_invite_modal").modal("show");$("#do_revoke_invite_button").unbind("click");- $("#do_revoke_invite_button").click(do_revoke_invite);+ $("#do_revoke_invite_button").on("click", do_revoke_invite);});$(".admin_invites_table").on("click", ".resend", (e) => {@@ -181,7 +181,7 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {$("#resend_invite_modal").modal("show");});- $("#do_resend_invite_button").click(() => {+ $("#do_resend_invite_button").on("click", () => {const modal_invite_id = $("#resend_invite_modal #do_resend_invite_button").attr("data-invite-id",);diff --git a/static/js/settings_notifications.js b/static/js/settings_notifications.jsindex 208f4e0974b..b8d4df73ee3 100644--- a/static/js/settings_notifications.js+++ b/static/js/settings_notifications.js@@ -111,20 +111,20 @@ exports.set_up = function () {update_desktop_icon_count_display();- $("#send_test_notification").click(() => {+ $("#send_test_notification").on("click", () => {notifications.send_test_notification(i18n.t("This is what a Zulip notification looks like."),);});- $("#play_notification_sound").click(() => {+ $("#play_notification_sound").on("click", () => {$("#notifications-area").find("audio")[0].play();});const notification_sound_dropdown = $("#notification_sound");notification_sound_dropdown.val(page_params.notification_sound);- $("#enable_sounds, #enable_stream_audible_notifications").change(() => {+ $("#enable_sounds, #enable_stream_audible_notifications").on("change", () => {if ($("#enable_stream_audible_notifications").prop("checked") ||$("#enable_sounds").prop("checked")diff --git a/static/js/settings_org.js b/static/js/settings_org.jsindex aba0d757b39..ceb8808168f 100644--- a/static/js/settings_org.js+++ b/static/js/settings_org.js@@ -869,7 +869,7 @@ exports.build_page = function () {}});- $("#id_realm_msg_edit_limit_setting").change((e) => {+ $("#id_realm_msg_edit_limit_setting").on("change", (e) => {const msg_edit_limit_dropdown_value = e.target.value;change_element_block_display_property("id_realm_message_content_edit_limit_minutes",@@ -877,7 +877,7 @@ exports.build_page = function () {);});- $("#id_realm_msg_delete_limit_setting").change((e) => {+ $("#id_realm_msg_delete_limit_setting").on("change", (e) => {const msg_delete_limit_dropdown_value = e.target.value;change_element_block_display_property("id_realm_message_content_delete_limit_minutes",@@ -885,7 +885,7 @@ exports.build_page = function () {);});- $("#id_realm_message_retention_setting").change((e) => {+ $("#id_realm_message_retention_setting").on("change", (e) => {const message_retention_setting_dropdown_value = e.target.value;change_element_block_display_property("id_realm_message_retention_days",@@ -893,7 +893,7 @@ exports.build_page = function () {);});- $("#id_realm_waiting_period_setting").change(function () {+ $("#id_realm_waiting_period_setting").on("change", function () {const waiting_period_threshold = this.value;change_element_block_display_property("id_realm_waiting_period_threshold",@@ -901,7 +901,7 @@ exports.build_page = function () {);});- $("#id_realm_org_join_restrictions").change((e) => {+ $("#id_realm_org_join_restrictions").on("change", (e) => {const org_join_restrictions = e.target.value;const node = $("#allowed_domains_label").parent();if (org_join_restrictions === "only_selected_domain") {@@ -914,7 +914,7 @@ exports.build_page = function () {}});- $("#id_realm_org_join_restrictions").click((e) => {+ $("#id_realm_org_join_restrictions").on("click", (e) => {// This prevents the disappearance of modal when there are// no allowed domains otherwise it gets closed due to// the click event handler attached to `#settings_overlay_container`@@ -945,7 +945,7 @@ exports.build_page = function () {});});- $("#submit-add-realm-domain").click(() => {+ $("#submit-add-realm-domain").on("click", () => {const realm_domains_info = $(".realm_domains_info");const widget = $("#add-realm-domain-widget");const domain = widget.find(".new-realm-domain").val();diff --git a/static/js/settings_streams.js b/static/js/settings_streams.jsindex d011a58d2e7..9864c41e783 100644--- a/static/js/settings_streams.js+++ b/static/js/settings_streams.js@@ -99,7 +99,7 @@ exports.build_page = function () {exports.update_default_streams_table();- $(".create_default_stream").keypress((e) => {+ $(".create_default_stream").on("keypress", (e) => {if (e.which === 13) {e.preventDefault();e.stopPropagation();diff --git a/static/js/stats/stats.js b/static/js/stats/stats.jsindex d944fcfb55b..d88d82fd2c5 100644--- a/static/js/stats/stats.js+++ b/static/js/stats/stats.js@@ -319,19 +319,19 @@ function populate_messages_sent_over_time(data) {}// Click handlers for aggregation buttons- $("#daily_button").click(function () {+ $("#daily_button").on("click", function () {draw_or_update_plot(daily_rangeselector, daily_traces, last_day_is_partial, false);$(this).addClass("selected");clicked_cumulative = false;});- $("#weekly_button").click(function () {+ $("#weekly_button").on("click", function () {draw_or_update_plot(weekly_rangeselector, weekly_traces, last_week_is_partial, false);$(this).addClass("selected");clicked_cumulative = false;});- $("#cumulative_button").click(function () {+ $("#cumulative_button").on("click", function () {clicked_cumulative = false;draw_or_update_plot(daily_rangeselector, cumulative_traces, false, false);$(this).addClass("selected");@@ -537,7 +537,7 @@ function populate_messages_sent_by_client(data) {button.addClass("selected");}- $("#pie_messages_sent_by_client button").click(function () {+ $("#pie_messages_sent_by_client button").on("click", function () {if ($(this).attr("data-user")) {set_user_button($(this));user_button = $(this).attr("data-user");@@ -665,7 +665,7 @@ function populate_messages_sent_by_message_type(data) {button.addClass("selected");}- $("#pie_messages_sent_by_type button").click(function () {+ $("#pie_messages_sent_by_type button").on("click", function () {if ($(this).attr("data-user")) {set_user_button($(this));user_button = $(this).attr("data-user");@@ -757,17 +757,17 @@ function populate_number_of_users(data) {add_hover_handler();}- $("#1day_actives_button").click(function () {+ $("#1day_actives_button").on("click", function () {draw_or_update_plot(_1day_trace);$(this).addClass("selected");});- $("#15day_actives_button").click(function () {+ $("#15day_actives_button").on("click", function () {draw_or_update_plot(_15day_trace);$(this).addClass("selected");});- $("#all_time_actives_button").click(function () {+ $("#all_time_actives_button").on("click", function () {draw_or_update_plot(all_time_trace);$(this).addClass("selected");});@@ -983,19 +983,19 @@ function populate_messages_read_over_time(data) {}// Click handlers for aggregation buttons- $("#read_daily_button").click(function () {+ $("#read_daily_button").on("click", function () {draw_or_update_plot(daily_rangeselector, daily_traces, last_day_is_partial, false);$(this).addClass("selected");clicked_cumulative = false;});- $("#read_weekly_button").click(function () {+ $("#read_weekly_button").on("click", function () {draw_or_update_plot(weekly_rangeselector, weekly_traces, last_week_is_partial, false);$(this).addClass("selected");clicked_cumulative = false;});- $("#read_cumulative_button").click(function () {+ $("#read_cumulative_button").on("click", function () {clicked_cumulative = false;draw_or_update_plot(daily_rangeselector, cumulative_traces, false, false);$(this).addClass("selected");diff --git a/static/js/stream_list.js b/static/js/stream_list.jsindex b2a88499307..52cf435b234 100644--- a/static/js/stream_list.js+++ b/static/js/stream_list.js@@ -496,7 +496,7 @@ exports.set_event_handlers = function () {$("#streams_header").expectOne()- .click((e) => {+ .on("click", (e) => {exports.toggle_filter_displayed(e);});diff --git a/static/js/stream_popover.js b/static/js/stream_popover.jsindex d35bca3ca32..b2fe4cffdb1 100644--- a/static/js/stream_popover.js+++ b/static/js/stream_popover.js@@ -286,7 +286,7 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) {".stream_header_colorblock",);ui_util.decorate_stream_bar(current_stream_name, stream_header_colorblock, false);- $("#select_stream_id").change(function () {+ $("#select_stream_id").on("change", function () {const stream_name = stream_data.maybe_get_stream_name(parseInt(this.value, 10));ui_util.decorate_stream_bar(stream_name, stream_header_colorblock, false);});diff --git a/static/js/ui.js b/static/js/ui.jsindex 590c8f5afe2..b47ab538c4d 100644--- a/static/js/ui.js+++ b/static/js/ui.js@@ -194,7 +194,7 @@ exports.maybe_show_deprecation_notice = function (key) {let saved_compose_cursor = 0;exports.set_compose_textarea_handlers = function () {- $("#compose-textarea").blur(function () {+ $("#compose-textarea").on("blur", function () {saved_compose_cursor = $(this).caret();});diff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex a049b054042..9b4593c48bd 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -92,7 +92,7 @@ exports.initialize_kitchen_sink_stuff = function () {// preventDefault, allowing the modal to scroll normally.});- $(window).resize(_.throttle(resize.handler, 50));+ $(window).on("resize", _.throttle(resize.handler, 50));// Scrolling in overlays. input boxes, and other elements that// explicitly scroll should not scroll the main view. Stop