eslint: Fix unicorn/prefer-add-event-listener.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-07 02:47:20 -07:00
committed by Tim Abbott
parent 2694f5caed
commit e0b1daa96d
4 changed files with 20 additions and 10 deletions

View File

@@ -109,6 +109,13 @@ exports.show_license_section = function (license) {
$(input_id).prop("disabled", false);
};
let current_page;
function handle_hashchange() {
$("#" + current_page + '-tabs.nav a[href="' + location.hash + '"]').tab("show");
$("html").scrollTop(0);
}
exports.set_tab = function (page) {
const hash = location.hash;
if (hash) {
@@ -120,10 +127,8 @@ exports.set_tab = function (page) {
location.hash = this.hash;
});
window.onhashchange = function () {
$("#" + page + '-tabs.nav a[href="' + location.hash + '"]').tab("show");
$("html").scrollTop(0);
};
current_page = page;
window.addEventListener("hashchange", handle_hashchange);
};
exports.is_valid_input = function (elem) {