PageSourceSearch

https://door-hunter.ru/js_new/geo_check.js

js door-hunter.ru collected 2026-10-09 21:51:43 UTC 3,355 bytes, 76 lines download raw bytes

1function setGeoCookie(cname, cvalue, exdays) {
2    const d = new Date();
3    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
4    let expires = "expires="+d.toUTCString();
5    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
6}
7function getGeoCookie(cname) {
8    let name = cname + "=";
9    let ca = document.cookie.split(';');
10    for(let i = 0; i < ca.length; i++) {
11        let c = ca[i];
12        while (c.charAt(0) == ' ') {
13            c = c.substring(1);
14        }
15        if (c.indexOf(name) == 0) {
16            return c.substring(name.length, c.length);
17        }
18    }
19    return "";
20}
21
22function checkGeoCookie() {
23    let geo = getGeoCookie("geo");
24    if (geo != "") {
25
26    } else {
27        let xhr = new XMLHttpRequest()
28        xhr.open('POST', "/getGeo.php", true)
29        xhr.setRequestHeader('Content-type', 'application/json; charset=UTF-8')
30        xhr.send();
31        xhr.onload = function () {
32            let parsed_response = JSON.parse(xhr.response)
33            if(parsed_response.city_name.length != 'undefined' && parsed_response.city_name.length > 1 && parsed_response.link.length > 1 && parsed_response.link.length != 'undefined'){
34                /*if(confirm("Âàø ãîðîä "+parsed_response.city_name+"?")){
35                    window.location.href = parsed_response.link + '' + window.location.pathname;
36                }*/
37            	const modalHTML = `
38                    <div class="modal fade" id="cityConfirmModal" tabindex="-1" aria-hidden="true">
39                        <div class="modal-dialog">
40                            <div class="modal-content">
41                                <div class="modal-header">
42                                    <span class="modal-title">Ïîäòâåðæäåíèå ãîðîäà</span>
43                                    <button type="button" class="btn-close" data-dismiss="modal" aria-label="Close"></button>
44                                </div>
45                                <div class="modal-body">
46                                    Âàø ãîðîä <strong>${parsed_response.city_name}</strong>?
47                                </div>
48                                <div class="modal-footer">
49                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Íåò</button>
50                                    <button type="button" class="btn btn-primary input-submit" id="confirmCityBtn">Äà</button>
51                                </div>
52                            </div>
53                        </div>
54                    </div>
55                `;
56
57                // Äîáàâëÿåì ìîäàëüíîå îêíî â DOM
58                document.body.insertAdjacentHTML('beforeend', modalHTML);
59
60                // Èíèöèàëèçàöèÿ ìîäàëüíîãî îêíà
61                const modal = new bootstrap.Modal(document.getElementById('cityConfirmModal'));
62                modal.show();
63
64                // Îáðàáîò÷èê ïîäòâåðæäåíèÿ
65                document.getElementById('confirmCityBtn').addEventListener('click', () => {
66                    window.location.href = parsed_response.link + window.location.pathname;
67                });
68            }
69        }
70        geo = 1
71        if (geo != "" && geo != null) {
72            setGeoCookie("geo", geo, 1);
73        }
74    }
75}
76checkGeoCookie()

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.