diff --git a/core/modules/file/file.js b/core/modules/file/file.js index 8f0c9db..640aec8 100644 --- a/core/modules/file/file.js +++ b/core/modules/file/file.js @@ -68,12 +68,12 @@ attach: function (context) { var $context = $(context); $context.find('.js-form-submit').on('mousedown', Drupal.file.disableFields); - $context.find('.form-managed-file .js-form-submit').on('mousedown', Drupal.file.progressBar); + $context.find('.js-form-managed-file .form-submit').on('mousedown', Drupal.file.progressBar); }, detach: function (context) { var $context = $(context); $context.find('.js-form-submit').off('mousedown', Drupal.file.disableFields); - $context.find('.form-managed-file .js-form-submit').off('mousedown', Drupal.file.progressBar); + $context.find('.js-form-managed-file .js-form-submit').off('mousedown', Drupal.file.progressBar); } }; @@ -82,10 +82,10 @@ */ Drupal.behaviors.filePreviewLinks = { attach: function (context) { - $(context).find('div.form-managed-file .file a, .file-widget .file a').on('click', Drupal.file.openInNewWindow); + $(context).find('div.js-form-managed-file .file a, .file-widget .file a').on('click', Drupal.file.openInNewWindow); }, detach: function (context) { - $(context).find('div.form-managed-file .file a, .file-widget .file a').off('click', Drupal.file.openInNewWindow); + $(context).find('div.js-form-managed-file .file a, .file-widget .file a').off('click', Drupal.file.openInNewWindow); } }; @@ -117,7 +117,7 @@ '%filename': this.value.replace('C:\\fakepath\\', ''), '%extensions': extensionPattern.replace(/\|/g, ', ') }); - $(this).closest('div.form-managed-file').prepend('
' + error + '
'); + $(this).closest('div.js-form-managed-file').prepend('
' + error + '
'); this.value = ''; // Cancel all other change event handlers. event.stopImmediatePropagation(); @@ -128,7 +128,7 @@ * Trigger the upload_button mouse event to auto-upload as a managed file. */ triggerUploadButton: function (event) { - $(event.target).closest('.form-managed-file').find('.js-form-submit').trigger('mousedown'); + $(event.target).closest('.js-form-managed-file').find('.js-form-submit').trigger('mousedown'); }, /** * Prevent file uploads when using buttons not intended to upload. @@ -143,8 +143,8 @@ // Check if we're working with an "Upload" button. var $enabledFields = []; - if ($clickedButton.closest('div.form-managed-file').length > 0) { - $enabledFields = $clickedButton.closest('div.form-managed-file').find('input.form-file'); + if ($clickedButton.closest('div.js-form-managed-file').length > 0) { + $enabledFields = $clickedButton.closest('div.js-form-managed-file').find('input.js-form-file'); } // Temporarily disable upload fields other than the one we're currently @@ -155,7 +155,7 @@ // behaviors) are executed before any timeout functions are called, so we // don't have to worry about the fields being re-enabled too soon. // @todo If the previous sentence is true, why not set the timeout to 0? - var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled'); + var $fieldsToTemporarilyDisable = $('div.js-form-managed-file input.js-form-file').not($enabledFields).not(':disabled'); $fieldsToTemporarilyDisable.prop('disabled', true); setTimeout(function () { $fieldsToTemporarilyDisable.prop('disabled', false); @@ -166,7 +166,7 @@ */ progressBar: function (event) { var $clickedButton = $(this); - var $progressId = $clickedButton.closest('div.form-managed-file').find('input.file-progress'); + var $progressId = $clickedButton.closest('div.js-form-managed-file').find('input.file-progress'); if ($progressId.length) { var originalName = $progressId.attr('name'); @@ -180,7 +180,7 @@ } // 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.js-form-managed-file').find('div.ajax-progress-bar').slideDown(); }, 500); }, /**