PageSourceSearch

https://subbclub.ru/js/alcr.js?1594191183

js subbclub.ru collected 2026-10-06 07:02:59 UTC 32,553 bytes, 864 lines download raw bytes

1//noinspection JSUnusedLocalSymbols,JSUnusedGlobalSymbols,JSUnusedGlobalSymbols
2let alcr = {
3    translations: {},
4    symbols: {
5        'RUB': "<span class='h-font--rouble'>a</span>",
6        'MIL': "<span aria-hidden='true' class='h-font--aero'>Â¥</span>",
7        'USD': '$',
8        'EUR': '€'
9    },
10    validateURL: function (url) {
11        var parser = document.createElement('a');
12        try {
13            parser.href = url;
14            return !!parser.hostname;
15        } catch (e) {
16            return false;
17        }
18    },
19    isMobile: function () {
20        let m;
21        try {
22            document.createEvent('TouchEvent');
23            m = true;
24        } catch (e) {
25            m = false;
26        }
27        return m;
28    },
29    date_i18n: {
30        de: {
31            previousMonth: 'Vorheriger Monat',
32            nextMonth: 'Nächsten Monat',
33            months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
34            weekdays: 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
35            weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_')
36        },
37        en: {
38            previousMonth: 'Mes anterior',
39            nextMonth: 'Próximo mes',
40            months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
41            weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
42            weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
43        },
44        es: {
45            previousMonth: 'Предыдущий месяц',
46            nextMonth: 'следующий месяц',
47            months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
48            weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
49            weekdaysShort: 'dom_lun_mar_mié_jue_vie_sáb'.split('_')
50        },
51        fr: {
52            previousMonth: 'Mois précédent',
53            nextMonth: 'Mois prochain',
54            months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
55            weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
56            weekdaysShort: 'dim_lun_mar_mer_jeu_ven_sam'.split('_')
57        },
58        it: {
59            previousMonth: 'Il mese scorso',
60            nextMonth: 'Il prossimo mese',
61            months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'),
62            weekdays: 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'),
63            weekdaysShort: 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_')
64        },
65        ja: {
66            previousMonth: '前の月',
67            nextMonth: '来月',
68            months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
69            weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
70            weekdaysShort: '日_月_火_水_木_金_土'.split('_')
71        },
72        ko: {
73            previousMonth: '지난 달',
74            nextMonth: '다음 달',
75            months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
76            weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
77            weekdaysShort: '일_월_화_수_목_금_토'.split('_')
78        },
79        ru: {
80            previousMonth: 'Предыдущий месяц',
81            nextMonth: 'следующий месяц',
82            months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
83            weekdays: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
84            weekdaysShort: ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб']
85        },
86        zh: {
87            previousMonth: '前一个月',
88            nextMonth: '下个月',
89            months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
90            weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
91            weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_')
92        }
93    },
94    parseDate: function (input, format) {
95        format = format || 'yyyy-mm-dd'; // default format
96        let parts = input.match(/(\d+)/g),
97            i = 0, fmt = {};
98        // extract date-part indexes from the format
99        format.replace(/(yyyy|dd|mm)/g, function (part) {
100            fmt[part] = i++;
101        });
102
103        return new Date(parts[fmt['yyyy']], parts[fmt['mm']] - 1, parts[fmt['dd']]);
104    },
105    set_cookie: function (name, value) {
106        document.cookie = [name, '=', JSON.stringify(value), '; domain=.', window.location.host.toString(), '; path=/;'].join('');
107    },
108    get_cookie: function (name) {
109        let result = document.cookie.match(new RegExp(name + '=([^;]+)'));
110        result && (result = JSON.parse(result[1]));
111        return result;
112    },
113    remove_cookie: function (name) {
114        document.cookie = [name, '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=.', window.location.host.toString()].join('');
115    },
116    upset_cookie: function (name, value) {
117        alcr.remove_cookie(name);
118        alcr.set_cookie(name, value);
119    },
120    array_sum: function (array) {
121        let sum = 0;
122        if (array) {
123            for (let key in array) {
124                sum += parseFloat(array[key]);
125            }
126        }
127        return sum;
128    },
129    translateString: function (string, params) {
130        for (let i in params) {
131            string = alcr.str_replace(i, params[i], string);
132        }
133        return string;
134    },
135    str_replace: function (search, replace, subject) {
136        return subject.split(search).join(replace);
137    },
138    declOfNum: function (number, titles) {
139        let cases = [2, 0, 1, 1, 1, 2];
140        return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]];
141    },
142    in_array: function (needle, haystack, strict) {
143        let found = false, key, itstrict = !!strict;
144        for (key in haystack) {
145            if ((itstrict && haystack[key] === needle) || (!itstrict && haystack[key] == needle)) {
146                found = true;
147                break;
148            }
149        }
150        return found;
151    },
152    number_format: function (number, decimals, dec_point, thousands_sep) {
153        let i, j, kw, kd, km;
154        if (isNaN(decimals = Math.abs(decimals))) {
155            decimals = 2;
156        }
157
158        if (dec_point === undefined) {
159            dec_point = ",";
160        }
161        if (thousands_sep === undefined) {
162            thousands_sep = ".";
163        }
164
165        i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
166
167        if ((j = i.length) > 3) {
168            j = j % 3;
169        } else {
170            j = 0;
171        }
172        km = (j ? i.substr(0, j) + thousands_sep : "");
173        kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
174        kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : "");
175        return km + kw + kd;
176    },
177    /**
178     * @param url
179     * @returns {{}}
180     */
181    parseParams: function (url) {
182        let request = {};
183        let pairs = url.substring(url.indexOf('?') + 1).split('&');
184        let old;
185        for (let i = 0; i < pairs.length; i++) {
186            let pair = pairs[i].split('=');
187
188            if (request[decodeURIComponent(pair[0])] && request[decodeURIComponent(pair[0])] != decodeURIComponent(pair[1])) {
189                if (typeof (request[decodeURIComponent(pair[0])]) == 'string') {
190                    old = request[decodeURIComponent(pair[0])];
191                    request[decodeURIComponent(pair[0])] = [];
192                    request[decodeURIComponent(pair[0])][0] = old;
193                }
194                request[decodeURIComponent(pair[0])].push(decodeURIComponent(pair[1]));
195            } else {
196                request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
197            }
198        }
199        return request;
200    },
201    parseForm: function (selector) {
202        if ($(selector).find('.ckeditor').length > 0) {
203            for (var instance in CKEDITOR.instances) {
204                //noinspection JSUnfilteredForInLoop
205                CKEDITOR.instances[instance].updateElement();
206            }
207        }
208        return alcr.parseParams($(selector).serialize());
209    },
210    implode: function (glue, pieces) {
211        return ((pieces instanceof Array) ? pieces.join(glue) : pieces);
212    },
213    build_url: function (controller, params) {
214        let string = [];
215        let i = 0;
216        if (params) {
217            for (let index in params) {
218                string[i] = index + '=' + params[index];
219                i++;
220            }
221            params = "?" + alcr.implode('&', string);
222        }
223        return (params ? '/' + controller + '/' + params : '/' + controller + '/');
224    },
225
226    build_method_url: function (controller, method, params, query_string) {
227        let string = [];
228        let i = 0;
229        if (params) {
230            if ((params).length > 2 || !!query_string) {
231                for (let index in params) {
232                    //noinspection JSUnfilteredForInLoop
233                    string[i] = index + '=' + params[index];
234                    i++;
235                }
236                params = "?" + alcr.implode('&', string);
237            } else {
238                params = alcr.implode('/', params);
239            }
240        }
241        return (params ? '/' + controller + '/' + method + '/' + params : '/' + controller + '/' + method + '/');
242    },
243    build_ext_method_url: function (controller, method, params, query_string) {
244        var string = [];
245        var i = 0;
246        if (params) {
247            if ((params).length > 2 || query_string == true) {
248                for (var index in params) {
249                    //noinspection JSUnfilteredForInLoop
250                    string[i] = index + '=' + params[index];
251                    i++;
252                }
253                params = "?" + cc.implode('&', string);
254            } else {
255                params = cc.implode('/', params);
256            }
257        }
258        return (params ? controller + '/' + method + '/' + params : controller + '/' + method + '/');
259    },
260    encode64: function (input) {
261        input = escape(input);
262        var output = "";
263        var chr1, chr2, chr3 = "";
264        var enc1, enc2, enc3, enc4 = "";
265        var i = 0;
266
267        do {
268            chr1 = input.charCodeAt(i++);
269            chr2 = input.charCodeAt(i++);
270            chr3 = input.charCodeAt(i++);
271
272            enc1 = chr1 >> 2;
273            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
274            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
275            enc4 = chr3 & 63;
276
277            if (isNaN(chr2)) {
278                enc3 = enc4 = 64;
279            } else if (isNaN(chr3)) {
280                enc4 = 64;
281            }
282
283            output = output +
284                keyStr.charAt(enc1) +
285                keyStr.charAt(enc2) +
286                keyStr.charAt(enc3) +
287                keyStr.charAt(enc4);
288            chr1 = chr2 = chr3 = "";
289            enc1 = enc2 = enc3 = enc4 = "";
290        } while (i < input.length);
291
292        return output;
293    },
294    decode64: function (input) {
295        var output = "";
296        var chr1, chr2, chr3 = "";
297        var enc1, enc2, enc3, enc4 = "";
298        var i = 0;
299
300        // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
301        var base64test = /[^A-Za-z0-9\+\/\=]/g;
302        if (base64test.exec(input)) {
303            alert("There were invalid base64 characters in the input text.\n" +
304                "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
305                "Expect errors in decoding.");
306        }
307        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
308        do {
309            enc1 = keyStr.indexOf(input.charAt(i++));
310            enc2 = keyStr.indexOf(input.charAt(i++));
311            enc3 = keyStr.indexOf(input.charAt(i++));
312            enc4 = keyStr.indexOf(input.charAt(i++));
313
314            chr1 = (enc1 << 2) | (enc2 >> 4);
315            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
316            chr3 = ((enc3 & 3) << 6) | enc4;
317
318            output = output + String.fromCharCode(chr1);
319
320            if (enc3 !== 64) {
321                output = output + String.fromCharCode(chr2);
322            }
323            if (enc4 !== 64) {
324                output = output + String.fromCharCode(chr3);
325            }
326
327            chr1 = chr2 = chr3 = "";
328            enc1 = enc2 = enc3 = enc4 = "";
329
330        } while (i < input.length);
331
332        return unescape(output);
333    },
334    ch(A, B) {
335        if (A.length === B.length) {
336            var r = true;
337            for (var m in A) {
338                if (Array.isArray(A[m])) {
339                    r = this.ch(A[m], B[m]);
340                } else {
341                    r = true;
342                }
343            }
344            return r;
345        } else {
346            return false;
347        }
348    },
349    /**
350     *
351     * @returns {number}
352     * @constructor
353     */
354    S4: function () {
355        var m = (((1 + Math.random()) * 0x10000) | 0);
356        m = m.toString(16).substring(1);
357        return m;
358    },
359    us: function () {
360        return (cc.S4() + cc.S4() + "-" + cc.S4() + "-" + cc.S4() + "-" + cc.S4() + "-" + cc.S4() + cc.S4() + cc.S4());
361    },
362    //Транслитерация кириллицы в URL
363    url_translit: function (str) {
364        str = str.toLowerCase(); // все в нижний регистр
365        var cyr2latChars = [['а', 'a'], ['б', 'b'], ['в', 'v'], ['г', 'g'],
366            ['д', 'd'], ['е', 'e'], ['ё', 'yo'], ['ж', 'zh'], ['з', 'z'],
367            ['и', 'i'], ['й', 'y'], ['к', 'k'], ['л', 'l'],
368            ['м', 'm'], ['н', 'n'], ['о', 'o'], ['п', 'p'], ['р', 'r'],
369            ['с', 's'], ['т', 't'], ['у', 'u'], ['ф', 'f'],
370            ['х', 'h'], ['ц', 'c'], ['ч', 'ch'], ['ш', 'sh'], ['щ', 'shch'],
371            ['ъ', ''], ['ы', 'y'], ['ь', ''], ['э', 'e'], ['ю', 'yu'], ['я', 'ya'],
372
373            ['А', 'A'], ['Б', 'B'], ['В', 'V'], ['Г', 'G'],
374            ['Д', 'D'], ['Е', 'E'], ['Ё', 'YO'], ['Ж', 'ZH'], ['З', 'Z'],
375            ['И', 'I'], ['Й', 'Y'], ['К', 'K'], ['Л', 'L'],
376            ['М', 'M'], ['Н', 'N'], ['О', 'O'], ['П', 'P'], ['Р', 'R'],
377            ['С', 'S'], ['Т', 'T'], ['У', 'U'], ['Ф', 'F'],
378            ['Х', 'H'], ['Ц', 'C'], ['Ч', 'CH'], ['Ш', 'SH'], ['Щ', 'SHCH'],
379            ['Ъ', ''], ['Ы', 'Y'],
380            ['Ь', ''],
381            ['Э', 'E'],
382            ['Ю', 'YU'],
383            ['Я', 'YA'],
384
385            ['a', 'a'], ['b', 'b'], ['c', 'c'], ['d', 'd'], ['e', 'e'],
386            ['f', 'f'], ['g', 'g'], ['h', 'h'], ['i', 'i'], ['j', 'j'],
387            ['k', 'k'], ['l', 'l'], ['m', 'm'], ['n', 'n'], ['o', 'o'],
388            ['p', 'p'], ['q', 'q'], ['r', 'r'], ['s', 's'], ['t', 't'],
389            ['u', 'u'], ['v', 'v'], ['w', 'w'], ['x', 'x'], ['y', 'y'],
390            ['z', 'z'],
391
392            ['A', 'A'], ['B', 'B'], ['C', 'C'], ['D', 'D'], ['E', 'E'],
393            ['F', 'F'], ['G', 'G'], ['H', 'H'], ['I', 'I'], ['J', 'J'], ['K', 'K'],
394            ['L', 'L'], ['M', 'M'], ['N', 'N'], ['O', 'O'], ['P', 'P'],
395            ['Q', 'Q'], ['R', 'R'], ['S', 'S'], ['T', 'T'], ['U', 'U'], ['V', 'V'],
396            ['W', 'W'], ['X', 'X'], ['Y', 'Y'], ['Z', 'Z'],
397
398            [' ', '_'], ['0', '0'], ['1', '1'], ['2', '2'], ['3', '3'],
399            ['4', '4'], ['5', '5'], ['6', '6'], ['7', '7'], ['8', '8'], ['9', '9'],
400            ['-', '-']];
401
402        var newStr = String();
403
404        for (var i = 0; i < str.length; i++) {
405
406            var ch = str.charAt(i);
407            var newCh = '';
408
409            for (var j = 0; j < cyr2latChars.length; j++) {
410                if (ch == cyr2latChars[j][0]) {
411                    newCh = cyr2latChars[j][1];
412
413                }
414            }
415            // Если найдено совпадение, то добавляется соответствие, если нет - пустая строка
416            newStr += newCh;
417
418        }
419        // Удаляем повторяющие знаки - Именно на них заменяются пробелы.
420        // Так же удаляем символы перевода строки, но это наверное уже лишнее
421        return newStr.replace(/[_]{2,}/gim, '_').replace(/\n/gim, '');
422    },
423    objectsize: function (obj) {
424        let size = 0, key;
425        for (key in obj) {
426            if (obj.hasOwnProperty(key)) size++;
427        }
428        return size;
429    },
430    options: {},
431    specials: {},
432    ext: function (object) {
433        /**
434         * Base helpers
435         */
436        if (object.specials) {
437            for (let s_index in object.specials) {
438                //noinspection JSUnfilteredForInLoop,JSUnfilteredForInLoop
439                alcr[s_index] = object.specials[s_index];
440            }
441        }
442        /**
443         * Init page
444         */
445        if (object.init) {
446            for (let i_index in object.init) {
447                //noinspection JSUnfilteredForInLoop
448                alcr.init[i_index] = object.init[i_index];
449            }
450        }
451        /**
452         * Late (after Init) page
453         */
454        if (object.late) {
455            for (let i_index in object.late) {
456                //noinspection JSUnfilteredForInLoop
457                alcr.late[i_index] = object.late[i_index];
458            }
459        }
460        /**
461         * controllers in subs
462         */
463        if (object.controllers) {
464            for (let c_index in object.controllers) {
465                //noinspection JSUnfilteredForInLoop
466                alcr.controllers[c_index] = object.controllers[c_index];
467            }
468        }
469        /**
470         * if any special models
471         */
472        if (object.models) {
473            for (let m_index in object.models) {
474                //noinspection JSUnfilteredForInLoop
475                alcr.models[m_index] = object.models[m_index];
476            }
477        }
478        /**
479         * show everywhere
480         */
481        if (object.show) {
482            for (let sh_index in object.show) {
483                //noinspection JSUnfilteredForInLoop
484                alcr.show[sh_index] = object.show[sh_index];
485            }
486        }
487        /**
488         * page end/close
489         */
490        if (object.unload) {
491            for (let u_index in object.unload) {
492                //noinspection JSUnfilteredForInLoop
493                alcr.unload[u_index] = object.unload[u_index];
494            }
495        }
496
497        /**
498         * Current screen
499         */
500        if (object.current_screen) {
501            alcr.current_screen = object.current_screen;
502        }
503
504
505    },
506    init: {
507        translator: function () {
508            window.translator = new yt.PageTranslator({
509                srv: 'tr-url-widget',
510                sid: 'dcf35f2f.5ba1e2b3.8135f3f2',
511                url: 'https://translate.yandex.net/api/v1/tr.json/translate',
512                autoSync: true,
513                maxPortionLength: 600
514            });
515        }
516    },
517    late: {},
518    unload: {},
519    controllers: {
520        ext: function (object) {
521            alcr.ext(object);
522        },
523        show: function (selector) {
524            alcr.show.show(selector);
525        },
526        check: function (selector) {
527            $(selector).prop('checked', true);
528        },
529        radiocheck: function (selector, value) {
530            $(selector).val(value);
531        },
532        show_hidden: function (selector) {
533            if ($(selector).hasClass('active') === false) {
534                $(selector).show();
535                $(selector).addClass('active');
536            }
537        },
538        hide_active: function (selector) {
539            if ($(selector).hasClass('active')) {
540                $(selector).hide();
541                $(selector).removeClass('active');
542            }
543        },
544        translate: function (languageFrom, languageTo) {
545            window.translator.translate(languageFrom, languageTo);
546        }
547    },
548    models: {
549        _get: function (controller, method, options) {
550            let result, url;
551            url = alcr.build_method_url(controller, method, options);
552            result = alcr.models.__sysGet(url);
553            return result;
554        },
555        _getASYNC: function (controller, method, options, callback, tskMgrName, errorCallback) {
556            let result, url;
557            url = alcr.build_method_url(controller, method);
558            result = alcr.models.__sysGet(url, options, callback, true, tskMgrName, 0, errorCallback);
559            return result;
560        },
561        _getJson: function (controller, method, options) {
562            let result, url;
563            url = alcr.build_method_url(controller, method, options);
564            result = alcr.models.__sysGetJSON(url);
565            return result;
566        },
567        _getJsonASYNC: function (controller, method, options, callback, tskMgrName, errorCallback) {
568            let result, url;
569            url = alcr.build_method_url(controller, method);
570            result = alcr.models.__sysGetJSON(url, options, callback, true, tskMgrName, 0, errorCallback);
571            return result;
572        },
573        _post: function (controller, method, options) {
574            let result, url;
575            url = alcr.build_method_url(controller, method);
576            result = alcr.models.__sysPost(url, options);
577            return result;
578        },
579        _postASYNC: function (controller, method, options, callback, tskMgrName, errorCallback) {
580            let result, url;
581            url = alcr.build_method_url(controller, method);
582            result = alcr.models.__sysPost(url, options, callback, true, tskMgrName, 0, errorCallback);
583            return result;
584        },
585        _postJson: function (controller, method, options) {
586            let result, url;
587            url = alcr.build_method_url(controller, method);
588            result = alcr.models.__sysPostJSON(url, options);
589            return result;
590        },
591        _postJsonASYNC: function (controller, method, options, callback, tskMgrName, errorCallback) {
592            let result, url;
593            url = alcr.build_method_url(controller, method);
594            result = alcr.models.__sysPostJSON(url, options, callback, true, tskMgrName, 0, errorCallback);
595            return result;
596        },
597        __sysGet: function (url, options, callback, async, tskMgrName, callcounter, errorCallback) {
598            if (!callcounter) {
599                callcounter = 1;
600            }
601            let result = null;
602            let asynct = false;
603            if (async) {
604                asynct = async;
605            } else {
606                asynct = false;
607            }
608
609            window[tskMgrName ? tskMgrName : 'lastCall'] = $.ajax(
610                {
611                    url: url,
612                    type: 'GET',
613                    async: asynct,
614                    data: options,
615                    success: function (data) {
616                        result = data;
617                        if (callback) {
618                            callback(result);
619                        }
620                    },
621                    error: function (jqXHR, textStatus, errorThrown) {
622                        if (async) {
623                            callcounter++;
624                            if (callcounter < 3) {
625                                /**
626                                 * Повторный вызов
627                                 */
628                                alcr.models.__sysGet(url, options, callback, async, tskMgrName, callcounter, errorCallback);
629                            } else {
630                                /**
631                                 * Показать ошибку
632                                 */
633                                if (!!errorCallback) {
634                                    errorCallback();
635                                }
636                            }
637                        }
638                    }
639                });
640            return result;
641        },
642        __sysGetJSON: function (url, options, callback, async, tskMgrName, callcounter, errorCallback) {
643            if (!callcounter) {
644                callcounter = 1;
645            }
646            let result = null;
647            let asynct = false;
648            if (async) {
649                asynct = async;
650            } else {
651                asynct = false;
652            }
653            window[tskMgrName ? tskMgrName : 'lastCall'] = $.ajax(
654                {
655                    url: url,
656                    type: 'GET',
657                    dataType: 'json',
658                    async: asynct,
659                    data: options,
660                    success: function (data) {
661                        result = data;
662                        if (callback) {
663                            callback(result);
664                        }
665                    },
666                    error: function (jqXHR, textStatus, errorThrown) {
667                        if (async) {
668                            if (callcounter < 3) {
669                                callcounter++;
670                                /**
671                                 * Повторный вызов
672                                 */
673                                alcr.models.__sysGetJSON(url, options, callback, async, tskMgrName, callcounter, errorCallback);
674                            } else {
675                                /**
676                                 * Показать ошибку
677                                 */
678                                if (!!errorCallback) {
679                                    errorCallback();
680                                }
681                            }
682                        }
683                    }
684                });
685            return result;
686        },
687        __sysPost: function (url, options, callback, async, tskMgrName, callcounter, errorCallback) {
688            if (!callcounter) {
689                callcounter = 1;
690            }
691            let result = null;
692            let asynct = false;
693            if (async) {
694                asynct = async;
695            } else {
696                asynct = false;
697            }
698
699            window[tskMgrName ? tskMgrName : 'lastCall'] = $.ajax(
700                {
701                    url: url,
702                    type: 'POST',
703                    async: asynct,
704                    data: options,
705                    success: function (data) {
706                        result = data;
707                        if (callback) {
708                            callback(result);
709                        }
710                    },
711                    error: function (jqXHR, textStatus, errorThrown) {
712                        if (async) {
713                            callcounter++;
714                            if (callcounter < 3) {
715                                /**
716                                 * Повторный вызов
717                                 */
718                                alcr.models.__sysPost(url, options, callback, async, tskMgrName, callcounter, errorCallback);
719                            } else {
720                                /**
721                                 * Показать ошибку
722                                 */
723                                if (!!errorCallback) {
724                                    errorCallback();
725                                }
726                            }
727                        }
728                    }
729                });
730            return result;
731        },
732        __sysPostJSON: function (url, options, callback, async, tskMgrName, callcounter, errorCallback) {
733            if (!callcounter) {
734                callcounter = 1;
735            }
736            let result = null;
737            let asynct = false;
738            if (async) {
739                asynct = async;
740            } else {
741                asynct = false;
742            }
743            window[tskMgrName ? tskMgrName : 'lastCall'] = $.ajax(
744                {
745                    url: url,
746                    type: 'POST',
747                    dataType: 'json',
748                    async: asynct,
749                    data: options,
750                    success: function (data) {
751                        result = data;
752                        if (callback) {
753                            callback(result);
754                        }
755                    },
756                    error: function (jqXHR, textStatus, errorThrown) {
757                        if (async) {
758                            if (callcounter < 3) {
759                                callcounter++;
760                                /**
761                                 * Повторный вызов
762                                 */
763                                alcr.models.__sysPostJSON(url, options, callback, async, tskMgrName, callcounter, errorCallback);
764                            } else {
765                                /**
766                                 * Показать ошибку
767                                 */
768                                if (!!errorCallback) {
769                                    errorCallback();
770                                }
771                            }
772                        }
773                    }
774                });
775            return result;
776        }
777    },
778    show: {
779        show: function (selector) {
780            if ($(selector).hasClass('active')) {
781                $(selector).hide();
782                $(selector).removeClass('active');
783            } else {
784                $(selector).show();
785                $(selector).addClass('active');
786            }
787        },
788        getSelectVal: function (selector) {
789            return $(selector).val();
790        },
791        getCheckboxState: function (selector) {
792            return $(selector).is(":checked");
793        },
794        /**
795         * Форматирование даты
796         * @param date
797         * @returns {string}
798         */
799        formatDate: function (date) {
800            let monthNames = [
801                "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"
802            ];
803
804            let day = date.getDate();
805            let monthIndex = date.getMonth();
806            let year = date.getFullYear();
807
808            return year + '-' + monthNames[monthIndex] + '-' + day;
809        },
810        result: function (result, callback) {
811            bootbox.dialog({
812                title: 'Результат операции',
813                className: 'modal-notify modal-' + result.type,
814                size: 'lg',
815                message: result.message,
816                buttons: {
817                    ok: {
818                        label: 'Ok',
819                        className: 'btn-primary',
820                        callback: function () {
821                            if (callback) {
822                                callback();
823                            } else {
824                                //location.reload();
825                            }
826                        }
827                    }
828                }
829            });
830        }
831    }
832};
833
834let ccli;
835
836
837ccli = alcr.controllers;
838
839$(document).ready(function () {
840    $.each(alcr.init, function (funcname, funcvalue) {
841        funcvalue();
842    });
843});
844
845$.fn.modal.Constructor.prototype.enforceFocus = function () {
846    modal_this = this
847    $(document).on('focusin.modal', function (e) {
848        if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length && $(e.target.parentNode).hasClass('cke_contents cke_reset')
849            && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_select')
850            && !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
851            modal_this.$element.focus()
852        }
853    })
854};
855
856$(document).ready(function () {
857    var windowLate = function () {
858        $.each(alcr.late, function (funcname, funcvalue) {
859            funcvalue();
860        });
861        $('.mdb-select').materialSelect();
862    };
863    setTimeout(windowLate, 10);
864});

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.