From 65f5dbf0a923dddf88db858e48caf4b32c10a451 Mon Sep 17 00:00:00 2001 From: igor <igor.markin@vereign.com> Date: Tue, 1 Dec 2020 19:27:41 +0300 Subject: [PATCH] Add missing build files --- dist/HTMLNormalizer/strategies/gmail.js | 1 + dist/HTMLNormalizer/strategies/outlook.js | 46 ++++++++++++++++++----- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/dist/HTMLNormalizer/strategies/gmail.js b/dist/HTMLNormalizer/strategies/gmail.js index bb994ff..2faccd1 100644 --- a/dist/HTMLNormalizer/strategies/gmail.js +++ b/dist/HTMLNormalizer/strategies/gmail.js @@ -7,6 +7,7 @@ const pruneGmailElement = (element) => { }; exports.pruneGmailElement = pruneGmailElement; const amendGmailNodes = (document) => { + // unwindTags(document, "span"); /** * Look for attachments panes and remove everything but liks */ diff --git a/dist/HTMLNormalizer/strategies/outlook.js b/dist/HTMLNormalizer/strategies/outlook.js index d31ae26..860c1d4 100644 --- a/dist/HTMLNormalizer/strategies/outlook.js +++ b/dist/HTMLNormalizer/strategies/outlook.js @@ -25,20 +25,44 @@ const pruneOutlookElement = (element) => { return !!element.nodeName.toLowerCase().startsWith("o:"); }; exports.pruneOutlookElement = pruneOutlookElement; +const qrCodeContainerId = "test-for-us"; +const removeQrCodeNodes = (document) => { + const remove = (node) => { + let toRemove = []; + let child = node.firstChild; + while (child) { + if (child.nodeType == child.ELEMENT_NODE) { + toRemove = [...toRemove, ...remove(child)]; + const childElement = child; + const id = childElement.getAttribute("id"); + if (id && id.includes(qrCodeContainerId)) { + toRemove.push(childElement.parentNode); + } + } + child = child.nextSibling; + } + return toRemove; + }; + const elementsToRemove = remove(document.body); + elementsToRemove.forEach((element) => element.parentNode.removeChild(element)); +}; const amendOutlookNodes = (document) => { /** * Remove quoted text */ // Quoted text in web apps - const appendOnSend = document.querySelector("[id*='appendonsend']"); - if (appendOnSend) { - let child = appendOnSend; - while (child) { - const nextSibling = child.nextSibling; - child.parentNode.removeChild(child); - child = nextSibling; - } - } + // const appendOnSend = document.querySelector( + // "[id*='appendonsend']" + // ) as Node; + // + // if (appendOnSend) { + // let child = appendOnSend; + // while (child) { + // const nextSibling = child.nextSibling; + // child.parentNode.removeChild(child); + // child = nextSibling as Node; + // } + // } // Quoted text in desktop apps // let mailOriginal = document.querySelector("[name*='_MailOriginal']") as HTMLElement; // if (mailOriginal) { @@ -69,6 +93,10 @@ const amendOutlookNodes = (document) => { // child = nextSibling as Node; // } // } + /** + * Remove QR code entries + */ + removeQrCodeNodes(document); /** * Get rid of attachments panes */ -- GitLab