PageSourceSearch

https://www.ncmuseumofhistory.org/modules/contrib/webform/js/webform.drupal.dialog.js?v=10.6.15

js ncmuseumofhistory.org collected 2026-10-01 10:43:43 UTC 1,743 bytes, 56 lines download raw bytes

1/**
2 * @file
3 * JavaScript behaviors to fix jQuery UI dialogs.
4 */
5
6(function ($, Drupal, once) {
7
8  'use strict';
9
10  /**
11   * Ensure that ckeditor has focus when displayed inside of jquery-ui dialog widget
12   *
13   * @see http://stackoverflow.com/questions/20533487/how-to-ensure-that-ckeditor-has-focus-when-displayed-inside-of-jquery-ui-dialog
14   */
15  if ($.ui && $.ui.dialog && $.ui.dialog.prototype._allowInteraction) {
16    var _allowInteraction = $.ui.dialog.prototype._allowInteraction;
17    $.ui.dialog.prototype._allowInteraction = function (event) {
18      if ($(event.target).closest('.cke_dialog').length) {
19        return true;
20      }
21      return _allowInteraction.apply(this, arguments);
22    };
23  }
24
25  /**
26   * Attaches webform dialog behaviors.
27   *
28   * @type {Drupal~behavior}
29   *
30   * @prop {Drupal~behaviorAttach} attach
31   *   Attaches event listeners for webform dialogs.
32   */
33  Drupal.behaviors.webformDialogEvents = {
34    attach: function () {
35      if (once('webform-dialog', 'html').length) {
36        $(window).on({
37          'dialog:aftercreate': function (event, dialog, $element, settings) {
38            setTimeout(function () {
39              var hasFocus = $element.find('[autofocus]:tabbable');
40              if (!hasFocus.length) {
41                // Move focus to first input which is not a button.
42                hasFocus = $element.find(':input:tabbable:not(:button)');
43              }
44              if (!hasFocus.length) {
45                // Move focus to close dialog button.
46                hasFocus = $element.parent().find('.ui-dialog-titlebar-close');
47              }
48              hasFocus.eq(0).trigger('focus');
49            });
50          }
51        });
52      }
53    }
54  };
55
56})(jQuery, Drupal, once);

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.