1/** 2* 3*/ 4var ee_conditional_show_questions = {}; 5function question_change_handler() { 6 var $j = jQuery.noConflict(); 7 8 var field_value = []; 9 10 // Get the data from the field that's being changed. 11 var field_name = (this.name).replace(/\[\]$/, ""); 12 13 if ( this.type === "checkbox" ) { 14 var selected_chk = $j("input[name='"+this.name+"']").serializeArray(); 15 for ( var i=0; i < selected_chk.length; i++ ) { 16 field_value.push( selected_chk[i].value ); 17 } 18 } else { 19 field_value.push( jQuery.trim(this.value) ); 20 } 21 22 var id_pos = field_name.lastIndexOf("_"); 23 var changed_question_id = field_name.substr(id_pos+1, field_name.length-id_pos); 24 25 var found_value; 26 // Loop through all the conditional settings. 27 for (var i = 0; i < ee_conditional_settings_json.length; i++) { 28 var cur_setting = ee_conditional_settings_json[i]; 29 var question_to_display = cur_setting.question_id; 30 var conditional_question_id = cur_setting.cq_id; 31 var conditional_operator = cur_setting.operator; 32 33 // Initialize the object for the current setting id 34 if ( ee_conditional_show_questions[question_to_display] == undefined ) { 35 ee_conditional_show_questions[question_to_display] = true; 36 } 37 38 if ( conditional_question_id == changed_question_id ) { 39 found_value = $j.inArray( cur_setting.value, field_value ); 40 if ( field_value.length > 0 && 41 ( 42 (conditional_operator === "Equals" && found_value > -1 ) || 43 (conditional_operator === "Not Equal" && found_value == -1 ) 44 ) 45 ) { 46 cur_setting.selected = true; 47 } else { 48 cur_setting.selected = false; 49 } 50 ee_conditional_show_questions[question_to_display] = cur_setting.selected; 51 } 52 ee_conditional_show_questions[question_to_display] = ee_conditional_show_questions[question_to_display] && cur_setting.selected; 53 } 54 55 for ( var id in ee_conditional_show_questions ) { 56 if ( ee_conditional_show_questions[id] === true ) { 57 //$j("#QUESTION_"+id).show(); 58 $j("#QUESTION_"+id).slideDown("fast"); 59 } else { 60 //$j("#QUESTION_"+id).hide(); 61 $j("#QUESTION_"+id).slideUp("fast", function() { 62 $j(this).hide(); 63 }); 64 } 65 } 66 67} 68 69function ee_debug(object) { 70 if ( console.log ) { 71 console.log(object); 72 } 73}
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.