PageSourceSearch

https://wpamelia.com/wp-content/themes/amelia-theme/amelia-blocks/assets/js/download-cta.js?ver=1777014097

js wpamelia.com collected 2026-10-02 02:29:14 UTC 2,116 bytes, 74 lines download raw bytes

1(function () {
2  'use strict';
3
4  function openPopup(popup) {
5    popup.removeAttribute('hidden');
6    document.body.style.overflow = 'hidden';
7
8    // Focus first focusable element inside
9    var focusable = popup.querySelectorAll('button, a, input, [tabindex]:not([tabindex="-1"])');
10    if (focusable.length) {
11      focusable[0].focus();
12    }
13  }
14
15  function closePopup(popup) {
16    popup.setAttribute('hidden', '');
17    document.body.style.overflow = '';
18  }
19
20  function initDownloadCta(scope) {
21    var triggers = scope.querySelectorAll('[data-popup-trigger]');
22
23    triggers.forEach(function (trigger) {
24      var popupId = trigger.dataset.popupTrigger;
25      var popup   = document.getElementById(popupId);
26      if (!popup) return;
27
28      // Open on trigger click
29      trigger.addEventListener('click', function () {
30        openPopup(popup);
31      });
32
33      // Close on overlay / close button clicks
34      popup.querySelectorAll('[data-popup-close]').forEach(function (el) {
35        el.addEventListener('click', function () {
36          closePopup(popup);
37        });
38      });
39
40      // Close on Escape key
41      document.addEventListener('keydown', function (e) {
42        if (e.key === 'Escape' && !popup.hasAttribute('hidden')) {
43          closePopup(popup);
44          trigger.focus();
45        }
46      });
47    });
48  }
49
50  function init() {
51    initDownloadCta(document);
52  }
53
54  if (document.readyState === 'loading') {
55    document.addEventListener('DOMContentLoaded', init);
56  } else {
57    init();
58  }
59
60  // Elementor editor re-init
61  if (window.elementorFrontend && window.elementorFrontend.hooks) {
62    window.elementorFrontend.hooks.addAction('frontend/element_ready/download-cta.default', function ($scope) {
63      initDownloadCta($scope[0]);
64    });
65  } else {
66    document.addEventListener('elementor/frontend/init', function () {
67      if (window.elementorFrontend && window.elementorFrontend.hooks) {
68        window.elementorFrontend.hooks.addAction('frontend/element_ready/download-cta.default', function ($scope) {
69          initDownloadCta($scope[0]);
70        });
71      }
72    });
73  }
74})();

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.