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;
}
var $node = $walker.currentNode;
if ($node.nodeType === Node.ELEMENT_NODE) {
+ console.log($node);
switch ($node.tagName) {
case 'A':
// \u2026 === …
case 'P':
$text += "\n\n";
break;
+
+ // smilies
+ case 'IMG':
+ $text += " " + $node.alt + " ";
+ break;
}
}
else {