YNICTE/FO/js/site.js

1145 lines
41 KiB
JavaScript
Raw Normal View History

2020-10-12 14:39:23 +09:00
$(window).on("keydown", function (e) {
if (e.keyCode == 116 || e.keyCode == 123) {
prv(); return false;
}
2020-10-28 15:25:13 +09:00
if (e.keyCode == 119 && typeof (save) == "function" && $("#layermessage:visible").length < 1) {
2020-10-12 14:39:23 +09:00
save();
}
else if (e.keyCode == 115 && typeof (del) == "function" && $("#layermessage:visible").length < 1) {
del();
}
else if (e.keyCode == 13 && $("#confirmbox:visible").length > 0) {
confirmok();
}
else if (e.keyCode == 27 && $("#confirmbox:visible").length > 0) {
confirmtoggle();
}
else if (e.keyCode == 27 && $("#layermessage:visible").length > 0) {
$(_focusitem).focus();
hidelayermsg();
}
});
$(document).ready(function () {
//$("body").on("blur", "input[type='text'],input[type='password']", function () {
// //$("body").focus();
//});
$("body").on("keydown", ".int, .intdot", function (e) {
//109,189
}).on("keyup", ".int, .intdot, input.mobile,input[type='text'],input[type='password']", function (e) {
if (($(this).hasClass("int") || $(this).hasClass("intdot") || $(this).hasClass("mobile")) && $(this).val() !== null && $(this).val() !== '' && e.keyCode != 8 && e.keyCode != 109 && e.keyCode != 189 && e.keyCode != 46 && e.keyCode != 190 && e.keyCode != 110 && e.keyCode != 109 && e.keycode != 189 && e.keyCode != 13
&& !(e.keyCode > 47 && e.keyCode < 58) && !(e.keyCode > 95 && e.keyCode < 106)) {
$(this).val($(this).val().replace(/[^0-9.-]/g, ''));
if ($(this).hasClass("int") && isNaN(parseInt($(this).val(), 10))) {
if (!$(this).hasClass("datazero")) {
$(this).val("");
}
else {
$(this).val(0);
}
}
else if ($(this).hasClass("double") && isNaN(parseFloat($(this).val()))) {
if (!$(this).hasClass("datazero")) {
$(this).val("");
}
else {
$(this).val(0);
}
}
}
if ($(this).val() == "") {
if (($(this).attr("id") || "") != "" && ($(this).attr("placeholder") || "") != "" && $("#ph_" + $(this).attr("id")).length < 1) {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie < 0) {
msie = ua.indexOf("Trident/");
}
if (msie > -1) {
$("label.phplaceholder").remove();
$("<label class=\"phplaceholder\" id=\"ph_" + $(this).attr("id") + "\">" + $(this).attr("placeholder") + "<label>").insertAfter($(this));
$("#ph_" + $(this).attr("id")).css("top", ($(this).position().top + 10) + 'px');
}
}
} else {
$("label.phplaceholder").remove();
}
}).on("change", ".int, .intdot, .email, .mobile, .mobilefmt, .telfmt", function () {
if ($(this).hasClass("email")) {
$("#" + $(this).attr("data-bind")).val(vals($(this).parent().find(".emaildata" + $(this).attr("data-bind")), '@'));
}
else if ($(this).hasClass("mobile")) {
$("#" + $(this).attr("data-bind")).val(vals($(this).parent().find(".mobiledata" + $(this).attr("data-bind"))));
}
else if ($(this).hasClass("mobilefmt")) {
$(this).val(formatmobile($(this).val()));
}
else if ($(this).hasClass("telfmt")) {
$(this).val(formattel($(this).val()));
}
else if ($(this).hasClass("int") && isNaN(parseInt($(this).val(), 10))) {
if (!$(this).hasClass("datazero")) {
$(this).val("");
}
else {
$(this).val(0);
}
}
else if ($(this).hasClass("intdot") && isNaN(parseFloat($(this).val()))) {
if (!$(this).hasClass("datazero")) {
$(this).val("");
}
else {
$(this).val(0);
}
}
}).on("click", ".int, .intdot", function () {
//if ($(this).hasClass("phplaceholder")) {
// $("#" + $(this).attr("id").substr(3)).focus();
//} else {
$(this)[0].select();
//}
}).on("focus", ".int, .intdot, input[type='text'], input[type='password']", function () {
if ($(this).hasClass("int") || $(this).hasClass("intdot")) {
$(this).val($(this).val().replace(/,/gi, ''));
}
if (($(this).attr("id") || "") != "" && ($(this).attr("placeholder") || "") != "" && $("#ph_" + $(this).attr("id")).length < 1 && $(this).val() == "") {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie < 0) {
msie = ua.indexOf("Trident/");
}
if (msie > -1) {
$("label.phplaceholder").remove();
$("<label class=\"phplaceholder\" id=\"ph_" + $(this).attr("id") + "\">" + $(this).attr("placeholder") + "<label>").insertAfter($(this));
$("#ph_" + $(this).attr("id")).css("top", ($(this).position().top + 10) + 'px');
}
}
}).on("focusout", "input.datepicker-input", function () {
var v = $(this).val().replace(/[^0-9]/g, '');
if (v.length != 8) {
$(this).val("");
} else {
$(this).val(v.substr(0, 4) + "-" + v.substr(4, 2) + "-" + v.substr(6));
}
}).on("focusout", ".int, .intdot, input[type='text'], input[type='password']", function () {
//focusoutobj = $(this);
//if (!$(this).hasClass("nocomma")) {
// setTimeout(function () {
// var fv = $.trim($(focusoutobj).val());
// bindComma2(fv);
// }, 10);
//}
$("label.phplaceholder").remove();
});
$('#breadcrumb dd > span').click(function () {
if ($(this).is('.on')) {
$(this).next().slideUp(300);
$(this).removeClass('on');
} else {
$('#breadcrumb dd > ul').slideUp(300);
$('#breadcrumb dd > span').removeClass('on');
$(this).addClass('on');
$(this).next().slideDown(300);
}
});
$(document).on("click", "a", function () {
if ($(this).attr("href") == "#") {
prv();
}
});
$("body").on("keydown", "input[type=text], input[type=password]", function (e) {
if (e.keyCode == 13) {
var index = $('input[type=text], input[type=password]').index(this) + 1;
$('input[type=text], input[type=password]').eq(index).focus();
if ($(this).closest("form").length == 1) {
if ($(this).closest("form").find("input[type=text]").length == 1) {
prv();
}
}
if (($(this).attr("data-eval") || "") != "") {
eval($(this).attr("data-eval"));
}
}
}).on("click", "a.btnpage", function () {
if (!$(this).hasClass("on")) {
if ($(this).hasClass("first")) {
eval($(this).closest(".paging").attr("data-method") + "('F')");
}
else if ($(this).hasClass("prev")) {
eval($(this).closest(".paging").attr("data-method") + "('P')");
}
else if ($(this).hasClass("next")) {
eval($(this).closest(".paging").attr("data-method") + "('N')");
}
else if ($(this).hasClass("last")) {
eval($(this).closest(".paging").attr("data-method") + "('L')");
}
else {
eval($(this).closest(".paging").attr("data-method") + "('" + $(this).text()+"')");
}
}
});
$('.popClose').click(function () {
$('.popWrap').css('display', 'none');
$('html, body').removeClass('lock');
});
2020-10-30 09:17:31 +09:00
//document.oncontextmenu = disableit;
2020-10-12 14:39:23 +09:00
});
var _uploadeditorimageitem;
var _uploadeditorimagecallback;
var _uploadeditorimagertn;
function checkpop() {
var cpop = open("", "checkpop", '');
if (cpop == null) {
alert("팝업이 차단되어 있습니다. 차단을 해제해 주세요.");
return false;
} else {
cpop.close();
return true;
}
}
function mpgPopClose(selector) {
$(selector || '.mpgPop').hide();
$('html, body').removeClass('lock');
}
function cbeditorupload() {
if (_uploadeditorimagertn.code == 1000) {
$(_uploadeditorimageitem).summernote('editor.insertImage', _uploadeditorimagertn.obj.uri);
}
}
function uploadeditorimage(files, el, fdata, _callback, _url) {
_url = _url || '/fcommon/UploadEditorImageUrl';
_uploadeditorimagecallback = _callback;
_uploadeditorimageitem = el;
$.ajax({
data: fdata,
type: "POST",
url: _url,
cache: false,
contentType: false,
processData: false,
success: function (result) {
//_uploadeditorimagertn = JSON.parse(result);
_uploadeditorimagertn = result;
eval(_uploadeditorimagecallback.substr(_uploadeditorimagecallback.length - 1, 1) == ")" ? _uploadeditorimagecallback : (_uploadeditorimagecallback + "()"));
}
});
}
function gologin(url, returnurl) {
url = url || '/Account/Index';
if ((returnurl || "") != "") {
url += "?ru=" + returnurl;
}
location.href = url;
}
function gopage(fid, pid, pno, a) {
fid = fid || "mform";
pid = pid || "pagenum";
$("#" + fid).find("#" + pid).val(pno);
bglayer();
$("#"+fid).submit();
}
var _vc_cmino = 0;
var _vc_istaste = false;
var _vc_lectno = 0;
var _vc_pseq = 0;
var _vcwin;
var _vcistaste = false;
function viewcontents(cmino, istaste, lectno, pseq) {
lectno = lectno || 0;
pseq = getint(pseq);
_vc_cmino = cmino;
_vc_istaste = istaste;
_vc_lectno = lectno;
_vc_pseq = pseq;
_vcistaste = istaste;
if (ismobile()) {
confirmtoggle(true, "사용 중인 요금제에 따라 데이터 요금이 발생할 수 있습니다.", "viewcontentsok()");
} else {
viewcontentsok();
}
}
function viewcontentsok() {
if (!_vcistaste) {
//로그인체크
capp("/focommon/isauth", {}, "cbviewcontents");
} else {
cbviewcontents();
}
}
var _cdmsisopenning = 0;
function cbviewcontents() {
if (_vcistaste || (capResult.code == 1000)) {
$("#bglayer").hide();
_cdmsisopenning = 1;
if (ismobile()) {
var win = window.open("/CDMS/Play" + (_vc_istaste ? "Taste" : "") + "?cmino=" + _vc_cmino + "&ismobile=1&lectno=" + _vc_lectno + "&pseq=" + _vc_pseq, 'contentsview');
if (win == null) {
msg("팝업이 차단되어 있습니다. 차단을 해제해 주세요(0)");
}
} else {
var cpop = open("/Open/Popup", "checkpop", 'width=100,height=100');
if (cpop == null) {
msg("팝업이 차단되어 있습니다. 차단을 해제해 주세요(1)");
} else {
cpop.close();
var nWidth = "1080";
var nHeight = screen.availHeight - 100;
var popOption = "";
popOption += "width=" + nWidth + ",";
popOption += "height=" + nHeight + ",";
popOption += "toolbar=no,menubar=no,location=no,";
popOption += "resizable=yes,status=yes,scrollbars=yes";
if (window.open("/CDMS/Play" + (_vc_istaste ? "Taste" : "") + "?cmino=" + _vc_cmino + "&ismobile=0&lectno=" + _vc_lectno + "&pseq=" + _vc_pseq, 'contentsview', popOption) != null) {
//window.open("/CDMS/Play" + (_vc_istaste ? "Taste" : "") + "?cmino=" + _vc_cmino + "&ismobile=0&lectno=" + _vc_lectno + "&pseq=" + _vc_pseq, 'contentsview', popOption).focus();
console.log('iscdms');
}
else { msg("팝업이 차단되어 있습니다. 차단을 해제해 주세요"); }
}
}
}
else {
location.href = "/Account/Index?ru="+location.href.replace(/#/gi,'');
}
}
function poppaging(id, ptc, pno) {
$("#" + id).attr("data-lastpage", 1);
if (ptc > 10) {
if (pno > 10) {
$("#" + id).append("<a href=\"#\" class=\"btnpage first\">맨앞</a>");
}
if (pno > 1) {
$("#" + id).append("<a href=\"#\" class=\"btnpage prev\">이전</a>");
}
var __lastpno = (getint(ptc / 10) + (ptc % 10 > 0 ? 1 : 0));
$("#" + id).attr("data-lastpage", __lastpno);
var pstart = getint((pno - 1) / 10) * 10 + 1;
var __paging = "<ul>";
for (var i = pstart; i < pstart + 10; i++) {
__paging += "<li class=\"" + (pno == i ? "on" : "") + "\"><a href=\"#\" class=\"btnpage \">" + i + "</a></li>";
if (i == __lastpno) {
break;
}
}
$("#" + id).append(__paging + "</ul>");
if (pno < __lastpno) {
$("#" + id).append("<a class=\"btnpage next\">다음</a>");
$("#" + id).append("<a class=\"btnpage last\">맨뒤</a>");
}
}
}
function mobilefmt(phoneNum) {
var regExp = /(01[016789])([1-9]{1}[0-9]{2,3})([0-9]{4})$/;
var myArray;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /(01[016789])-([1-9]{1}[0-9]{2,3})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
return false;
}
function formatmobile(phoneNum) {
phoneNum = phoneNum.replace(/-/gi, '');
if (mobilefmt(phoneNum)) {
var rtnNum;
var regExp = /(01[016789])([1-9]{1}[0-9]{2,3})([0-9]{4})$/;
var myArray;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum); rtnNum = myArray[1] + '-' + myArray[2] + '-' + myArray[3]; return rtnNum;
} else { return phoneNum; }
} else { return phoneNum; }
}
function telfmt(phoneNum) {
var regExp;
var myArray;
if (phoneNum.length == 8) {
regExp = /([1-9]{1}[0-9]{3})([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /([1-9]{1}[0-9]{3})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
} else if (phoneNum.length == 9) {
regExp = /([0]{1}[2]{1})([1-9]{1}[0-9]{2})([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /([0]{1}[2]{1})-([1-9]{1}[0-9]{2})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
} else if (phoneNum.length == 10) {
if (phoneNum.substr(0, 2) == "02") {
regExp = /([0]{1}[2]{1})([1-9]{1}[0-9]{3})([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /([0]{1}[2]{1})-([1-9]{1}[0-9]{3})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
} else {
regExp = /([0]{1}[3-9]{1}[0-9]{1})([1-9]{1}[0-9]{2})([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /([0]{1}[3-9]{1}[0-9]{1})-([1-9]{1}[0-9]{2})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
}
} else {
regExp = /([0]{1}[3-9]{1}[0-9]{1})([1-9]{1}[0-9]{3})([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
regExp = /([0]{1}[3-9]{1}[0-9]{1})-([1-9]{1}[0-9]{3})-([0-9]{4})$/;
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
return true;
}
}
return false;
}
function formattel(phoneNum) {
phoneNum = phoneNum.replace(/-/gi, '');
if (telfmt(phoneNum)) {
var rtnNum;
var regExp;
var myArray;
if (phoneNum.length == 8) {
regExp = /([1-9]{1}[0-9]{3})([0-9]{4})$/;
} else if (phoneNum.length == 9) {
regExp = /([0]{1}[2]{1})([1-9]{1}[0-9]{2})([0-9]{4})$/;
} else if (phoneNum.length == 10) {
if (phoneNum.substr(0, 2) == "02") {
regExp = /([0]{1}[2]{1})([1-9]{1}[0-9]{3})([0-9]{4})$/;
} else {
regExp = /([0]{1}[3-9]{1}[0-9]{1})([1-9]{1}[0-9]{2})([0-9]{4})$/;
}
} else {
regExp = /([0]{1}[3-9]{1}[0-9]{1})([1-9]{1}[0-9]{3})([0-9]{4})$/;
}
if (regExp.test(phoneNum)) {
myArray = regExp.exec(phoneNum);
if (phoneNum.length == 8) {
return myArray[1] + '-' + myArray[2];
} else {
return myArray[1] + '-' + myArray[2] + '-' + myArray[3];
}
}
}
return phoneNum;
}
function bindComma(v) {
var fv = v.toString().replace(/,/gi, '');
var fv2 = "";
if (fv.indexOf('.') > -1) {
if (fv.split('.')[0].length > 3) {
for (var fvi = fv.split('.')[0].length - 1; fvi > -1; fvi--) {
fv2 = fv.split('.')[0].substr(fvi, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? "," : "") + fv2;
}
fv = fv2 + "." + fv.split('.')[1];
}
}
else if (fv.length > 3) {
for (var fvi2 = fv.length - 1; fvi2 > -1; fvi2--) {
fv2 = fv.substr(fvi2, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? "," : "") + fv2;
}
fv = fv2;
}
return fv;
}
function gourl(url) {
location.href = url;
}
function disableit() {return false;}
function refresh() {
bglayer();
location.href = location.href.replace('#', '');
}
function getnull(v) {
return v || "";
}
function getdb(v, norpspliter, nullto) {
nullto = nullto || "";
if ((norpspliter || false)) {
return v=="0" ? "0" : (v || nullto).toString();
}
return v == "0" ? v : (v || nullto).toString().replace(/:/gi, '').replace(/;/gi, '');
}
function getint(v) {
v = v == null ? 0 : v;
v = v.toString();
v = v.replace(/,/gi, '');
if (isNaN(parseInt(v, 10)))
return 0;
return parseInt(v, 10);
}
function prv() { try { if (event.preventDefault) { event.preventDefault(); } } catch (ex) { try { ffEvent.preventDefault(); } catch (ex2) { var exceptionmsg = ex2; } } return false; }
function gomenu(pno, ptype, url, a, no, no2) {
no = no || 0;
setv("menupageno", pno);
setv("menupagedatakey", no);
setv("menupagedatakey2", no2);
if (ptype == 3) {
if (no > 0) {
$("#menuform").attr("action", "/Board/View").submit();
} else {
$("#menuform").attr("action", "/Board/List").submit();
}
} else if (ptype == 5) {
eval(url);
} else {
bglayer();
location.href = (url == '' ? '/Home/Html' : url) + ((url == '' ? '/Home/Html' : url).indexOf('?') > -1 ? '' : '?') + 'menupageno=' + pno + '&menupagedatakey=' + no + '&menupagedatakey2=' + no2;
//$("#menuform").attr("action", url == '' ? "/Home/Html" : url).submit();
}
}
function viewlayer(pno, a, title) {
$("#mainpoptitle").text(title);
capp("/focommon/Html", { pno: pno }, "cbhtmlget");
}
function cbhtmlget() {
$("#mainpopcont").html(capResult.obj.pagehtml);
$(".mainpopwrap").show();
}
function breadcrumb(a) {
$("#ulm1 li").addClass("hidden");
$("#ulm1 li.m" + $(a).closest("li").attr("data-pno")).removeClass("hidden");
$("#ul0span").next().slideUp(300);
$("#ul0span").removeClass('on');
$("#ul0span").text($(a).text());
$("#ul1span").text('-');
$("#ul1span").addClass('on');
$("#ul1span").next().slideDown(300);
}
function val(id) {
if ($("#" + id).length < 1) {
return "";
}
return $.trim($("#" + id).val());
}
function vals(els, sepa) {
sepa = sepa || "";
var rtn = "";
$.each(els, function (i, r) {
rtn += sepa + ($(r).val() || "");
});
return rtn == "" ? rtn : rtn.substr(sepa.length);
}
function focus(id, isel) {
isel = isel || false;
id = id || "";
if (id != "") {
if (isel) {
$(id).focus();
$([document.documentElement, document.body]).animate({
scrollTop: $(id).offset().top - (ismobile() ? 80 : 120)
}, 700);
} else {
$("#" + id).focus();
$([document.documentElement, document.body]).animate({
scrollTop: $("#" + id).offset().top - (ismobile() ? 80 : 120)
}, 700);
}
}
}
var _jsislayer2, isAutoMsg, _bging, _callback, capResult, capOK, isCaping, _hideBG, _noerror;
function cap(url, formid, callback, getpost, autoMsg, noBG, jsislayer2) {
_jsislayer2 = jsislayer2 || false;
if (!isCaping) {
isAutoMsg = autoMsg || false;
_bging = noBG || false;
if (!_bging) {
ajaxing();
}
if (_jsislayer2) {
bglayer2();
}
_callback = callback;
capResult = null;
capOK = false;
isCaping = true;
clearComma();
$.ajax({
type: getpost || "post",
url: url,
data: $("#" + formid).serialize(),
success: function (r) {
isCaping = false;
capResult = r;
setcap();
}, error: function (e) {
isCaping = false;
console.log(e.responseText);
if (_jsislayer2) {
msg2("잠시 후 다시 요청해주세요.");
}
else {
msg("잠시 후 다시 요청해주세요.");
}
}, complete: function () {
ajaxing(false);
}
});
}
else {
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
}
}
function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2, hideBG, noerror, sync) {
2020-10-12 14:39:23 +09:00
_jsislayer2 = jsislayer2 || false;
_noerror = noerror || false;
_hideBG = hideBG || false;
_async = !(sync || false);
2020-10-12 14:39:23 +09:00
if (!isCaping) {
isAutoMsg = autoMsg || false;
_bging = noBG || false;
if (!_bging) {
ajaxing();
}
if (_jsislayer2) {
bglayer2();
}
_callback = callback;
capResult = null;
capOK = false;
isCaping = true;
clearComma();
$.ajax({
type: getpost || "post",
url: url,
data: p,
async: _async,
2020-10-12 14:39:23 +09:00
success: function (r) {
isCaping = false;
capResult = r;
setcap();
}, error: function (e) {
isCaping = false;
console.log(e.responseText);
if (_jsislayer2) {
//msg2("잠시 후 다시 요청해주세요.");
}
else {
//msg("잠시 후 다시 요청해주세요.");
}
}, complete: function () {
ajaxing(false);
}
});
}
else if (!_noerror){
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
}
}
function capfile(url, data, callback, noeval, setBG, jsislayer2) {
noeval = noeval || false;
_jsislayer2 = jsislayer2 || false;
_setBG = setBG || false;
capfilecallback = callback;
if (_setBG) {
bglayer();
}
if (_jsislayer2) {
bglayer2();
}
var ajaxRequest = $.ajax({
type: "POST",
url: url,
contentType: false,
processData: false,
data: data
});
ajaxRequest.error(function (e) {
console.log(e);
capResult = data;
if (!noeval) {
eval(capfilecallback.substr(capfilecallback.length - 1, 1) == ")" ? capfilecallback : (capfilecallback + "()"));
}
else {
ajaxRequest.done(capfilecallback);
}
});
ajaxRequest.done(function (data) {
if (_setBG) {
$("#bglayer").hide();
}
capResult = data;
if (capResult.code == 1000) {
if (!noeval) {
eval(capfilecallback.substr(capfilecallback.length - 1, 1) == ")" ? capfilecallback : (capfilecallback + "()"));
}
else {
ajaxRequest.done(capfilecallback);
}
}
});
}
function capfileform(url, fid, callback, iseval, getpost, autoMsg, noBG, jsislayer2) {
_jsislayer2 = jsislayer2 || false;
if (!isCaping) {
isAutoMsg = autoMsg || false;
_bging = noBG || false;
if (!_bging) {
ajaxing();
}
if (_jsislayer2) {
bglayer2();
}
_callback = callback;
capResult = null;
capOK = false;
isCaping = true;
//clearComma();
$.ajax({
type: getpost || "post",
url: url,
data: new FormData($('#' + fid)[0]),
contentType: false,
processData: false,
success: function (r) {
isCaping = false;
capResult = r;
setcap();
}, error: function (e) {
isCaping = false;
console.log(e.responseText);
if (_jsislayer2) {
msg2("개발담당자에게 문의해주세요.");
}
else {
msg("개발담당자에게 문의해주세요.");
}
}, complete: function () {
ajaxing(false);
}
});
}
else {
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
}
}
function ajaxing(tf) {
if (!_jsislayer2) {
bglayer(false);
$("#bgprogress").hide();
if (tf == null || tf === true) {
bglayer();
$("#bgprogress").show();
}
}
else {
bglayer2(false);
if (tf == null || tf === true) {
bglayer();
}
}
}
function bglayer(tf) {
if (tf == null || tf === true || (_bging && !_hideBG)) {
$("#bglayer").show();
}
else {
$("#bglayer").hide();
}
}
function bglayer2(tf) {
if (tf == null || tf === true) {
$("#bglayer2").show();
}
else {
$("#bglayer2").hide();
}
}
function clearComma() {
$.each($("input.int, input.double"), function (i, c) {
$(c).val($(c).val().replace(/,/gi, ''));
});
}
function setcap() {
if (capResult.code === 1000) {
capOK = true;
capResultObj = capResult.obj;
capResultMsg = capResult.msg;
}
if (capResult.code == 9991) {
if (ispop()) {
parent.location.href = capResult.obj + '?istimeout=true';
}
else if ((parent.ismainlayout || 0) == 1) {
parent.location.href = capResult.obj + '?istimeout=true';
}
else if (opener != null) {
parent.location.href = capResult.obj + '?istimeout=true';
self.close();
}
else {
//msg("인증시간이 초과되어 로그아웃되었습니다.");
location.href = capResult.obj;
}
}
else {
if (isAutoMsg) {
switch (capResult.code) {
case 1000:
showOK();
break;
case 9999:
msg("서버접속이 원활하지 않습니다 <" + capResult.code + ": " + capResult.msg + ">");
break;
case 9998:
msg("권한이 없는 요청입니다. <" + capResult.code + ": " + capResult.msg + ">");
break;
case 9997:
msg("권한(로그인)이 없는 요청입니다. <" + capResult.code + ": " + capResult.msg + ">");
break;
case 9996:
msg("검색된 데이터가 없습니다. <" + capResult.code + ": " + capResult.msg + ">");
break;
case 9995:
msg("적용된 데이터가 없습니다. <" + capResult.code + ": " + capResult.msg + ">");
break;
default:
console.log(capResult.code);
console.log(capResult.msg);
console.log(capResult.obj);
break;
}
}
else {
capResultMsg = capResult.code + ": " + capResult.msg;
}
if ((_callback || "") != "") {
eval(_callback.indexOf(")") > -1 ? _callback : (_callback + "()"));
}
}
}
var _focusitem;
var _focusitem2;
var _okm;
function msg(m, t, bging, fi, okm, okmt, hidebtn) {
okmt = okmt || 0;
hidebtn = hidebtn || false;
_okm = okm || "";
fi = fi || "";
if (fi == "x") {
_focusitem = "";
} else {
_focusitem = fi == "" ? $("input:focus, select:focus, textarea:focus") : $(fi);
}
if (hidebtn) {
$("#layermessage a.mainokbutton").hide();
}
else {
$("#layermessage a.mainokbutton").unbind("click");
$("#layermessage a.mainokbutton").on("click", function () {
if (_okm == "" && _focusitem != "") {
$(_focusitem).focus();
}
else {
eval(_okm);
}
});
}
if (okm != "" && okmt > 0) {
setTimeout(function () {
eval(_okm);
}, okmt);
}
t = t || 10;
bging = bging || false;
if ($("#layermessage a.mainokbutton").length > 0) {
$("#layermessage a.mainokbutton").focus();
}
setTimeout(function () {
bglayer();
msglayer(m, bging);
}, t);
}
function msg2(m, t, fi) {
_focusitem2 = (fi || "") == "" ? $("input:focus, select:focus, textarea:focus") : $(fi);
$("#layermessage2 a.mainokbutton2").on("click", function () {
$(_focusitem2).focus();
});
t = t || 0;
if ($("#layermessage2 a.mainokbutton2").length > 0) {
$("#layermessage2 a.mainokbutton2").focus();
}
setTimeout(function () {
bglayer2();
msglayer2(m);
}, t);
}
function msglayer(msg, bging) {
_bging = bging;
$("#layermessage div").html(msg);
$("#bglayer, #layermessage").show();
$("#layermessage a.mainokbutton").focus();
}
function msglayer2(msg) {
$("#layermessage2 div").html(msg);
$("#bglayer2, #layermessage2").show();
$("#layermessage2 a.mainokbutton2").focus();
}
function hidelayermsg() {
ajaxing(_bging);
$("#layermessage").hide();
if (!_bging) {
$("#bglayer").hide();
}
else {
$("#bgprogress").hide();
}
}
function hidelayermsg2() {
$("#layermessage2").hide();
$("#bglayer2").hide();
}
function popup(pop) {
$('.popWrap#' + pop).css('display', 'block');
$('html, body').addClass('lock');
}
function checkInt(id, focus, m) {
m = m || "";
if ($("#" + id).length < 1 || $.trim($("#" + id).val()) == "" || getBytes($.trim($("#" + id).val())) < 1 || getint(val(id)) == 0) {
if ($("#" + (id || focus)).length > 0) {
$("#" + (id || focus)).focus();
}
if (m != "") {
msg(m);
}
return true;
}
return false;
}
function check(id, focusid, m, ism2) {
ism2 = ism2 || false;
m = m || "";
if ($("#" + id).length < 1 || $.trim($("#" + id).val()) == "" || $.trim($("#" + id).val()) == "0" || getBytes($.trim($("#" + id).val())) < 1) {
if ($("#" + (focusid || id)).length > 0) {
if ($("#" + (focusid || id)).hasClass("datepicker-input")) {
$("#" + (focusid || id)).next("i").focus();
$("#" + (focusid || id)).next("i")[0].scrollIntoView(false);
}
else {
focus($("#" + (focusid || id)), true);
}
}
if (m != "") {
if (ism2) {
msg2(m);
}
else {
msg(m);
}
}
return true;
}
return false;
}
function checkn(id, focus, m) {
m = m || "";
if ($("#" + id).length < 1 || $.trim($("#" + id).val()) === "" || getBytes($.trim($("#" + id).val())) < 1 || getint(getv(id)) < 1) {
if ($("#" + (id || focus)).length > 0) {
$("#" + (id || focus)).focus();
}
if (m != "") {
msg(m);
}
return true;
}
return false;
}
function checkrv(name) {
if ($("input[name='" + name + "']:checked").length < 1) {
$("input[name='" + name + "']").first().focus();
return true;
}
return false;
}
function setrv(name, val) {
$("input[name='" + name + "'][value='" + val + "']").prop("checked", true);
}
function setv(id, val) {
$("#" + id).val(val);
}
function sett(id, text) {
$("#" + id).text(text);
}
function submit(fid, t, remainpage) {
remainpage = remainpage || false;
if (!remainpage) {
$("#PageNum").val(1);
}
t = t || 10;
setTimeout(function () {
bglayer();
$("#" + (fid || "mform")).submit();
}, t);
}
function msgadmin(t) {
setTimeout('msg("운영자에게 문의해주세요.")', t || 10);
}
function isid(v) {
//영문숫자-_ , 나머지입력시 오류반환
var regExp = /[a-zA-Z0-9\-_]/i;
var regExp2 = /[\,.=~!@#$%^&*()\[\]+|<>?:{}]/;
if (regExp.test(v) && !regExp2.test(v)) {
return true;
}
return false;
}
2020-10-12 14:39:23 +09:00
function isemail(v) {
//이메일 검사
var regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
if (regExp.test(v)) {
return true;
}
return false;
}
function ispassword(v) {
var r = /^(?=.*[a-zA-Z])(?=.*[!@#$%^&~*+=-])(?=.*[0-9]).{8,20}$/;
return r.test(v);
}
function getBytes(v, nocrtrim) {
nocrtrim = nocrtrim == undefined || nocrtrim == null ? false : nocrtrim;
if (v == null) {
return 0;
}
v = $.trim(v);
if (!nocrtrim) {
v = v.replace(/[\r\n]/gi, '').replace(/[\n]/gi, '');
}
var stringByteLength = 0;
stringByteLength = (function (s, b, i, c) {
for (b = i = 0; c = s.charCodeAt(i++); b += c >> 11 ? 2 : c >> 7 ? 2 : 1);
return b
})(v);
return stringByteLength;
}
function confirmtoggle(b, m, cb, cbcancel) {
b = b || false;
if (b) {
_confirmokcb = "";
_confirmokcbcancel = "";
_confirmokcb = cb || "confirmokpage()";
_confirmokcbcancel = cbcancel || "";
$("#confirmboxmsg").html(m);
setTimeout(function () {
bglayer(); $("#confirmbox").show();
}, 30);
}
else {
_bging = false;
bglayer(false); $("#confirmbox").hide();
if (_confirmokcbcancel != "") {
if (_confirmokcbcancel.substr(_confirmokcbcancel.length - 1, 1) != ';' &&
_confirmokcbcancel.substr(_confirmokcbcancel.length - 1, 1) != ')' &&
_confirmokcbcancel.indexOf('(') < 0 &&
_confirmokcbcancel.indexOf(')') < 0) {
_confirmokcbcancel += "()";
}
eval(_confirmokcbcancel);
}
}
}
var _confirmokcb;
var _confirmokcbcancel;
function confirmok() {
$("#confirmbox").hide();
if (_confirmokcb != "" &&
_confirmokcb.substr(_confirmokcb.length - 1, 1) != ';' &&
_confirmokcb.substr(_confirmokcb.length - 1, 1) != ')' &&
_confirmokcb.indexOf('(') < 0 &&
_confirmokcb.indexOf(')') < 0) {
_confirmokcb += "()";
}
eval(_confirmokcb);
}
window.ismobile = function () {
var check = false;
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera);
return check;
};
function fillzero(v, padleft, len) {
v = (v || "").toString();
var v2 = v;
if (v2.length < len) {
while (v2.length < len) {
v2 = padleft ? ('0' + v2) : (v2 + '0');
}
}
return v2;
}
function ismobilenumber(v) {
//모바일 검사
v = v.replace(/-/gi, '');
if (v.search(/[0-9]/g) < 0 || !/^[0-9]{10,11}$/.test(v)) {
return false;
}
return true;
}
function istelnumber(v) {
//일반전화 검사
return telfmt(v.replace(/-/gi, ''));
}
function getcheckv(name) {
var rtn = "";
$.each($("input[name='" + name + "']"), function (i, c) {
if ($(c).prop("checked")) {
rtn += "," + $(c).val();
}
});
return rtn == "" ? "" : rtn.substr(1);
}
function commaset(v) {
var fv = v.toString().replace(/,/gi, '');
var fv2 = "";
if (fv.indexOf('.') > -1) {
if (fv.split('.')[0].length > 3) {
for (var fvi = fv.split('.')[0].length - 1; fvi > -1; fvi--) {
fv2 = fv.split('.')[0].substr(fvi, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? "," : "") + fv2;
}
fv = fv2 + "." + fv.split('.')[1];
}
}
else if (fv.length > 3) {
for (var fvi = fv.length - 1; fvi > -1; fvi--) {
fv2 = fv.substr(fvi, 1) + (fv2 != "" && (fv2.replace(/,/gi, '').length % 3) < 1 ? "," : "") + fv2;
}
fv = fv2;
}
return fv;
}
function goremote() {
var winl = (screen.width - 840) / 2;
var wint = (screen.height - 410) / 2;
var opt = 'height=410, width=840, top=' + wint + ', left=' + winl + ', scrollbars=no, location=no, noresizable';
window.open("http://helpu.kr/kfcf/", "remoteWin", opt);
}
function checkall(c, cssclass) {
$("input[type=checkbox]." + cssclass).prop("checked", $(c).prop("checked"));
}