Fossil SCM

For the audio captcha, do not actually download the sound file until the user clicks on the button.

drh 2020-03-14 23:41 trunk
Commit 54d93954a9848d6671877c79f1fa180f3aa3a8bec55a8c7982d8732bfe54a998
1 file changed +1 -2
+1 -2
--- src/captcha.c
+++ src/captcha.c
@@ -559,15 +559,14 @@
559559
** Add a "Speak the captcha" button.
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">
564
- @ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" />
565564
@ <script nonce="%h(style_nonce())">
566565
@ var x = document.getElementById("speakthetext")
567566
@ x.onclick = function(){
568
- @ var audio = document.getElementById("spokencaptcha");
567
+ @ var audio = new Audio("%R/captcha-audio/%u(uSeed)")
569568
@ audio.play();
570569
@ }
571570
@ </script>
572571
}
573572
574573
--- 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

Keyboard Shortcuts

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