elements with
:
//
|
| .protonmail_signature_block
//
// The '.protonmail_signature_block' itself has 3
children which can be:
// (when user signature doesn't exist) 2 with
, and the proton signature
//
|
| .protonmail_signature_block-proton
// (when user signature exists) the user signature (.protonmail_signature_block-user) , 1 with
, and the signature itself
// .protonmail_signature_block-user |
| .protonmail_signature_block-proton
//
// Our aim is:
// 1. if there user signature exists, to also remove the 2
elements before the main '.protonmail_signature_block' element.
// 2. Regardless of whether user signature exists, to remove the last element ('.protonmail_signature_block-proton') and the
before it.
const signatureUser = '.protonmail_signature_block-user';
const signatureProton = '.protonmail_signature_block-proton';
if (node.querySelector(signatureUser).firstElementChild.innerText === '' ) {
node.previousElementSibling.remove();
node.previousElementSibling.remove();
}
node.querySelector(signatureProton).previousElementSibling.remove();
node.querySelector(signatureProton).remove();
observer.disconnect();
}
});
});
};
const observer = new MutationObserver(callback);
observer.observe(iframe, config);
});