1/** 2 * jquery.readmore - Substring long paragraphs and make expandable with "more" link 3 * @date 7 July 2010 4 * @author Jake Trent http://www.jtsnake.com/ 5 * @version 1.1 6 */ 7(function ($) { 8 $.fn.readmore = function (settings) { 9 10 var opts = $.extend({}, $.fn.readmore.defaults, settings); 11 12 this.each(function () { 13 $(this).data("opts", opts); 14 if ($(this).html().length > opts.substr_len) { 15 abridge($(this)); 16 linkage($(this)); 17 } 18 }); 19 20 function linkage(elem) { 21 elem.append(elem.data("opts").more_link); 22 elem.children(".more").click( function () { 23 $(this).hide(); 24 $(this).siblings("span:not(.hidden)").hide().siblings("span.hidden").animate({'opacity' : 'toggle'},1000); 25 }); 26 } 27 28 function abridge(elem) { 29 var opts = elem.data("opts"); 30 var txt = elem.html(); 31 var len = opts.substr_len; 32 var dots = "<span>" + opts.ellipses + "</span>"; 33 var shown = txt.substring(0, len) + dots; 34 var hidden = '<span class="hidden" style="display:none;">' + txt.substring(len, txt.length) + '</span>'; 35 elem.html(shown + hidden); 36 } 37 38 return this; 39 }; 40 41 $.fn.readmore.defaults = { 42 substr_len: 500, 43 ellipses: '…', 44 more_link: '' 45 }; 46 47})(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.