1jQuery(document).ready(function($){ 2 3 var xt_widget_conditional = function() { 4 5 var first_load = true; 6 7 $('.widgets-php .widget-content [data-showif],.widgets-php .widget-content [data-hideif]').each(function() { 8 9 $(this).hide(); 10 11 var $this = $(this); 12 var widget = $this.closest('.widget-content'); 13 var type = $this.data('showif') ? 'show' : 'hide'; 14 15 var data = ''; 16 if(type == 'show') 17 data = $this.data('showif'); 18 else 19 data = $this.data('hideif'); 20 21 22 if(data.length > 0) { 23 24 var field = ''; 25 var field_data = []; 26 var field_name = ''; 27 var field_dependency = []; 28 29 data = data.trim(); 30 var fields = data.split(','); 31 for(var i = 0 ; i < fields.length ; i++) { 32 33 field = fields[i]; 34 field = field.trim(); 35 36 field_data = field.split(':'); 37 field_name = field_data[0]; 38 field_dependency = field_data[1]; 39 field_dependency = field_dependency.trim(); 40 field_dependency = field_dependency.split('|'); 41 42 field = widget.find('[id*='+field_name+']'); 43 44 if(field.length > 0) { 45 46 field.on('change', function() { 47 48 if($.inArray(field.val(), field_dependency) !== -1) { 49 (type == 'show') ? $this.show() : $this.hide(); 50 }else{ 51 (type == 'show') ? $this.hide() : $this.show(); 52 } 53 54 }); 55 56 if(first_load) 57 field.change(); 58 } 59 } 60 61 } 62 }); 63 64 first_load = false; 65 66 } 67 68 xt_widget_conditional(); 69 70 $(document).on('ajaxComplete', function() { 71 xt_widget_conditional(); 72 }); 73 74});
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.