vendor: 112 bytes, lines 1-5
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ({ 4 5/***/ "./s
5rc/css/popup-styles.css": 6/*!**********************************!*\ 7 !*** ./src/css/popup-styles.css ***! 8 \**********************************/ 9/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10 11__webpack_require__.r(__webpack_exports__); 12// extracted by mini-css-extract-plugin 13 14 15/***/ })
15 16 17/******/ }); 18/************************************************************************/ 19/******/ // The module cache 20/******/ var __webpack_module_cache__ = {}; 21/******/ 22/******/ // The require function 23/******/ function __webpack_require__(moduleId) { 24/******/ // Check if module is in cache 25/******/ var cachedModule = __webpack_module_cache__[moduleId]; 26/******/ if (cachedModule !== undefined) { 27/******/ return cachedModule.exports; 28/******/ } 29/******/ // Create a new module (and put it into the cache) 30/******/ var module = __webpack_module_cache__[moduleId] = { 31/******/ // no module.id needed 32/******/ // no module.loaded needed 33/******/ exports: {} 34/******/ }; 35/******/ 36/******/ // Execute the module function 37/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 38/******/ 39/******/ // Return the exports of the module 40/******/ return module.exports; 41/******/ } 42/******/ 43/************************************************************************/ 44/******/ /* webpack/runtime/define property getters */ 45/******/ (() => { 46/******/ // define getter functions for harmony exports 47/******/ __webpack_require__.d = (exports, definition) => { 48/******/ for(var key in definition) { 49/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 50/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 51/******/ } 52/******/ } 53/******/ }; 54/******/ })(); 55/******/ 56/******/ /* webpack/runtime/hasOwnProperty shorthand */ 57/******/ (() => { 58/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 59/******/ })(); 60/******/ 61/******/ /* webpack/runtime/make namespace object */ 62/******/ (() => { 63/******/ // define __esModule on exports 64/******/ __webpack_require__.r = (exports) => { 65/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 66/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 67/******/ } 68/******/ Object.defineProperty(exports, '__esModule', { value: true }); 69/******/ }; 70/******/ })(); 71/******/ 72/************************************************************************/ 73var __webpack_exports__ = {}; 74// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. 75(() => { 76/*!*************************!*\ 77 !*** ./src/js/index.js ***! 78 \*************************/ 79__webpack_require__.r(__webpack_exports__); 80/* harmony export */ __webpack_require__.d(__webpack_exports__, { 81/* harmony export */ "default": () => (/* binding */ StrlPopup) 82/* harmony export */ }); 83/* harmony import */ var _css_popup_styles_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css/popup-styles.css */ "./src/css/popup-styles.css"); 84function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } 85function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 86function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } 87function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } 88function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } 89function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } 90function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 91function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } 92function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } 93function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } 94function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 95function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 96// Import main CSS file 97 98var StrlPopup = /*#__PURE__*/function () { 99 function StrlPopup(element, popupData) { 100 _classCallCheck(this, StrlPopup); 101 this.popup = element; 102 this.popupData = popupData; 103 this.focusHandler = null; 104 this.triggerElement = null; 105 this.inertSiblings = []; 106 if (!this.popupData.popupId) { 107 return; 108 } 109 this.initialize(); 110 } 111 return _createClass(StrlPopup, [{ 112 key: "initialize", 113 value: function initialize() { 114 if (this.getCookie("stuurlui-popup-shown-".concat(this.popupData.popupId)) && this.popupData.frequency !== "always") { 115 return; 116 } 117 this.setupTriggers(); 118 this.setupClosing(); 119 } 120 }, { 121 key: "getCookie", 122 value: function getCookie(name) { 123 var value = "; ".concat(document.cookie); 124 var parts = value.split("; ".concat(name, "=")); 125 if (parts.length === 2) return parts.pop().split(";").shift(); 126 return null; 127 } 128 }, { 129 key: "setCookie", 130 value: function setCookie(name, value) { 131 var expires = ""; 132 var _this$popupData = this.popupData, 133 frequency = _this$popupData.frequency, 134 frequencyCustom = _this$popupData.frequencyCustom, 135 frequencyUnit = _this$popupData.frequencyUnit; 136 if (frequency === "always") { 137 return; 138 } else if (frequency === "session") { 139 expires = "; expires=0"; 140 } else if (frequency === "custom") { 141 var date = new Date(); 142 var time = parseInt(frequencyCustom, 10); 143 switch (frequencyUnit) { 144 case "days": 145 time *= 24 * 60 * 60 * 1000; 146 break; 147 case "weeks": 148 time *= 7 * 24 * 60 * 60 * 1000; 149 break; 150 case "months": 151 time *= 30 * 24 * 60 * 60 * 1000; // Approximation 152 break; 153 } 154 date.setTime(date.getTime() + time); 155 expires = "; expires=" + date.toUTCString(); 156 } 157 document.cookie = "".concat(name, "=").concat(value || "").concat(expires, "; path=/"); 158 } 159 }, { 160 key: "showPopup", 161 value: function showPopup() { 162 var _this = this; 163 if (this.popup.classList.contains("popup-is-visible")) { 164 return; 165 } 166 this.triggerElement = document.activeElement; 167 this.popup.classList.add("popup-is-visible", "animation-".concat(this.popupData.animation)); 168 setTimeout(function () { 169 _this.popup.classList.add("is-animating"); 170 }, 10); 171 this.setCookie("stuurlui-popup-shown-".concat(this.popupData.popupId), "true"); 172 if (this.popupData.trapFocus) { 173 this.trapFocus(); 174 } 175 this.setInitialFocus();
176 this.hideBackgroundContent(); 177 } 178 }, { 179 key: "closePopup", 180 value: function closePopup() { 181 var _this2 = this; 182 this.popup.classList.remove("is-animating"); 183 setTimeout(function () { 184 _this2.popup.classList.remove("popup-is-visible"); 185 }, 300); 186 if (this.popupData.trapFocus) { 187 this.releaseFocus(); 188 } 189 if (this.triggerElement) { 190 this.triggerElement.focus(); 191 } 192 this.showBackgroundContent(); 193 } 194 }, { 195 key: "setupTriggers", 196 value: function setupTriggers() { 197 var _this3 = this; 198 switch (this.popupData.trigger) { 199 case "immediate": 200 this.showPopup(); 201 break; 202 case "delay": 203 setTimeout(function () { 204 return _this3.showPopup(); 205 }, this.popupData.triggerDelay * 1000); 206 break; 207 case "scroll": 208 this.handleScrollTrigger(); 209 break; 210 case "element": 211 this.handleElementTrigger(); 212 break; 213 } 214 } 215 }, { 216 key: "handleScrollTrigger", 217 value: function handleScrollTrigger() { 218 var _this4 = this; 219 var _onScroll = function onScroll() { 220 var scrollPercent = window.scrollY / (document.documentElement.scrollHeight - window.innerHeight) * 100; 221 if (scrollPercent > _this4.popupData.triggerScroll) { 222 _this4.showPopup(); 223 window.removeEventListener("scroll", _onScroll); 224 } 225 }; 226 window.addEventListener("scroll", _onScroll, { 227 passive: true 228 }); 229 } 230 }, { 231 key: "handleElementTrigger", 232 value: function handleElementTrigger() { 233 var _this5 = this; 234 if (this.popupData.triggerElement) { 235 var targets = document.querySelectorAll(this.popupData.triggerElement + ",a[href='" + this.popupData.triggerElement + "']"); 236 if (targets.length > 0) { 237 targets.forEach(function (target) { 238 target.addEventListener("click", function () { 239 _this5.showPopup(); 240 }); 241 }); 242 } 243 } 244 } 245 }, { 246 key: "setupClosing", 247 value: function setupClosing() { 248 var _this6 = this; 249 var closeButtons = this.popup.querySelectorAll(".stuurlui-popup-close"); 250 if (closeButtons) { 251 closeButtons.forEach(function (button) { 252 button.addEventListener("click", function () { 253 return _this6.closePopup(); 254 }); 255 }); 256 } 257 var overlay = this.popup.querySelector(".stuurlui-popup-overlay"); 258 if (overlay) { 259 overlay.addEventListener("click", function () { 260 return _this6.closePopup(); 261 }); 262 } 263 document.addEventListener("keyup", function (e) { 264 if (e.key === "Escape") { 265 _this6.closePopup(); 266 } 267 }); 268 } 269 }, { 270 key: "setInitialFocus", 271 value: function setInitialFocus() { 272 var focusableElements = this.popup.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'); 273 var firstElement = focusableElements[0]; 274 if (firstElement) { 275 firstElement.focus(); 276 } 277 } 278 }, { 279 key: "trapFocus", 280 value: function trapFocus() { 281 var focusableElements = this.popup.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'); 282 var firstElement = focusableElements[0]; 283 var lastElement = focusableElements[focusableElements.length - 1]; 284 this.focusHandler = function (e) { 285 if (e.key !== "Tab") { 286 return; 287 } 288 if (e.shiftKey) { 289 if (document.activeElement === firstElement) { 290 lastElement.focus(); 291 e.preventDefault(); 292 } 293 } else { 294 if (document.activeElement === lastElement) { 295 firstElement.focus(); 296 e.preventDefault(); 297 } 298 } 299 }; 300 this.popup.addEventListener("keydown", this.focusHandler); 301 } 302 }, { 303 key: "releaseFocus", 304 value: function releaseFocus() { 305 if (this.focusHandler) { 306 this.popup.removeEventListener("keydown", this.focusHandler); 307 this.focusHandler = null; 308 } 309 } 310 }, {
311 key: "hideBackgroundContent", 312 value: function hideBackgroundContent() { 313 var _this7 = this; 314 var siblings = Array.from(document.body.children); 315 this.inertSiblings = siblings.filter(function (sibling) { 316 if (sibling === _this7.popup || sibling.tagName === "SCRIPT" || sibling.hasAttribute("aria-hidden")) { 317 return false; 318 } 319 sibling.setAttribute("aria-hidden", "true"); 320 return true; 321 }); 322 } 323 }, { 324 key: "showBackgroundContent", 325 value: function showBackgroundContent() { 326 this.inertSiblings.forEach(function (sibling) { 327 sibling.removeAttribute("aria-hidden"); 328 }); 329 this.inertSiblings = []; 330 } 331 }]); 332}(); // set data for dev access 333 334window.StuurluiPopups = { 335 version: "3.5.1", 336 getAllPopups: function getAllPopups() { 337 return _toConsumableArray(window.stuurlui_popup_instances || []); 338 }, 339 getPopupById: function getPopupById(popupId) { 340 if (!window.stuurlui_popup_instances) return null; 341 return ( 342 // TODO:fix 343 window.stuurlui_popup_instances.find(function (p) { 344 return p.popupData.popupId == popupId; 345 }) || null 346 ); 347 }, 348 showPopup: function showPopup(popupId) { 349 var popup = this.getPopupById(popupId); 350 if (popup) popup.showPopup(); 351 }, 352 closePopup: function closePopup(popupId) { 353 var popup = this.getPopupById(popupId); 354 if (popup) popup.closePopup(); 355 }, 356 closeAllPopups: function closeAllPopups() { 357 if (!window.stuurlui_popup_instances) return; 358 window.stuurlui_popup_instances.forEach(function (popup) { 359 return popup.closePopup(); 360 }); 361 } 362}; 363window.addEventListener("load", function () { 364 var allPopupConfigs = window.stuurlui_popup_configs || []; 365 if (!Array.isArray(allPopupConfigs) || allPopupConfigs.length === 0) { 366 return; 367 } 368 window.stuurlui_popup_instances = window.stuurlui_popup_instances || []; 369 allPopupConfigs.forEach(function (popupConfig) { 370 var popupElement = document.getElementById("stuurlui-popup-".concat(popupConfig.popupId)); 371 if (popupElement) { 372 var p = new StrlPopup(popupElement, popupConfig); 373 window.stuurlui_popup_instances['"' + popupConfig.popupId + '"'] = p; 374 } 375 }); 376 377 // TODO: not fully working, need to fix 378 // Gravity Forms non-ajax integration - Force open when form is submitted 379 if (typeof jQuery !== "undefined") { 380 jQuery(document).on("gform_confirmation_loaded", function (event, formId) { 381 var formWrapper = document.getElementById("gform_wrapper_".concat(formId)); 382 if (!formWrapper) return; 383 var popupElement = formWrapper.closest(".stuurlui-popup"); 384 if (!popupElement) return; 385 var popupId = popupElement.id.replace("stuurlui-popup-", ""); 386 if (!popupId) return; 387 388 // const popupInstance = window.stuurlui_popup_instances.find( 389 // (p) => p.popupData.popupId == popupId 390 // );
391 // TODO: fix 392 var popupInstance = window.stuurlui_popup_instances[popupId]; 393 if (popupInstance) { 394 popupInstance.showPopup(); 395 } 396 }); 397 } 398}); 399})(); 400 401/******/ })() 402; 403//# sourceMappingURL=popup-scripts.min.js.map
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.