!function(t){function e(t,e,n){var o=t.children(),r=!1;t.empty();for(var a=0,d=o.length;d>a;a++){var l=o.eq(a);if(t.append(l),n&&t.append(n),i(t,e)){l.remove(),r=!0;break}n&&n.remove()}return r}function n(e,r,a,d,l){var u=e.contents(),c=!1;e.empty();for(var s="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, select, optgroup, option, textarea, script, style",f=0,h=u.length;h>f&&!c;f++){var p=u[f],v=t(p);void 0!==p&&(e.append(v),l&&e[e.is(s)?"after":"append"](l),3==p.nodeType?i(a,d)&&(c=o(v,r,a,d,l)):c=n(v,r,a,d,l),c||l&&l.remove())}return c}function o(t,e,n,a,u){var c=!1,s=t[0];if(void 0===s)return!1;for(var f="letter"==a.wrap?"":" ",h=l(s).split(f),p=-1,v=-1,g=0,w=h.length-1;w>=g;){var m=Math.floor((g+w)/2);if(m==v)break;v=m,d(s,h.slice(0,v+1).join(f)+a.ellipsis),i(n,a)?w=v:(p=v,g=v)}if(-1==p||1==h.length&&0==h[0].length){var b=t.parent();t.remove();var y=u?u.length:0;if(b.contents().size()>y){var x=b.contents().eq(-1-y);c=o(x,e,n,a,u)}else{var s=b.prev().contents().eq(-1)[0];if(void 0!==s){var T=r(l(s),a);d(s,T),b.remove(),c=!0}}}else{var T=r(h.slice(0,p+1).join(f),a);c=!0,d(s,T)}return c}function i(t,e){return t.innerHeight()>e.maxHeight}function r(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return 0>t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)&&(e+=n.ellipsis),e}function a(t){return{width:t.innerWidth(),height:t.innerHeight()}}function d(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function l(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function u(e,n){return void 0!==e&&(!!e&&("string"==typeof e?(e=t(e,n),!!e.length&&e):"object"==typeof e&&(void 0!==e.jquery&&e)))}function c(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],o=0,i=n.length;i>o;o++){var r=parseInt(t.css(n[o]),10);isNaN(r)&&(r=0),e-=r}return e}function s(t,e){return!!t&&(e="string"==typeof e?"dotdotdot: "+e:["dotdotdot:",e],void 0!==window.console&&void 0!==window.console.log&&window.console.log(e),!1)}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(o){if(0==this.length)return o&&o.debug===!1||s(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(o)});var r=this;r.data("dotdotdot")&&r.trigger("destroy.dot"),r.bind_events=function(){return r.bind("update.dot",function(o,a){o.preventDefault(),o.stopPropagation(),l.maxHeight="number"==typeof l.height?l.height:c(r),l.maxHeight+=l.tolerance,void 0!==a&&(("string"==typeof a||a instanceof HTMLElement)&&(a=t("
").append(a).contents()),a instanceof t&&(d=a)),g=r.wrapInner('').children(),g.empty().append(d.clone(!0)).css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var u=!1,s=!1;return h.afterElement&&(u=h.afterElement.clone(!0),h.afterElement.remove()),i(g,l)&&(s="children"==l.wrap?e(g,l,u):n(g,r,g,l,u)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(r[0],s,d),h.isTruncated=s,s}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(r[0],h.isTruncated),h.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(r[0],d),d}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),r.unwatch().unbind_events().empty().append(d).data("dotdotdot",!1)}),r},r.unbind_events=function(){return r.unbind(".dot"),r},r.watch=function(){if(r.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),o=e.height();e.bind("resize.dot"+h.dotId,function(){n==e.width()&&o==e.height()&&l.windowResizeFix||(n=e.width(),o=e.height(),v&&clearInterval(v),v=setTimeout(function(){r.trigger("update.dot")},10))})}else p=a(r),v=setInterval(function(){var t=a(r);(p.width!=t.width||p.height!=t.height)&&(r.trigger("update.dot"),p=a(r))},100);return r},r.unwatch=function(){return t(window).unbind("resize.dot"+h.dotId),v&&clearInterval(v),r};var d=r.contents(),l=t.extend(!0,{},t.fn.dotdotdot.defaults,o),h={},p={},v=null,g=null;return h.afterElement=u(l.after,r),h.isTruncated=!1,h.dotId=f++,r.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&r.watch(),r},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",lastCharacter:{remove:[" ",",",";",".","!","?"],noEllipsis:[]},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,debug:!1};var f=1,h=t.fn.html;t.fn.html=function(t){return void 0!==t?this.data("dotdotdot")&&"function"!=typeof t?this.trigger("update",[t]):h.call(this,t):h.call(this)};var p=t.fn.text;t.fn.text=function(e){if(void 0!==e){if(this.data("dotdotdot")){var n=t("");return n.text(e),e=n.html(),n.remove(),this.trigger("update",[e])}return p.call(this,e)}return p.call(this)}}}(jQuery);