PageSourceSearch

https://shareme.chat/crossFile.js

js shareme.chat collected 2026-10-04 07:10:35 UTC 3,533 bytes, 113 lines download raw bytes

1//////////
2// Mobile Menu Configurations
3
4document.addEventListener('DOMContentLoaded', function() {
5    const header = document.querySelector('.header');
6    const mobileToggle = document.querySelector('.header__mobile-toggle');
7    const mobileContainer = document.querySelector('.header__mobile-container');
8    const body = document.body;
9
10    mobileToggle.addEventListener('click', function() {
11        header.classList.toggle('active');
12        mobileContainer.classList.toggle('active');
13        body.classList.toggle('menu-open');
14    });
15
16    // Close menu when clicking outside
17    document.addEventListener('click', function(e) {
18        if (!header.contains(e.target) && mobileContainer.classList.contains('active')) {
19            header.classList.remove('active');
20            mobileContainer.classList.remove('active');
21            body.classList.remove('menu-open');
22        }
23    });
24
25    // Close menu when clicking nav links
26    const navLinks = document.querySelectorAll('.header__nav-link');
27    navLinks.forEach(link => {
28        link.addEventListener('click', () => {
29            header.classList.remove('active');
30            mobileContainer.classList.remove('active');
31            body.classList.remove('menu-open');
32        });
33    });
34});
35
36
37//////////
38// Email Configurations
39
40document.addEventListener('DOMContentLoaded', function() {
41    const subscriptionForm = document.querySelector('.footer__form');
42    const submitButton = document.querySelector('.footer__submit');
43    let isSubmitting = false;
44
45    subscriptionForm.addEventListener('submit', async function(e) {
46        e.preventDefault();
47
48        if (isSubmitting) {
49            return;
50        }
51
52        const emailInput = document.querySelector('.footer__input');
53        const email = emailInput.value.trim();
54
55        // Basic email validation
56        if (!isValidEmail(email)) {
57            alert('Please enter a valid email address');
58            return;
59        }
60
61        // Set submitting state and disable button
62        isSubmitting = true;
63        submitButton.disabled = true;
64        submitButton.innerHTML = '<span>Processing...</span>';
65
66
67        try {
68            await sendSubscriptionEmail(email, '[email protected]');
69
70            // await sendSubscriptionEmail(email, '[email protected]');
71
72            // Clear the input
73            emailInput.value = '';
74
75            // Redirect to thank you page
76            window.location.href = '/thankYou';
77
78        } catch (error) {
79            console.error('Subscription error:', error);
80            alert('There was an error processing your subscription. Please try again.');
81        }
82    });
83
84    // Email validation helper function
85    function isValidEmail(email) {
86        const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
87        return emailRegex.test(email);
88    }
89
90    // Function to send subscription email
91    async function sendSubscriptionEmail(subscriberEmail, targetEmail) {
92        const data = {
93            subscriberEmail: subscriberEmail,
94            targetEmail: targetEmail,
95            timestamp: new Date().toISOString()
96        };
97
98        // Contacting backend to send emails
99        const response = await fetch('/api/subscribe', {
100            method: 'POST',
101            headers: {
102                'Content-Type': 'application/json'
103            },
104            body: JSON.stringify(data)
105        });
106
107        if (!response.ok) {
108            throw new Error('Failed to send subscription email');
109        }
110
111        return response.json();
112    }
113});

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.