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) => { ...@@ -7,6 +7,7 @@ const pruneGmailElement = (element) => {
}; };
exports.pruneGmailElement = pruneGmailElement; exports.pruneGmailElement = pruneGmailElement;
const amendGmailNodes = (document) => { const amendGmailNodes = (document) => {
// unwindTags(document, "span");
/** /**
* Look for attachments panes and remove everything but liks * Look for attachments panes and remove everything but liks
*/ */
......
...@@ -25,20 +25,44 @@ const pruneOutlookElement = (element) => { ...@@ -25,20 +25,44 @@ const pruneOutlookElement = (element) => {
return !!element.nodeName.toLowerCase().startsWith("o:"); return !!element.nodeName.toLowerCase().startsWith("o:");
}; };
exports.pruneOutlookElement = pruneOutlookElement; 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) => { const amendOutlookNodes = (document) => {
/** /**
* Remove quoted text * Remove quoted text
*/ */
// Quoted text in web apps // Quoted text in web apps
const appendOnSend = document.querySelector("[id*='appendonsend']"); // const appendOnSend = document.querySelector(
if (appendOnSend) { // "[id*='appendonsend']"
let child = appendOnSend; // ) as Node;
while (child) { //
const nextSibling = child.nextSibling; // if (appendOnSend) {
child.parentNode.removeChild(child); // let child = appendOnSend;
child = nextSibling; // while (child) {
} // const nextSibling = child.nextSibling;
} // child.parentNode.removeChild(child);
// child = nextSibling as Node;
// }
// }
// Quoted text in desktop apps // Quoted text in desktop apps
// let mailOriginal = document.querySelector("[name*='_MailOriginal']") as HTMLElement; // let mailOriginal = document.querySelector("[name*='_MailOriginal']") as HTMLElement;
// if (mailOriginal) { // if (mailOriginal) {
...@@ -69,6 +93,10 @@ const amendOutlookNodes = (document) => { ...@@ -69,6 +93,10 @@ const amendOutlookNodes = (document) => {
// child = nextSibling as Node; // child = nextSibling as Node;
// } // }
// } // }
/**
* Remove QR code entries
*/
removeQrCodeNodes(document);
/** /**
* Get rid of attachments panes * 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