diff --git a/js/main.js b/js/main.js index f3a310c..6316864 100644 --- a/js/main.js +++ b/js/main.js @@ -466,7 +466,14 @@ EmoteModule.prototype.obsCallback = function (mutation) { if (!settingsCookie["bda-es-7"]) return; - $(".emoji").each(function () { + $(".emoji").each(function() { + var t = $(this); + if(t.attr("src").indexOf(".png") != -1) { + t.replaceWith(t.attr("alt")); + } + }); + + /* $(".emoji").each(function () { var t = $(this); if (t.attr("src").indexOf(".png") != -1) { @@ -485,7 +492,7 @@ EmoteModule.prototype.obsCallback = function (mutation) { t.replaceWith(newText); } } - }); + });*/ for (var i = 0; i < mutation.addedNodes.length; ++i) { var next = mutation.addedNodes.item(i); @@ -524,26 +531,29 @@ EmoteModule.prototype.injectEmote = function (node) { var parent = node.parentElement; - if (parent.tagName != "SPAN") return; - if (!$(parent.parentElement).hasClass("markup") && !$(parent.parentElement).hasClass("message-content")) { + if (!$(parent).hasClass("markup")) { return; } var edited = false; - if ($(parent.parentElement).hasClass("edited")) { + /*if ($(parent.parentElement).hasClass("edited")) { parent = parent.parentElement.parentElement.firstChild; edited = true; - } + }*/ function inject() { - var parentInnerHTML = parent.innerHTML; + var p = $(parent); + var parentInnerHTML = p.html(); var words = parentInnerHTML.split(/\s+/g); - + var injected = false; if (!words) return; + var oldHeight = parent.parentElement.offsetHeight; + words.forEach(function (word) { - words.some(function (word) { - if (word.slice(0, 4) == "[!s]") { + var w = word.replace("-->", "").replace("