1
0
mirror of https://github.com/GenderDysphoria/GenderDysphoria.fyi.git synced 2025-11-25 12:32:42 +00:00

Added tweet translation mechanism (#96)

* Added tweet translation mechanism.

* Removed test translation.

It was done via Google Translate which I don't trust for this application.
This commit is contained in:
G Queiroz
2022-06-01 00:06:53 -03:00
committed by GitHub
parent 3687239cd9
commit 93743fc532
15 changed files with 1363 additions and 46 deletions

15
js/_fixer.js Normal file
View File

@@ -0,0 +1,15 @@
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);