PageSourceSearch

https://nationaltrailraceway.com/core/misc/dialog/dialog.ajax.js?v=8.9.11

js nationaltrailraceway.com collected 2026-10-02 05:51:43 UTC 4,504 bytes, 141 lines download raw bytes

1/**
2* DO NOT EDIT THIS FILE.
3* See the following change record for more information,
4* https://www.drupal.org/node/2815083
5* @preserve
6**/
7
8(function ($, Drupal) {
9  Drupal.behaviors.dialog = {
10    attach: function attach(context, settings) {
11      var $context = $(context);
12
13      if (!$('#drupal-modal').length) {
14        $('<div id="drupal-modal" class="ui-front"></div>').hide().appendTo('body');
15      }
16
17      var $dialog = $context.closest('.ui-dialog-content');
18      if ($dialog.length) {
19        if ($dialog.dialog('option', 'drupalAutoButtons')) {
20          $dialog.trigger('dialogButtonsChange');
21        }
22
23        $dialog.dialog('widget').trigger('focus');
24      }
25
26      var originalClose = settings.dialog.close;
27
28      settings.dialog.close = function (event) {
29        for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
30          args[_key - 1] = arguments[_key];
31        }
32
33        originalClose.apply(settings.dialog, [event].concat(args));
34        $(event.target).remove();
35      };
36    },
37    prepareDialogButtons: function prepareDialogButtons($dialog) {
38      var buttons = [];
39      var $buttons = $dialog.find('.form-actions input[type=submit], .form-actions a.button');
40      $buttons.each(function () {
41        var $originalButton = $(this).css({ display: 'none' });
42        buttons.push({
43          text: $originalButton.html() || $originalButton.attr('value'),
44          class: $originalButton.attr('class'),
45          click: function click(e) {
46            if ($originalButton.is('a')) {
47              $originalButton[0].click();
48            } else {
49              $originalButton.trigger('mousedown').trigger('mouseup').trigger('click');
50              e.preventDefault();
51            }
52          }
53        });
54      });
55      return buttons;
56    }
57  };
58
59  Drupal.AjaxCommands.prototype.openDialog = function (ajax, response, status) {
60    if (!response.selector) {
61      return false;
62    }
63    var $dialog = $(response.selector);
64    if (!$dialog.length) {
65      $dialog = $('<div id="' + response.selector.replace(/^#/, '') + '" class="ui-front"></div>').appendTo('body');
66    }
67
68    if (!ajax.wrapper) {
69      ajax.wrapper = $dialog.attr('id');
70    }
71
72    response.command = 'insert';
73    response.method = 'html';
74    ajax.commands.insert(ajax, response, status);
75
76    // Move the buttons to the jQuery UI dialog buttons area.
77    response.dialogOptions = response.dialogOptions || {};
78    if (typeof response.dialogOptions.drupalAutoButtons === 'undefined') {
79      response.dialogOptions.drupalAutoButtons = true;
80    } else if (response.dialogOptions.drupalAutoButtons === 'false') {
81      response.dialogOptions.drupalAutoButtons = false;
82    } else {
83      response.dialogOptions.drupalAutoButtons =
84        !!response.dialogOptions.drupalAutoButtons;
85    }
86    if (
87      !response.dialogOptions.buttons &&
88      response.dialogOptions.drupalAutoButtons
89    ) {
90      response.dialogOptions.buttons = Drupal.behaviors.dialog.prepareDialogButtons(
91        $dialog,
92      );
93    }
94
95    $dialog.on('dialogButtonsChange', function () {
96      var buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog);
97      $dialog.dialog('option', 'buttons', buttons);
98    });
99
100    response.dialogOptions = response.dialogOptions || {};
101    var dialog = Drupal.dialog($dialog.get(0), response.dialogOptions);
102    if (response.dialogOptions.modal) {
103      dialog.showModal();
104    } else {
105      dialog.show();
106    }
107
108    $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions');
109  };
110
111  Drupal.AjaxCommands.prototype.closeDialog = function (ajax, response, status) {
112    var $dialog = $(response.selector);
113    if ($dialog.length) {
114      Drupal.dialog($dialog.get(0)).close();
115      if (!response.persist) {
116        $dialog.remove();
117      }
118    }
119
120    $dialog.off('dialogButtonsChange');
121  };
122
123  Drupal.AjaxCommands.prototype.setDialogOption = function (ajax, response, status) {
124    var $dialog = $(response.selector);
125    if ($dialog.length) {
126      $dialog.dialog('option', response.optionName, response.optionValue);
127    }
128  };
129
130  $(window).on('dialog:aftercreate', function (e, dialog, $element, settings) {
131    $element.on('click.dialog', '.dialog-cancel', function (e) {
132      dialog.close('cancel');
133      e.preventDefault();
134      e.stopPropagation();
135    });
136  });
137
138  $(window).on('dialog:beforeclose', function (e, dialog, $element) {
139    $element.off('.dialog');
140  });
141})(jQuery, Drupal);

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.