Skip to content

Commit

Permalink
use jquery given element on $.each()
Browse files Browse the repository at this point in the history
  • Loading branch information
SimulatedGREG committed Apr 25, 2016
1 parent 9c02ceb commit 0eb4c3e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Kappa.js",
"version": "2.0.0",
"version": "2.0.2",
"homepage": "http://simulatedgreg.github.io/kappa.js/",
"authors": [
"Greg Holguin <[email protected]>"
Expand Down
9 changes: 3 additions & 6 deletions dist/kappa.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@
function replaceTextWithEmotes() {
for (var emote in KappaJS.emotes) {
if (KappaJS.emotes.hasOwnProperty(emote)) {
$(self).each(function () {
// NOTE: Transpiler bug
// Next 2 selector should be `this`, but babel grab context of `replaceTextWithEmotes` function
// Manually adjusted in build until futher notice.
$(this).html($(this).html().replace(new RegExp('\\b' + emote + '\\b', 'g'), generateImgTag(KappaJS.emotes[emote], emote)));
$(self).each(function (i, el) {
$(el).html($(el).html().replace(new RegExp('\\b' + emote + '\\b', 'g'), generateImgTag(KappaJS.emotes[emote], emote)));
});
}
}
Expand All @@ -115,4 +112,4 @@
waitKappaJS();
} else replaceTextWithEmotes();
};
})(jQuery);
})(jQuery);
2 changes: 1 addition & 1 deletion dist/kappa.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kappa.js",
"version": "2.0.0",
"version": "2.0.2",
"description": "Kappa.js is a simple jQuery Plugin that can easily find text Twitch emotes and replace them with their respective emoticons. ",
"main": "dist/kappa.min.js",
"scripts": {
Expand Down
9 changes: 3 additions & 6 deletions src/kappa.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,9 @@
function replaceTextWithEmotes() {
for (var emote in KappaJS.emotes) {
if (KappaJS.emotes.hasOwnProperty(emote)) {
$(self).each(() => {
// NOTE: Transpiler bug
// Next 2 selector should be `this`, but babel grab context of `replaceTextWithEmotes` function
// Manually adjusted in build until futher notice.
$(self).html(
$(self).html().replace(
$(self).each((i, el) => {
$(el).html(
$(el).html().replace(
new RegExp('\\b' + emote + '\\b', 'g'),
generateImgTag(KappaJS.emotes[emote], emote)
)
Expand Down

0 comments on commit 0eb4c3e

Please sign in to comment.