From 1cbceeec872172dff1d9c8299f6efc76571977d2 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Wed, 3 Oct 2012 18:04:58 -0400 Subject: [PATCH] Fix more problems uncovered by lint (imported from commit 7fb8432f362f22770334e6bd1161a61b0bc0e528) --- zephyr/static/js/compose.js | 33 ++++++++++++++++----------------- zephyr/static/js/hotkey.js | 22 +++++++++++----------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 4741565a50..f7b6e3f88a 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -4,6 +4,18 @@ var status_classes = 'alert-error alert-success alert-info'; +function show_compose(tabname, focus_area) { + $('.zephyr_compose').slideDown(100); + $('#zephyr-type-tabs a[href="#' + tabname + '-message"]').tab('show'); + focus_area.focus(); + focus_area.select(); +} + +function hide_compose() { + $('input, textarea, button').blur(); + $('.zephyr_compose').slideUp(100); +} + function clear_compose_box() { $("#zephyr_compose").find('input[type=text], textarea').val(''); } @@ -14,18 +26,6 @@ function compose_button() { show_compose('class', $("#class")); } -function hide_compose() { - $('input, textarea, button').blur(); - $('.zephyr_compose').slideUp(100); -} - -function show_compose(tabname, focus_area) { - $('.zephyr_compose').slideDown(100); - $('#zephyr-type-tabs a[href="#' + tabname + '-message"]').tab('show'); - focus_area.focus(); - focus_area.select(); -} - function toggle_compose() { if ($("#zephyr-type-tabs li.active").find("a[href=#class-message]").length !== 0) { // In class tab, switch to personals. @@ -87,8 +87,7 @@ function check_class_for_send(class_name) { if (data === "False") { // The class doesn't exist okay = false; - send_status.removeClass(status_classes); - send_status.show(); + $('#send-status').removeClass(status_classes).show(); $('#class-dne-name').text(class_name); $('#class-dne').show(); $('#create-it').focus(); @@ -124,13 +123,13 @@ function validate_class_message() { return false; } - if (!check_class_for_send(zephyr_class)) + if (!check_class_for_send(class_name)) return false; - if (class_list.indexOf(zephyr_class.toLowerCase()) === -1) { + if (class_list.indexOf(class_name.toLowerCase()) === -1) { // You're not subbed to the class $('#send-status').removeClass(status_classes).show(); - $('#class-nosub-name').text(zephyr_class); + $('#class-nosub-name').text(class_name); $('#class-nosub').show(); $('#sub-it').focus(); submit_buttons().removeAttr('disabled'); diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index a533b8f31c..19254de703 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -2,6 +2,17 @@ plusplus: true, white: true, undef: true */ /*global $: false */ +var pressed_keys = {}; + +function num_pressed_keys() { + var size = 0, key; + for (key in pressed_keys) { + if (pressed_keys.hasOwnProperty(key)) + size++; + } + return size; +} + var directional_hotkeys = { 40: get_next_visible, // down arrow 74: get_next_visible, // 'j' @@ -106,17 +117,6 @@ function process_compose_hotkey(code) { } } -var pressed_keys = {}; - -function num_pressed_keys() { - var size = 0, key; - for (key in pressed_keys) { - if (pressed_keys.hasOwnProperty(key)) - size++; - } - return size; -} - $(document).keydown(function (e) { pressed_keys[e.which] = true; });