1(function($) { 2 $.fn.jTruncate = function(h) { 3 var i = { 4 length: 300, 5 minTrail: 20, 6 moreText: "more", 7 lessText: "less", 8 ellipsisText: "...", 9 moreAni: "", 10 lessAni: "" 11 }; 12 var h = $.extend(i, h); 13 return this.each(function() { 14 obj = $(this); 15 var a = obj.html(); 16 if (a.length > h.length + h.minTrail) { 17 var b = a.indexOf(' ', h.length); 18 if (b != -1) { 19 var b = a.indexOf(' ', h.length); 20 var c = a.substring(0, b); 21 var d = a.substring(b, a.length - 1); 22 obj.html(c + '<span class="truncate_ellipsis">' + h.ellipsisText + '</span>' + '<span class="truncate_more">' + d + '</span>'); 23 obj.find('.truncate_more').css("display", "none"); 24 obj.append('<div class="clearboth">' + '<a href="#" class="truncate_more_link">' + h.moreText + '</a>' + '</div>'); 25 var e = $('.truncate_more_link', obj); 26 var f = $('.truncate_more', obj); 27 var g = $('.truncate_ellipsis', obj); 28 e.click(function() { 29 if (e.text() == h.moreText) { 30 f.show(h.moreAni); 31 e.text(h.lessText); 32 g.css("display", "none"); 33 f.css("display", "inline"); 34 } else { 35 f.hide(h.lessAni); 36 e.text(h.moreText); 37 g.css("display", "inline"); 38 } 39 return false 40 }) 41 } 42 } 43 }) 44 } 45})(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.