PageSourceSearch

https://www.copernicus.eu/core/misc/dialog/dialog.jquery-ui.js?v=10.6.17

js copernicus.eu collected 2026-09-24 08:25:48 UTC 2,319 bytes, 75 lines download raw bytes

1/**
2 * @file
3 * Adds default classes to buttons for styling purposes.
4 */
5
6(function ($, { tabbable, isTabbable }) {
7  $.widget('ui.dialog', $.ui.dialog, {
8    options: {
9      buttonClass: 'button',
10      buttonPrimaryClass: 'button--primary',
11    },
12    _createButtons() {
13      const opts = this.options;
14      let primaryIndex;
15      let index;
16      const il = opts.buttons.length;
17      for (index = 0; index < il; index++) {
18        if (
19          opts.buttons[index].primary &&
20          opts.buttons[index].primary === true
21        ) {
22          primaryIndex = index;
23          delete opts.buttons[index].primary;
24          break;
25        }
26      }
27      this._super();
28      const $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
29      if (typeof primaryIndex !== 'undefined') {
30        $buttons.eq(index).addClass(opts.buttonPrimaryClass);
31      }
32    },
33    // Override jQuery UI's `_focusTabbable()` so finding tabbable elements uses
34    // the core/tabbable library instead of jQuery UI's `:tabbable` selector.
35    _focusTabbable() {
36      // Set focus to the first match:
37
38      // 1. An element that was focused previously.
39      let hasFocus = this._focusedElement ? this._focusedElement.get(0) : null;
40
41      // 2. First element inside the dialog matching [autofocus].
42      if (!hasFocus) {
43        hasFocus = this.element.find('[autofocus]').get(0);
44      }
45
46      // 3. Tabbable element inside the content element.
47      // 4. Tabbable element inside the buttonpane.
48      if (!hasFocus) {
49        const $elements = [this.element, this.uiDialogButtonPane];
50        for (let i = 0; i < $elements.length; i++) {
51          const element = $elements[i].get(0);
52          if (element) {
53            const elementTabbable = tabbable(element);
54            hasFocus = elementTabbable.length ? elementTabbable[0] : null;
55          }
56          if (hasFocus) {
57            break;
58          }
59        }
60      }
61
62      // 5. The close button.
63      if (!hasFocus) {
64        const closeBtn = this.uiDialogTitlebarClose.get(0);
65        hasFocus = closeBtn && isTabbable(closeBtn) ? closeBtn : null;
66      }
67
68      // 6. The dialog itself.
69      if (!hasFocus) {
70        hasFocus = this.uiDialog.get(0);
71      }
72      $(hasFocus).eq(0).trigger('focus');
73    },
74  });
75})(jQuery, window.tabbable);

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.