PageSourceSearch

https://www.tradix.cz/js/Ecom/App/Web/footer.js?1787255219

js tradix.cz collected 2026-10-04 14:50:54 UTC 3,042 bytes, 80 lines download raw bytes

1/**
2 * JS to handle actions occurring in footer.
3 */
4tswEcomWebAppFooter = {
5    /**
6     * Input field to subscribe to the newsletter by email.
7     */
8    newsletterForm: null,
9    newsletterEmailInput: null,
10    newsletterHoneypot: null,
11    /**
12     * Init listeners for actions and cache elements.
13     */
14    init() {
15        this.newsletterForm = document.querySelector('form#newsletter-form');
16        this.newsletterEmailInput = this.newsletterForm?.querySelector('input#newsletter-email');
17        this.newsletterHoneypot = this.newsletterForm?.querySelector('input#newsletter-website');
18        this.newsletterForm?.addEventListener('submit', this.onNewsletterFormSubmit);
19        document.querySelectorAll('.footer-top-col h3').forEach(function (elem) {
20            elem.addEventListener('click', tswEcomWebAppFooter.slideToggleMenuSection);
21        });
22    },
23    /**
24     * Callback for newsletter form submit action. Sends passed input to the backed for further processing.
25     * @param {Event} event
26     */
27    onNewsletterFormSubmit(event) {
28        event.preventDefault();
29        if (!tswEcomWebAppFooter.newsletterEmailInput) {
30            return;
31        }
32        let emailInput = tswEcomWebAppFooter.newsletterEmailInput;
33        let email = emailInput.value;
34        let honeypot = tswEcomWebAppFooter.newsletterHoneypot?.value ?? '';
35        let response = JSON.parse(
36            tsw.getContentFromUrl(
37                PROJECT_URL + 'ajax.php?&presenter=tsw.module.ecom.newsletter.subscriber.subscriber&action=subscribeAjax&email=' + encodeURIComponent(email) + '&website=' + encodeURIComponent(honeypot)
38            )
39        );
40        tswEcomWebAppFooter.processSubscriptionResponse(response);
41    },
42    /**
43     * Renders email subscription response message.
44     * @param response
45     */
46    processSubscriptionResponse(response) {
47        let status = response.status;
48        if (status === 'success') {
49            tswEcomWebAppFooter.newsletterEmailInput.value = '';
50        }
51        let message = response.message;
52        let messageLastSpan = tswEcomWebAppFooter.newsletterEmailInput.parentElement.querySelector('span');
53        if (messageLastSpan) {
54            messageLastSpan.setAttribute('class', status + '-text');
55            messageLastSpan.innerHTML = message;
56            return;
57        }
58        tswEcomWebAppFooter.newsletterEmailInput.insertAdjacentHTML(
59            'afterend',
60            '<span class="' + status + '-text">' + message + '</span>'
61        );
62    },
63    /**
64     * Expands or collapses menu section on menu header click
65     * if page is in mobile layout.
66     * @param {Event} event
67     */
68    slideToggleMenuSection(event) {
69        event.preventDefault();
70        if (this.querySelector('svg').tswIsHidden()) {
71            return;
72        }
73        this.tswToggleClass('active');
74        this.closest('.footer-top-col')?.querySelector('ul')?.tswSlideToggle(350);
75    }
76};
77
78document.addEventListener('DOMContentLoaded', () => {
79    tswEcomWebAppFooter.init();
80});

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.