PageSourceSearch

https://la2world.ru/themes/la2world_mobile/js/app.js

js la2world.ru collected 2026-10-07 14:45:03 UTC 5,038 bytes, 163 lines download raw bytes

1;(function($){
2
3    'use strict';
4
5    var Modal, modalFadeClass, modalClass, inputWrap, Notify, AjaxLoading, ajaxLoadingClass;
6
7    modalFadeClass   = 'modal-box-fade';
8    modalClass       = 'modal-box';
9    ajaxLoadingClass = 'ajax-loading-modal';
10
11    $.Modal = Modal = function(html) {
12        var $body = $('body');
13
14        $body.find('.' + modalFadeClass + ', .' + modalClass).remove();
15        $body.append('<div class="' + modalFadeClass + '"></div>');
16        $body.append('<div class="' + modalClass + '"><a class="close" title="Закрыть"></a>' + html + '</div>');
17
18        inputWrap();
19    };
20
21    // Fancybox
22    if($.isFunction($.fn.fancybox)) {
23        $('.fancybox').fancybox({
24            padding: 0
25        });
26    }
27
28    inputWrap = function() {
29        $('[type=text], [type=password], .btn, select').filter(':not(.no-wrap)').each(function(){
30            var $self = $(this);
31            if(!$self.parent().hasClass('input-wrapper')) {
32                $self.wrap('<div class="input-wrapper"/>')
33            }
34        });
35    };
36
37    $.Notify = Notify = function(opt){
38        var textColor = '#cb5f61',
39            bgColor = '#1A1E1C';
40        if (opt.hasOwnProperty('type') && opt.type === 'success') {
41            textColor = '#2faa12';
42        }
43        $.toast({
44            text: opt.text,
45            textColor: textColor,
46            bgColor: bgColor,
47            position: 'top-right',
48            hideAfter: 6000
49        });
50    };
51
52    $.AjaxLoading = AjaxLoading = function(action){
53        var $body = $('body');
54        if($body.find('.' + modalClass).length) {
55            $body.find('.' + ajaxLoadingClass).remove();
56        } else {
57            $body.find('.' + ajaxLoadingClass + ', .' + modalFadeClass).remove();
58        }
59        if(action == 'start') {
60            if($body.find('.' + modalClass).length) {
61                var a = '<div class="' + ajaxLoadingClass + '">Loading please wait...</div>';
62            } else {
63                var a = '<div class="' + modalFadeClass + '"></div><div class="' + ajaxLoadingClass + '">Loading please wait...</div>';
64            }
65            $body.append(a);
66        }
67    };
68
69    $(function(){
70
71        // Checkbox styles
72        if(typeof $.kalypto === 'function') {
73            $(':checkbox').kalypto({
74                customClasses: 'my-checkbox'
75            });
76        }
77
78        $('.bxslider').bxSlider({
79            mode: 'fade',
80            auto: true,
81            adaptiveHeight: true,
82            speed: 300,
83            controls: false
84        });
85
86        $('.js-custom-scrollbar').mCustomScrollbar({
87            axis: 'x',
88            scrollbarPosition: 'inside',
89            scrollInertia: false
90        });
91
92
93        inputWrap();
94
95        $('.js-modal').on('click', function(e){
96            e.preventDefault();
97
98            var $self;
99
100            $self = $(this);
101
102            $.get($self[0].href).done(function(){
103
104            }).fail(function(xht, e, throwError){
105                console.log(['error', throwError])
106            });
107        });
108
109        $('body').delegate('.' + modalClass + ' .close, .' + modalFadeClass, 'click', function(){
110            $('.' + modalClass + ', .' + modalFadeClass).remove();
111        });
112
113
114        $('.js-modal-login').on('click', function(e){
115            e.preventDefault();
116            AjaxLoading('start');
117            $.get('/modal-login/').done(function(res){
118                AjaxLoading();
119                Modal(res);
120            }).fail(function(e){
121                AjaxLoading();
122                console.log(e);
123            });
124        });
125
126        $('body').delegate('#modal-login-form', 'submit', function(e){
127            e.preventDefault();
128            AjaxLoading('start');
129            $.post('/modal-login/', $(this).serialize()).done(function(res){
130                AjaxLoading();
131                res = JSON.parse(res);
132                var errorsStr = [];
133                if(res.status) {
134                    window.location = '/cabinet/';
135                } else {
136                    $.each(res.msg, function(field, errors){
137                        $.each(errors, function(i, err){
138                            errorsStr.push(err);
139                        });
140                    });
141                    Notify({text: errorsStr.join('<br>')});
142                }
143            }).fail(function(e){
144                AjaxLoading();
145            });
146        });
147
148        $('body').delegate('.ui-pnotify-icon .close', 'click', function(e){
149            e.preventDefault();
150            $.toast().reset('all');
151        });
152
153        var $a = $('.alert');
154        if($a.length) {
155            if ($a.find('button').length) {
156                $a.find('button').remove();
157            }
158            var msg = $a.html();
159            Notify({text: msg, type: $a.hasClass('alert-success') ? 'success' : 'error'});
160        }
161    });
162
163})(jQuery);

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.