Fossil SCM

Have repeated clicks to the "Speakit" button restart the audio-captcha from the beginning instead of repeating several times in parallel.

florian 2020-03-18 14:08 trunk
Commit 1bf8df8ad2e1993f1c04509a613e4ffd1bb4384a3cb1bba56caa7ea8b3c9567f
1 file changed +5 -3
+5 -3
--- src/captcha.c
+++ src/captcha.c
@@ -560,13 +560,15 @@
560560
*/
561561
void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562562
if( zMsg==0 ) zMsg = "Speak the text";
563563
@ <input type="button" value="%h(zMsg)" id="speakthetext">
564564
@ <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;
568570
@ audio.play();
569571
@ }
570572
@ </script>
571573
}
572574
573575
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button