1 2 3(function($) 4{ 5 /** 6* Auto-growing textareas; technique ripped from Facebook 7* 8* http://github.com/jaz303/jquery-grab-bag/tree/master/javascripts/jquery.autogrow-textarea.js 9*/ 10 $.fn.autogrow = function(options) 11 { 12 return this.filter('textarea').each(function() 13 { 14 var self = this; 15 var $self = $(self); 16 var minHeight = $self.height(); 17 var noFlickerPad = $self.hasClass('autogrow-short') ? 0 : parseInt($self.css('lineHeight')); 18 19 var shadow = $('<div></div>').css({ 20 position: 'absolute', 21 top: -10000, 22 left: -10000, 23 width: $self.width(), 24 fontSize: $self.css('fontSize'), 25 fontFamily: $self.css('fontFamily'), 26 fontWeight: $self.css('fontWeight'), 27 lineHeight: $self.css('lineHeight'), 28 resize: 'none' 29 }).appendTo(document.body); 30 31 var update = function() 32 { 33 var times = function(string, number) 34 { 35 for (var i=0, r=''; i<number; i++) r += string; 36 return r; 37 }; 38 39 var val = self.value.replace(/</g, '<') 40 .replace(/>/g, '>') 41 .replace(/&/g, '&') 42 .replace(/\n$/, '<br/> ') 43 .replace(/\n/g, '<br/>') 44 .replace(/ {2,}/g, function(space){ return times(' ', space.length - 1) + ' ' }); 45 46 shadow.css('width', $self.width()); 47 shadow.html(val); 48 $self.css('height', Math.max(shadow.height() + noFlickerPad, minHeight)); 49 } 50 51 $self.change(update).keyup(update).keydown(update); 52 $(window).resize(update); 53 54 update(); 55 }); 56 }; 57})(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.