PageSourceSearch

https://afchub.org/custom/js/hub-layout.js?1790293703

js afchub.org collected 2026-09-24 23:49:04 UTC 5,108 bytes, 163 lines download raw bytes

1
2// Submit subscription
3document.getElementById('subscribeForm').addEventListener('submit', async function (e) {
4    e.preventDefault();
5
6    const form = {
7        name: document.getElementById('mce-FNAME').value,
8        email: document.getElementById('mce-EMAIL').value,
9        _token: document.querySelector('input[name="_token"]').value,
10    };
11
12    const errors = {};
13    const loading = false;
14    const submitted = false;
15
16    document.getElementById('loadingIcon').style.display = 'inline-block';
17    document.getElementById('subscribeText').style.display = 'none';
18
19    if (!form.email) {
20        errors.email = ['Email is required'];
21        document.getElementById('emailError').textContent = errors.email[0];
22        document.getElementById('emailError').style.display = 'block';
23        document.getElementById('loadingIcon').style.display = 'none';
24        document.getElementById('subscribeText').style.display = 'inline-block';
25        return false;
26    }
27
28    try {
29        const response = await fetch('/api/home/subscribe', {
30            method: 'POST',
31            headers: {
32                'Content-Type': 'application/json',
33            },
34            body: JSON.stringify(form),
35        });
36
37        const data = await response.json();
38
39        if (data.success) {
40            document.getElementById('submittedMessage').style.display = 'block';
41            document.getElementById('mce-EMAIL').value = '';
42            document.getElementById('mce-FNAME').value = '';
43            document.getElementById('emailError').style.display = 'none';
44        }
45    } catch (error) {
46        if (error.response) {
47            if (error.response.status >= 400) {
48                errors.value = error.response.data.errors;
49                document.getElementById('emailError').textContent = errors.value.email[0];
50                document.getElementById('emailError').style.display = 'block';
51            }
52        }
53    }
54
55    document.getElementById('loadingIcon').style.display = 'none';
56    document.getElementById('subscribeText').style.display = 'inline-block';
57});
58
59
60// Demo Slider
61$(window).on('load', function() {
62    $('#myModal').modal('show');
63});
64
65$(document).ready(function() {
66    $('.nav-link').click(function() {
67        $('.nav-link').removeClass('active'); // Remove active class from all menu items
68        $(this).addClass('active'); // Add active class to the clicked menu item
69    });
70});
71
72(function($) {
73    "use strict";
74    // Auto-scroll demo
75    $('#myCarousel').carousel({
76        interval: 5000
77    });
78
79    $('#demo').carousel({
80        interval: 5000
81    });
82
83    // Control buttons
84    $('.next').click(function() {
85        $('.carousel').carousel('next');
86        return false;
87    });
88    $('.prev').click(function() {
89        $('.carousel').carousel('prev');
90        return false;
91    });
92
93    // On carousel scroll
94    $("#myCarousel").on("slide.bs.carousel", function(e) {
95        var $e = $(e.relatedTarget);
96        var idx = $e.index();
97        var itemsPerSlide = 3;
98        var totalItems = $(".carousel-item").length;
99        if (idx >= totalItems - (itemsPerSlide - 1)) {
100            var it = itemsPerSlide -
101                (totalItems - idx);
102            for (var i = 0; i < it; i++) {
103                // append slides to end
104                if (e.direction == "left") {
105                    $(
106                        ".carousel-item").eq(i).appendTo(".carousel-inner");
107                } else {
108                    $(".carousel-item").eq(0).appendTo(".carousel-inner");
109                }
110            }
111        }
112    });
113})
114(jQuery);
115
116
117// Toggle sidebar menu
118document.addEventListener('DOMContentLoaded', function () {
119    const toggler = document.getElementById('navbarSideCollapse');
120    const menu = document.getElementById('navbarSideMenu');
121
122    toggler.addEventListener('click', function () {
123      menu.classList.toggle('open');
124      toggler.classList.toggle('open');
125    });
126});
127
128// Stat. Counter
129document.addEventListener("DOMContentLoaded", () => {
130    const counters = document.querySelectorAll(".count-stat");
131    const duration = 20;
132    const steps = 60;
133    const interval = duration / steps;
134
135    counters.forEach(counter => {
136        const target = +counter.getAttribute("data-target");
137        const increment = target / steps;
138        let current = 0;
139
140        const timer = setInterval(() => {
141            current += increment;
142            if (current >= target) {
143                counter.innerText = target.toLocaleString() + "+";
144                clearInterval(timer);
145            } else {
146                counter.innerText = Math.ceil(current).toLocaleString() + "+";
147            }
148        }, interval);
149    });
150});
151
152//toggle export dropdown on mobile
153document.addEventListener('DOMContentLoaded', function() {
154    document.querySelectorAll('.sub-drop-export .sub-toggle').forEach(function(el) {
155        el.addEventListener('click', function(e) {
156        e.preventDefault();
157        e.stopPropagation();
158        const submenu = this.nextElementSibling;
159        submenu.classList.toggle('show-sub');
160        });
161    });
162});
163

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.