1 2// fields controlled by other fields 3function manageControlledFields($,this_field,field_type, recursive) { 4 if (field_type == 'select') { 5 if (recursive) { 6 var to_hide_array = []; 7 this_field.find('option').each( function() { 8 if (typeof $(this).data('control-show') !== 'undefined') { 9 to_hide_array.push($(this).data('control-show')); 10 } 11 if (typeof $(this).data('control-hide') !== 'undefined') { 12 to_hide_array.push($(this).data('control-hide')); 13 } 14 }); 15 if (to_hide_array.length > 0) { 16 var to_hide = to_hide_array.join(','); 17 } 18 } else { 19 var to_show = this_field.find('option:selected').first().data('control-show'); 20 var to_hide = this_field.find('option:selected').first().data('control-hide'); 21 } 22 } else if (field_type = 'input') { 23 var to_show = this_field.data('control-show'); 24 var to_hide = this_field.data('control-hide'); 25 if (recursive && typeof to_show !== 'undefined') { 26 to_hide = to_hide + ',' + to_show; 27 to_show = undefined; 28 } 29 } 30 if (typeof to_hide != 'undefined') { 31 var to_hide_array = to_hide.split(','); 32 $.each(to_hide_array, function(i,v) { 33 $(v).find("select,input").each( function() { 34 $(this).val( function() {return this.defaultValue;}).prop('selected', function() {return this.defaultSelected; }); 35 if (typeof $(this).data('required') !== typeof undefined) { 36 $(this).removeProp('required'); 37 } 38 if ($(this).hasClass('field-controller')) { 39 if ($(this).is('input')) { 40 var this_type = 'input'; 41 } else if ($(this).is('select')) { 42 var this_type = 'select'; 43 } 44 if (typeof this_type !== 'undefined') { 45 manageControlledFields($,$(this),this_type,true); 46 } 47 } 48 }); 49 $(v).slideUp('fast'); 50 }); 51 } 52 if (typeof to_show != 'undefined') { 53 var to_show_array = to_show.split(','); 54 $.each(to_show_array, function(i,v) { 55 $(v).find("select,input").each( function() { 56 $(this).val( function() {return this.defaultValue; }).prop('selected', function() {return this.defaultSelected; }); 57 if (typeof $(this).data('required') !== typeof undefined) { 58 $(this).prop('required','required'); 59 } 60 }); 61 $(v).slideDown('fast'); 62 }); 63 } 64} 65 66function change_campus_select($) { 67 var campus_value = $('#er-form-campus option[value=""]').html(); 68 if (campus_value.indexOf('Select a campus') >= 0) { 69 $('#er-form-campus option[value=""]').html('- Select a location -'); 70 } 71} 72 73(function($){ 74 75 $(function(){ 76 77 // select fields that control other fields 78 if ($('select.field-controller').length > 0) { 79 $('select.field-controller').on('change', function() { 80 manageControlledFields($,$(this),'select',false); 81 }); 82 } 83 84 // input radio fields that control other fields 85 if ($('input[type="radio"].field-controller').length > 0) { 86 $('input[type="radio"].field-controller').on('change', function() { 87 var this_name = $(this).prop('name'); 88 $('input[name="'+this_name+'"]').each( function() { 89 if ($(this).prop('checked')) { 90 manageControlledFields($,$(this),'input',false); 91 } 92 }); 93 }); 94 } 95 96 // trigger when document is ready 97 change_campus_select($); 98 // trigger when program selection changes 99 $('select#er-form-programs').on('change', function () { 100 change_campus_select($); 101 }); 102 103 104 // er outtake 105 /* 106 if ($('#er-form,#apply-form,#contact-form,#tour-form,#job-application-form').prop("data-er-outtake") == 'true' || getParameterByName('alex') == 'alex') { 107 $('#er-form,#apply-form,#contact-form,#tour-form,#job-application-form').prop("action", wp_vars.stylesheetUrl+'/er-outtake/outtake-form-processor.php'); 108 } 109 */ 110 }); 111 112})(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.