Skip to content
Snippets Groups Projects
Commit 65f5dbf0 authored by Igor Markin's avatar Igor Markin
Browse files

Add missing build files

parent ca5bec93
No related branches found
No related tags found
1 merge request!4Prettier html
......@@ -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
*/
......
......@@ -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
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment