/* * jquery dotdotdot 1.8.3 * * copyright (c) fred heusschen * www.frebsite.nl * * plugin website: * dotdotdot.frebsite.nl * * licensed under the mit license. * http://en.wikipedia.org/wiki/mit_license */ !function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="a, table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var h=this,f=t(h);if("undefined"==typeof h)return!0;if(f.is(u))e.append(f);else{if(s)return!0;e.append(f),!l||f.is(d.after)||f.find(d.after).length||e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==h.nodetype?o(f,n,i,d,l):r(f,n,i,d,l)),s||l&&l.detach()}}),n.addclass("is-truncated"),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var h=s(c),f=-1!==h.indexof(" ")?" ":" ",p="letter"==o.wrap?"":f,g=h.split(p),v=-1,w=-1,b=0,m=g.length-1;for(o.fallbacktoletter&&0==b&&0==m&&(p="",g=h.split(p),m=g.length-1);m>=b&&(0!=b||0!=m);){var y=math.floor((b+m)/2);if(y==w)break;w=y,l(c,g.slice(0,w+1).join(p)+o.ellipsis),r.children().each(function(){t(this).toggle().toggle()}),a(r,o)?(m=w,o.fallbacktoletter&&0==b&&0==m&&(p="",g=g[0].split(p),v=-1,w=-1,b=0,m=g.length-1)):(v=w,b=w)}if(-1==v||1==g.length&&0==g[0].length){var x=e.parent();e.detach();var c=d&&d.closest(x).length?d.length:0;if(x.contents().length>c?c=u(x.contents().eq(-1-c),n):(c=u(x,n,!0),c||x.detach()),c&&(h=i(s(c),o),l(c,h),c&&d)){var t=d.parent();t(c).parent().append(d),t.trim(t.html())||t.remove()}}else h=i(g.slice(0,v+1).join(p),o),l(c,h);return!0}function a(t,e){return t.innerheight()>e.maxheight}function i(e,n){for(;t.inarray(e.slice(-1),n.lastcharacter.remove)>-1;)e=e.slice(0,-1);return t.inarray(e.slice(-1),n.lastcharacter.noellipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerwidth(),height:t.innerheight()}}function l(t,e){t.innertext?t.innertext=e:t.nodevalue?t.nodevalue=e:t.textcontent&&(t.textcontent=e)}function s(t){return t.innertext?t.innertext:t.nodevalue?t.nodevalue:t.textcontent?t.textcontent:""}function c(t){do t=t.previoussibling;while(t&&1!==t.nodetype&&3!==t.nodetype);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodetype)return a;if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function h(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function f(t){for(var e=t.innerheight(),n=["paddingtop","paddingbottom"],r=0,o=n.length;o>r;r++){var a=parseint(t.css(n[r]),10);isnan(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('no element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this,i=o.contents();o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){switch(o.removeclass("is-truncated"),e.preventdefault(),e.stoppropagation(),typeof l.height){case"number":l.maxheight=l.height;break;case"function":l.maxheight=l.height.call(o[0]);break;default:l.maxheight=f(o)}l.maxheight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||"nodetype"in d&&1===d.nodetype)&&(d=t("
").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapinner('
').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replacewith("
").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterelement&&(c=s.afterelement.clone(!0),c.show(),s.afterelement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replacewith(g.contents()),g=null,t.isfunction(l.callback)&&l.callback.call(o[0],u,i),s.istruncated=u,u}).bind("istruncated.dot",function(t,e){return t.preventdefault(),t.stoppropagation(),"function"==typeof e&&e.call(o[0],s.istruncated),s.istruncated}).bind("originalcontent.dot",function(t,e){return t.preventdefault(),t.stoppropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventdefault(),t.stoppropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").removeclass("is-truncated").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotid,function(){n==e.width()&&r==e.height()&&l.windowresizefix||(n=e.width(),r=e.height(),u&&clearinterval(u),u=settimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setinterval(function(){if(o.is(":visible")){var t=d(o);c.width==t.width&&c.height==t.height||(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotid),u&&clearinterval(u),o};var l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastcharacter.remove instanceof array||(l.lastcharacter.remove=t.fn.dotdotdot.defaultarrays.lastcharacter.remove),l.lastcharacter.noellipsis instanceof array||(l.lastcharacter.noellipsis=t.fn.dotdotdot.defaultarrays.lastcharacter.noellipsis),s.afterelement=h(l.after,o),s.istruncated=!1,s.dotid=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbacktoletter:!0,lastcharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowresizefix:!0},t.fn.dotdotdot.defaultarrays={lastcharacter:{remove:[" "," ",",",";",".","!","?"],noellipsis:[]}},t.fn.dotdotdot.debug=function(t){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isfunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isfunction(n)&&this.data("dotdotdot")?(n=t("
").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jquery),jquery(document).ready(function(t){t(".dot-ellipsis").each(function(){var e=t(this).hasclass("dot-resize-update"),n=t(this).hasclass("dot-timer-update"),r=0,o=t(this).attr("class").split(/\s+/);t.each(o,function(t,e){var n=e.match(/^dot-height-(\d+)$/);null!==n&&(r=number(n[1]))});var a=new object;n&&(a.watch=!0),e&&(a.watch="window"),r>0&&(a.height=r),t(this).dotdotdot(a)})}),jquery(window).on("load",function(){jquery(".dot-ellipsis.dot-load-update").trigger("update.dot")});