PageSourceSearch

https://uarts.school/js/admission.js

js uarts.school collected 2026-10-08 19:05:51 UTC 11,374 bytes, 324 lines download raw bytes

1$(document).ready(function() {
2    $('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
3      if (!$(this).next().hasClass('show')) {
4        $(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
5      }
6      var $subMenu = $(this).next(".dropdown-menu");
7      $subMenu.toggleClass('show');
8
9
10      $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
11        $('.dropdown-submenu .show').removeClass("show");
12      });
13
14
15      return false;
16    });
17
18    $('#con_prog_pc_id').click(function() {
19        console.log("clicked");
20        console.log(this.checked);
21    });
22
23    $('.select2_pais').select2({
24        selectionCssClass: "select2_pais"
25    });
26
27    $('.select3_pais').select2({
28        selectionCssClass: "select3_pais"
29    });
30
31    $(".date").datepicker({
32        dateFormat: 'yy/mm/dd',
33        changeMonth: true,
34        changeYear: true,
35        yearRange: '1920:2058',
36        firstDay: 1,
37        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa']
38    });
39
40    $('#admiform select').on({
41        'change': function(ev) {
42            adselchange(ev, this);
43        }
44    });
45
46    $('select[name="con_interes"]').change(function() {
47        $('select[name="con_titulacion"]').attr('disabled', 'disabled');
48        $('select[name="con_formacion"]').attr('disabled', 'disabled');
49        $('select[name="con_titulacion"]').html('');
50        $('select[name="con_formacion"]').html('');
51        if ($(this).val() == 0) {
52        } else {
53            $.post('../includes/listado_rutalist.php', {
54                cat: $(this).val()
55            }, function(data) {
56                $('select[name="con_titulacion"]').html(data);
57                $('select[name="con_titulacion"]').prop("disabled", false);
58            });
59        }
60    })
61    $('select[name="con_titulacion"]').change(function() {
62        $('select[name="con_formacion"]').attr('disabled', 'disabled');
63        $('select[name="con_formacion"]').html('');
64        if ($(this).val() == 0) {
65        } else {
66            $.post('../includes/listado_temalines.php', {
67                cat: $('select[name="con_interes"]').val(),
68                tf: $(this).val()
69            }, function(data) {
70                $('select[name="con_formacion"]').html(data);
71                $('select[name="con_formacion"]').prop("disabled", false);
72            });
73        }
74    });$('select[name="con_interes"]').change(function() {
75        $('select[name="con_titulacion"]').attr('disabled', 'disabled');
76        $('select[name="con_formacion"]').attr('disabled', 'disabled');
77        $('select[name="con_titulacion"]').html('');
78        $('select[name="con_formacion"]').html('');
79        if ($(this).val() == 0) {
80        } else {
81            $.post('../includes/listado_rutalist.php', {
82                cat: $(this).val()
83            }, function(data) {
84                $('select[name="con_titulacion"]').html(data);
85                $('select[name="con_titulacion"]').prop("disabled", false);
86            });
87        }
88    })
89    $('select[name="con_titulacion"]').change(function() {
90        $('select[name="con_formacion"]').attr('disabled', 'disabled');
91        $('select[name="con_formacion"]').html('');
92        if ($(this).val() == 0) {
93        } else {
94            $.post('../includes/listado_temalines.php', {
95                cat: $('select[name="con_interes"]').val(),
96                tf: $(this).val()
97            }, function(data) {
98                $('select[name="con_formacion"]').html(data);
99                $('select[name="con_formacion"]').prop("disabled", false);
100            });
101        }
102    });
103});
104
105function adselchange(ev, obj) {
106    id = $(obj).attr('id');
107    val = $(obj).val();
108    ind = $(obj)[0].selectedIndex;
109    //console.log(id);
110    //alert(id);
111    if (id == 'con_presencial') {
112
113        if (ind > 0) { $('#div_con_prog_pc').show(); } else { $('#div_con_prog_pc').hide(); }
114    }
115
116    if (id == 'con_nacion') {
117        $('#div_con_nacion_pasaporte').hide();
118        $('#div_con_nacion_ss').hide();
119        $('#div_con_nacion_pais').hide();
120        $('#div_con_nacion_caduca').hide();
121        if (ind == 1) {
122            $('#div_con_nacion_ss').show();
123        }
124        if (ind == 2) {
125            $('#div_con_nacion_pasaporte').show();
126            //$('#div_con_nacion_ss').show();
127        }
128        if (ind == 3) {
129            $('#div_con_nacion_pasaporte').show();
130            // $('#div_con_nacion_visa').show();
131            //$('#div_con_nacion_caduca').show();
132        }
133    }
134    // if (id == 'con_nacion_visa') {
135    //     $('#div_con_nacion_caduca').hide();
136    //     if (ind > 0) {
137    //         $('#div_con_nacion_caduca').show();
138    //     }
139
140    // }
141    if (id == 'con_minus') {
142        $('#div_con_minus_text').hide();
143        if (ind == 1) {
144            $('#div_con_minus_text').show();
145        }
146    }
147    if (id == 'con_misconduct') {
148        $('#div_con_misconduct_text').hide();
149        if (ind == 1) {
150            $('#div_con_misconduct_text').show();
151        }
152    }
153    if (id == 'con_pais') {
154        //alert(val);
155        $('#div_con_dir').hide();
156        if (val == '724') {
157            $('#div_con_dir').show();
158        }
159    }
160    if (id == 'con_amigo') {
161        $('#div_con_amigo_name').hide();
162        $('#div_con_amigo_phone').hide();
163        $('#div_con_amigo_email').hide();
164        if (ind == 1) {
165            $('#div_con_amigo_name').show();
166            $('#div_con_amigo_phone').show();
167            $('#div_con_amigo_email').show();
168        }
169    }
170
171}
172let part = 1;
173
174function validateEmail(email_val){
175    let emailRegex = /^([a-zA-Z0-9_\.\+\-])+\@(([a-zA-z0-9\-])+\.)+([a-zA-Z0-9]{2,6})$/;
176
177    if (emailRegex.test(email_val)){
178        return true;
179    } else {
180        return false;
181    }
182}
183
184function validatePhone(phone_val){
185    let phoneRegex = /^[+][\d ]*$/;
186
187    if (phoneRegex.test(phone_val)){
188        return true;
189    } else {
190        return false;
191    }
192}
193
194function validateDNI(dni_val){
195    let validChars = 'TRWAGMYFPDXBNJZSQVHLCKET';
196	let nifRexp = /^[0-9]{8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/i;
197
198    let str = dni_val.toString().toUpperCase();
199    if (!nifRexp.test(str)) return false;
200
201    let nie = str
202        .replace(/^[X]/, '0')
203        .replace(/^[Y]/, '1')
204        .replace(/^[Z]/, '2');
205
206    let letter = str.substr(-1);
207    let charIndex = parseInt(nie.substr(0, 8)) % 23;
208
209    if (validChars.charAt(charIndex) === letter) return true;
210
211    return false;
212}
213
214function adnext(add) {
215    var part2 = part;
216    part2 = part2 + add;
217    var redColor = '#dd0000';
218    var greenColor = '#009900';
219    if (part2 > 0 && part2 < 4) {
220        var ok = 1;
221        if (part2 > part) {
222            $('#admipart' + part + ' .req').each(function() {
223                var id = this.id;
224                p = $('#' + id).parent()
225                if ($(p).is(":visible")) {
226                    if ($(this).val() == '') {
227                        ok = 0;
228                        $(this).css('border-color', redColor);
229                        if (this.tagName === 'SELECT') {
230                            $(this).css('border-style', 'solid');
231                            $(this).css('border-width', '1px');
232                        }
233                        console.log(id + ' ' + $(this).val());
234    
235                    } else {
236                        if (['con_email', 'con_amigo_email', 'con_telf', 'con_telf2', 'con_emcont_phone', 'con_amigo_phone', 'con_nacion_ss'].includes(this.id)) {
237                            if(this.id == 'con_email' || this.id == 'con_amigo_email'){
238                                $(this).css('border-color', greenColor);
239                                if(!validateEmail($(this).val())){
240                                    ok = 0; 
241                                    $(this).css('border-color', redColor);
242                                } else {
243                                    $(this).css('border-color', greenColor);
244                                }
245                            }
246                            if(this.id == 'con_telf'|| this.id == 'con_telf2' || this.id == 'con_emcont_phone' || this.id == 'con_amigo_phone'){
247                                $(this).css('border-color', greenColor);
248                            }
249                            // cmarti - remove validation for phone
250                            // if(this.id == 'con_telf'|| this.id == 'con_telf2' || this.id == 'con_emcont_phone' || this.id == 'con_amigo_phone'){
251                            //     if(!validatePhone($(this).val())){ 
252                            //         ok = 0; 
253                            //         $(this).css('border-color', redColor);
254                            //     } else {
255                            //         $(this).css('border-color', greenColor);
256                            //     }
257                            // }
258                            /*if(this.id == 'con_nacion_ss'){
259                                if(!validateDNI($(this).val())){
260                                    ok = 0; 
261                                    $(this).css('border-color', redColor);
262                                } else {
263                                    $(this).css('border-color', greenColor);
264                                }
265                            } */
266                        } else {
267                            $(this).css('border-color', greenColor);
268                        }
269                    }
270                }
271            });
272            if (part == 2) {
273                if ($('#con_agree').is(':checked') == false) {
274                    ok = 0;
275                    alert(textos["jsPrivacy"]);
276                }
277            }
278        }
279
280
281        if (ok == 0) {
282            alert(textos["admisError"]);
283        } else {
284
285            $('#admipart' + part).hide();
286            part = part + add;
287            $('#admipart' + part).show();
288            //cambiamos punto y botones
289            $('.botadmision2').css('opacity', 1);
290            if (part == 1) $('#adbotant').css('opacity', 0.3);
291            $('.paso').attr('class', 'paso pasodesactnuevo');
292            if (part == 1) {
293                $('#2paso1').attr('class', 'paso pasoact pasoactnuevo');
294            }
295
296            if (part == 2) {
297                $('#2paso1').attr('class', 'paso pasoact pasoactnuevo');
298                $('#2paso2').attr('class', 'paso pasoact pasoactnuevo');
299            }
300            if (part == 2) {
301                $('#adbotsig').html(textos["FINALIZAR"])
302            } else {
303                $('#adbotsig').html(textos["SIGUIENTE"])
304            }
305            if (part == 3) {
306                $.post('../includes_new/admission/sendformadmis.php', $(".admiform").serialize(), function(data) {
307                    console.log(data);
308                    $('#2paso3').attr('class', 'paso pasoact pasoactnuevo');
309                    $('#admisionblock').hide();
310                    $('.pasos').hide();
311                    $('#admisionok').html(data);
312                    $('.botonesFormAdm').hide();
313                    var myFunction = function(){
314                        //window.location.reload();
315                    };
316                    setTimeout(myFunction, 10000);
317
318
319                });
320            }
321            // $('html,body').animate({ scrollTop: $('#admisionblock').position().top + 40 }, 500);
322        }
323    }
324}

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.