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}; 121 122 123/*elemToolTip*/ 124$.fn.elemToolTip = function(options) { 125 return this.each(function(){ 126 var $this = $(this); 127 var settings = $.extend({ 128 position: 'top', 129 text: '', 130 margin: 0 131 }, options); 132 133 if ($('.gr-tooltip').length<1) { 134 $('body').append('<div class="gr-tooltip"></div>'); 135 }; 136 137 $(window).on('scroll', function(){ 138 $('.gr-tooltip').removeClass('show_tooltip'); 139 }); 140 141 $this.on('mouseover', function(){ 142 $('.gr-tooltip').removeAttr('style'); 143 144 var elemWidth = $(this).outerWidth(); 145 var elemTop = $(this).offset().top; 146 var elemLeft = $(this).offset().left; 147 var elemHeight = $(this).outerHeight(); 148 var elemText = $(this).data('tooltip') || settings.text; 149 var thisClass = $(this).attr('class'); 150 151 $('.gr-tooltip').attr('data-class', thisClass); 152 $('.gr-tooltip').text(elemText); 153 154 var tooltipHeight = $('.gr-tooltip').outerHeight(); 155 156 if (settings.position == 'top' && elemText) { 157 $('.gr-tooltip').css({ 158 'top': elemTop - tooltipHeight - settings.margin, 159 'left': elemLeft + elemWidth / 2, 160 'transform': 'translateX(-50%)' 161 }); 162 $('.gr-tooltip').removeClass('bottom_tooltip').removeClass('right_tooltip').removeClass('left_tooltip').addClass('top_tooltip').addClass('show_tooltip'); 163 }; 164 165 if (settings.position == 'left' && elemText) { 166 $('.gr-tooltip').css({ 167 'top': elemTop + (elemHeight / 2) - tooltipHeight, 168 'left': elemLeft - settings.margin, 169 'transform': 'translate(-100%, 50%)' 170 }); 171 $('.gr-tooltip').removeClass('bottom_tooltip').removeClass('right_tooltip').removeClass('top_tooltip').addClass('left_tooltip').addClass('show_tooltip'); 172 }; 173 174 if (settings.position == 'right' && elemText) { 175 $('.gr-tooltip').css({ 176 'top': elemTop + (elemHeight / 2) - tooltipHeight, 177 'left': elemLeft + elemWidth + settings.margin, 178 'transform': 'translate(0, 50%)' 179 }); 180 $('.gr-tooltip').removeClass('bottom_tooltip').removeClass('left_tooltip').removeClass('top_tooltip').addClass('right_tooltip').addClass('show_tooltip'); 181 }; 182 183 if (settings.position == 'bottom' && elemText) { 184 $('.gr-tooltip').css({ 185 'top': elemTop + elemHeight + settings.margin, 186 'left': elemLeft + elemWidth / 2, 187 'transform': 'translateX(-50%)' 188 }); 189 $('.gr-tooltip').removeClass('right_tooltip').removeClass('left_tooltip').removeClass('top_tooltip').addClass('bottom_tooltip').addClass('show_tooltip'); 190 }; 191 }); 192 193 $this.on('mouseleave', function(){ 194 $('.gr-tooltip').removeClass('show_tooltip'); 195 $('.gr-tooltip').removeAttr('style'); 196 $('.gr-tooltip').removeAttr('data-class'); 197 $('.gr-tooltip').text(''); 198 }); 199 }); 200}; 201/*elemToolTip*/
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.