1jQuery(function () { 2 var $wrap = jQuery('#plugin__captcha_wrapper'); 3 if (!$wrap.length) return; 4 5 /** 6 * Autofill and hide the whole CAPTCHA stuff in the simple JS mode 7 */ 8 var $code = jQuery('#plugin__captcha_code'); 9 if ($code.length) { 10 var $box = $wrap.find('input[type=text]'); 11 $box.first().val($code.text().replace(/([^A-Z])+/g, '')); 12 $wrap.hide(); 13 } 14 15 /** 16 * Add a HTML5 player for the audio version of the CAPTCHA 17 */ 18 var $audiolink = $wrap.find('a.audiolink'); 19 if ($audiolink.length) { 20 var audio = document.createElement('audio'); 21 if (audio) { 22 audio.src = $audiolink.attr('href'); 23 $wrap.append(audio); 24 $audiolink.click(function (e) { 25 audio.play(); 26 e.preventDefault(); 27 e.stopPropagation(); 28 }); 29 } 30 } 31}); 32