Add alt title for audio button.

This commit is contained in:
rulingcom 2022-10-13 14:25:58 +08:00
parent aefc02d8a2
commit b7d7b6e9ae
4 changed files with 5 additions and 2 deletions

View File

@ -3,3 +3,4 @@ en:
invalid: "The captcha code is incorrect (if you can't read, you can click image to refresh it)"
placeholder: please fill in the identifying code
captcha: Captcha
play_captcha_voice: "Play Captcha Voice"

View File

@ -1,3 +1,4 @@
'zh-CN':
rucaptcha:
invalid: "验证码不正确(如无法识别,可以点击刷新验证码)"
play_captcha_voice: "播放验证码的语音"

View File

@ -2,3 +2,4 @@ zh_tw:
rucaptcha:
placeholder: 請填寫驗證碼
captcha: 驗證碼
play_captcha_voice: 播放驗證碼語音

View File

@ -22,7 +22,7 @@ module RuCaptcha
tag(:img, opts)
end
def rucaptcha_audio_tag()
"<button type=\"button\" onclick=\"document.getElementById(&quot;captcha_audio&quot;).play();\" class=\"fas fa-volume-up\" style=\"font-size: 1.5em; color: #333; cursor: pointer; border: 2px solid #333; padding: 0.2em;\"></button><audio id=\"captcha_audio\" src=\"#{ru_captcha.root_path(:format=>:wav)}\"></audio>".html_safe
"<button title=\"#{I18n.t('rucaptcha.play_captcha_voice')}\" type=\"button\" onclick=\"document.getElementById(&quot;captcha_audio&quot;).play();\" class=\"fas fa-volume-up\" style=\"font-size: 1.5em; color: #333; cursor: pointer; border: 2px solid #333; padding: 0.2em;\"></button><audio id=\"captcha_audio\" src=\"#{ru_captcha.root_path(:format=>:wav)}\"></audio>".html_safe
end
def gotcha(opts = {})
if opts[:placeholder].blank?