"undefined"!=typeof jQuery&&function(t){var e=0,i=/(?:^|\W*)\w*$/,n=/(?:\w+)(?=\W+|$)/,s=null!==/msie/i.exec(navigator.userAgent)?function(t,e){t.nodeValue=e}:function(t,e){t.textContent=e},o=!1,l=!1,a=function(){var e=t("
",{id:"truncate-detect-height-method",text:". . . ."});e.css({"line-height":1.43125,"font-size":"16px","font-family":"sans-serif",width:0,position:"absolute",top:0,left:0,visibility:"hidden"}),t("body").append(e);var i=parseFloat(e.css("line-height")),n=Math.abs(4*i-e.height());0!==n&&(n<1?l=!0:n>1&&(o=!0),a=function(){})},h=function(e,n,o,l){var a=[],h=t("");h.html(e);var r,c,u,g,f,p,d,m,x,v,y=0,b=h.contents().detach(),w=0;for(w=b.size()-1;w>=0;w-=1)a.push({$parent:h,node:b.get(w)});for(;a.length>0&&yn-y){m=(d=i.exec(f.substring(0,n-y))).index+d[0].length,s(c,f.substring(0,m)),void 0!==o&&(p.is("a")&&!1!==l?p.parent().append(o):p.append(o)),y+=m;break}y+=g}else{if((g=(f=u.text()).length)>n-y)for(v=0,v=(x=u.contents().detach()).size()-1;v>=0;v-=1)a.push({$parent:u,node:x.get(v)});else y+=g;r.$parent.append(u)}y===n&&r.$parent.append(o)}return h.html()},r=function(t){for(var e=t.parent();void 0!==e&&e.size()>0;){if("inline"!==e.css("display"))return e;e=e.parent()}return null},c=function(s,r,c){var u=null,g=function(){if((-1!==window.location.hash.indexOf("_debugTruncate")||!0===r.debug)&&void 0!==window.console)if(null!==/msie/i.exec(navigator.userAgent)){var t,e="";for(t=0;t0&&(e+=", "),"function"==typeof arguments[t]?e+="[function]":"object"==typeof arguments[t]&&"object"==typeof JSON&&"function"==typeof JSON.stringify?e+=JSON.stringify(arguments[t]):e+=arguments[t].toString();console.log(e)}else try{console.log.apply(null,arguments)}catch(t){console.log(arguments)}};a();var f,p,d,m=""!==r.showText?' '+r.showText+"":"",x=""!==r.hideText?' '+r.hideText+"":"",v=(f=r.maxLines,p=r.lineHeight,d=f*(!0===o?Math.floor(p):p),!0===l?Math.round(d):d),y=function(t,e){var i=(t+1)*(!0===o?Math.floor(e):e)-1;return!0===l?Math.round(i):i}(r.maxLines,r.lineHeight),b=new Date,w=t("");if(w.html(c),void 0!==s.data("truncatePlugin")||s.height()>y){var $,P,z,H=null===r.contextParent||r.contextParent===s?s:t(r.contextParent);if(H.find(s).size()>0){for(var T,j,O=[],k=s,A=k.parent();0!==A.size()&&!(A.find(H).size()>0);)O.unshift(k.index()),k=A,A=A.parent();for($=P=H.clone(),T=0;Ty){var N,S,C,D,M=w.text(),F=0,J=M.length,W=J,Q=0;do{$.height()>y?J=W:F=W,S=Math.floor((J+F)/2),(W=i.exec(M.substring(0,S)).index)===F&&null!==(C=n.exec(M.substring(S,J)))&&(D=S+C.index+C[0].length)!==J&&(W=D),N=h(c,W,r.truncateString,r.truncateAfterLinks),$.html(N+m),Q+=1}while(QF&&W "+y+"px in "+Q+" steps."),u=W}else P.remove(),s.html(c),!0===r.tooltip&&s.removeAttr("title"),u=c.length}else g("truncate.js: skipped processing element with height "+s.height()+"px < "+y+"px"),u=c.length;var q=new Date;return e+=q-b,g("truncate.js: took "+(q-b)+" ms to execute."),g("truncate.js: ",s),g("truncate.js: cumulative execution time "+e+" ms"),u};function u(e,i){if(this.defaults={maxLines:1,lineHeight:null,truncateString:"",truncateAfterLinks:!0,showText:"",hideText:"",showClass:"show",hideClass:"hide",collapsed:!0,debug:!1,contextParent:null,maxSteps:100,tooltip:!1,animate:!1,animateOptions:{complete:function(){}}},this.config=t.extend(!0,{},this.defaults,i),this.$el=t(e),null===this.config.lineHeight){var n=NaN;if(n="normal"===this.$el.css("line-height")?1.14*parseFloat(this.$el.css("font-size")):-1===this.$el.css("line-height").indexOf("px")?this.$el.css("line-height")*parseFloat(this.$el.css("font-size")):parseFloat(this.$el.css("line-height")),isNaN(n))throw new Error('No "lineHeight" parameter was specified and none could be calculated.');this.config.lineHeight=n}"inline"===this.$el.css("display")&&(null===this.config.contextParent?this.config.contextParent=r(this.$el):"inline"===this.config.contextParent.css("display")&&(this.config.contextParent=r(this.config.contextParent))),this.html=this.$el.html(),this.lastTruncationPoint=null}u.prototype={options:function(e){if("object"!=typeof e)return this.config;this.config=t.extend(!0,{},this.config,e)},update:function(t){if(void 0===t){var e=this.$el.html();void 0!==this.lastHtmlLength&&e.length!==this.lastHtmlLength&&(t=e.substring(0,this.lastTruncationPoint)+this.html.substring(this.lastTruncationPoint),this.html=t)}else this.html=t;this.lastTruncationPoint=c(this.$el,this.config,this.html),this.lastHtmlLength=this.$el.html().length},getOriginalHtml:function(){return this.html}},t.fn.truncate=function(e){var i,n=t(this);null!=e&&"object"!=typeof e||n.each(function(){var i=t(this),n=new u(i,e);i.data("truncatePlugin",n),n.lastTruncationPoint=c(i,n.config,n.html),n.lastHtmlLength=i.html().length});var s=arguments;return"string"==typeof e&&n.each(function(){var n=t(this).data("truncatePlugin");if("function"==typeof n[e]){var o=n[e].apply(n,Array.prototype.slice.call(s,1));void 0===i&&(i=o)}}),void 0!==i?i:this}}(jQuery);