Skip to content

Instantly share code, notes, and snippets.

@LevitatingBusinessMan
Last active March 23, 2024 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LevitatingBusinessMan/386ee123ec2a9c5f7e4a3e7644c74355 to your computer and use it in GitHub Desktop.
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
// ==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