1$.fn.mgStyler = function() { 2 return this.each(function() { 3 var $this = $(this), 4 isChecked = $this.is(':checked'), 5 isDisabled = $this.is(':disabled'), 6 isRadio = $this.is(':radio'), 7 jqLabel = $this.parent('label') 8 radioClass = "mg-styler-label--radio", 9 checkboxClass = "mg-styler-label--checkbox", 10 labelClass = isRadio ? radioClass : checkboxClass; 11 12 if (jqLabel.length) { 13 jqLabel.addClass(labelClass); 14 } else { 15 jqLabel = $this 16 .wrap('<label></label>') 17 .parent('label') 18 .addClass(labelClass); 19 } 20 21 jqLabel.toggleClass('disabled', isDisabled); 22 23 jqLabel 24 .on('click.mgStyler', function(e){ 25 toggle($(this)); 26 e.preventDefault(); 27 }); 28 29 if (isChecked) { 30 jqLabel.addClass('checked'); 31 } 32 33 function toggle(jqInput) { 34 if ( jqInput.find('input').is(':radio') ) { 35 var radioGroup = jqInput.find('input').attr('name'); 36 $('input[name="' + radioGroup + '"]').closest('.' + radioClass).removeClass('checked'); 37 38 jqInput.addClass('checked').find('input[type=radio]').prop('checked', true); 39 } else { 40 jqInput.toggleClass('checked').find('input[type=checkbox]').prop('checked', !jqInput.find('input[type=checkbox]').prop('checked')); 41 } 42 } 43 }); 44}; 45 46function setEqualHeight(columns, callback) { 47 var tallestcolumn = 0; 48 var itemsLength = columns.length; 49 var itemsCounter = 0; 50 var hasCallback = callback == undefined; 51 52 columns.removeAttr('style'); 53 columns.each(function(){ 54 currentHeight = $(this).height(); 55 if(currentHeight > tallestcolumn) { 56 tallestcolumn = currentHeight; 57 } 58 itemsCounter++; 59 60 }); 61 columns.height(tallestcolumn); 62 63 if (itemsLength == itemsCounter && !hasCallback) { 64 callback(); 65 } 66}; 67 68 69function resizeController() { 70 var $win = $(window), 71 winWidth = window.innerWidth, 72 range = [], 73 func = [], 74 toggleState = [undefined, undefined]; 75 76 if (!!arguments.length) { 77 for (var i = 0; i <= arguments.length-1; i++) { 78 79 if ($.isArray(arguments[i])) { 80 range = arguments[i]; 81 } else if ($.isNumeric(arguments[i])) { 82 range.push(arguments[i]); 83 } else if ($.isFunction(arguments[i])) { 84 func.push(arguments[i]); 85 } 86 }; 87 } 88 89 $win.resize(function(event) { 90 winWidth = window.innerWidth; 91 92 if (range.length > 1) { 93 if (winWidth >= range[0] && winWidth <= range[range.length-1] && typeof toggleState[0] === "undefined") { 94 func[0](); 95 toggleState[0] = true; 96 toggleState[1] = undefined; 97 } else if ((winWidth < range[0] || winWidth > range[range.length-1]) && typeof toggleState[1] === "undefined") { 98 toggleState[0] = undefined; 99 toggleState[1] = true; 100 101 if ($.isFunction(func[1])) { 102 func[1](); 103 } 104 } 105 } else if (range.length == 1) { 106 if (winWidth <= range[0] && typeof toggleState[0] === "undefined") { 107 func[0](); 108 toggleState[0] = true; 109 toggleState[1] = undefined; 110 } else if (winWidth > range[0] && typeof toggleState[1] === "undefined") { 111 toggleState[0] = undefined; 112 toggleState[1] = true; 113 114 if ($.isFunction(func[1])) { 115 func[1](); 116 } 117 } 118 } 119 }).trigger('resize'); 120};
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.