1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
drupalSettings.dialog = {
autoOpen: true,
dialogClass: '',
buttonClass: 'button',
buttonPrimaryClass: 'button--primary',
close: function close(event) {
Drupal.dialog(event.target).close();
Drupal.detachBehaviors(event.target, null, 'unload');
}
};
Drupal.dialog = function (element, options) {
var undef;
var $element = $(element);
var dialog = {
open: false,
returnValue: undef
};
function openDialog(settings) {
settings = $.extend({}, drupalSettings.dialog, options, settings);
$(window).trigger('dialog:beforecreate', [dialog, $element, settings]);
$element.dialog(settings);
dialog.open = true;
$(window).trigger('dialog:aftercreate', [dialog, $element, settings]);
}
function closeDialog(value) {
$(window).trigger('dialog:beforeclose', [dialog, $element]);
$element.dialog('close');
dialog.returnValue = value;
dialog.open = false;
$(window).trigger('dialog:afterclose', [dialog, $element]);
}
dialog.show = function () {
openDialog({
modal: false
});
};
dialog.showModal = function () {
openDialog({
modal: true
});
};
dialog.close = closeDialog;
return dialog;
};
})(jQuery, Drupal, drupalSettings);
|