1/*!--------------------------------------------------------------------------* 2 * 3 * jquery.heightLine.js 4 * 5 * MIT-style license. 6 * 7 * 2013 Kazuma Nishihata 8 * http://www.to-r.net 9 * 10 *--------------------------------------------------------------------------*/ 11;(function($){ 12 $.fn.heightLine = function(){ 13 var target = this,fontSizeChangeTimer,windowResizeId= Math.random(); 14 var heightLineObj = { 15 op : { 16 "maxWidth" : 10000, 17 "minWidth" : 0, 18 "fontSizeCheck" : false 19 }, 20 setOption : function(op){ 21 this.op = $.extend(this.op,op); 22 }, 23 destroy : function(){ 24 target.css("height",""); 25 }, 26 create : function(op){ 27 var self = this, 28 maxHeight = 0, 29 windowWidth = $(window).width(); 30 self.setOption(op); 31 if( windowWidth<=self.op.maxWidth && windowWidth>=self.op.minWidth ){ 32 target.each(function(){ 33 if($(this).outerHeight()>maxHeight){ 34 maxHeight = $(this).outerHeight(); 35 } 36 }).each(function(){ 37 var height = maxHeight 38 - parseInt($(this).css("padding-top")) 39 - parseInt($(this).css("padding-bottom")); 40 $(this).height(height); 41 }); 42 } 43 }, 44 refresh : function(op){ 45 this.destroy(); 46 this.create(op); 47 }, 48 removeEvent :function(){ 49 $(window).off("resize."+windowResizeId); 50 target.off("destroy refresh"); 51 clearInterval(fontSizeChangeTimer); 52 } 53 } 54 if(typeof arguments[0] === "string" && arguments[0] === "destroy"){ 55 target.trigger("destroy"); 56 }else if(typeof arguments[0] === "string" && arguments[0] === "refresh"){ 57 target.trigger("refresh"); 58 }else{ 59 heightLineObj["create"](arguments[0]); 60 61 $(window).on("resize."+windowResizeId,function(){ 62 heightLineObj["refresh"](); 63 }); 64 65 target.on("destroy",function(){ 66 heightLineObj["removeEvent"](); 67 heightLineObj["destroy"](); 68 }).on("refresh",function(){ 69 heightLineObj["refresh"](); 70 }); 71 72 if(heightLineObj.op.fontSizeCheck){ 73 74 if($("#fontSizeChange").length<=0){ 75 var fontSizeChange = $("<span id='fontSizeChange'></span>").css({ 76 width:0, 77 height:"1em", 78 position:"absolute", 79 left:0, 80 top:0 81 }).appendTo("body"); 82 } 83 var defaultFontSize = $("#fontSizeChange").height(); 84 fontSizeChangeTimer = setInterval(function(){ 85 if(defaultFontSize != $("#fontSizeChange").height()){ 86 heightLineObj["refresh"](); 87 } 88 },100); 89 } 90 } 91 return target; 92 } 93})(jQuery);
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.