summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-01-25 02:38:50 (GMT)
committerwebchick2014-01-25 02:38:50 (GMT)
commit57934b6e36bf5d79fd52ddb30dea12ce66bee5d9 (patch)
tree4ba580a6efb0d51dcbbb15c20b76012ceea5e974
parent498c96cac7c13b26a51f060c68b4fa24cc5110a0 (diff)
Issue #1751382 by droplet, Jelle_S: Selectors clean-up: file module.
-rw-r--r--core/modules/file/file.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/modules/file/file.js b/core/modules/file/file.js
index c7c6362..89f46c1 100644
--- a/core/modules/file/file.js
+++ b/core/modules/file/file.js
@@ -63,13 +63,13 @@ Drupal.behaviors.fileAutoUpload = {
Drupal.behaviors.fileButtons = {
attach: function (context) {
var $context = $(context);
- $context.find('input.form-submit').on('mousedown', Drupal.file.disableFields);
- $context.find('div.form-managed-file input.form-submit').on('mousedown', Drupal.file.progressBar);
+ $context.find('.form-submit').on('mousedown', Drupal.file.disableFields);
+ $context.find('.form-managed-file .form-submit').on('mousedown', Drupal.file.progressBar);
},
detach: function (context) {
var $context = $(context);
- $context.find('input.form-submit').off('mousedown', Drupal.file.disableFields);
- $context.find('div.form-managed-file input.form-submit').off('mousedown', Drupal.file.progressBar);
+ $context.find('.form-submit').off('mousedown', Drupal.file.disableFields);
+ $context.find('.form-managed-file .form-submit').off('mousedown', Drupal.file.progressBar);
}
};
@@ -128,17 +128,17 @@ Drupal.file = Drupal.file || {
* Prevent file uploads when using buttons not intended to upload.
*/
disableFields: function (event){
- var clickedButton = this;
+ var $clickedButton = $(this);
// Only disable upload fields for Ajax buttons.
- if (!$(clickedButton).hasClass('ajax-processed')) {
+ if (!$clickedButton.hasClass('ajax-processed')) {
return;
}
// Check if we're working with an "Upload" button.
var $enabledFields = [];
- if ($(this).closest('div.form-managed-file').length > 0) {
- $enabledFields = $(this).closest('div.form-managed-file').find('input.form-file');
+ if ($clickedButton.closest('div.form-managed-file').length > 0) {
+ $enabledFields = $clickedButton.closest('div.form-managed-file').find('input.form-file');
}
// Temporarily disable upload fields other than the one we're currently
@@ -159,8 +159,8 @@ Drupal.file = Drupal.file || {
* Add progress bar support if possible.
*/
progressBar: function (event) {
- var clickedButton = this;
- var $progressId = $(clickedButton).closest('div.form-managed-file').find('input.file-progress');
+ var $clickedButton = $(this);
+ var $progressId = $clickedButton.closest('div.form-managed-file').find('input.file-progress');
if ($progressId.length) {
var originalName = $progressId.attr('name');
@@ -174,7 +174,7 @@ Drupal.file = Drupal.file || {
}
// Show the progress bar if the upload takes longer than half a second.
setTimeout(function () {
- $(clickedButton).closest('div.form-managed-file').find('div.ajax-progress-bar').slideDown();
+ $clickedButton.closest('div.form-managed-file').find('div.ajax-progress-bar').slideDown();
}, 500);
},
/**