/* * jQuery dotdotdot 1.6.7 * * Copyright (c) 2013 Fred Heusschen * www.frebsite.nl * * Plugin website: * dotdotdot.frebsite.nl * * Dual licensed under the MIT and GPL licenses. * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License */ !function(a,b){function d(a,b,c){var d=a.children(),e=!1;a.empty();for(var f=0,h=d.length;h>f;f++){var i=d.eq(f);if(a.append(i),c&&a.append(c),g(a,b)){i.remove(),e=!0;break}c&&c.detach()}return e}function e(b,c,d,h,i){var j=b.contents(),k=!1;b.empty();for(var l="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",m=0,n=j.length;n>m&&!k;m++){var o=j[m],p=a(o);"undefined"==typeof o||3==o.nodeType&&0==a.trim(o.data).length||(b.append(p),i&&b[b.is(l)?"after":"append"](i),g(d,h)&&(k=3==o.nodeType?f(p,c,d,h,i):e(p,c,d,h,i),k||(p.remove(),k=!0)),k||i&&i.detach())}return k}function f(b,c,d,e,f){var i=b[0];if(!i)return!1;var l=k(i),n=-1!==l.indexOf(" ")?" ":"\u3000",o="letter"==e.wrap?"":n,p=l.split(o),q=-1,r=-1,s=0,t=p.length-1;for(e.fallbackToLetter&&0==t&&t==s&&(o="",p=l.split(o),t=p.length-1);t>=s&&(0!=s||0!=t);){var u=Math.floor((s+t)/2);if(u==r)break;r=u,j(i,p.slice(0,r+1).join(o)+e.ellipsis),g(d,e)?t=r:(q=r,s=r)}if(-1==q||1==p.length&&0==p[0].length){var v=b.parent();b.remove();var w=f&&f.closest(v).length?f.length:0;v.contents().length>w?i=m(v.contents().eq(-1-w),c):(i=m(v,c,!0),w||v.remove()),i&&(l=h(k(i),e),j(i,l),w&&f&&a(i).parent().append(f))}else l=h(p.slice(0,q+1).join(o),e),j(i,l);return!0}function g(a,b){return a.innerHeight()>b.maxHeight}function h(b,c){for(;a.inArray(b.slice(-1),c.lastCharacter.remove)>-1;)b=b.slice(0,-1);return a.inArray(b.slice(-1),c.lastCharacter.noEllipsis)<0&&(b+=c.ellipsis),b}function i(a){return{width:a.innerWidth(),height:a.innerHeight()}}function j(a,b){a.innerText?a.innerText=b:a.nodeValue?a.nodeValue=b:a.textContent&&(a.textContent=b)}function k(a){return a.innerText?a.innerText:a.nodeValue?a.nodeValue:a.textContent?a.textContent:""}function l(a){do a=a.previousSibling;while(a&&1!==a.nodeType&&3!==a.nodeType);return a}function m(b,c,d){var f,e=b&&b[0];if(e){if(!d){if(3===e.nodeType)return e;if(a.trim(b.text()))return m(b.contents().last(),c)}for(f=l(e);!f;){if(b=b.parent(),b.is(c)||!b.length)return!1;f=l(b[0])}if(f)return m(a(f),c)}return!1}function n(b,c){return b?"string"==typeof b?(b=a(b,c),b.length?b:!1):b.jquery?b:!1:!1}function o(a){for(var b=a.innerHeight(),c=["paddingTop","paddingBottom"],d=0,e=c.length;e>d;d++){var f=parseInt(a.css(c[d]),10);isNaN(f)&&(f=0),b-=f}return b}function p(a,b){return a?(b="string"==typeof b?"dotdotdot: "+b:["dotdotdot:",b],"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&window.console.log(b),!1):!1}if(!a.fn.dotdotdot){a.fn.dotdotdot=function(b){if(0==this.length)return b&&b.debug===!1||p(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){a(this).dotdotdot(b)});var f=this;f.data("dotdotdot")&&f.trigger("destroy.dot"),f.data("dotdotdot-style",f.attr("style")||""),f.css("word-wrap","break-word"),"nowrap"===f.css("white-space")&&f.css("white-space","normal"),f.bind_events=function(){return f.bind("update.dot",function(b,c){b.preventDefault(),b.stopPropagation(),j.maxHeight="number"==typeof j.height?j.height:o(f),j.maxHeight+=j.tolerance,"undefined"!=typeof c&&(("string"==typeof c||c instanceof HTMLElement)&&(c=a("
").append(c).contents()),c instanceof a&&(h=c)),q=f.wrapInner('').children(),q.empty().append(h.clone(!0)).find("br").replaceWith("