diff --git a/dist/HTMLNormalizer/strategies/gmail.js b/dist/HTMLNormalizer/strategies/gmail.js index bb994ff3b9b8c40e7a8e5820bf0af2a9f301facd..2faccd189909c4df2d77cf6076fc104d8b180b15 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 d31ae26b7bb9ccf69403518345fce07f4f539c31..860c1d49716ef719eb6fcf72a78e2d121edbd036 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 */