forked from davatron5000/Lettering.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jquery.lettering-min.js
2 lines (2 loc) · 1.03 KB
/
jquery.lettering-min.js
1
2
// $.fn.lettering 1.0 -- MIT/GPL Licensed - More info: http://github.com/maranomynet/Lettering.js/
(function(e){var i=e.fn.lettering=function(d,f){var b=e.extend({},m,j[d]||d||j.letters,f);return this.each(function(){b.prep&&b.prep(this);k.call(this,b);if(b.num){e(this).find(b.tag+'.'+b.cl.replace(/\s/g,'.')).addClass(function(a){return b.cl+(a+1)})}})},k=function(a){var d=this,f=d.nodeType,b=a.split?e(d).text().split(a.split):f==3?d.nodeValue.split(''):f==1?d.childNodes:[],g,h=[],l=b.length;while(l--){var c=b[l];if(c){if(typeof c=='string'){g='';if(a.addAttr){c=a.matAttr?a.mapAttr.call(c):c;g=' data-cont="'+(c=='"'?'"':c)+'"'}h.push('<span class="'+a.cl+'"'+g+'>'+c+'</span>'+(a.after||''))}else{k.call(c,a)}}}h.length&&e(d)[a.split?'html':'replaceWith'](h.reverse().join(''))},j=i.presets={letters:{},kern:{addAttr:!0,num:!1},words:{split:/\s+/,cl:'word',after:' '},lines:{cl:'line',prep:function(a){this.split='|'+(new Date()).getTime()+'|';e(a).find('br').replaceWith(this.split)}}},m=i.defaults={tag:'span',cl:'char',num:!0}})(jQuery);