diff --git a/client/status-icon-fix.js b/client/status-icon-fix.js new file mode 100644 index 000000000..ddbdc8009 --- /dev/null +++ b/client/status-icon-fix.js @@ -0,0 +1,45 @@ +(function () { + "use strict"; + + var ICON_MARKUP = + '"; + + function createIcon() { + var span = document.createElement("span"); + span.innerHTML = ICON_MARKUP; + return span.firstChild; + } + + function fix() { + var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null); + var matches = []; + var node; + while ((node = walker.nextNode())) { + if (node.nodeValue.trim() === "✅") matches.push(node); + } + matches.forEach(function (textNode) { + textNode.parentNode.replaceChild(createIcon(), textNode); + }); + } + + fix(); + document.addEventListener("DOMContentLoaded", fix); + window.addEventListener("load", fix); + + // The Sapper bundle re-renders this section on hydration and on each + // data poll, reinstating the emoji text node — watch for that and + // swap it back to the SVG. This script runs from a