mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Clean up jQuery selectors for the composebox send button.
(imported from commit 6bf7ee00f23290ae5e254b4964db3ed51527368b)
This commit is contained in:
@@ -53,7 +53,6 @@ var send_options;
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var send_status = $('#send-status');
|
var send_status = $('#send-status');
|
||||||
var buttons = $('#compose').find('input[type="submit"]');
|
|
||||||
|
|
||||||
send_options = {
|
send_options = {
|
||||||
dataType: 'json', // This seems to be ignored. We still get back an xhr.
|
dataType: 'json', // This seems to be ignored. We still get back an xhr.
|
||||||
@@ -61,7 +60,7 @@ $(function () {
|
|||||||
form.find('textarea').val('');
|
form.find('textarea').val('');
|
||||||
send_status.hide();
|
send_status.hide();
|
||||||
compose.hide();
|
compose.hide();
|
||||||
buttons.removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
},
|
},
|
||||||
error: function (xhr, error_type) {
|
error: function (xhr, error_type) {
|
||||||
if (error_type !== 'timeout' && get_updates_params.reload_pending) {
|
if (error_type !== 'timeout' && get_updates_params.reload_pending) {
|
||||||
@@ -83,7 +82,7 @@ $(function () {
|
|||||||
.click(function () { send_status.stop(true).fadeOut(500); }))
|
.click(function () { send_status.stop(true).fadeOut(500); }))
|
||||||
.stop(true).fadeTo(0,1);
|
.stop(true).fadeTo(0,1);
|
||||||
|
|
||||||
buttons.removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -197,14 +196,10 @@ function compose_error(error_text, bad_input) {
|
|||||||
.addClass('alert-error')
|
.addClass('alert-error')
|
||||||
.text(error_text)
|
.text(error_text)
|
||||||
.stop(true).fadeTo(0, 1);
|
.stop(true).fadeTo(0, 1);
|
||||||
$('#compose').find('input[type="submit"]').removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
bad_input.focus().select();
|
bad_input.focus().select();
|
||||||
}
|
}
|
||||||
|
|
||||||
function submit_buttons() {
|
|
||||||
return $('#compose').find('input[type="submit"]');
|
|
||||||
}
|
|
||||||
|
|
||||||
// *Synchronously* check if a stream exists.
|
// *Synchronously* check if a stream exists.
|
||||||
// If not, displays an error and returns false.
|
// If not, displays an error and returns false.
|
||||||
function check_stream_for_send(stream_name) {
|
function check_stream_for_send(stream_name) {
|
||||||
@@ -221,7 +216,7 @@ function check_stream_for_send(stream_name) {
|
|||||||
$('#send-status').removeClass(status_classes).show();
|
$('#send-status').removeClass(status_classes).show();
|
||||||
$('#stream-dne-name').text(stream_name);
|
$('#stream-dne-name').text(stream_name);
|
||||||
$('#stream-dne').show();
|
$('#stream-dne').show();
|
||||||
submit_buttons().removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
exports.hide();
|
exports.hide();
|
||||||
$('#create-it').focus();
|
$('#create-it').focus();
|
||||||
}
|
}
|
||||||
@@ -231,7 +226,7 @@ function check_stream_for_send(stream_name) {
|
|||||||
okay = false;
|
okay = false;
|
||||||
report_error("Error checking subscription", xhr, $("#home-error"));
|
report_error("Error checking subscription", xhr, $("#home-error"));
|
||||||
$("#stream").focus();
|
$("#stream").focus();
|
||||||
submit_buttons().removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return okay;
|
return okay;
|
||||||
@@ -262,7 +257,7 @@ function validate_stream_message() {
|
|||||||
$('#send-status').removeClass(status_classes).show();
|
$('#send-status').removeClass(status_classes).show();
|
||||||
$('#stream-nosub-name').text(stream_name);
|
$('#stream-nosub-name').text(stream_name);
|
||||||
$('#stream-nosub').show();
|
$('#stream-nosub').show();
|
||||||
submit_buttons().removeAttr('disabled');
|
$("#compose-send-button").removeAttr('disabled');
|
||||||
exports.hide();
|
exports.hide();
|
||||||
$('#sub-it').focus();
|
$('#sub-it').focus();
|
||||||
return false;
|
return false;
|
||||||
@@ -286,7 +281,7 @@ function validate_huddle_message() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exports.validate = function () {
|
exports.validate = function () {
|
||||||
submit_buttons().attr('disabled', 'disabled').blur();
|
$("#compose-send-button").attr('disabled', 'disabled').blur();
|
||||||
|
|
||||||
if (exports.composing() === 'huddle') {
|
if (exports.composing() === 'huddle') {
|
||||||
return validate_huddle_message();
|
return validate_huddle_message();
|
||||||
|
|||||||
Reference in New Issue
Block a user