
// subistitui text-overflow: elipsis, mas com a vantagem de elementos multilinhas
// usar <TAG tamanho id=foo><subtag>texto</subtag></TAG>
// uso : $('#fos').ellipsis();
// by rodolfo

(function($) {
        $.fn.ellipsis = function()
        {
                return this.each(function(index)
                {
                    var divh=$(this).height();
                    var p=$(this).children().eq(0);
                    if ($(this).css('display') != 'none') {                        
                        while ($(p).outerHeight()>divh) {
                                $(p).text(function (index, text) {
                                        return text.replace(/\W*\s(\S)*$/, '...');
                                });
                        }
                    }
                });
        };
})(jQuery);
