mirror of
https://github.com/GenderDysphoria/GenderDysphoria.fyi.git
synced 2025-02-07 10:16:16 +00:00
* Added tweet translation mechanism. * Removed test translation. It was done via Google Translate which I don't trust for this application.
16 lines
784 B
JavaScript
16 lines
784 B
JavaScript
function fixTweetMentions() {
|
|
document.querySelectorAll('div.tweet-text> p').forEach((p) => {
|
|
for (const node of p.childNodes) {
|
|
if (node.nodeType == Node.ELEMENT_NODE && node.tagName == "A" && node.classList.contains("mention")) {
|
|
node.classList.add("initial-mention");
|
|
} else if (node.nodeType == Node.TEXT_NODE && node.textContent.trim() == '') {
|
|
// nothing to do
|
|
} else {
|
|
// we got to the main text of the tweet and must stop
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
document.addEventListener('DOMContentLoaded', fixTweetMentions, false);
|