diff --git a/src/angular-ellipsis.js b/src/angular-ellipsis.js index 2f430af..efae020 100644 --- a/src/angular-ellipsis.js +++ b/src/angular-ellipsis.js @@ -1,3 +1,6 @@ +// Export module +if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.exports === exports) { module.exports = 'dibari.angular-ellipsis'; } + /** * Angular directive to truncate multi-line text to visible height * diff --git a/src/angular-ellipsis.min.js b/src/angular-ellipsis.min.js index c098412..e97950e 100644 --- a/src/angular-ellipsis.min.js +++ b/src/angular-ellipsis.min.js @@ -1 +1 @@ -angular.module("dibari.angular-ellipsis",[]).directive("ellipsis",["$timeout","$window",function(a,b){return{restrict:"A",scope:{ngBind:"=",ellipsisAppend:"@",ellipsisAppendClick:"&",ellipsisSymbol:"@"},compile:function(){return function(c,d,e){function f(){if("undefined"!=typeof c.ngBind){var a=c.ngBind.split(" "),b=0,f="undefined"!=typeof e.ellipsisSymbol?e.ellipsisSymbol:"…",h="undefined"!=typeof c.ellipsisAppend&&""!==c.ellipsisAppend?f+""+c.ellipsisAppend+"":f;if(e.isTruncated=!1,d.html(c.ngBind),g(d)){var i=a.length,j=d[0].clientHeight;for(d.html(c.ngBind+h);i>b;b++)if(a.pop(),d.html(a.join(" ")+h),d[0].scrollHeighta[0].clientHeight}e.lastWindowResizeTime=0,e.lastWindowResizeWidth=0,e.lastWindowResizeHeight=0,e.lastWindowTimeoutEvent=null,e.isTruncated=!1,c.$watch("ngBind",function(){f()}),c.$watch("ellipsisAppend",function(){f()}),angular.element(b).bind("resize",function(){a.cancel(e.lastWindowTimeoutEvent),e.lastWindowTimeoutEvent=a(function(){(e.lastWindowResizeWidth!=window.innerWidth||e.lastWindowResizeHeight!=window.innerHeight)&&f(),e.lastWindowResizeWidth=window.innerWidth,e.lastWindowResizeHeight=window.innerHeight},75)})}}}}]); \ No newline at end of file +"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="dibari.angular-ellipsis"),angular.module("dibari.angular-ellipsis",[]).directive("ellipsis",["$timeout","$window",function(a,b){return{restrict:"A",scope:{ngBind:"=",ellipsisAppend:"@",ellipsisAppendClick:"&",ellipsisSymbol:"@"},compile:function(c,d,e){return function(c,d,e){function f(){if("undefined"!=typeof c.ngBind){var a=c.ngBind.split(" "),b=0,f="undefined"!=typeof e.ellipsisSymbol?e.ellipsisSymbol:"…",h="undefined"!=typeof c.ellipsisAppend&&""!==c.ellipsisAppend?f+""+c.ellipsisAppend+"":f;if(e.isTruncated=!1,d.html(c.ngBind),g(d)){var i=a.length,j=d[0].clientHeight;for(d.html(c.ngBind+h);i>b;b++)if(a.pop(),d.html(a.join(" ")+h),d[0].scrollHeighta[0].clientHeight}e.lastWindowResizeTime=0,e.lastWindowResizeWidth=0,e.lastWindowResizeHeight=0,e.lastWindowTimeoutEvent=null,e.isTruncated=!1,c.$watch("ngBind",function(){f()}),c.$watch("ellipsisAppend",function(){f()}),angular.element(b).bind("resize",function(){a.cancel(e.lastWindowTimeoutEvent),e.lastWindowTimeoutEvent=a(function(){(e.lastWindowResizeWidth!=window.innerWidth||e.lastWindowResizeHeight!=window.innerHeight)&&f(),e.lastWindowResizeWidth=window.innerWidth,e.lastWindowResizeHeight=window.innerHeight},75)})}}}}]); \ No newline at end of file