Skip to content

Commit

Permalink
Merge pull request #5 from drvic10k/pull-2
Browse files Browse the repository at this point in the history
only one hyphen was replaced
  • Loading branch information
Adam Lukaszczyk committed Jun 9, 2014
2 parents d612944 + 9325442 commit 9cd29ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/jquery.FastEllipsis.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function FastEllipsis(cssStyle) {
ellipseIt = function(myString, maxLine, lineWidth) {
var lineNo = 1,
wordsInLineWidth = 0,
wordArr = myString.trim().strip_tags().replace("-", "- ").split(/\s+/g), // trim string, remove HTML tags, remove space duplicates, detect dash word breaking
wordArr = myString.trim().strip_tags().replace(/-/g, "- ").split(/\s+/g), // trim string, remove HTML tags, remove space duplicates, detect dash word breaking
spaceWidth = getCharWidth(" "),
threeDotsWidth = getWordWidth("...");

Expand All @@ -140,7 +140,7 @@ function FastEllipsis(cssStyle) {

// When you reached the end of maxLine parameter break the loop and return the result
else if (lineNo > maxLine) {
return wordArr.slice(0, i).join(" ").replace("- ", "-") + "..."; // replace to reverse dash word breaking
return wordArr.slice(0, i).join(" ").replace(/-\s/g, "-") + "..."; // replace to reverse dash word breaking
}

// If the words width was bigger than line width go back in the loop to take last word for use in the beggining of next line
Expand Down Expand Up @@ -179,4 +179,4 @@ if (typeof String.prototype.strip_tags !== "function") {
String.prototype.strip_tags = function() {
return this.replace(/<\/?[^>]+(>|$)/g, "");
};
};
};

0 comments on commit 9cd29ae

Please sign in to comment.