PageSourceSearch

https://dposs.ru/static/accounts/js/accounts.js

js dposs.ru collected 2026-10-09 22:44:18 UTC 3,001 bytes, 97 lines download raw bytes

1/**
2 * Created by Mike86k on 16.06.2014.
3 */
4
5(function($){
6
7$(function(){ // DOM ready
8
9    registrationFormEvents( $('.js-registration-form') );
10    loginFormEvents( $('.js-login-form') );
11
12});
13
14
15function loginFormEvents($form){
16    $form.validate({
17        rules: {
18            email: {required: true},
19            password: {required: true}
20        },
21        errorPlacement: function(error, element){}
22    });
23
24    var request = null;
25
26    $form.on('submit', function(event){
27        event.preventDefault();
28        if( $form.valid() ){
29            if( request ) request.abort();
30            request = $.ajax({
31                url: $form.prop('action'),
32                data: $form.serialize(),
33                type: 'post',
34                dataType: 'json',
35                success: function(response){
36                    if( response.status == 1 ){
37                        location.reload();
38                    }else{
39                        alert(response.message);
40                    }
41                },
42                error: function(){
43                    alert('Извените произошла ошибка.\nПовторите попытку позже или свяжитесь снами.');
44                }
45            });
46        }
47    });
48}
49
50
51function registrationFormEvents($form){
52    var request = null;
53
54    $form.find('input[name=phone]').mask("+d (ddd) ddd-dd-dd", {placeholder: "_"});
55
56    $form.validate({
57        rules: {
58            name: {required: true},
59            phone: {required: true},
60            email: {required: true, email: true, uniqueEmail: $form.data('checkEmailUrl')},
61            password1: {required: true},
62            password2: {required: true, equalTo: "#id_password1"}
63        },
64        messages: {
65            password2: {equalTo: 'Пароли не совпадают!'}
66        }
67//        errorPlacement: function(error, element){}
68    });
69
70    $form.on('submit', function(event){
71        event.preventDefault();
72        if( $form.valid() ){
73            if( request ) request.abort();
74            request = $.ajax({
75                url: $form.prop('action'),
76                data: $form.serialize(),
77                type: 'post',
78                before: function(){
79                    $form.find('input, textarea, select').prop('disabled', true);
80                },
81                complete: function(){
82                    $form.find('input, textarea, select').prop('disabled', false);
83                },
84                success: function(response){
85                    $form.hide();
86                    $('.js-registration-thanks').show();
87                },
88                error: function(){
89                    alert('Извените произошла ошибка.\nПовторите попытку позже или свяжитесь снами.');
90                }
91            });
92        }
93    });
94}
95
96
97})(window.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.