PageSourceSearch

https://collaborator.pl/free-backlink-checker/js/app/core.js

js collaborator.pl collected 2026-10-05 03:03:20 UTC 2,914 bytes, 89 lines download raw bytes

1/**
2 * Backlink Checker App Module — ядро: стан, селектори елементів, init().
3 * Методи додаються іншими файлами через Object.assign нижче за списком підключення.
4 */
5const BacklinkApp = {
6    state: {
7        isLoading: false,
8        used: 0,
9        total: 0,
10    },
11    deviceId: null,
12    elements: {
13        form: document.querySelector('form'),
14        formSelect: document.querySelector('form .selectpicker'),
15        submitBtn: document.querySelector('form button[type="submit"]'),
16        resultContainer: document.querySelector('#results'),
17        counterElem: document.getElementById('limit-counter'),
18        benefitsItems: document.querySelector('.backlink-benefits__block'),
19    },
20
21    async init() {
22        if (!this.elements.form) return;
23
24        if (!window.CLOUDFLARE_SITE_KEY) {
25            const cfContainer = document.getElementById('cf-turnstile-selector');
26            if (cfContainer) cfContainer.style.display = 'none';
27        }
28
29        try {
30            this.deviceId = await FPDevice.get();
31        } catch (e) {
32            console.error("Failed to get Fingerprint", e);
33        }
34
35        this.bindEvents();
36        this.initSelectpicker();
37        this.initSwiperBenefits();
38        await this.loadInitialLimits();
39    },
40
41    delay(ms) {
42        return new Promise(resolve => setTimeout(resolve, ms));
43    },
44
45    scrollToElement(element) {
46        const header = document.querySelector('.head');
47        const headerOffset = header ? header.getBoundingClientRect().height : 0;
48        const elementPosition = element.getBoundingClientRect().top;
49        const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
50        window.scrollTo({top: offsetPosition, behavior: 'smooth'});
51    },
52
53    getHeaders() {
54        return {
55            'X-Requested-With': 'XMLHttpRequest',
56            'X-Device-ID': this.deviceId
57        };
58    },
59
60    initSelectpicker() {
61        if (typeof $.fn.selectpicker !== 'undefined') {
62            $(this.elements.formSelect).selectpicker();
63        }
64    },
65
66    initSwiperBenefits() {
67        const el = this.elements.benefitsItems;
68        if (!el || typeof Swiper === 'undefined') return;
69
70        const initSwiper = () => {
71            if (window.innerWidth < 768) {
72                if (!this.swiper) {
73                    this.swiper = new Swiper(el, {
74                        slidesPerView: 'auto',
75                        spaceBetween: 10,
76                        loop: true,
77                        pagination: {el: '.swiper-pagination', clickable: true},
78                    });
79                }
80            } else if (this.swiper) {
81                this.swiper.destroy(true, true);
82                this.swiper = null;
83            }
84        };
85
86        initSwiper();
87        window.addEventListener('resize', initSwiper);
88    },
89};

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.