Skip to content

Commit

Permalink
Added match to handle Emojji - Issue davatron5000#90
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTOBrien committed Jul 27, 2020
1 parent d06bb73 commit a4c6b18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h4>The jQuery</h4>

<h4>The Result</h4>
<div id="demo1" class="demo">
<h1>Rainbow</h1>
<h1>Rainbow 🌈</h1>
</div>

</section>
Expand All @@ -91,7 +91,7 @@ <h2>Words</h2>

<h4>The Result</h4>
<div id="demo2" class="demo">
<h1>Hi, Multi Color</h1>
<h1>Hi, Multi Color 😎</h1>
</div>
</section>

Expand All @@ -101,7 +101,7 @@ <h2>Lines</h2>

<h4>The Result</h4>
<div id="demo3" class="demo">
<p>This is an amazing<br/> Revolution in Typography. <br/> The possibilities are endless: <br/> Coloring, Vertical spacing, and Kerning.</p>
<p>This is amazing!😂😂<br/>Revolution in Typography. <br/> The possibilities are endless: <br/> Coloring, Vertical spacing, and Kerning.</p>
</div>
</section>

Expand All @@ -120,7 +120,7 @@ <h2>Advanced #2: Chaining and Styling</h2>
.children("span").css({'display':'inline-block', '-webkit-transform':'rotate(-25deg)'});</pre></code>
<h4>The Result</h4>
<div id="demo5" class="demo">
<h1>WOOOoo!</h1>
<h1>WOOOoo!😎</h1>
</div>
</section>

Expand Down
9 changes: 5 additions & 4 deletions jquery.lettering.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
* Date: Mon Sep 20 17:14:00 2010 -0600
*/
(function($){
function injector(t, splitter, klass, after) {
function injector(t, splitter, klass, after, match) {
var text = t.text()
, a = text.split(splitter)
, a = match ? text.match(splitter) : text.split(splitter)
, inject = '';
if (a.length) {
$(a).each(function(i, item) {
Expand All @@ -31,15 +31,15 @@
init : function() {

return this.each(function() {
injector($(this), '', 'char', '');
injector($(this), /([\u0000-\u007F])|([^\u0000-\u007F]+)/g, 'char', '', true);
});

},

words : function() {

return this.each(function() {
injector($(this), ' ', 'word', ' ');
injector($(this), /\s/g, 'word', ' ', false);
});

},
Expand All @@ -55,6 +55,7 @@
injector($(this).children("br").replaceWith(r).end(), r, 'line', '');
});


}
};

Expand Down

0 comments on commit a4c6b18

Please sign in to comment.