Closed Ismael-VC closed 6 years ago
Did you successfully test this? If I try it, it adds the link to the menu header, rather than as an entry in the list of languages.
I'm pretty sure the "tx-live-lang-picker" ID is the right one, but the script must wait until it is created dynamically before it runs. I'll see if I can introduce some sort of listener. I think we'll need to use the Mutation Observer API. I'll comment when I have more info.
After some time reading about Mutation Observers. More than I would have liked, actually -- I ended up modifying the MDN example because, like everything else I was finding online, it included unnecessary complexity that made the basic concept harder to grasp.
Anyway, it looks like a possible way to fix this, although quite verbose (it will pretty much double the size of this script). I'll submit a PR with the proposed fix; hopefully it'll work out.
Fixes: