Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not extract until it find a space #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/jquery.shorten.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
var content = $this.html();
var contentlen = $this.text().length;
if (contentlen > config.showChars) {
var c = content.substr(0, config.showChars);
var nextSpaceIndex = content.substr(config.showChars, contentlen - config.showChars).indexOf(" "); // Index of the first space in the text to hide
var c = content.substr(0, parseInt(config.showChars) + parseInt(nextSpaceIndex));
if (c.indexOf('<') >= 0) // If there's HTML don't want to cut it
{
var inTag = false; // I'm in a tag?
Expand Down