PageSourceSearch

https://winoption4.link/core/bcms.js

js winoption4.link collected 2026-09-28 09:07:32 UTC 8,616 bytes, 208 lines download raw bytes

1let timeOnSite = 0;//calculate time of being on the website
2setInterval(function () {
3    timeOnSite = document.cookie.split("; ").find((row) => row.startsWith("timeOnSite="))?.split("=")[1];
4    if (typeof timeOnSite === "undefined" || timeOnSite < 1) timeOnSite = 0;
5    let expireDate = new Date();
6    expireDate = new Date(expireDate.setFullYear(expireDate.getFullYear() + 1));
7    document.cookie = 'timeOnSite=' + (timeOnSite * 1 + 3) + ';expires=' + (expireDate) + ';path=/';
8}, 3000);
9
10let informerErrorsCount = 0
11document.addEventListener("DOMContentLoaded", () => {
12    //DOM has been formed
13    document.querySelectorAll('.rating-stars__label').forEach(trigger => {
14        trigger.addEventListener('click', () => {
15            bcmsAjax('rate', 'rating=' + document.getElementById(trigger.htmlFor).value);
16        });
17    });
18
19    const hideAboutCookiesTrigger = document.querySelector('#hide-about-cookies__trigger');
20    if (hideAboutCookiesTrigger) {
21        hideAboutCookiesTrigger.onclick = function () {
22            document.querySelector('.cookies').style.display = 'none';
23            let expireDate = new Date();
24            expireDate = new Date(expireDate.setFullYear(expireDate.getFullYear() + 1));
25            document.cookie = 'cookiesAlert=1;expires=' + (expireDate) + ';path=/';
26        }
27    }
28
29    logInformer();
30});
31
32async function logInformer() {
33    try {
34        const response = await fetch('/storage/informer.html')
35        if (response.ok) {
36            document.querySelector('#informer').innerHTML = await response.text();
37            return "ok"
38        }
39
40        throw new Error('response status: ' + response.status)
41    } catch (error) {
42        console.error(`Download error: ${error.message}`);
43        informerErrorsCount++
44        if (informerErrorsCount < 5) {
45            setTimeout(logInformer, 3000)
46            return 'error'
47        }
48    }
49}
50
51document.addEventListener("submit", (event) => {
52    document.querySelectorAll('.success-message').forEach(item => {
53        item.style.display = 'none';
54    })
55});
56
57let previousSearchString = '';
58
59document.querySelectorAll('.search__field.form-field').forEach(trigger => {
60    trigger.addEventListener('keyup', function (e) {
61        const searchResultTop = document.querySelector('.search__result-top');
62        const searchResultBottom = document.querySelector('.search__result-bottom');
63        const searchResultBottom2 = document.querySelector('.search__result-bottom2');
64        if (previousSearchString !== this.value) {
65            previousSearchString = this.value;
66            if (this.value.length > 2) {
67                searchResultTop.innerHTML = '<li class="search__item"><span class="search__hint">' + cfg['pw'] + '</span></li>';
68                searchResultTop.classList.add('_show');
69                searchResultBottom.innerHTML = '<li class="search__item"><span class="search__hint">' + cfg['pw'] + '</span></li>';
70                searchResultBottom.classList.add('_show');
71                searchResultBottom2.innerHTML = '<li class="search__item"><span class="search__hint">' + cfg['pw'] + '</span></li>';
72                searchResultBottom2.classList.add('_show');
73                bcmsAjax(trigger.closest('form'));
74            } else {
75                searchResultTop.classList.remove('_show');
76                searchResultBottom.classList.remove('_show');
77                searchResultBottom2.classList.remove('_show');
78            }
79        }
80    })
81});
82
83document.addEventListener('click', (e) => {
84    const target = e.target.closest('.search');
85    if (target) {
86        return;
87    }
88    document.querySelectorAll('.search__result._show').forEach(item => {
89        item.classList.remove('_show');
90    });
91});
92
93window.addEventListener("load", () => {
94    //resources have been loaded
95});
96
97document.querySelectorAll('.anchor').forEach(trigger => {
98    trigger.addEventListener('click', function (e) {
99        e.preventDefault();
100        let anchorHref = e.target.getAttribute('href');
101        anchorHref = anchorHref.split('#');
102        if (typeof anchorHref[1] !== "undefined") {
103            let offsetToFirstErrorNode;
104            let scrollNode;
105            let firstNode;
106            let headerHeight = 0;
107            const fullWidth = Math.max(
108                document.body.scrollWidth,
109                document.documentElement.scrollWidth,
110                document.body.offsetWidth,
111                document.documentElement.offsetWidth,
112                document.body.clientWidth,
113                document.documentElement.clientWidth
114            );
115            if ((fullWidth <= 575) || (fullWidth >= 970))
116                headerHeight = document.querySelector('.header__bottom').getBoundingClientRect().height;
117            firstNode = document.getElementById(anchorHref[1]);
118            scrollNode = window;
119            //console.log(headerHeight);
120            offsetToFirstErrorNode = firstNode.getBoundingClientRect().top + window.scrollY - headerHeight - 10;
121            scrollNode.scroll({top: offsetToFirstErrorNode, behavior: "smooth"});
122        }
123    });
124});
125
126function commonMessageAlerter(selector) {
127    const domNode = document.querySelector(selector);
128    domNode.style.opacity = '0';
129    domNode.style.display = 'table';
130    const offsetDomNode = domNode.getBoundingClientRect().top + window.scrollY - 150;
131    window.scroll({top: offsetDomNode, behavior: "smooth"});
132    setTimeout(() => domNode.style.opacity = '1', 300);
133    setTimeout(() => domNode.style.opacity = '0', 600);
134    setTimeout(() => domNode.style.opacity = '1', 900);
135}
136
137function login(result) {
138    if (result['success'] == '1') {
139        if (typeof result['url'] !== "undefined") location.href = result['url'];
140        else location.reload();
141    }
142}
143
144function forgot(result) {
145    if (result['success'] == '1') commonMessageAlerter('.forgot-message__success');
146}
147
148function contacts(result) {
149    if (result['success'] == '1') commonMessageAlerter('.contacts__success');
150}
151
152function addmessage(result) {
153    if (result['success'] == '1') document.location = '/' + (cfg['lang'] ? cfg['lang'] + '/' : '') + 'dashboard';/*commonMessageAlerter('.add-message__success');*/
154}
155
156function addcomment(result) {
157    if (result['success'] == '1') document.location = '/' + (cfg['lang'] ? cfg['lang'] + '/' : '') + 'dashboard/correspondence/' + result['correspondenceId'];/*commonMessageAlerter('.add-comment__success');*/
158}
159
160function updatePassword(result) {
161    if (result['success'] == '1') commonMessageAlerter('.update-password__success');
162}
163
164function register(result) {
165    if (result['success'] == '1') {
166        const registerSuccessNode = document.querySelector('.register__success');
167        let registerSuccessText = registerSuccessNode.innerHTML;
168        registerSuccessText = registerSuccessText.replace('{email}', result['email']);
169        registerSuccessNode.innerHTML = registerSuccessText;
170        commonMessageAlerter('.register__success');
171        document.getElementById('register').style.display = 'none';
172    }
173}
174
175function updateProfile(result) {
176    if (result['success'] == '1') commonMessageAlerter('.update-profile__success');
177}
178
179function rate(result) {
180    document.querySelectorAll('.rating-stars__input').forEach(function (item) {
181        item.setAttribute('disabled', 'disabled')
182    });
183    if (result['success'] == '1') {
184        document.getElementById('current-rate').innerHTML = result['newRate'];
185        const newRateInt = Math.floor(result['newRate']);
186        document.querySelectorAll('.rating-stars__input').forEach(function (item) {
187            item.removeAttribute('checked', 'checked')
188        });
189        document.getElementById('rating-stars-' + newRateInt).setAttribute('checked', 'checked');
190        for (let i = 1; i <= 5; i++)
191            document.getElementById('rating-star-icon-' + i).style.color = '#ffc800';
192        for (let i = newRateInt + 1; i <= 5; i++)
193            document.getElementById('rating-star-icon-' + i).style.color = '#ddd';
194        commonMessageAlerter('.rate__success_message');
195    }
196}
197
198function search(result) {
199    const searchResultTop = document.querySelector('.search__result-top');
200    const searchResultBottom = document.querySelector('.search__result-bottom');
201    const searchResultBottom2 = document.querySelector('.search__result-bottom2');
202    searchResultTop.innerHTML = result['html'];
203    searchResultTop.classList.add('_show');
204    searchResultBottom.innerHTML = result['html'];
205    searchResultBottom.classList.add('_show');
206    searchResultBottom2.innerHTML = result['html'];
207    searchResultBottom2.classList.add('_show');
208}

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.