PageSourceSearch

https://viavuca.com/core/misc/dialog/dialog.ajax.js?v=8.8.5

js viavuca.com collected 2026-10-02 23:49:12 UTC 3,971 bytes, 127 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"/>').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"/>').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    if (!response.dialogOptions.buttons) {
77      response.dialogOptions.drupalAutoButtons = true;
78      response.dialogOptions.buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog);
79    }
80
81    $dialog.on('dialogButtonsChange', function () {
82      var buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog);
83      $dialog.dialog('option', 'buttons', buttons);
84    });
85
86    response.dialogOptions = response.dialogOptions || {};
87    var dialog = Drupal.dialog($dialog.get(0), response.dialogOptions);
88    if (response.dialogOptions.modal) {
89      dialog.showModal();
90    } else {
91      dialog.show();
92    }
93
94    $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions');
95  };
96
97  Drupal.AjaxCommands.prototype.closeDialog = function (ajax, response, status) {
98    var $dialog = $(response.selector);
99    if ($dialog.length) {
100      Drupal.dialog($dialog.get(0)).close();
101      if (!response.persist) {
102        $dialog.remove();
103      }
104    }
105
106    $dialog.off('dialogButtonsChange');
107  };
108
109  Drupal.AjaxCommands.prototype.setDialogOption = function (ajax, response, status) {
110    var $dialog = $(response.selector);
111    if ($dialog.length) {
112      $dialog.dialog('option', response.optionName, response.optionValue);
113    }
114  };
115
116  $(window).on('dialog:aftercreate', function (e, dialog, $element, settings) {
117    $element.on('click.dialog', '.dialog-cancel', function (e) {
118      dialog.close('cancel');
119      e.preventDefault();
120      e.stopPropagation();
121    });
122  });
123
124  $(window).on('dialog:beforeclose', function (e, dialog, $element) {
125    $element.off('.dialog');
126  });
127})(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.