1window.GWAdvCondLogic = function(args) { 2 try { 3 gform; 4 } catch (e) { 5 console.error( 6 "GWAdvCondLogic was inititated before gform object was loaded." 7 ); 8 return; 9 } 10 var self = this; 11 12 // copy all args to current object: (list expected props) 13 for (prop in args) { 14 if (args.hasOwnProperty(prop)) { 15 self[prop] = args[prop]; 16 } 17 } 18 19 self.init = function() { 20 self.doingLogic = false; 21 // do the magic 22 gform.addFilter("gform_is_value_match", function(isMatch, formId, rule) { 23 if (formId != self.formId) { 24 return isMatch; 25 } 26 if (rule.value == "__return_true") { 27 return true; 28 } else if (rule.value == "__return_false") { 29 return false; 30 } else if ( 31 rule.fieldId != "__adv_cond_logic" || 32 self.doingLogic || 33 !self.logic[rule.value] 34 ) { 35 //quit now if not adv_logic rule, or already doing logic 36 return isMatch; 37 } 38 39 self.doingLogic = true; 40 var logic = self.logic[rule.value]; 41 isMatch = self.isAdvancedConditionalLogicMatch(formId, logic); 42 43 self.doingLogic = false; 44 45 // return logic.actionType == 'hide' ? !isMatch : isMatch; 46 return isMatch; 47 }); 48 }; 49 self.isAdvancedConditionalLogicMatch = function(formId, logic) { 50 for (var i in logic.groups) { 51 if (logic.groups.hasOwnProperty(i)) { 52 var action = gf_get_field_action(formId, logic.groups[i]); 53 if (action == "show" || action == "send") { 54 return true; 55 } 56 } 57 } 58 return false; 59 }; 60 self.init(); 61};
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.