Fix more problems uncovered by lint

(imported from commit 7fb8432f362f22770334e6bd1161a61b0bc0e528)
This commit is contained in:
Keegan McAllister 2012-10-03 18:04:58 -04:00
parent 9c6bf90fad
commit 1cbceeec87
2 changed files with 27 additions and 28 deletions

View File

@ -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');

View File

@ -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;
});