PageSourceSearch

https://app.blinger.io/js/main.js?v=1677175066

js blinger.io collected 2026-09-28 08:07:17 UTC 18,149 bytes, 588 lines download raw bytes

1$(document).ready(function () {
2
3    $(".alert.alert-dismissible").delay(10000).slideUp(200, function () {
4        $(this).alert('close');
5    });
6
7    $("#telegram-app-form").submit(function () {
8        var number = $("#telegramappphoneform-phone_number").intlTelInput("getNumber");
9
10        $('#telegramappphoneform-phone_number_full').val(number);
11
12        return true;
13    });
14
15    $("#whatsapp-app-form").submit(function () {
16        var number = $("#whatsappappform-phone_number").intlTelInput("getNumber");
17
18        $('#whatsappappform-phone_number_full').val(number);
19
20        return true;
21    });
22
23    $(".btn-prices .btn").on('click', function () {
24        $(".btn-prices .btn").removeClass('active');
25        $(this).addClass('active');
26    });
27
28    $('#agree-checkbox').on('change', function(e) {
29        $('button[name="registration-button"]').prop('disabled', !e.target.checked);
30    });
31
32    $('.nav-icons.icon-only').on('click', function() {
33        $(this).toggleClass('is-active');
34    });
35
36    $('.profile').on('click', function() {
37        $(this).toggleClass('is-active');
38    });
39
40    $(document).on('click', function (e) {
41        if (!$(e.target).hasClass('.nav-icons.icon-only')) {
42            $('.nav-icons').removeClass('is-active');
43        }
44        if (!$(e.target).hasClass('.profile')) {
45            $('.profile').removeClass('is-active');
46        }
47    });
48
49    var showBlinger = function () {
50        if (typeof Blinger !== 'undefined' && !Blinger.launcherWidget.isOpen) {
51            Blinger.launcherWidget.onLaunchButtonClick();
52        }
53    };
54
55    $('#open-live-chat').on('click', function (e) {
56        e.preventDefault();
57        showBlinger();
58    });
59
60    // Profile page
61    $('#change-language-form .lang-change').on('click', function () {
62        // alert($(this).val());
63        window.location.href = '/site/language?lang=' + $(this).val()
64    });
65});
66
67/**
68 * Theme: Adminto Admin Template
69 * Author: Coderthemes
70 * SweetAlert
71 */
72
73!function ($) {
74    "use strict";
75
76    var SweetAlert = function () {
77    };
78
79    SweetAlert.prototype.init = function () {
80
81        //Danger
82        $('a.danger-alert').click(function () {
83            var btn = $(this);
84
85            swal({
86                title: "Are you sure?",
87                text: $(this).data('alert-text'),
88                type: "error",
89                showCancelButton: true,
90                confirmButtonClass: 'btn-danger waves-effect waves-light',
91                confirmButtonText: 'Delete'
92            }, function (confirm) {
93                if (confirm)
94                    window.location.href = btn.attr('href');
95            });
96
97            return false;
98        });
99
100    },
101        //init
102        $.SweetAlert = new SweetAlert, $.SweetAlert.Constructor = SweetAlert
103}(window.jQuery),
104
105//initializing
106    function ($) {
107        "use strict";
108        $.SweetAlert.init()
109    }(window.jQuery);
110
111/**
112 * Аналитика по всем сообщениям
113 * Запускается в фоне, трекаем с некоторой периодичностью создался ли файл
114 */
115$(document).on('click', '.export-excel', function (e) {
116    e.preventDefault();
117    var $obj = $(this);
118    $obj.next().removeClass('hidden');
119
120    var url = new URL(location.href);
121    var startDate = url.searchParams.get("startDate");
122    var endDate = url.searchParams.get("endDate");
123    var tags = url.searchParams.get("tag");
124
125    requestExcel($obj, startDate, endDate, tags);
126});
127
128function requestExcel($obj, startDate, endDate, tags) {
129    var date = new Date();
130    $.post($obj.attr('href'), {
131        from: startDate,
132        to: endDate,
133        timezone: -date.getTimezoneOffset() * 60,
134        tags: tags
135    }, function (response) {
136        if (response.error) {
137            alert(response.error);
138            return false;
139        }
140        if (response.end) {
141            $obj.next().addClass('hidden');
142            location.href = response.file;
143        } else {
144            if (response.process) {
145                requestExcel($obj, startDate, endDate, tags);
146            }
147        }
148    });
149}
150
151/**
152 * Аналитика по операторам
153 */
154$(document).on('click', '.export-operators', function (e) {
155    e.preventDefault();
156    var $obj = $(this);
157    $obj.next().removeClass('hidden');
158
159    var url = new URL(location.href);
160    var startDate = url.searchParams.get("startDate");
161    var endDate = url.searchParams.get("endDate");
162    var date = new Date();
163
164    $.post($obj.attr('href'), {
165        from: startDate,
166        to: endDate,
167        timezone: -date.getTimezoneOffset() * 60
168    }, function (response) {
169        $obj.next().addClass('hidden');
170        if (response.file) {
171            location.href = response.file;
172            return true;
173        }
174        if (response.error) {
175            alert(response.error);
176        }
177    });
178});
179
180// Аналитика по времени работы операторов
181$(document).on('click', '.export-operator-time', function (e) {
182    e.preventDefault();
183    var $obj = $(this);
184    $obj.next().removeClass('hidden');
185
186    var url = new URL(location.href);
187    var startDate = url.searchParams.get("startDate");
188    var endDate = url.searchParams.get("endDate");
189    var date = new Date();
190
191    $.get('/analytics/operator-time-excel', {
192        startDate: startDate,
193        endDate: endDate,
194        timezone: -date.getTimezoneOffset() * 60
195    }, function (response) {
196        $obj.next().addClass('hidden');
197        if (response.file) {
198            location.href = response.file;
199            return true;
200        }
201        if (response.error) {
202            alert(response.error);
203        }
204    });
205});
206
207$(function () {
208    var serviceBlingerUserId = $('#serviceBlingerUserId').val();
209
210    // Создаем тег для приложения
211    $('#inputTags').on('beforeItemAdd', function (e) {
212        if (!e.item || !serviceBlingerUserId) {
213            return false;
214        }
215        var tag = e.item;
216        $.post('/apps/tags/create', {
217            tag: tag,
218            serviceBlingerUserId: serviceBlingerUserId
219        }, function (response) {
220            if (!response) {
221                alert('Error');
222            }
223        });
224    });
225
226    // Удаляем тег для приложения
227    $('#inputTags').on('beforeItemRemove', function (e) {
228        if (!e.item || !serviceBlingerUserId) {
229            return false;
230        }
231        var tag = e.item;
232        $.post('/apps/tags/delete', {
233            tag: tag,
234            serviceBlingerUserId: serviceBlingerUserId
235        }, function (response) {
236            if (!response) {
237                alert('Error');
238            }
239        });
240    });
241});
242
243// Аналитика по закрытым диалогам
244$(function () {
245    $(document).on('click', '.export-close-groups', function (e) {
246        e.preventDefault();
247
248        var range = $('input[name="date_range_1"]').val();
249        if (!range) {
250            return false;
251        }
252
253        range = range.split(' to ');
254        var startDate = range[0];
255        var endDate = range[1];
256        var date = new Date();
257
258        $.post('/analytics/close-groups-csv', {
259            startDate: startDate,
260            endDate: endDate,
261            timezone: -date.getTimezoneOffset() * 60
262        }, function (data) {
263            if (data == 'error') {
264                alert('Error');
265            } else {
266                location.href = data;
267            }
268        });
269    });
270});
271
272$(function () {
273    $('#getWhatsappMultiQr').click(function (e) {
274        e.preventDefault();
275
276        let $obj = $(this);
277        let waClientId = null;
278        let waQr = null;
279
280        setTimeout(function (){
281            location.href = '/apps/whatsapp-web-chrome/index';
282        }, 1000*60*2);
283
284        $('#loadQr').css('display', 'block');
285        $obj.hide();
286
287        $.post('/apps/whatsapp-web-chrome/create-client', {
288
289        }, function (msg) {
290            console.log(msg);
291            waClientId = msg.clientId;
292            console.log(waClientId);
293
294            let myIntervalCount = 0;
295            const myInterval = setInterval(myTimer, 2000);
296
297            function myTimer() {
298                ++myIntervalCount;
299
300                if (myIntervalCount >= 50) {
301                    clearInterval(myInterval);
302                }
303
304                $.get('/apps/whatsapp-web-chrome/check-qr?clientId=' + waClientId, {
305
306                }, function (msg) {
307                    console.log(msg);
308                    waQr = msg.qr;
309                    console.log(waQr);
310
311                    if (waQr !== null) {
312                        new QRious({
313                            element: document.getElementById("whatsappQrImg"),
314                            background: '#ffffff',
315                            backgroundAlpha: 1,
316                            foreground: '#5868bf',
317                            foregroundAlpha: 1,
318                            level: 'H',
319                            padding: 0,
320                            size: 300,
321                            value: waQr
322                        });
323                        $('#loadQr').css('display', 'none');
324                        clearInterval(myInterval);
325
326                        let myIntervalCount2 = 0;
327                        const myInterval2 = setInterval(myTimer2, 2000);
328
329                        function myTimer2() {
330                            ++myIntervalCount2;
331
332                            if (myIntervalCount2 >= 120) {
333                                clearInterval(myInterval2);
334                            }
335
336                            $.get('/apps/whatsapp-web-chrome/check-ready?clientId=' + waClientId, {
337
338                            }, function (msg) {
339                                console.log(msg);
340
341                                if (msg.ready !== null) {
342                                    // $('#loadQr').css('display', 'none');
343                                    clearInterval(myInterval2);
344                                    location.href = '/apps/whatsapp-web-chrome/registration?clientId=' + waClientId + '&name=' + msg.ready.pushname + '&phone=' + msg.ready.wid.user;
345                                }
346                            });
347                        }
348                    }
349                });
350            }
351
352        });
353    });
354
355    $('#getWhatsappQr').click(function (e) {
356        e.preventDefault();
357
358        var $obj =$(this);
359        var clientId = getClientId();
360
361        $('#loadQr').css('display', 'block');
362        $obj.attr('disabled', 'disabled');
363
364        $.post('/apps/whatsapp-web/registration', {
365            'clientId': clientId
366        }, function (file) {
367            if (!file) {
368                alert('Error');
369                return false;
370            }
371
372            var timer = 15;
373            var start = false;
374
375            var interval = setInterval(function () {
376                $('#whatsappQrImg').attr('src', file).load(function () {
377                    clearInterval(interval);
378
379                    if (start) {
380                        return;
381                    }
382
383                    start = true;
384
385                    $('#loadQr').css('display', 'none');
386
387                    var textInterval = setInterval(function () {
388                        $('#whatsappTimer').text(timer);
389
390                        if (timer === 5) {
391                            $('#whatsappTimer').addClass('text-danger');
392                        }
393
394                        if (timer === 0) {
395                            clearInterval(textInterval);
396                            $('#whatsappTimer').removeClass('text-danger').text('');
397                            $('#whatsappQrImg').attr('src', '');
398                            $obj.removeAttr('disabled');
399                        }
400
401                        timer--;
402                    }, 1000);
403
404                    checkEndWhatsappQr(clientId, file);
405                });
406            }, 500)
407        });
408    });
409
410    $('#getWhatsappBlingerQr').click(function (e) {
411        e.preventDefault();
412
413        var $obj =$(this);
414        var clientId = getClientId();
415
416        $('#loadQr').css('display', 'block');
417        $obj.attr('disabled', 'disabled');
418
419        $.post('/apps/whatsapp-blinger/registration', {
420            'clientId': clientId
421        }, function (file) {
422            if (!file) {
423                alert('Error');
424                return false;
425            }
426
427            var timer = 15;
428            var start = false;
429
430            var interval = setInterval(function () {
431                $('#whatsappQrImg').attr('src', file).load(function () {
432                    clearInterval(interval);
433
434                    if (start) {
435                        return;
436                    }
437
438                    start = true;
439
440                    $('#loadQr').css('display', 'none');
441
442                    var textInterval = setInterval(function () {
443                        $('#whatsappTimer').text(timer);
444
445                        if (timer === 5) {
446                            $('#whatsappTimer').addClass('text-danger');
447                        }
448
449                        if (timer === 0) {
450                            clearInterval(textInterval);
451                            $('#whatsappTimer').removeClass('text-danger').text('');
452                            $('#whatsappQrImg').attr('src', '');
453                            $obj.removeAttr('disabled');
454                        }
455
456                        timer--;
457                    }, 1000);
458
459                    checkEndWhatsappBlingerQr(clientId, file);
460                });
461            }, 500)
462        });
463    });
464});
465
466// User operations
467$(function () {
468    var timezone = new Date().getTimezoneOffset();
469
470    if ($('#registrationform-timezone').length) {
471        $('#registrationform-timezone').val(parseInt(-(timezone / 60)));
472    }
473
474    $(document).on('keyup', '.repeat-password', function (e) {
475        var self = $(this);
476
477        if ($('.field-resetpasswordform-password .help-block-error').text() == '' && $('#resetpasswordform-password').val() == $(this).val()) {
478            $('.reset-password-confirm').removeAttr('disabled');
479        } else {
480            $('.reset-password-confirm').attr('disabled', 'disabled');
481        }
482    })
483});
484
485function checkEndWhatsappQr(clientId, file) {
486    $.ajax({
487        type: "POST",
488        url: '/apps/whatsapp-web/check-qr',
489        data: {
490            'file': file
491        },
492        success: function (data) {
493            if (!data) {
494                $.post('/apps/whatsapp-web/confirm-registration', {
495                    'clientId': clientId
496                }, function (data) {
497                    location.href = '/apps/index';
498                });
499                return;
500            }
501
502            setTimeout(function () {
503                checkEndWhatsappQr(clientId, file);
504            }, 1000);
505        },
506        error: function (data) {
507            alert('Error');
508        }
509    });
510}
511
512function checkEndWhatsappBlingerQr(clientId, file) {
513    $.ajax({
514        type: "POST",
515        url: '/apps/whatsapp-blinger/check-qr',
516        data: {
517            'file': file
518        },
519        success: function (data) {
520            console.log('checkEndWhatsappBlingerQr:');
521            console.log(data);
522            if (!data) {
523                $.post('/apps/whatsapp-blinger/process-registration', {
524                    'clientId': clientId
525                }, function (data) {
526                    location.href = '/apps/index';
527                });
528                return;
529            }
530
531            setTimeout(function () {
532                checkEndWhatsappBlingerQr(clientId, file);
533            }, 1000);
534        },
535        error: function (data) {
536            alert('Error');
537        }
538    });
539}
540
541function getClientId() {
542    var r = window.crypto.getRandomValues(new Uint8Array(16));
543
544    var clientId = '';
545
546    for (var i in r) {
547        clientId += String.fromCharCode(r[i])
548    }
549
550    return window.btoa(clientId);
551}
552//
553// new Vue();
554//
555// $(function () {
556//
557//     // Add operator fields settings
558//     $('body').on('click', '#addOperatorField', function (e) {
559//         e.preventDefault();
560//
561//         $(this).closest('tr').before('<tr>\n' +
562//           '                        <td><input class="form-control input-sm" type="text" value=""/></td>\n' +
563//           '                        <td>\n' +
564//           '                            <select class="form-control input-sm" id="exampleFormControlSelect1">\n' +
565//           '                                <option>String</option>\n' +
566//           '                                <option>Integer</option>\n' +
567//           '                            </select>\n' +
568//           '                        </td>\n' +
569//           '                        <td><input type="checkbox"></td>\n' +
570//           '                        <td><input type="checkbox"></td>\n' +
571//           '                        <td><input type="checkbox"></td>\n' +
572//           '                    </tr>');
573//     })
574//
575//     // Operator fields settings form
576//       $('body').on('submit', '#operatorFieldsForm', function (e) {
577//           e.preventDefault();
578//
579//           console.log($(this).serializeArray());
580//       });
581//
582// });
583
584function createPasswordResetToken(userId) {
585    $.post('/site/forgot-operator', {'userId': userId}, function (data) {
586        $('#create-password-reset-token + .popover .popover-content').text(data).parent().css('margin-top', '-73px').css('margin-left', '-93px');
587    })
588}

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.