PageSourceSearch

https://mdk-lancut.pl/js/zdzislowicz-form-2.0.js?date=20260403210247

js mdk-lancut.pl collected 2026-09-26 21:39:22 UTC 6,393 bytes, 173 lines download raw bytes

1/*
2         _       _       _                  _                       _
3 ____ __| | ____(_) ___ | |  ___ __      __(_)  ___  ____    _ __  | |
4|_  // _` ||_  /| |/ __|| | / _ \\ \ /\ / /| | / __||_  /   | '_ \ | |
5 / /| (_| | / / | |\__ \| || (_) |\ V  V / | || (__  / /  _ | |_) || |
6/___|\__,_|/___||_||___/|_| \___/  \_/\_/  |_| \___|/___|(_)| .__/ |_|
7                                                            |_|
8
9CONTACT FORM
10www.zdzislowicz.pl
11[email protected]
12
13all rights reserved
14
15/* 
16
172.0
182023-06-19
19- dodano obsługę plików
20- ujednolicono z plikami / formularzem zgłoszenia
21
22*/
23
24$(document).ready(function() {
25    let gogogo = false;
26
27    $(".formularz-kontakt").submit(function(e) {
28        if(!gogogo)
29        {
30            let formularz = $(this);
31
32            $(formularz.find('input[type=submit]')).attr('disabled', 'disabled');
33
34            var kontakt = {};
35            $(formularz.find('input[name^="kontakt"]')).each(function() {
36                if($(this).is(':checkbox'))
37                {
38                    if($(this).is(':checked'))
39                    {
40                        kontakt[$(this).attr('data-name')] = "1";
41                    }
42                    else
43                    {
44                        kontakt[$(this).attr('data-name')] = '0';
45                    }
46                }
47                else
48                {
49                    kontakt[$(this).attr('data-name')] = $(this).val();
50                }
51            });
52            $(formularz.find('textarea[name^="kontakt"]')).each(function() {
53                kontakt[$(this).attr('data-name')] = $(this).val();
54            });
55            $(formularz.find('select[name^="kontakt"]')).each(function() {
56                kontakt[$(this).attr('data-name')] = $(this).val();
57            });
58
59            kontakt = JSON.stringify(kontakt);
60
61            $.ajax( {
62                url: strona_adres_pelny + 'ajax/formularz-kontaktowy.php',
63                dataType: 'json',
64                type: 'POST',
65                data: "kontakt=" + kontakt + "&id=" + formularz.attr('data-id'),
66                success: function(data, status) {
67                    const bledy = data.bledy;
68                    const potwierdzenie = data.potwierdzenie;
69
70                    const JSONArray = JSON.parse(bledy);
71
72                    let caret = -1;
73                    let caret_field = "";
74                    $.each(JSONArray, function(index, value) {
75
76                        if(caret == -1) {
77                            caret++;
78                            caret_field = index;
79
80                            if(formularz.find('.' + index).parent().hasClass('check'))
81                            {
82                                $('html, body').animate({
83                                    scrollTop: (formularz.find('.' + index).parent().offset().top - 120)
84                                }, 250);
85                            }
86                            else
87                            {
88                                $('html, body').animate({
89                                    scrollTop: (formularz.find('.' + index).offset().top - 120)
90                                }, 250);
91                            }
92
93                            setTimeout(function() {
94                                formularz.find('.' + index).focus();
95                            }, 250);
96                        }
97                        if(formularz.find('.' + index).parent().hasClass('checkbox'))
98                        {
99                            formularz.find('.' + index).parent().parent().find('.blad').css('display', 'block');
100                            formularz.find('.' + index).parent().parent().find('.blad').html(value);
101                        }
102                        else
103                        {
104                            formularz.find('.' + index).parent().find('.blad').css('display', 'block');
105                            formularz.find('.' + index).parent().find('.blad').html(value);
106                        }
107                    });
108
109                    if(potwierdzenie == 1)
110                    {
111                        formularz.css('display', 'none');
112                        const potwierdzenieEl = formularz.parent().find('.potwierdzenie');
113                        potwierdzenieEl.css('display', 'block');
114
115                        $('html, body').animate({
116                            scrollTop: (formularz.parent().offset().top)
117                        }, 500);
118
119                        // WCAG 2.4.3: przenieś fokus na potwierdzenie
120                        setTimeout(function() {
121                            potwierdzenieEl[0].focus();
122                        }, 520);
123                    }
124
125                    $(formularz.find('input[type=submit]')).removeAttr('disabled');
126                },
127                error: function() {
128                    $(formularz.find('input[type=submit]')).removeAttr('disabled');
129                }
130            });
131
132            e.preventDefault();
133            e.stopPropagation();
134            return;
135        }
136    });
137
138    $(".zdzForm input, .zdzForm select, .zdzForm textarea").on('keyup click contextmenu', function(e) {
139        if (e.type === 'keyup' && e.key === 'Enter') return;
140        $(this).parent().find('.blad').html('').css('display', 'none');
141    });
142
143    let choiceStop = false;
144    $('.zdzForm .choice label a').on('click', function(e) {
145        choiceStop = true;
146    });
147
148    $('.zdzForm .choice input[type="checkbox"]').on('change', function () {
149        const checkbox = $(this);
150        const choice = checkbox.closest('.choice');
151
152        // Usunięcie komunikatu błędu, jeśli był
153        choice.find('.blad').hide().empty();
154        checkbox.removeClass('error');
155
156        // Opcjonalnie: ustawienie atrybutu aria-checked
157        checkbox.attr('aria-checked', checkbox.is(':checked') ? 'true' : 'false');
158    });
159});
160
161
162/*
163TODO - dopisać odświeżanie sesji
164function formularzKontaktowyRefresh() {
165
166    $.ajax({url: strona_adres_pelny + "/ajax/formularz-kontaktowy-refresh.php", success: function(result){
167    }});         
168
169    setTimeout(formularzKontaktowyRefresh, 10000);
170}
171 
172setTimeout(formularzKontaktowyRefresh, 10000);
173*/

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.