upload: Extract feature_check helper function.

This commit is contained in:
Tim Abbott
2018-02-13 14:26:19 -08:00
parent 8836161611
commit 6638c12aef
2 changed files with 8 additions and 5 deletions

View File

@@ -741,11 +741,7 @@ exports.initialize = function () {
resize.watch_manual_resize("#compose-textarea");
// Run a feature test and decide whether to display
// the "Attach files" button
if (window.XMLHttpRequest && (new XMLHttpRequest()).upload) {
$("#compose #attach_files").removeClass("notdisplayed");
}
upload.feature_check($("#compose #attach_files"));
// Lazy load the Dropbox script, since it can slow our page load
// otherwise, and isn't enabled for all users. Also, this Dropbox

View File

@@ -21,6 +21,13 @@ function clear_out_file_list(jq_file_list) {
// $("#file_input").val("");
}
// Show the upload button only if the browser supports it.
exports.feature_check = function (upload_button) {
if (window.XMLHttpRequest && (new XMLHttpRequest()).upload) {
upload_button.removeClass("notdisplayed");
}
};
exports.options = function (config) {
var textarea;
var send_button;