PageSourceSearch

https://artehistoria.com/core/misc/message.js?v=9.5.11

js artehistoria.com collected 2026-10-02 02:14:07 UTC 5,979 bytes, 119 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**/
7function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13(function (Drupal) {
14  Drupal.Message = function () {
15    function _class() {
16      var messageWrapper = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
17      _classCallCheck(this, _class);
18      if (!messageWrapper) {
19        this.messageWrapper = Drupal.Message.defaultWrapper();
20      } else {
21        this.messageWrapper = messageWrapper;
22      }
23    }
24    _createClass(_class, [{
25      key: "add",
26      value: function add(message) {
27        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28        if (!options.hasOwnProperty('type')) {
29          options.type = 'status';
30        }
31        if (typeof message !== 'string') {
32          throw new Error('Message must be a string.');
33        }
34        Drupal.Message.announce(message, options);
35        options.id = options.id ? String(options.id) : "".concat(options.type, "-").concat(Math.random().toFixed(15).replace('0.', ''));
36        if (!Drupal.Message.getMessageTypeLabels().hasOwnProperty(options.type)) {
37          var type = options.type;
38          throw new Error("The message type, ".concat(type, ", is not present in Drupal.Message.getMessageTypeLabels()."));
39        }
40        this.messageWrapper.appendChild(Drupal.theme('message', {
41          text: message
42        }, options));
43        return options.id;
44      }
45    }, {
46      key: "select",
47      value: function select(id) {
48        return this.messageWrapper.querySelector("[data-drupal-message-id^=\"".concat(id, "\"]"));
49      }
50    }, {
51      key: "remove",
52      value: function remove(id) {
53        return this.messageWrapper.removeChild(this.select(id));
54      }
55    }, {
56      key: "clear",
57      value: function clear() {
58        var _this = this;
59        Array.prototype.forEach.call(this.messageWrapper.querySelectorAll('[data-drupal-message-id]'), function (message) {
60          _this.messageWrapper.removeChild(message);
61        });
62      }
63    }], [{
64      key: "defaultWrapper",
65      value: function defaultWrapper() {
66        var wrapper = document.querySelector('[data-drupal-messages]');
67        if (!wrapper) {
68          wrapper = document.querySelector('[data-drupal-messages-fallback]');
69          wrapper.removeAttribute('data-drupal-messages-fallback');
70          wrapper.setAttribute('data-drupal-messages', '');
71          wrapper.classList.remove('hidden');
72        }
73        return wrapper.innerHTML === '' ? Drupal.Message.messageInternalWrapper(wrapper) : wrapper.firstElementChild;
74      }
75    }, {
76      key: "getMessageTypeLabels",
77      value: function getMessageTypeLabels() {
78        return {
79          status: Drupal.t('Status message'),
80          error: Drupal.t('Error message'),
81          warning: Drupal.t('Warning message')
82        };
83      }
84    }, {
85      key: "announce",
86      value: function announce(message, options) {
87        if (!options.priority && (options.type === 'warning' || options.type === 'error')) {
88          options.priority = 'assertive';
89        }
90        if (options.announce !== '') {
91          Drupal.announce(options.announce || message, options.priority);
92        }
93      }
94    }, {
95      key: "messageInternalWrapper",
96      value: function messageInternalWrapper(messageWrapper) {
97        var innerWrapper = document.createElement('div');
98        innerWrapper.setAttribute('class', 'messages__wrapper');
99        messageWrapper.insertAdjacentElement('afterbegin', innerWrapper);
100        return innerWrapper;
101      }
102    }]);
103    return _class;
104  }();
105  Drupal.theme.message = function (_ref, _ref2) {
106    var text = _ref.text;
107    var type = _ref2.type,
108      id = _ref2.id;
109    var messagesTypes = Drupal.Message.getMessageTypeLabels();
110    var messageWrapper = document.createElement('div');
111    messageWrapper.setAttribute('class', "messages messages--".concat(type));
112    messageWrapper.setAttribute('role', type === 'error' || type === 'warning' ? 'alert' : 'status');
113    messageWrapper.setAttribute('data-drupal-message-id', id);
114    messageWrapper.setAttribute('data-drupal-message-type', type);
115    messageWrapper.setAttribute('aria-label', messagesTypes[type]);
116    messageWrapper.innerHTML = "".concat(text);
117    return messageWrapper;
118  };
119})(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.