$(function(){ var mp3_url = ""; $(document).on( "click", "#captcha_reload", function(){ $.ajax({ type: 'POST', url: g5_captcha_url+'/kcaptcha_session.php', cache: false, async: false, success: function(text) { $('#captcha_img').attr('src', g5_captcha_url+'/kcaptcha_image.php?t=' + (new Date).getTime()); } }); $.ajax({ type: 'POST', url: g5_captcha_url+'/kcaptcha_mp3.php', cache: false, async: false, success: function(url) { if (url) { mp3_url = url + "?t="+new Date().getTime(); $("#captcha_audio").attr("src", mp3_url); } } }); }); $(document).on( "click", "#captcha_mp3", function(){ $("body").css("cursor", "wait"); $.ajax({ type: 'POST', url: g5_captcha_url+'/kcaptcha_mp3.php', cache: false, async: false, success: function(url) { if (url) { mp3_url = url + "?t="+new Date().getTime(); } } }); var html5use = false; var html5audio = document.createElement("audio"); if (html5audio.canPlayType && html5audio.canPlayType("audio/mpeg")) { var wav = new Audio(mp3_url); wav.id = "mp3_audio"; wav.autoplay = true; wav.controls = false; wav.autobuffer = false; wav.loop = false; if ($("#mp3_audio").length) $("#mp3_audio").remove(); $("#captcha_mp3").after(wav); html5use = true; } if (!html5use) { var object = '<object id="mp3_object" classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" height="0" width="0" style="width:0; height:0;">'; object += '<param name="AutoStart" value="1" />'; object += '<param name="Volume" value="0" />'; object += '<param name="PlayCount" value="1" />'; object += '<param name="FileName" value="' + mp3_url + '" />'; object += '<embed id="mp3_embed" src="' + mp3_url + '" autoplay="true" hidden="true" volume="100" type="audio/x-wav" style="display:inline;" />'; object += '</object>'; if ($("#mp3_object").length) $("#mp3_object").remove(); $("#captcha_mp3").after(object); } $("body").css("cursor", "default"); return false; }).css('cursor', 'pointer'); $("#captcha_reload").trigger("click"); }); // ì¶œë ¥ëœ ìº¡ì± ì´ë¯¸ì§€ì˜ 키값과 ìž…ë ¥í•œ í‚¤ê°’ì´ ê°™ì€ì§€ 비êµí•œë‹¤. function chk_captcha() { var captcha_result = false; var captcha_key = document.getElementById('captcha_key'); $.ajax({ type: 'POST', url: g5_captcha_url+'/kcaptcha_result.php', data: { 'captcha_key': captcha_key.value }, cache: false, async: false, success: function(text) { captcha_result = text; } }); if (!captcha_result) { alert('ìžë™ë“±ë¡ë°©ì§€ ìž…ë ¥ 글ìžê°€ í‹€ë ¸ê±°ë‚˜ ìž…ë ¥ 횟수가 넘었습니다.\n\nìƒˆë¡œê³ ì¹¨ì„ í´ë¦í•˜ì—¬ 다시 ìž…ë ¥í•´ 주ì‹ì‹œì˜¤.'); captcha_key.select(); captcha_key.focus(); return false; } return true; }