Gruntified and added more options

Ability to configure if you compensate for images as well as being able to
adjust the number of words per minute being used. Closes #1
This commit is contained in:
Josh Sherman 2014-09-03 22:04:59 -04:00
parent 8c99148381
commit ca545cfc33
7 changed files with 55 additions and 9 deletions

2
build/jquery.readtime.min.js vendored Normal file
View file

@ -0,0 +1,2 @@
/*! jquery.readtime 2014-09-03 */
!function(a){a.fn.readtime=function(b){var c={"class":"readtime",format:"# min read",images:12,wpm:275,wrapper:"time"};return b=a.extend(c,b),this.each(function(){var c=this.textContent||this.innerText||"",d=c.replace(/(^\s*)|(\s*$)/gi,"").replace(/[ ]{2,}/gi," ").replace(/\n /,"\n").split(" ").length,e=d/b.wpm*60;b.images&&(e+=a(this).find("img").length*b.images),e=Math.round(e/60),e=b.format.replace(/#/,e);var f=document.createElement(b.wrapper);a(f).addClass(b.class).html(e).prependTo(a(this))})}}(jQuery);