PageSourceSearch

https://www.medef.nc/sites/all/modules/custom/lfk_webform_ajax_patch/script.js?tiakjg

js medef.nc collected 2026-10-02 13:45:54 UTC 1,612 bytes, 36 lines download raw bytes

1(function($) {
2
3  // Overwrite Drupal.file.disableFields from file module to
4  // allow file fields being submitted when submitting through
5  // ajax.
6  Drupal.file.disableFields = function(event) {
7    var clickedButton = this;
8
9    // Do not disable fields for non-ajax buttons and the
10    // webform ajax submit button.
11    if (!$(clickedButton).hasClass('ajax-processed') || $(clickedButton).hasClass('webform-ajax-submit')) {
12      return;
13    }
14
15    // Check if we're working with an "Upload" button.
16    var $enabledFields = [];
17    if ($(this).closest('div.form-managed-file').length > 0) {
18      $enabledFields = $(this).closest('div.form-managed-file').find('input.form-file');
19    }
20
21    // Temporarily disable upload fields other than the one we're currently
22    // working with. Filter out fields that are already disabled so that they
23    // do not get enabled when we re-enable these fields at the end of behavior
24    // processing. Re-enable in a setTimeout set to a relatively short amount
25    // of time (1 second). All the other mousedown handlers (like Drupal's Ajax
26    // behaviors) are excuted before any timeout functions are called, so we
27    // don't have to worry about the fields being re-enabled too soon.
28    // @todo If the previous sentence is true, why not set the timeout to 0?
29    var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled');
30    $fieldsToTemporarilyDisable.attr('disabled', 'disabled');
31    setTimeout(function() {
32      $fieldsToTemporarilyDisable.attr('disabled', false);
33    }, 1000);
34  }
35
36}(jQuery));  

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.