From 634213797241c10ac67922e6f6a785e2e914825b Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 29 Jul 2016 17:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81=E6=96=87?= =?UTF-8?q?=E5=AD=97=E8=BF=87=E5=A4=9A=E6=98=BE=E7=A4=BA=E7=9C=81=E7=95=A5?= =?UTF-8?q?=E5=8F=B7=EF=BC=9A=E4=B8=AD=E6=96=87=E7=9C=81=E7=95=A5=E5=8F=B7?= =?UTF-8?q?=EF=BC=8C=E8=8B=B1=E6=96=87=E5=8D=95=E8=AF=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E8=A2=AB=E6=8B=86=E5=88=86=E6=98=BE=E7=A4=BA=E7=9C=81=E7=95=A5?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascripts/wechat/directives/ellipsis.js | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/public/javascripts/wechat/directives/ellipsis.js b/public/javascripts/wechat/directives/ellipsis.js index a5dcfa293..d3a67c557 100644 --- a/public/javascripts/wechat/directives/ellipsis.js +++ b/public/javascripts/wechat/directives/ellipsis.js @@ -1,25 +1,25 @@ -/** - * Created by Tim on 7/22/16. - */ -//app.directive('ellipsisShow',["$timeout",function(timer){ -// return{ -// restrict: 'A', -// scope: {}, -// link: function(scope, element){ -// timer(function() { -// var textSplit = element.text().split(" "); -// var newContent = []; -// element.text(""); -// for (var i = 0; i < textSplit.length; i++) { -// newContent = newContent + " " + textSplit[i]; -// element.text(newContent); -// if(element[0].scrollHeight >= 100){ -// newContent = newContent + " " + textSplit[i+1] + " " + textSplit[i+2] + " " + textSplit[i+3] + " " + textSplit[i+4] + "..."; -// element.text(newContent); -// break; -// } -// } -// }); -// } -// } -//}]); \ No newline at end of file +/** + * Created by Tim on 7/22/16. + */ +app.directive('ellipsisShow',["$timeout",function(timer){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + timer(function() { + var textSplit = element.text().split(""); + var newContent = []; + element.text(""); + for (var i = 0; i < textSplit.length; i++) { + newContent = newContent + textSplit[i]; + element.text(newContent); + if(element[0].scrollHeight >= 100){ + newContent = newContent + textSplit[i+1] + textSplit[i+2] + textSplit[i+3] + textSplit[i+4] + "..."; + element.text(newContent); + break; + } + } + }); + } + } +}]); \ No newline at end of file