RadLikeWhoa / Countable

Add live paragraph-, word- and character-counting to an HTML element.
https://sacha.me/Countable
MIT License
1.64k stars 134 forks source link

Fixed RegEx & Added ucs2decode #13

Closed craniumslows closed 11 years ago

craniumslows commented 11 years ago

I needed to get my mind off of work so I went ahead and fixed the 3 open issues. You can check it out at http://jsfiddle.net/j6nkw/3/

I think this could do with a minified version.

Specific Changes / issues

  1. The word counter wasn't greedy enough so it would match " but not "x"
  2. Excluding HTML tags required a new RegularExpression. Made it selectable by looking for an omit attribute if it is "on" then html tags aren't counted.
  3. Since punycode and Countable are both MIT licensed took the ucs2decode function and used to correct counting for Unicode characters.
craniumslows commented 11 years ago

http://jsfiddle.net/j6nkw/4/ Linked to the not quite done fiddle. Here it is

RadLikeWhoa commented 11 years ago

Awesome, great work! Thanks a lot.

craniumslows commented 11 years ago

Thank you for accepting my code.