| (() => { |
| "use strict"; |
| |
| var __webpack_require__ = {}; |
| |
| |
| |
| (() => { |
| |
| __webpack_require__.n = (module) => { |
| var getter = module && module.__esModule ? |
| () => (module['default']) : |
| () => (module); |
| __webpack_require__.d(getter, { a: getter }); |
| return getter; |
| }; |
| })(); |
| |
| |
| (() => { |
| |
| __webpack_require__.d = (exports, definition) => { |
| for(var key in definition) { |
| if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| } |
| } |
| }; |
| })(); |
| |
| |
| (() => { |
| __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| })(); |
| |
| |
| (() => { |
| |
| __webpack_require__.r = (exports) => { |
| if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| } |
| Object.defineProperty(exports, '__esModule', { value: true }); |
| }; |
| })(); |
| |
| |
| var __webpack_exports__ = {}; |
| |
| __webpack_require__.r(__webpack_exports__); |
|
|
| |
| __webpack_require__.d(__webpack_exports__, { |
| setup: () => ( setup), |
| speak: () => ( speak) |
| }); |
|
|
| ; |
| const external_wp_domReady_namespaceObject = window["wp"]["domReady"]; |
| var external_wp_domReady_default = __webpack_require__.n(external_wp_domReady_namespaceObject); |
| ; |
| const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
| ; |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| function addIntroText() { |
| const introText = document.createElement('p'); |
| introText.id = 'a11y-speak-intro-text'; |
| introText.className = 'a11y-speak-intro-text'; |
| introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications'); |
| introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
| introText.setAttribute('hidden', 'hidden'); |
| const { |
| body |
| } = document; |
| if (body) { |
| body.appendChild(introText); |
| } |
| return introText; |
| } |
|
|
| ; |
| |
| |
| |
| |
| |
| |
| |
| function addContainer(ariaLive = 'polite') { |
| const container = document.createElement('div'); |
| container.id = `a11y-speak-${ariaLive}`; |
| container.className = 'a11y-speak-region'; |
| container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;'); |
| container.setAttribute('aria-live', ariaLive); |
| container.setAttribute('aria-relevant', 'additions text'); |
| container.setAttribute('aria-atomic', 'true'); |
| const { |
| body |
| } = document; |
| if (body) { |
| body.appendChild(container); |
| } |
| return container; |
| } |
|
|
| ; |
| |
| |
| |
| function clear() { |
| const regions = document.getElementsByClassName('a11y-speak-region'); |
| const introText = document.getElementById('a11y-speak-intro-text'); |
| for (let i = 0; i < regions.length; i++) { |
| regions[i].textContent = ''; |
| } |
|
|
| |
| if (introText) { |
| introText.setAttribute('hidden', 'hidden'); |
| } |
| } |
|
|
| ; |
| let previousMessage = ''; |
|
|
| |
| |
| |
| |
| |
| |
| |
| function filterMessage(message) { |
| |
| |
| |
| |
| |
| |
| |
| message = message.replace(/<[^<>]+>/g, ' '); |
|
|
| |
| |
| |
| |
| if (previousMessage === message) { |
| message += '\u00A0'; |
| } |
| previousMessage = message; |
| return message; |
| } |
|
|
| ; |
| |
| |
| |
|
|
|
|
| |
| |
| |
|
|
|
|
|
|
|
|
|
|
| |
| |
| |
| function setup() { |
| const introText = document.getElementById('a11y-speak-intro-text'); |
| const containerAssertive = document.getElementById('a11y-speak-assertive'); |
| const containerPolite = document.getElementById('a11y-speak-polite'); |
| if (introText === null) { |
| addIntroText(); |
| } |
| if (containerAssertive === null) { |
| addContainer('assertive'); |
| } |
| if (containerPolite === null) { |
| addContainer('polite'); |
| } |
| } |
|
|
| |
| |
| |
| external_wp_domReady_default()(setup); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function speak(message, ariaLive) { |
| |
| |
| |
| |
| clear(); |
| message = filterMessage(message); |
| const introText = document.getElementById('a11y-speak-intro-text'); |
| const containerAssertive = document.getElementById('a11y-speak-assertive'); |
| const containerPolite = document.getElementById('a11y-speak-polite'); |
| if (containerAssertive && ariaLive === 'assertive') { |
| containerAssertive.textContent = message; |
| } else if (containerPolite) { |
| containerPolite.textContent = message; |
| } |
|
|
| |
| |
| |
| |
| if (introText) { |
| introText.removeAttribute('hidden'); |
| } |
| } |
|
|
| (window.wp = window.wp || {}).a11y = __webpack_exports__; |
| })() |
| ; |