1(function ( ) { 2 "use strict"; 3 4 function showHideToggle ($el) { 5 var options = $.extend({ 6 "target": "" 7 }, $el.data()); 8 var $target = $(options.target); 9 10 $el.on("click", function (e) { 11 e.preventDefault(); 12 $target.toggleClass("show-hide-visible"); 13 }); 14 }; 15 16 $.fn.showHideToggle = jQueryPlugin("showHideToggle", showHideToggle); 17 18 $(".show-hide-toggle").showHideToggle(); 19 20 21 function showHideConditional ($el) { 22 var options = $.extend({ 23 "target": "", 24 "value": "" 25 }, $el.data()); 26 var $target = $(options.target); 27 var targetType; 28 29 if (!$target[0]) { 30 console.error("Target '" + options.target + "' not found!"); 31 return; 32 } 33 34 switch ($target[0].nodeName.toLowerCase()) { 35 case "input": 36 targetType = $target.attr("type").toLowerCase(); 37 break; 38 default: 39 targetType = $target[0].nodeName.toLowerCase(); 40 break; 41 } 42 43 function show ( ) { 44 $el.addClass('show-hide-visible'); 45 } 46 47 function hide ( ) { 48 $el.removeClass('show-hide-visible'); 49 } 50 51 function change ( ) { 52 var makeVisible = false;
53 54 if ($target.length === 1) { 55 switch (targetType) { 56 case "radio": 57 case "checkbox": 58 if ($target.is(":checked")) { 59 makeVisible = true; 60 } 61 break; 62 default: 63 if ($target.val() == options.value) { 64 makeVisible = true; 65 } 66 break; 67 } 68 } else { 69 $target.filter(":checked").each(function ( ) { 70 if ($(this).val() == options.value) { 71 makeVisible = true; 72 } 73 }); 74 } 75 76 if (makeVisible) { 77 show(); 78 } else { 79 hide(); 80 } 81 }; 82 83 $target.on("change", change); 84 85 change(); 86 }; 87 88 $.fn.showHideConditional = jQueryPlugin("showHideConditional", showHideConditional); 89 90 $(".show-hide-conditional").showHideConditional(); 91}()); 92 93// 94// Btn => show/hide el 95// el => show hide on input state 96//
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.