PageSourceSearch

https://kazssl.com/js/common.js

js kazssl.com collected 2026-10-05 00:13:02 UTC 6,575 bytes, 200 lines download raw bytes

1$(".prev-button").click(function () {
2    window.history.go(-1);
3});
4
5
6function reCaptchaToken(action = "", input_id = "#rct", callback = false) {
7    if ( action.length < 1 ) {
8        action = "homepage";
9    }
10    grecaptcha.ready(function () {
11        grecaptcha.execute(re_public_key, {action: action}).then(function (token) {
12            $(input_id).each(function () {
13                $(this).val(token);
14            });
15
16            if ( typeof callback == 'function' ) {
17                callback();
18            }
19        });
20    });
21}
22
23function sendAjaxPostRequest(url, reqObj, blockUi = true, customBlockTarget = false) {
24    return $.ajax({
25        url: url,
26        method: 'POST',
27        data: reqObj,
28        beforeSend: function (xhr) {
29            if ( blockUi == true ) {
30                if ( customBlockTarget === false ) {
31                    BlockUI();
32                } else {
33                    BlockCustomTarget(customBlockTarget.target, customBlockTarget.message, customBlockTarget.css);
34                }
35            }
36        }
37    }).fail(function (xhr, status, error) {
38        ShowErrorNotification(error);
39    }).always(function () {
40        if ( blockUi == true ) {
41            if ( customBlockTarget === false ) {
42                UnBlockUI();
43            } else {
44                UnBlockCustomTarget(customBlockTarget.target);
45            }
46        }
47    });
48}
49
50function parseAjaxResponse(data, message, callback) {
51    try {
52        var json = $.parseJSON(data);
53        if ( json.STATUS == 'OK' ) {
54            if ( message.length > 0 ) {
55                ShowSuccessNotification(message);
56            }
57        } else {
58            if ( json.STATUS == 'ERROR' ) {
59                if ( json.ERROR.length > 0 ) {
60                    ShowErrorNotification(json.ERROR);
61                }
62            }
63        }
64
65        if ( typeof callback == 'function' ) {
66            if ( arguments.length > 3 ) {
67                var args = [];
68                for (var i = 3; i < arguments.length; i++) {
69                    args.push(arguments[i]);
70                }
71                callback(json, args);
72            } else {
73                callback(json);
74            }
75        }
76    } catch (e) {
77        console.log(e);
78        ShowErrorNotification("Ошибка обработки ответа. Обратитесь в техническую поддержку!");
79    }
80}
81
82function parseAjaxResponseEx(data, message, callback, exCallback) {
83    try {
84        var json = $.parseJSON(data);
85        if ( json.STATUS == 'OK' ) {
86            if ( message.length > 0 ) {
87                ShowSuccessNotification(message);
88            }
89
90            if ( typeof callback == 'function' ) {
91                if ( arguments.length > 4 ) {
92                    var args = [];
93                    for (var i = 4; i < arguments.length; i++) {
94                        args.push(arguments[i]);
95                    }
96                    callback(json, args);
97                } else {
98                    callback(json);
99                }
100            }
101        } else {
102            ShowErrorNotification(json.ERROR);
103        }
104    } catch (e) {
105        ShowErrorNotification("Ошибка обработки ответа. Обратитесь в техническую поддержку!");
106        exCallback();
107    }
108}
109
110function ReloadPage() {
111    document.location.reload();
112}
113
114function LocalRedirect(href) {
115    window.location.href = href;
116}
117
118function ResetForm(form_id) {
119    $("#" + form_id)[0].reset();
120}
121
122function GetCurrentURI() {
123    return document.location.href;
124}
125
126function NumberFormat(number, decimal = false) {
127    var formatedNumber = '';
128    var arNumbers = number.toString().split('').reverse();
129    for (var i = 0; i < arNumbers.length; i++) {
130        formatedNumber = arNumbers[i] + formatedNumber;
131        if ( ((i + 1) % 3) == 0 && (i + 1) != arNumbers.length ) {
132            formatedNumber = " " + formatedNumber;
133        }
134    }
135    if ( decimal ) {
136        formatedNumber += ",00"
137    }
138    return formatedNumber;
139}
140
141/*
142 * Natural Sort algorithm for Javascript - Version 0.7 - Released under MIT license
143 * Author: Jim Palmer (based on chunking idea from Dave Koelle)
144 * Contributors: Mike Grier (mgrier.com), Clint Priest, Kyle Adams, guillermo
145 * See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js
146 */
147function naturalSort(a, b, html) {
148    var re = /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?%?$|^0x[0-9a-f]+$|[0-9]+)/gi,
149        sre = /(^[ ]*|[ ]*$)/g,
150        dre = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,
151        hre = /^0x[0-9a-f]+$/i,
152        ore = /^0/,
153        htmre = /(<([^>]+)>)/ig,
154        // convert all to strings and trim()
155        x = a.toString().replace(sre, '') || '',
156        y = b.toString().replace(sre, '') || '';
157    // remove html from strings if desired
158    if ( !html ) {
159        x = x.replace(htmre, '');
160        y = y.replace(htmre, '');
161    }
162    // chunk/tokenize
163    var xN = x.replace(re, '\0$1\0').replace(/\0$/, '').replace(/^\0/, '').split('\0'),
164        yN = y.replace(re, '\0$1\0').replace(/\0$/, '').replace(/^\0/, '').split('\0'),
165        // numeric, hex or date detection
166        xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)),
167        yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null;
168
169    // first try and sort Hex codes or Dates
170    if ( yD ) {
171        if ( xD < yD ) {
172            return -1;
173        } else if ( xD > yD ) {
174            return 1;
175        }
176    }
177
178    // natural sorting through split numeric strings and default strings
179    for (var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
180        // find floats not starting with '0', string or 0 if not defined (Clint Priest)
181        var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc], 10) || xN[cLoc] || 0;
182        var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc], 10) || yN[cLoc] || 0;
183        // handle numeric vs string comparison - number < string - (Kyle Adams)
184        if ( isNaN(oFxNcL) !== isNaN(oFyNcL) ) {
185            return (isNaN(oFxNcL)) ? 1 : -1;
186        }
187        // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
188        else if ( typeof oFxNcL !== typeof oFyNcL ) {
189            oFxNcL += '';
190            oFyNcL += '';
191        }
192        if ( oFxNcL < oFyNcL ) {
193            return -1;
194        }
195        if ( oFxNcL > oFyNcL ) {
196            return 1;
197        }
198    }
199    return 0;
200}

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.