PageSourceSearch

https://www.hcomo.it/core/misc/dialog/dialog.position.js?v=9.4.8

js hcomo.it collected 2026-10-08 15:03:38 UTC 2,884 bytes, 82 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, drupalSettings, debounce, displace) {
9  drupalSettings.dialog = $.extend({
10    autoResize: true,
11    maxHeight: '95%'
12  }, drupalSettings.dialog);
13
14  function resetPosition(options) {
15    var offsets = displace.offsets;
16    var left = offsets.left - offsets.right;
17    var top = offsets.top - offsets.bottom;
18    var leftString = "".concat((left > 0 ? '+' : '-') + Math.abs(Math.round(left / 2)), "px");
19    var topString = "".concat((top > 0 ? '+' : '-') + Math.abs(Math.round(top / 2)), "px");
20    options.position = {
21      my: "center".concat(left !== 0 ? leftString : '', " center").concat(top !== 0 ? topString : ''),
22      of: window
23    };
24    return options;
25  }
26
27  function resetSize(event) {
28    var positionOptions = ['width', 'height', 'minWidth', 'minHeight', 'maxHeight', 'maxWidth', 'position'];
29    var adjustedOptions = {};
30    var windowHeight = $(window).height();
31    var option;
32    var optionValue;
33    var adjustedValue;
34
35    for (var n = 0; n < positionOptions.length; n++) {
36      option = positionOptions[n];
37      optionValue = event.data.settings[option];
38
39      if (optionValue) {
40        if (typeof optionValue === 'string' && /%$/.test(optionValue) && /height/i.test(option)) {
41          windowHeight -= displace.offsets.top + displace.offsets.bottom;
42          adjustedValue = parseInt(0.01 * parseInt(optionValue, 10) * windowHeight, 10);
43
44          if (option === 'height' && event.data.$element.parent().outerHeight() < adjustedValue) {
45            adjustedValue = 'auto';
46          }
47
48          adjustedOptions[option] = adjustedValue;
49        }
50      }
51    }
52
53    if (!event.data.settings.modal) {
54      adjustedOptions = resetPosition(adjustedOptions);
55    }
56
57    event.data.$element.dialog('option', adjustedOptions).trigger('dialogContentResize');
58  }
59
60  $(window).on({
61    'dialog:aftercreate': function dialogAftercreate(event, dialog, $element, settings) {
62      var autoResize = debounce(resetSize, 20);
63      var eventData = {
64        settings: settings,
65        $element: $element
66      };
67
68      if (settings.autoResize === true || settings.autoResize === 'true') {
69        $element.dialog('option', {
70          resizable: false,
71          draggable: false
72        }).dialog('widget').css('position', 'fixed');
73        $(window).on('resize.dialogResize scroll.dialogResize', eventData, autoResize).trigger('resize.dialogResize');
74        $(document).on('drupalViewportOffsetChange.dialogResize', eventData, autoResize);
75      }
76    },
77    'dialog:beforeclose': function dialogBeforeclose(event, dialog, $element) {
78      $(window).off('.dialogResize');
79      $(document).off('.dialogResize');
80    }
81  });
82})(jQuery, Drupal, drupalSettings, Drupal.debounce, Drupal.displace);

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.