PageSourceSearch

https://torrepadre.es/core/themes/olivero/js/messages.js?v=10.2.7

js torrepadre.es collected 2026-10-02 23:19:37 UTC 1,539 bytes, 56 lines download raw bytes

1/**
2 * @file
3 * Customization of messages.
4 */
5
6((Drupal, once) => {
7  /**
8   * Adds a close button to the message.
9   *
10   * @param {object} message
11   *   The message object.
12   */
13  const closeMessage = (message) => {
14    const messageContainer = message.querySelector(
15      '[data-drupal-selector="messages-container"]',
16    );
17    if (!messageContainer.querySelector('.messages__button')) {
18      const closeBtnWrapper = document.createElement('div');
19      closeBtnWrapper.setAttribute('class', 'messages__button');
20
21      const closeBtn = document.createElement('button');
22      closeBtn.setAttribute('type', 'button');
23      closeBtn.setAttribute('class', 'messages__close');
24
25      const closeBtnText = document.createElement('span');
26      closeBtnText.setAttribute('class', 'visually-hidden');
27      closeBtnText.innerText = Drupal.t('Close message');
28
29      messageContainer.appendChild(closeBtnWrapper);
30      closeBtnWrapper.appendChild(closeBtn);
31      closeBtn.appendChild(closeBtnText);
32
33      closeBtn.addEventListener('click', () => {
34        message.classList.add('hidden');
35      });
36    }
37  };
38
39  /**
40   * Get messages from context.
41   *
42   * @type {Drupal~behavior}
43   *
44   * @prop {Drupal~behaviorAttach} attach
45   *   Attaches the close button behavior for messages.
46   */
47  Drupal.behaviors.messages = {
48    attach(context) {
49      once('messages', '[data-drupal-selector="messages"]', context).forEach(
50        closeMessage,
51      );
52    },
53  };
54
55  Drupal.olivero.closeMessage = closeMessage;
56})(Drupal, once);

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.