Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added match to handle Emojji - Issue https://github.com/davatron5000/… #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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