Fossil SCM
Have repeated clicks to the "Speakit" button restart the audio-captcha from the beginning instead of repeating several times in parallel.
Commit
1bf8df8ad2e1993f1c04509a613e4ffd1bb4384a3cb1bba56caa7ea8b3c9567f
Parent
2233a7b7ac48c5f…
1 file changed
+5
-3
+5
-3
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -560,13 +560,15 @@ | ||
| 560 | 560 | */ |
| 561 | 561 | void captcha_speakit_button(unsigned int uSeed, const char *zMsg){ |
| 562 | 562 | if( zMsg==0 ) zMsg = "Speak the text"; |
| 563 | 563 | @ <input type="button" value="%h(zMsg)" id="speakthetext"> |
| 564 | 564 | @ <script nonce="%h(style_nonce())"> |
| 565 | - @ var x = document.getElementById("speakthetext") | |
| 566 | - @ x.onclick = function(){ | |
| 567 | - @ var audio = new Audio("%R/captcha-audio/%u(uSeed)") | |
| 565 | + @ document.getElementById("speakthetext").onclick = function(){ | |
| 566 | + @ var audio = window.fossilAudioCaptcha \ | |
| 567 | + @ || new Audio("%R/captcha-audio/%u(uSeed)"); | |
| 568 | + @ window.fossilAudioCaptcha = audio; | |
| 569 | + @ audio.currentTime = 0; | |
| 568 | 570 | @ audio.play(); |
| 569 | 571 | @ } |
| 570 | 572 | @ </script> |
| 571 | 573 | } |
| 572 | 574 | |
| 573 | 575 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -560,13 +560,15 @@ | |
| 560 | */ |
| 561 | void captcha_speakit_button(unsigned int uSeed, const char *zMsg){ |
| 562 | if( zMsg==0 ) zMsg = "Speak the text"; |
| 563 | @ <input type="button" value="%h(zMsg)" id="speakthetext"> |
| 564 | @ <script nonce="%h(style_nonce())"> |
| 565 | @ var x = document.getElementById("speakthetext") |
| 566 | @ x.onclick = function(){ |
| 567 | @ var audio = new Audio("%R/captcha-audio/%u(uSeed)") |
| 568 | @ audio.play(); |
| 569 | @ } |
| 570 | @ </script> |
| 571 | } |
| 572 | |
| 573 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -560,13 +560,15 @@ | |
| 560 | */ |
| 561 | void captcha_speakit_button(unsigned int uSeed, const char *zMsg){ |
| 562 | if( zMsg==0 ) zMsg = "Speak the text"; |
| 563 | @ <input type="button" value="%h(zMsg)" id="speakthetext"> |
| 564 | @ <script nonce="%h(style_nonce())"> |
| 565 | @ document.getElementById("speakthetext").onclick = function(){ |
| 566 | @ var audio = window.fossilAudioCaptcha \ |
| 567 | @ || new Audio("%R/captcha-audio/%u(uSeed)"); |
| 568 | @ window.fossilAudioCaptcha = audio; |
| 569 | @ audio.currentTime = 0; |
| 570 | @ audio.play(); |
| 571 | @ } |
| 572 | @ </script> |
| 573 | } |
| 574 | |
| 575 |