1(function ( $ ) { 2 3 /* 4 Plugin: ShowMore 5 author: [email protected] 6 */ 7 8 $.fn.showMore = function (options) { 9 10 "use strict"; 11 12 var currentelem = 1; 13 14 this.each(function(){ 15 16 var currentid = ''; 17 var element = $(this); 18 var auto = parseInt(element.innerHeight())/2; 19 var fullheight = element.innerHeight(); 20 var maxWidth = element.css('width'); 21 var settings = $.extend({ 22 minheight: auto, 23 buttontxtmore: "show more", 24 buttontxtless: "show less", 25 buttoncss: "showmore-button", 26 animationspeed: auto 27 }, options ); 28 29 element.attr('id') != undefined ? currentid = element.attr('id') : currentid = currentelem; 30 element.wrap( "<div id='showmore-"+currentid+"' data-showmore"+(maxWidth == '0px' ? "" : " style='max-width:"+maxWidth+";'")+"></div>" ); 31 32 if (element.parent().not('[data-showmore]')) { 33 34 if (fullheight > settings.minheight) { 35 element.addClass('has-toggle'); 36 element.css('min-height', settings.minheight).css('max-height', settings.minheight).css('overflow', 'hidden'); 37 var showMoreButton = $("<div />", { 38 id: "showmore-button-"+currentid, 39 "class": settings.buttoncss, 40 click: function() { 41 if (element.css('max-height') != 'none') { 42 element.addClass('is-expanded'); 43 element.css('height', settings.minheight).css('max-height', '').animate({height:fullheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtless); }); 44 } else { 45 element.removeClass('is-expanded'); 46 element.animate({height:settings.minheight}, settings.animationspeed, function () { showMoreButton.html(settings.buttontxtmore); element.css('max-height', settings.minheight); }); 47 } 48 }, 49 html: settings.buttontxtmore 50 }); 51 52 element.after(showMoreButton); 53 54 } 55 56 currentelem++; 57 58 } 59 60 }); 61 62 return this; 63 64 }; 65 66}(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.