Fossil SCM
For the audio captcha, do not actually download the sound file until the user clicks on the button.
Commit
54d93954a9848d6671877c79f1fa180f3aa3a8bec55a8c7982d8732bfe54a998
Parent
220ed0a939c4d35…
1 file changed
+1
-2
+1
-2
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -559,15 +559,14 @@ | ||
| 559 | 559 | ** Add a "Speak the captcha" button. |
| 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 | - @ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" /> | |
| 565 | 564 | @ <script nonce="%h(style_nonce())"> |
| 566 | 565 | @ var x = document.getElementById("speakthetext") |
| 567 | 566 | @ x.onclick = function(){ |
| 568 | - @ var audio = document.getElementById("spokencaptcha"); | |
| 567 | + @ var audio = new Audio("%R/captcha-audio/%u(uSeed)") | |
| 569 | 568 | @ audio.play(); |
| 570 | 569 | @ } |
| 571 | 570 | @ </script> |
| 572 | 571 | } |
| 573 | 572 | |
| 574 | 573 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -559,15 +559,14 @@ | |
| 559 | ** Add a "Speak the captcha" button. |
| 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 | @ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" /> |
| 565 | @ <script nonce="%h(style_nonce())"> |
| 566 | @ var x = document.getElementById("speakthetext") |
| 567 | @ x.onclick = function(){ |
| 568 | @ var audio = document.getElementById("spokencaptcha"); |
| 569 | @ audio.play(); |
| 570 | @ } |
| 571 | @ </script> |
| 572 | } |
| 573 | |
| 574 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -559,15 +559,14 @@ | |
| 559 | ** Add a "Speak the captcha" button. |
| 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 |