$.fn.readMore=function(t){var a,e=$.extend({showLines:8,showParagraph:!1,linking:!0,linkCaption:"read more",linkCloseCaption:"read less",linkHint:"Click to see full article",animationSpeed:800,previewTextOnly:!0},t);$(document).ready(function(){$(".jrm-truncate").each(function(t){var i,n,s,r,l,o=t+1,d=$(this).outerHeight();$(this).addClass("jrm-"+o),$(this).children(":first-child").append('<div id="Temp"> </div>'),a=$("#Temp").height(),$("#Temp").remove(),s=parseFloat($(this).children(":first-child").css("margin-top")),0!=s&&($(this).css("margin-top",s),$(this).children(":first-child").css("margin-top",0)),e.showParagraph||-1==$(this).attr("data-lines")?n=parseFloat($(this).children("p:first-child").outerHeight()):(i=$(this).attr("data-lines")?parseFloat($(this).attr("data-lines")):parseFloat(e.showLines),n=i*parseFloat(a)),r=$(this).attr("data-link-caption")?$(this).attr("data-link-caption"):e.linkCaption,l=$(this).attr("data-link-closecaption")?$(this).attr("data-link-closecaption"):e.linkCloseCaption,d>n&&($(this).css("height",n).addClass("jrm-reduced"),e.linking||"true"==$(this).attr("data-linking")||"open only"==$(this).attr("data-linking")?$('<span class="jrm-toggle" data-id="'+o+'" title="'+e.linkHint+'">'+r+"</span>").insertAfter($(this)):setting.linking&&"true"==$(this).attr("data-linking")||($(this).prepend('<p id="Temp"> </p>'),$(this).css("margin-bottom",$("#Temp").css("margin-bottom")),$("#Temp").remove()),e.previewTextOnly&&$(this).addClass("jrm-textOnly"))}),$(".jrm-toggle").click(function(){var t,n=$(this),s=n.parent().children(".jrm-"+n.attr("data-id"));if((1!=e.linking||"open only"==s.attr("data-linking"))&&n.remove(),t=s.attr("data-duration")?parseFloat(s.attr("data-duration")):e.animationSpeed,e.showParagraph||-1==s.attr("data-lines")?sectionHeight=parseFloat(s.children("p:first-child").outerHeight()):(sectionLines=s.attr("data-lines")?parseFloat(s.attr("data-lines")):parseFloat(e.showLines),sectionHeight=sectionLines*parseFloat(a)),linkCaption=s.attr("data-link-caption")?s.attr("data-link-caption"):e.linkCaption,linkCloseCaption=s.attr("data-link-closecaption")?s.attr("data-link-closecaption"):e.linkCloseCaption,s.hasClass("jrm-reduced")){setTimeout(function(){s.removeClass("jrm-reduced")},1);var r=s.children().length,l=0;for(i=1;r+1>i;i++)l+=s.children(":nth-child("+i+")").outerHeight(!0);s.animate({height:l},t),setTimeout(function(){n.text(linkCloseCaption).attr("title",""),$(window).resize()},t)}else s.animate({height:sectionHeight},t),setTimeout(function(){n.text(linkCaption).attr("title",e.linkHint),s.addClass("jrm-reduced"),$(window).resize()},t)})})};
|