Last active
March 23, 2024 01:39
-
-
Save LevitatingBusinessMan/386ee123ec2a9c5f7e4a3e7644c74355 to your computer and use it in GitHub Desktop.
Userscript to ensure that a recipients email address is shown when composing in roundcube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name RecipientEmailFixerRoundcube | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function on_mutation() { | |
document.querySelectorAll("body.action-compose li.recipient").forEach(recipient => { | |
if (!recipient.fixed) { | |
const [name, email] = recipient.children | |
name.innerText = name.innerText + " " + email.innerText.replace(/,$/, "") | |
console.log("Fixed", name.innerText) | |
recipient.fixed = true | |
} | |
}) | |
} | |
const recipient_input = document.querySelector("#compose_to ul.recipient-input") | |
const config = { childList: true, subtree: false } | |
const observer = new MutationObserver(on_mutation) | |
observer.observe(recipient_input, config) | |
on_mutation() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment