PageSourceSearch

https://www.emergency.it/wp-content/themes/crowdchicken/js/lib/dobPicker.js?ver=1.0.2

js emergency.it collected 2026-09-24 08:34:36 UTC 5,169 bytes, 142 lines download raw bytes

1/*
2 
3 jQuery DOB Picker
4 
5 Website: https://github.com/tyea/dobpicker
6 Version: 1.0
7 Author: Tom Yeadon
8 License: MIT
9 
10 */
11(function ($) {
12    jQuery.extend({
13        dobPicker: function (params) {
14
15            // -------------------------------------------------------
16
17            // set the defaults
18
19            if (typeof (params.dayDefault) === 'undefined')
20                params.dayDefault = 'Day';
21            if (typeof (params.monthDefault) === 'undefined')
22                params.monthDefault = 'Month';
23            if (typeof (params.yearDefault) === 'undefined')
24                params.yearDefault = 'Year';
25            if (typeof (params.minimumAge) === 'undefined')
26                params.minimumAge = 12;
27            if (typeof (params.maximumAge) === 'undefined')
28                params.maximumAge = 80;
29
30            // -------------------------------------------------------
31
32            // set the default messages
33
34            $(params.daySelector).append('<option value="">' + params.dayDefault + '</option>');
35            $(params.monthSelector).append('<option value="">' + params.monthDefault + '</option>');
36            $(params.yearSelector).append('<option value="">' + params.yearDefault + '</option>');
37
38            // -------------------------------------------------------
39
40            // populate the day select
41
42            for (i = 1; i <= 31; i++) {
43                if (i <= 9) {
44                    var val = '0' + i;
45                } else {
46                    var val = i;
47                }
48                $(params.daySelector).append('<option value="' + val + '">' + i + '</option>');
49            }
50
51            // -------------------------------------------------------
52
53            // populate the month select
54
55            var months = ["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"];
56
57            for (i = 1; i <= 12; i++) {
58                if (i <= 9) {
59                    var val = '0' + i;
60                } else {
61                    var val = i;
62                }
63                $(params.monthSelector).append('<option value="' + val + '">' + months[i - 1] + '</option>');
64            }
65
66            // -------------------------------------------------------
67
68            // populate the year select
69
70            var date = new Date();
71            var year = date.getFullYear();
72            var start = year - params.minimumAge;
73            var count = start - params.maximumAge;
74
75            for (i = start; i >= count; i--) {
76                $(params.yearSelector).append('<option value="' + i + '">' + i + '</option>');
77            }
78
79            // -------------------------------------------------------
80
81            // do the logic for the day select
82
83            $(params.daySelector).change(function () {
84
85                /*$(params.monthSelector)[0].selectedIndex = 0;
86                 $(params.yearSelector)[0].selectedIndex = 0; */
87                $(params.yearSelector + ' option').removeAttr('disabled');
88
89                if ($(params.daySelector).val() >= 1 && $(params.daySelector).val() <= 29) {
90
91                    $(params.monthSelector + ' option').removeAttr('disabled');
92
93                } else if ($(params.daySelector).val() == 30) {
94
95                    $(params.monthSelector + ' option').removeAttr('disabled');
96                    $(params.monthSelector + ' option[value="02"]').attr('disabled', 'disabled');
97
98                } else if ($(params.daySelector).val() == 31) {
99
100                    $(params.monthSelector + ' option').removeAttr('disabled');
101                    $(params.monthSelector + ' option[value="02"]').attr('disabled', 'disabled');
102                    $(params.monthSelector + ' option[value="04"]').attr('disabled', 'disabled');
103                    $(params.monthSelector + ' option[value="06"]').attr('disabled', 'disabled');
104                    $(params.monthSelector + ' option[value="09"]').attr('disabled', 'disabled');
105                    $(params.monthSelector + ' option[value="11"]').attr('disabled', 'disabled');
106
107                }
108
109            });
110
111            // -------------------------------------------------------
112
113            // do the logic for the month select
114
115            $(params.monthSelector).change(function () {
116
117                /*$(params.yearSelector)[0].selectedIndex = 0;*/
118                $(params.yearSelector + ' option').removeAttr('disabled');
119
120                if ($(params.daySelector).val() == 29 && $(params.monthSelector).val() == '02') {
121
122                    $(params.yearSelector + ' option').each(function (index) {
123                        if (index !== 0) {
124                            var year = $(this).attr('value');
125                            var leap = !((year % 4) || (!(year % 100) && (year % 400)));
126                            if (leap === false) {
127                                $(this).attr('disabled', 'disabled');
128                            }
129                        }
130                    });
131
132                }
133
134            });
135
136            // -------------------------------------------------------
137
138        }
139
140    });
141
142})(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.