removing ellipses from posts with < 225 chars
authorAnthony Talarico <talarico@gaslightmedia.com>
Mon, 18 Jan 2016 20:15:47 +0000 (15:15 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Mon, 18 Jan 2016 20:15:47 +0000 (15:15 -0500)
js/app.js
js/custom/pageSetup.js

index d28a8f9..c7af6d9 100644 (file)
--- a/js/app.js
+++ b/js/app.js
@@ -113,14 +113,16 @@ $(document).ready(function () {
 
     // remove link from posts with less than 225 characters
     for (var i = 0; i < $('div[class*="excerpt"]').length; i++){
-//        var words = $(".excerpt" + i).text().split(' ');
-        var words = $(".excerpt" + i).text();
-        if(words.length < 225){
-           
+        var chars= $(".excerpt" + i).text();
+
+        if(chars.length < 225){
+           chars = chars.substr(0,chars.length - 2);
+            
             // disable link if excerpt is < 225 characters
             $(".excerpt" + i).parent().find("a").replaceWith(function(){
                return $("<h2 />", {html: $(this).html()});
             });
+            $('.excerpt' + i).text(chars);
         }
     }
    /* get number of elements in DOM console.log($("*").length);
index d361547..40ea86d 100644 (file)
@@ -104,14 +104,16 @@ $(document).ready(function () {
 
     // remove link from posts with less than 225 characters
     for (var i = 0; i < $('div[class*="excerpt"]').length; i++){
-//        var words = $(".excerpt" + i).text().split(' ');
-        var words = $(".excerpt" + i).text();
-        if(words.length < 225){
-           
+        var chars= $(".excerpt" + i).text();
+
+        if(chars.length < 225){
+           chars = chars.substr(0,chars.length - 2);
+            
             // disable link if excerpt is < 225 characters
             $(".excerpt" + i).parent().find("a").replaceWith(function(){
                return $("<h2 />", {html: $(this).html()});
             });
+            $('.excerpt' + i).text(chars);
         }
     }
    /* get number of elements in DOM console.log($("*").length);