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(function ($, Drupal) { 8 Drupal.behaviors.dialog = { 9 attach: function attach(context, settings) { 10 var $context = $(context); 11 if (!$('#drupal-modal').length) { 12 $('<div id="drupal-modal" class="ui-front"></div>').hide().appendTo('body'); 13 } 14 var $dialog = $context.closest('.ui-dialog-content'); 15 if ($dialog.length) { 16 if ($dialog.dialog('option', 'drupalAutoButtons')) { 17 $dialog.trigger('dialogButtonsChange'); 18 } 19 $dialog.dialog('widget').trigger('focus'); 20 } 21 var originalClose = settings.dialog.close; 22 settings.dialog.close = function (event) { 23 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 24 args[_key - 1] = arguments[_key]; 25 } 26 originalClose.apply(settings.dialog, [event].concat(args)); 27 $(event.target).remove(); 28 }; 29 }, 30 prepareDialogButtons: function prepareDialogButtons($dialog) { 31 var buttons = []; 32 var $buttons = $dialog.find('.form-actions input[type=submit], .form-actions a.button'); 33 $buttons.each(function () { 34 var $originalButton = $(this).css({ 35 display: 'none' 36 }); 37 buttons.push({ 38 text: $originalButton.html() || $originalButton.attr('value'), 39 class: $originalButton.attr('class'), 40 click: function click(e) { 41 if ($originalButton.is('a')) { 42 $originalButton[0].click(); 43 } else { 44 $originalButton.trigger('mousedown').trigger('mouseup').trigger('click'); 45 e.preventDefault(); 46 } 47 } 48 }); 49 }); 50 return buttons; 51 } 52 }; 53 Drupal.AjaxCommands.prototype.openDialog = function (ajax, response, status) { 54 if (!response.selector) { 55 return false; 56 } 57 var $dialog = $(response.selector); 58 if (!$dialog.length) { 59 $dialog = $("<div id=\"".concat(response.selector.replace(/^#/, ''), "\" class=\"ui-front\"></div>")).appendTo('body'); 60 } 61 if (!ajax.wrapper) { 62 ajax.wrapper = $dialog.attr('id'); 63 } 64 response.command = 'insert'; 65 response.method = 'html'; 66 ajax.commands.insert(ajax, response, status); 67 if (!response.dialogOptions.buttons) { 68 response.dialogOptions.drupalAutoButtons = true; 69 response.dialogOptions.buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog); 70 } 71 $dialog.on('dialogButtonsChange', function () { 72 var buttons = Drupal.behaviors.dialog.prepareDialogButtons($dialog); 73 $dialog.dialog('option', 'buttons', buttons); 74 }); 75 response.dialogOptions = response.dialogOptions || {}; 76 var dialog = Drupal.dialog($dialog.get(0), response.dialogOptions); 77 if (response.dialogOptions.modal) { 78 dialog.showModal(); 79 } else { 80 dialog.show(); 81 } 82 $dialog.parent().find('.ui-dialog-buttonset').addClass('form-actions'); 83 }; 84 Drupal.AjaxCommands.prototype.closeDialog = function (ajax, response, status) { 85 var $dialog = $(response.selector); 86 if ($dialog.length) { 87 Drupal.dialog($dialog.get(0)).close(); 88 if (!response.persist) { 89 $dialog.remove(); 90 } 91 } 92 $dialog.off('dialogButtonsChange'); 93 }; 94 Drupal.AjaxCommands.prototype.setDialogOption = function (ajax, response, status) { 95 var $dialog = $(response.selector); 96 if ($dialog.length) { 97 $dialog.dialog('option', response.optionName, response.optionValue); 98 } 99 }; 100 $(window).on('dialog:aftercreate', function (e, dialog, $element, settings) { 101 $element.on('click.dialog', '.dialog-cancel', function (e) { 102 dialog.close('cancel'); 103 e.preventDefault(); 104 e.stopPropagation(); 105 }); 106 }); 107 $(window).on('dialog:beforeclose', function (e, dialog, $element) { 108 $element.off('.dialog'); 109 }); 110})(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.