PageSourceSearch

https://amitim.com/wp-content/themes/a2z/js/script.js?1790320746&ver=1.0.0

js amitim.com collected 2026-09-25 07:19:25 UTC 4,403 bytes, 143 lines download raw bytes

1// Menu
2document.addEventListener('DOMContentLoaded', function () {
3    const menuCollapse = document.getElementById('mobileMenuCollapse');
4    const searchCollapse = document.getElementById('mobileSearchCollapse');
5    const overlay = document.getElementById('mobileOverlay');
6    const menuIconBars = document.getElementById('menuIconBars');
7    const menuIconClose = document.getElementById('menuIconClose');
8
9    // Toggle icon 
10    if (menuCollapse) {
11        menuCollapse.addEventListener('show.bs.collapse', function () {
12            // Close search if open
13            const searchInstance = bootstrap.Collapse.getInstance(searchCollapse);
14            if (searchInstance) searchInstance.hide();
15
16            // Show overlay
17            overlay.classList.add('show');
18
19            // Toggle icon
20            menuIconBars.classList.add('d-none');
21            menuIconClose.classList.remove('d-none');
22        });
23
24        menuCollapse.addEventListener('hide.bs.collapse', function () {
25            overlay.classList.remove('show');
26            menuIconBars.classList.remove('d-none');
27            menuIconClose.classList.add('d-none');
28        });
29    }
30
31    // Close menu when search opens
32    if (searchCollapse) {
33        searchCollapse.addEventListener('show.bs.collapse', function () {
34            const menuInstance = bootstrap.Collapse.getInstance(menuCollapse);
35            if (menuInstance) menuInstance.hide();
36        });
37    }
38
39    // Close menu on overlay click
40    if (overlay) {
41        overlay.addEventListener('click', function () {
42            const menuInstance = bootstrap.Collapse.getInstance(menuCollapse);
43            if (menuInstance) menuInstance.hide();
44        });
45    }
46});
47
48// SubMenu on mob
49document.addEventListener('DOMContentLoaded', function () {
50
51    if (!isMobile()) return false;
52
53    var menu = document.querySelector('.content-menu');
54    var items = menu.querySelector('.content-menu-items');
55    var title = menu.querySelector('.content-menu-title');
56
57    function isMobile() {
58        return window.innerWidth < 768;
59    }
60
61    if (isMobile()) {
62        menu.classList.add('collapsed');
63        items.style.maxHeight = '0';
64    }
65
66    title.addEventListener('click', function () {
67        if (!isMobile()) return;
68
69        if (menu.classList.contains('collapsed')) {
70            items.style.maxHeight = items.scrollHeight + 'px';
71            menu.classList.remove('collapsed');
72        } else {
73            items.style.maxHeight = '0';
74            menu.classList.add('collapsed');
75        }
76    });
77
78    window.addEventListener('resize', function () {
79        if (!isMobile()) {
80            items.style.maxHeight = '';
81            menu.classList.remove('collapsed');
82        }
83    });
84});
85
86// Form redirection to thx pages
87document.addEventListener('wpcf7mailsent', function (event) {
88
89    var redirects = {
90        '842': '/thank-you-jobs/',
91        '6150': '/thank-you-public-inquiries/',
92        '2898': '/thank-you-employers/',
93        '662': '/thank-you-customer-service/',
94        '521': '/thank-you-consultants/',
95        '6156': '/thank-you-accessibility/',
96        '7185': '/thank-you-associate/',
97    };
98
99    var formId = event.detail.contactFormId.toString();
100
101    if (redirects[formId]) {
102        window.location.href = redirects[formId];
103    }
104
105}, false);
106
107// Form fields
108document.addEventListener('input', function (e) {
109    if (!e.target.classList.contains('wpcf7-tel')) {
110        return;
111    }
112
113    e.target.value = e.target.value.replace(/[^0-9-]/g, '');
114});
115
116document.addEventListener('input', function (e) {
117    if (!e.target.classList.contains('digits-only')) {
118        return;
119    }
120
121    e.target.value = e.target.value.replace(/[^0-9]/g, '');
122});
123
124 document.addEventListener('input', function (e) {
125    if (!e.target.classList.contains('letters-only')) {
126        return;
127    }
128
129    e.target.value = e.target.value.replace(/[^\p{L}]/gu, '');
130});
131
132
133// category buttons equal height
134window.addEventListener('load', function() {
135    if (window.innerWidth < 992) {
136        const btns = document.querySelectorAll('.category-column-link');
137        let maxH = 0;
138        btns.forEach(b => maxH = Math.max(maxH, b.offsetHeight));
139        btns.forEach(b => b.style.height = maxH + 'px');
140    }
141});
142
143

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.