PageSourceSearch

https://kupitekvartiru.com/error_reporter_api/api.js

js kupitekvartiru.com collected 2026-10-05 06:46:46 UTC 3,247 bytes, 110 lines download raw bytes

1(function (window, document) {
2    'use strict';
3
4    console.log('js error api loaded');
5    var baseUrl = isApiLoadedDirectly()
6        ? 'https://error-reporter-api.whitewill.ru/api.php'
7        : '/error_reporter_api/api.php';
8
9    window.onerror = function (msg, url, lineNo, columnNo, error) {
10        if (typeof window.SW_BS !== 'undefined') {
11            if (!window.SW_BS.isInit) {
12                window.SW_BS.init();
13            }
14            if (window.SW_BS.browser.name == 'Microsoft Internet Explorer' && window.SW_BS.browser.version < 12) {
15                return;
16            }
17        }
18        console.log('error');
19        var location = getLocation(url);
20        if (location.hostname !== 't5.moscowcitysale.ru' && location.hostname !== window.location.hostname) {
21            return;
22        } else if (url.indexOf('//') === 0) {
23            return;
24        }
25
26        if (error) {
27            var stack = error.stack;
28            if (stack !== '') {
29                console.log(error);
30                ajax(
31                    baseUrl,
32                    'POST',
33                    {stack: stack, type: 'js', name: msg}
34                );
35            }
36        }
37        return false;
38    };
39
40    function ajax(url, type, data) {
41        console.log('ajax send');
42        if (typeof window.$ === 'undefined') {
43            var xhr = new window.XMLHttpRequest();
44            xhr.open(type, url);
45            xhr.setRequestHeader('Content-type', 'application/json');
46            xhr.send(JSON.stringify(data));
47        } else {
48            window.$.ajax({
49                url: url,
50                method: type,
51                data: data
52            });
53        }
54    }
55
56    window.formErrorApi = function (data, form_name, crm_http_code) {
57        if (data === undefined) {
58            data = null;
59        }
60        if (typeof data == 'string') {
61            try {
62                data = JSON.parse(data);
63            } catch (e) {}
64        }
65        ajax(
66            baseUrl,
67            'POST',
68            {
69                stack: data,
70                type: 'form',
71                form_name: form_name,
72                crm_http_code: crm_http_code,
73            }
74        );
75    };
76
77    function isApiLoadedDirectly() {
78        var directApiHost = 'error-reporter-api.whitewill.ru';
79        var currentScript = document.currentScript;
80
81        if (currentScript && currentScript.src) {
82            return getLocation(currentScript.src).hostname === directApiHost;
83        }
84
85        var scripts = document.getElementsByTagName('script');
86        for (var i = scripts.length - 1; i >= 0; i--) {
87            if (!scripts[i].src) {
88                continue;
89            }
90
91            var scriptLocation = getLocation(scripts[i].src);
92            if (scriptLocation.hostname === directApiHost && scriptLocation.pathname === '/api.js') {
93                return true;
94            }
95        }
96
97        return false;
98    }
99
100    function isValidUrl(url) {
101        var objRE = /(^https?:\/\/)?[a-z0-9~_\-\.]+\.[a-z]{2,9}(\/|:|\?[!-~]*)?$/i;
102        return objRE.test(url);
103    }
104
105    function getLocation(url) {
106        var l = document.createElement('a');
107        l.href = url;
108        return l;
109    }
110}(window, document));

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.