isra00 / neo-transposer

Automatically transpose the chords of the songs of the Neocatechumenal Way so that they fit your voice range. Available in Spanish, Italian, Portuguese, English and Swahili!
http://neo-transposer.com
GNU Affero General Public License v3.0
10 stars 1 forks source link

Prevent Wizard's instructions and other pages's JS from breaking because of Google Translation #158

Closed isra00 closed 3 years ago

isra00 commented 3 years ago

Users with Chrome's auto-translation feature see pages translated automatically (i.e. from Swahili to English in a device in English language, which is the usual in East Africa), which breaks JavaScript. This is a problem in the Wizard's instructions step, since the button "i understood" is disabled and does not get enabled without JavaScript.

How to implement it: https://stackoverflow.com/a/12238414

This is not a problem of progressive enhancement, since the button is NOT disabled in HTML, but in JavaScript upon page loading. Google translation jumps in after the load event is fired, and then breaks the enable timeout. Nevertheless, we can delay some half a second the disabling of the button, so that the translation jumps in (if for any reason the Meta tags do not prevent it) before the button is disabled.

Additionally, when the countdown is finished, the Interval should be deleted:

if (current < 1)
            {
                $(document.getElementById("submit")).removeAttr("disabled");
                $(document.getElementById("countdown")).css("visibility", "hidden")
            }