/* * Name : eng.js * Version : 1.0.1 * Author : 1px studio * Date : 2023-10-25 * Desc : formmail check alert (eng) * ------------------------------------------------ */ $(function(){ if ($("html").attr("lang") != 'en') {return false;} const bizdemo = "bizdemo88358"; var script = document.createElement("script"); script.innerHTML = ` // board search keyword let search_value_input = $('input[name=com_board_search_value]'); if (search_value_input.length > 0) { search_value_input.attr("msg", "keyword"); } var delete_check_notice2 = function(id, path, template, query, idxs, pass){ if(!confirm('Are you sure you want to delete it?')) return; document.location.href="/chtml/board.php?com_board_id=" + id + "&com_board_basic=delete&com_board_idx=" + idxs + "&template=" + template + "&" + query + "&com_board_path=" + path + "&com_board_password=" + pass, 'cafe_component_delete'; } let policy = document.querySelector('.contact-form #chk_agree'); if (policy) { policy.setAttribute('msg', "Privacy policy"); } // cjs - formmail var com_formmail_formCheck = function(this_form) { if(comFormmailFormCheckFlag==true){ return false; } Ajax.init("/cjs/ajax/ajax.formmail.php?com_formmail_id=4&template=/${bizdemo}", null, 'GET', null , null , false , false ); var rsXml = Ajax.rltXml(); if(this_form) { var fform = this_form; } else { var fform = "com_formmail"; } //rsXml = Ajax.rltXml(); var xmlData = Ajax.rltXmlLoop(rsXml, "formmail_title"); var tempArr = new Array(); for(var i = 0; i < xmlData.length; i++) { tempArr[i] = new Array(); tempArr[i]["code"] = Ajax.rltXmlOnce(xmlData[i], "code"); tempArr[i]["name"] = Ajax.rltXmlOnce(xmlData[i], "name"); tempArr[i]["attribute"] = Ajax.rltXmlOnce(xmlData[i], "attribute"); tempArr[i]["necessary"] = Ajax.rltXmlOnce(xmlData[i], "necessary"); tempArr[i]["attribute_value"] = Ajax.rltXmlOnce(xmlData[i], "attribute_value"); if(Common.int(tempArr[i]["necessary"]) == 1) { switch (Common.int(tempArr[i]["attribute"])) { case 1 : //일반텍스트 FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], '', '1-'+tempArr[i]["attribute_value"]); break; case 3 : //이메일 FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], 'email'); break; case 2 : //testarea case 4 : //URL case 9 : //select FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], ''); break; case 5 : //전화번호 if(Common.int(tempArr[i]["attribute_value"]) == 2) { FormCheck.setCheck(fform, tempArr[i]["code"]+'0', 'y', tempArr[i]["name"], 'num', '1-4'); } FormCheck.setCheck(fform, tempArr[i]["code"]+'1', 'y', tempArr[i]["name"], 'num', '1-4'); FormCheck.setCheck(fform, tempArr[i]["code"]+'2', 'y', tempArr[i]["name"], 'num', '1-4'); FormCheck.setCheck(fform, tempArr[i]["code"]+'3', 'y', tempArr[i]["name"], 'num', '1-4'); break; case 6 : //날짜 FormCheck.setCheck(fform, tempArr[i]["code"]+'Y', 'y', tempArr[i]["name"], ''); FormCheck.setCheck(fform, tempArr[i]["code"]+'M', 'y', tempArr[i]["name"], ''); FormCheck.setCheck(fform, tempArr[i]["code"]+'D', 'y', tempArr[i]["name"], ''); break; case 7 : //주소 if(Common.int(tempArr[i]["attribute_value"]) == 1) { FormCheck.setCheck(fform, tempArr[i]["code"]+'_post1', 'y', tempArr[i]["name"], 'num', '5-5'); //FormCheck.setCheck(fform, tempArr[i]["code"]+'_post2', 'y', tempArr[i]["name"], 'num', '3-3'); } FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], ''); break; case 8 : //file FormCheck.setCheck(fform, tempArr[i]["code"]+'[]', 'y', tempArr[i]["name"], 'file', '', '', ''); break; case 10 : //체크박스 FormCheck.setCheck(fform, tempArr[i]["code"]+'[]', 'y', tempArr[i]["name"], 'checkbox', '', '', '1'); break; case 11 : //라디오버튼 FormCheck.setCheck(fform, tempArr[i]["code"], 'y', tempArr[i]["name"], 'checkbox', '', '', ''); break; case 13 : //휴대전화 if(Common.int(tempArr[i]["attribute_value"]) == 1) { FormCheck.setCheck(fform, tempArr[i]["code"]+'0', 'y', tempArr[i]["name"], ''); } FormCheck.setCheck(fform, tempArr[i]["code"]+'1', 'y', tempArr[i]["name"], 'num', '1-4'); FormCheck.setCheck(fform, tempArr[i]["code"]+'2', 'y', tempArr[i]["name"], 'num', '1-4'); FormCheck.setCheck(fform, tempArr[i]["code"]+'3', 'y', tempArr[i]["name"], 'num', '1-4'); break; } } } if(eval(document.com_formmail.com_formmail_check_safe) != undefined) { FormCheck.setCheck(fform, 'com_formmail_check_safe', 'y', 'Privacy policy', 'checkbox', '', '', ''); } if(eval(document.com_formmail.com_formmail_check_safe_user_add) != undefined) { FormCheck.setCheck(fform, 'com_formmail_check_safe_user_add', 'y', 'Privacy policy', 'checkbox', '', '', ''); } if(FormCheck.init(fform) == true) { var f = document.forms['com_formmail']; f.target=''; if(typeof(gRelay) != "undefined") { //gRelay.relayForm('com_formmail'); gRelay.relayForm(f); } try { if(!document.getElementsByName('captcha_code')[0].value) { alert('Please enter anti-spam characters.'); document.getElementsByName('captcha_code')[0].focus(); return false; } } catch (e){} comFormmailFormCheckFlag=true; encrypt(); } return false; } // cjs - javascript.lib FormCheck.check = function () { for (var x = 0; x < this.count; x++) { this.item = this.objForm.elements[x]; if (this.item.name) { if (this.item.getAttribute('chk')) { this.chk = this.item.getAttribute('chk'); this.msg = this.item.getAttribute('msg'); this.kind = this.item.getAttribute('kind'); this.from = this.item.getAttribute('from'); this.len = (this.item.getAttribute('len')) ? this.item.getAttribute('len') : ''; this.checkcount = this.item.getAttribute('checkcount'); if (this.chk == 'y' || this.chk == 'Y') { this.first = "this.item.value == '' || (" } else { this.first = "this.item.value && (" } if (this.len) { if (this.len.indexOf('-') > 0) { this.ex_len = this.len.split('-'); this.min = this.ex_len[0]; this.max = this.ex_len[1]; if (this.min == this.max) { this.len_chk = " || this.item.value.length != " + this.min } else { this.len_chk = " || this.item.value.length < " + this.min + " || this.item.value.length > " + this.max } if (typeof (this.min) != 'undefined' || typeof (this.max) != 'undefined') { this.len_text = " [" + this.min + " ~ " + this.max + " characters]" } } } if (this.checkcount) { this.chk_cnt = "if(chk < " + this.checkcount + ") {"; this.chk_cnt += "alert('Please choose at least " + this.checkcount + this.msg + ".');"; this.chk_cnt += "this.ret_chk = true;"; this.chk_cnt += "}" } else { this.chk_cnt = "if(chk < 1) {"; this.chk_cnt += "alert('Please choose a " + this.msg + ".');"; this.chk_cnt += "this.ret_chk = true;"; this.chk_cnt += "}" } switch (this.kind) { default: if (this.item.name == 'description') { if (__BR__ == 'IE') { this.result += "if(Common.getObj('description','name')[0].value == '

') {"; this.result += "alert('Please enter the contents.');"; this.result += "this.ret_chk = true;"; this.result += "}" } else if (__BR__ == 'FF') { if (Common.getObj('descriptionView_TEXTAREA') == '[object HTMLTextAreaElement]') { this.result += "if(trim(stripHTMLtag(Common.getObj('descriptionView_TEXTAREA').value)).length<1) {"; this.result += "alert('Please enter the contents.');"; this.result += "document.getElementById('descriptionView_IFRAME').contentWindow.document.body.focus();"; this.result += "this.ret_chk = true;"; this.result += "}" } } } else { this.result = "if(" + this.first + "Common.trim(this.item.value) == ''" + this.len_chk + ")) {"; this.result += "alert('Please enter the correct " + this.msg + " " + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}" } break; case 'float': this.result = "var num_pattern = /(^[0-9]+)\.([0-9]+$)/gi;"; this.result += "if(" + this.first + "!num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + " must be entered only in numbers and decimal points." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num': this.result = "var num_pattern = /(^[0-9]+$)/gi;"; this.result += "if(" + this.first + "!num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + " must only be entered numerically." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'eng': this.result = "var eng_pattern = /(^[a-zA-Z]+$)/gi;"; this.result += "if(" + this.first + "!eng_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('Please enter the " + this.msg + " in English." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'kor': this.result = "var kor_pattern = /(^[가-하]+$)/gi;"; this.result += "if(" + this.first + "!kor_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('Please enter the " + this.msg + " in Korean." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'eng+kor+num': this.result = "var eng_kor_num_pattern = /(^[a-zA-Z0-9가-하]+$)/gi;"; this.result += "if(" + first + "!eng_kor_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + " must be entered in English, Korean, and numerals only." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num+eng': case 'eng+num': this.result = "var eng_num_pattern = /(^[a-zA-Z0-9]+$)/gi;"; this.result += "if(" + this.first + "!eng_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + " must be entered in English and numerals only." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num+eng2': this.result = "var eng_num_pattern = /(^[a-z0-9]+$)/gi;"; this.result += "if(" + this.first + "!eng_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + " must be entered in English and numerals only." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'email': this.result = "var email_pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;"; this.result += "if(" + this.first + "!email_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('Please enter the correct " + this.msg + " " + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'checkbox': this.result = "var obj = Common.getObj('" + this.item.name + "', 'name');"; this.result += "var count = obj.length;"; this.result += "var chk = 0;"; this.result += "for(var c=0; c