Skip to content

Commit a4c6b18

Browse files
committedJul 27, 2020
Added match to handle Emojji - Issue davatron5000#90
1 parent d06bb73 commit a4c6b18

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed
 

‎examples/index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ <h4>The jQuery</h4>
8080

8181
<h4>The Result</h4>
8282
<div id="demo1" class="demo">
83-
<h1>Rainbow</h1>
83+
<h1>Rainbow 🌈</h1>
8484
</div>
8585

8686
</section>
@@ -91,7 +91,7 @@ <h2>Words</h2>
9191

9292
<h4>The Result</h4>
9393
<div id="demo2" class="demo">
94-
<h1>Hi, Multi Color</h1>
94+
<h1>Hi, Multi Color 😎</h1>
9595
</div>
9696
</section>
9797

@@ -101,7 +101,7 @@ <h2>Lines</h2>
101101

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

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

‎jquery.lettering.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* Date: Mon Sep 20 17:14:00 2010 -0600
1212
*/
1313
(function($){
14-
function injector(t, splitter, klass, after) {
14+
function injector(t, splitter, klass, after, match) {
1515
var text = t.text()
16-
, a = text.split(splitter)
16+
, a = match ? text.match(splitter) : text.split(splitter)
1717
, inject = '';
1818
if (a.length) {
1919
$(a).each(function(i, item) {
@@ -31,15 +31,15 @@
3131
init : function() {
3232

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

3737
},
3838

3939
words : function() {
4040

4141
return this.each(function() {
42-
injector($(this), ' ', 'word', ' ');
42+
injector($(this), /\s/g, 'word', ' ', false);
4343
});
4444

4545
},
@@ -55,6 +55,7 @@
5555
injector($(this).children("br").replaceWith(r).end(), r, 'line', '');
5656
});
5757

58+
5859
}
5960
};
6061

0 commit comments

Comments
 (0)