From: Alexander Ebert Date: Wed, 6 Sep 2017 13:05:20 +0000 (+0200) Subject: Convert smilies into their alt-value for manual text quotes X-Git-Tag: 3.1.0_Alpha_3~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a545943bab04309760def5beaf5f63a93fe4208;p=GitHub%2FWoltLab%2FWCF.git Convert smilies into their alt-value for manual text quotes Closes #2415 --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 162ed17af3..38d2f93bf6 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -1181,10 +1181,16 @@ if (COMPILER_TARGET_DEFAULT) { var $nodeFilter = function (node) { switch (node.tagName) { case 'BLOCKQUOTE': - case 'IMG': case 'SCRIPT': return NodeFilter.FILTER_REJECT; + case 'IMG': + if (!node.classList.contains('smiley') || node.alt.length === 0) { + return NodeFilter.FILTER_REJECT; + } + // fallthrough + + //noinspection FallthroughInSwitchStatementJS default: return NodeFilter.FILTER_ACCEPT; } @@ -1203,6 +1209,7 @@ if (COMPILER_TARGET_DEFAULT) { var $node = $walker.currentNode; if ($node.nodeType === Node.ELEMENT_NODE) { + console.log($node); switch ($node.tagName) { case 'A': // \u2026 === … @@ -1235,6 +1242,11 @@ if (COMPILER_TARGET_DEFAULT) { case 'P': $text += "\n\n"; break; + + // smilies + case 'IMG': + $text += " " + $node.alt + " "; + break; } } else {