/*
* Name : board.min.js
* Version : 3.0.1
* Product : prime series (board pro EN)
* Author : 1px studio
* Date : 2025-01-07
* Desc : 게시판 Pro 버전 영문 게시판 스크립트 + faq 게시판 슬라이드 + 게시판 C형 video-mode
* ------------------------------------------------
*/
$(function () {
if (null != document.getElementById("isIndex")) return;
let e = "en" == $("html").attr("lang") && "1px" == $("html").data("tpl");
function t(e, t) {
t || (e = e.substr(0, 4) + "-" + e.substr(5, 2) + "-" + e.substr(8, 2));
let a = new Date(e);
return ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][a.getMonth()] + " " + a.getDate() + ", " + a.getFullYear();
}
function a(a) {
return !!e && !!RegExp(/^\d{4}[\.\-년](0[1-9]|1[012])[\.\-월](0[1-9]|[12][0-9]|3[01])[일]?$/).test(a) && t(a);
}
function n(t, a) {
let n = 1,
i = "contact-form" == a[0].className;
if ($("#privacy_terms_context").length) {
let l = $(".formmail_cell_bgcolor textarea[readonly]").val();
$("#privacy_terms_context").val(l);
}
t.each(function (t, l) {
$(l).find("input[type=text], select").length >= 3 && $(l).addClass("flex-line");
$(l).find(".button-zipcode").length && $(l).addClass("zipcode-line");
let s = $(l).find("input[type=checkbox], input[type=radio]");
if (s.length) {
let r = { count: $(l).find("br").eq(0).index() };
i && (r.count = $(l).find("tr").eq(0).find("input").length),
s.each(function (t) {
let a = "labelfor" + n;
if (((this.id = a), this.name.match("_lunar"))) {
let i = $(l).find("select"),
s = '
';
i.each(function (e) {
0 == e ? (s += this.outerHTML + "년 ") : 1 == e ? (s += this.outerHTML + "월 ") : 2 == e && (s += this.outerHTML + "일 ");
}),
(s += this.outerHTML + ``),
(s += "
"),
$(l).html(s);
} else {
let o = "label-group";
o += t > 0 && t % r.count == 0 ? " end" : "";
let c = this.value;
"com_board_notice" == this.name && (e ? ((c = "Set this as a notice"), $(this).parents("tr.board").find(".board_bgcolor").text("Notice")) : (c = "이 글을 공지글로 설정합니다.")),
$(this).replaceWith('
' + this.outerHTML + `
`);
}
n++;
}),
$(l).addClass("flex-line");
let o = $(l).find(".label-group, .select-group, input[type=hidden]");
$(l).html(o),
r.count > -1 &&
($(l)
.find(".label-group")
.each(function (e) {
if (e % r.count == 0) {
let t = $(this),
a = t.nextUntil(".label-group.end");
$.merge(t, a).wrapAll('');
}
}),
$(l).addClass("change-direction"));
}
let c = $(l).find("input[type=file]");
if (c.length) {
let d = $(l)
.text()
.split(/[\n\t]+/g)
.filter((e) => e.length > 0 && "삭제" != e);
$(l).addClass("file-desc");
let p = 0;
c.each(function () {
let e = "labelfor" + n;
(this.id = e), (this.className = "upload-hidden");
let t = $(this);
t.wrap('');
let a = t.closest(".file-upload"),
i = ``;
a.prepend(i), n++, p++;
});
let f = $(l).find(".file_attach_del");
f.length &&
f.each(function (e) {
$(this).closest("a").prev(".file-upload").find(".upload-name").addClass("exist").val(d[e]);
});
let h = $(l).children();
$(l).html(h);
a.find(".file-upload .upload-hidden").on("change", function () {
let e = $(this)[0].files[0].name;
$(this).siblings(".upload-name").val(e);
});
}
});
}
function i(e, t) {
let a = e.find(".gallery_etc font"),
n = [],
i = [],
l = [];
return (a.each(function (e, t) {
let a = $(t).text().split(" : "),
s = a[1],
r = a[0],
o = "486px" == t.style.fontSize;
if (t.children.length > 0) i.push({ name: r, text: t.children[0].outerHTML }), l.push({ name: r, text: t.children[0].outerHTML });
else {
let c = RegExp(/^\d{4}년 (0[1-9]|1[012])월 (0[1-9]|[12][0-9]|3[01])일$/),
d = RegExp(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/);
if (c.test(s)) {
let p = s;
(p = p.replace(/[(가-힣)]/g, "").replaceAll(" ", ".")), n.push({ name: r, text: p });
} else if (d.test(s)) {
let f = s.replaceAll("-", ".");
n.push({ name: r, text: f, secret: o }), l.push({ name: r, text: f, secret: o });
} else i.push({ name: r, text: s, secret: o }), l.push({ name: r, text: s, secret: o });
}
}),
1 == t)
? l
: { dateList: n, etcList: i };
}
$("#ext_search select").after(''),
a(),
(function t() {
let a = "",
n = [],
i = [],
l = window.location.search,
s = new URLSearchParams(l);
if ($("select[name=com_board_category_code]").length) {
let r = s.get("com_board_category_code"),
o = $("select[name=com_board_category_code]").attr("onchange").split("'")[1],
c = "";
(o = "?" == o.substr(-1) ? o + "com_board_category_code=" : o + "&&com_board_category_code="),
$("select[name=com_board_category_code] option").each(function (t) {
let a = $(this);
e && 0 == t ? n.push("All") : n.push(a.text()), i.push(a.val());
});
for (let d = 0; d < n.length; d++) a += `${n[d]}`;
$(".category-button-wrapper").empty().append(a);
}
})(),
(function t() {
let a = $("input[type=image]"),
n = $("img"),
i = e
? ["Search", "Submit", "Write a comment", "Delete", "Move", "Copy", "Prev", "List", "Next", "Spam report", "Modify", "Delete", "Answer", "Writing", "Confirm", "Cancel", "Download", "Zipcode", "Delete"]
: ["검색", "확인", "댓글작성", "삭제", "이동", "복사", "이전", "목록", "다음", "스팸신고", "수정", "삭제", "답변", "글쓰기", "작성완료", "취소", "다운로드", "우편번호검색", "삭제"];
a.each(function () {
let t = $(this).attr("src");
t.indexOf("search.gif") > -1 &&
($(this).before(``),
$(document).on("click", "#btn-search", function () {
$(this).next("input[type=image]").trigger("click");
}),
$(this).hide()),
t.indexOf("confirm.gif") > -1 && ($(this).before(``), $(this).hide()),
t.indexOf("comment_write.gif") > -1 &&
($(this).before(``),
$(document).on("click", "#btn-comment-write", function () {
$(this).next("input[type=image]").trigger("click");
}),
$(this).hide());
}),
n.each(function () {
let e = $(this).attr("src"),
t = $(this).attr("onclick");
e.indexOf("btn_sdel.gif") > -1 && ($(this).before(``), $(this).remove()),
e.indexOf("move.gif") > -1 && ($(this).before(``), $(this).remove()),
e.indexOf("copy.gif") > -1 && ($(this).before(``), $(this).remove()),
e.indexOf("/prev.gif") > -1 && $(this).parent().addClass("button-b button--default move-page").text(i[6]),
e.indexOf("list.gif") > -1 && $(this).parent().addClass("button-b button--dark").text(i[7]),
e.indexOf("/next.gif") > -1 && $(this).parent().addClass("button-b button--default move-page").text(i[8]),
e.indexOf("spam.gif") > -1 && ($(this).before(``), $(this).remove()),
e.indexOf("modify.gif") > -1 && $(this).parent().addClass("button-b button--default").text(i[10]),
e.indexOf("delete.gif") > -1 && $(this).parent().addClass("button-b button--default board-delete-btn").text(i[11]),
e.indexOf("reply.gif") > -1 && $(this).parent().addClass("button-b button--default").text(i[12]),
e.indexOf("write.gif") > -1 && $(this).parent().addClass("button-b button--dark size--3").text(i[13]),
e.indexOf("btn_confirm.gif") > -1 && $(this).parent().addClass("button-b button--primary").text(i[14]),
e.indexOf("cancel.gif") > -1 && $(this).parent().addClass("button-b button--default button--lg").text(i[15]),
e.indexOf("download.gif") > -1 && $(this).parent().addClass("button-download").text(i[16]),
e.indexOf("search_zipcode.gif") > -1 && $(this).parent().addClass("button-zipcode").text(i[17]),
e.indexOf("btn_zip.gif") > -1 && $(this).parent().addClass("button-zipcode").text(i[17]),
e.indexOf("btn_del.gif") > -1 && $(this).replaceWith('' + i[18] + ""),
e.indexOf("icon_sct.gif") > -1 && $(this).replaceWith('');
});
})(),
(function e() {
let t = $("form[name=com_board]");
if (!t.length) return !1;
n(t.find(".board_desc"), t);
})(),
(function t() {
if (!$(".board-gallery").length) return !1;
let a = $(".board-gallery .gallery-list").data("column") ? $(".board-gallery .gallery-list").data("column") : 3,
n = "";
switch (a) {
case 1:
n = "col-xl-12";
break;
case 2:
n = "col-xl-6";
break;
case 3:
default:
n = "col-xl-4";
break;
case 4:
n = "col-xl-3";
break;
case 5:
n = "col-xl-2-5";
break;
case 6:
n = "col-xl-2";
}
let l = $(".board-gallery").hasClass("video-mode"),
s = "",
r = "",
o = "",
c = "",
d = "",
p = "",
f = l ? '
'),
$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function () {
let e = $(this).find(".bbsnewf5"),
t = i(e, 1);
if (t.length > 0) {
let a = '';
t.forEach(function (e, t) {
a += `${e.name}${e.text}`;
}),
(a += ""),
(d = a);
}
(s = e.find("img").attr("src")), (r = e.find(".gallery_subject>a").attr("href")), (o = e.find(".gallery_title").text());
let l = e.find(".gallery_cont");
p += `
'),
$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function () {
let e = $(this).find(".bbsnewf5"),
t = i(e, 1);
if (t.length > 0) {
let a = '';
t.forEach(function (e, t) {
a += `${e.name}${e.text}`;
}),
(a += ""),
(d = a);
}
(s = e.find("img").attr("src")), (r = e.find(".gallery_subject>a").attr("href")), (o = e.find(".gallery_title").text());
let l = e.find(".gallery_cont");
p += `
'),
$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function () {
let e = $(this).find(".bbsnewf5"),
t = i(e, 1);
if (t.length > 0) {
let a = '';
t.forEach(function (e, t) {
a += `${e.name}${e.text}`;
}),
(a += ""),
(d = a);
}
(s = e.find("img").attr("src")), (r = e.find(".gallery_subject>a").attr("href")), (o = e.find(".gallery_title").text());
let l = e.find(".gallery_cont");
p += `
"),
$(".board-gallery .article-wrapper").empty().append(p)),
l &&
((h = $(".board-gallery.video-mode .article-wrapper .col-photo > a")),
(b = []),
(window.youtube_list = b),
(u = 0),
h.each(function (t) {
let a = $(this),
n = a.attr("href");
a.attr("data-no", t), (this.href = "javascript:void(0)");
let i = a.parents(".col-photo");
$.ajax({
url: n,
method: "GET",
contentType: "application/x-www-form-urlencoded;charset=euc-kr",
dataType: "html",
success: function (e) {
let l = $(e).find("#post_area embed").attr("src"),
s = $(e).find("#post_area").text().trim(),
r = i.find(".info h5").text();
b.push({ data_no: t, title: r, desc: s, youtube_src: l }),
i.removeClass("loading"),
void 0 == l && a.parent().find(".play-icon").remove(),
a.on("click", (e) => {
if ((e.preventDefault(), l)) {
let t = $("#youtubeModal"),
a = t.find(".youtube-wrapper>iframe");
t.find(".youtube-desc").html(`
${r}
${s}
`),
a.attr("src", l),
t.modal("show"),
t.on("hidden.bs.modal", () => {
a.attr("src", "");
});
} else location.href = n;
});
},
error: function (t) {
alert(e ? "An error has occurred." : "오류가 발생하였습니다.");
},
beforeSend: function (e) {
e.overrideMimeType("application/x-www-form-urlencoded;charset=euc-kr"), i.addClass("loading");
},
});
}));
})(),
(function t() {
if (!$(".faq-list .table-article-list .titdesign").length) return !1;
let a = `
`;
function n(e) {
e.closest(".titdesign").hasClass("article--open")
? (e.parent().next(".reply-content").slideUp(), e.closest(".titdesign").removeClass("article--open"))
: (e.closest(".titdesign").addClass("article--open"), e.parent().next(".reply-content").stop().slideDown());
}
$(".faq-list .table-article-list .bbsnewf5 > a").on("click", (t) => {
let i = $(t.currentTarget);
if (i.parent().next(".reply-content").length) return n(i), !1;
if (!$('input[name="delete_check_notice[]"]').length) {
t.preventDefault();
let l = i.attr("href"),
s = "";
$.ajax({
url: l,
method: "GET",
contentType: "application/x-www-form-urlencoded;charset=euc-kr",
dataType: "html",
async: !1,
success: function (e) {
(s = `
${$(e).find("#post_area").html()}
`),
i.parent().after(s),
n(i);
},
error: function (t) {
alert(e ? "An error has occurred." : "오류가 발생하였습니다.");
},
beforeSend: function (e) {
e.overrideMimeType("application/x-www-form-urlencoded;charset=euc-kr"), $("body").prepend(a);
},
complete: function () {
$("#ajax-loader").remove();
},
});
}
});
})(),
(function a() {
if (!$(".board-event").length) return !1;
let n = '
';
$(".board-event .article-wrapper > .event-article-list > tbody > tr").each(function () {
let a = $(this).find(".bbsnewf5"),
l = a.find("img").attr("src"),
s = a.find(".gallery_subject>a").attr("href"),
r = a.find(".gallery_title").text(),
o = "",
c = a.find(".gallery_cont");
c.length && (o = "
" + c.text() + "
");
let d = "",
p = "",
f = i(a),
h = f.dateList,
b = f.etcList;
if (h.length > 0) {
let u = '';
h.forEach(function (a, n) {
let i = a.text;
e && (i = (i = t(a.text)) || a.text),
n > 0 && (a.name.match("종료") || a.name.match("마감") || a.name.match("Finish") || a.name.match("finish") || a.name.match("End") || a.name.match("end")) && (i = " ~ " + i),
(u += `${a.name}${i}`);
}),
(u += ""),
(d = u);
}
if (b.length > 0) {
let m = '';
b.forEach(function (e, t) {
m += `${e.name}${e.text}`;
}),
(m += ""),
(p = m);
}
n += `
${p}
${d}
${r}
${o}
`;
}),
(n += "
"),
$(".board-event .article-wrapper").empty().append(n);
})(),
(function e() {
if (!$(".board-blog").length) return !1;
let t,
n,
i,
l,
s,
r,
o,
c = "",
d = '
';
$(".board-blog .article-wrapper > .blog-article-list .webzine_type2 > tbody > tr").each(function () {
let e = $(this).find(".webzine_type_text_td_left");
if (0 == e.length) return;
let p = $(this).find(".webzine_type_img_td"),
f = e.find(".webzine_no .obj_value").text();
(t = f.length ? 'NO. ' + f + "" : ""), e.find(".webzine_no").remove(), (n = e.find(".webzine_subject .obj_value").text().trim()), e.find(".webzine_subject").remove();
let h = e.find(".webzine_dateof_write .obj_value").text().trim();
(i = (h = a(h)).length ? '' + h + "" : ""), e.find(".webzine_dateof_write").remove();
let b = e.find(".webzine_category .obj_value").text().trim();
(l = b.length ? '#' + b + "" : ""), e.find(".webzine_category").remove();
let u = e.find(".webzine_description .obj_value").text().trim();
(s = u.length ? "
" + u + "
" : ""), e.find(".webzine_description").remove(), (r = p.find("img").attr("src")), (o = p.find("a").attr("href"));
let m = $(this).find(".webzine_type_text_td_left dd");
if (m.length > 0) {
let g = '
`;
else {
t = $(this).find(".board_bgcolor").text().trim();
let n = $(this).find(".board_desc"),
c = "";
if (
(n.find("div").length && (c = " download"),
0 ==
(a =
void 0 == (a = n.html())
? ""
: (function e(t) {
for (;;)
if (-1 != t.indexOf("");
t = t.substring(0, a) + t.substring(n + 3, t.length);
} else break;
return t;
})(a)).trim().length || 0 == t.length)
)
return;
o
? (i += `
${t}${a}
`)
: ((l += `
${t}${a}
`),
(s = !0));
}
}),
(i += '
'),
(l += "
"),
$(".board-blog .table-article-common").replaceWith(i);
let c = $(".board-blog").find(".post-body").html(r);
s && c.after(l);
let d = $(".board-view-thumbnails").find("a"),
p = '
Previous posts
';
d.each(function () {
let e = $(this).attr("href"),
t;
p += `
`;
}),
(p += "
"),
$(".board-blog").find(".post-body").append(p),
$(".board-view-thumbnails").remove();
let f = '
',
h = $(".board-blog .move-page");
h.each(function () {
let t = $(this).text().trim(),
a;
a = e
? "Prev" == t
? 'Prev'
: 'Next'
: "이전" == t
? '이전글'
: '다음글';
let n;
f += `${a}`;
}),
(f += "
"),
h.remove(),
$(".board-blog").find(".post-wrap").append(f),
$(".board-blog")
.find(".move-btn")
.on("mouseover", function () {
$(this).addClass("on");
}),
$(".board-blog")
.find(".move-btn")
.on("mouseout", function () {
$(this).removeClass("on");
});
})(),
(function e() {
let t = $(".contact-form");
if (!t.length) return !1;
let a;
n($(".contact-form .table-form > tbody > tr .formmail_cell_bgcolor"), t);
})(),
(function t() {
if (!e || !$(".table-article-common").length || $(".board-blog").length) return !1;
$(".table-article-common tr td").each((e, t) => {
let n = a(t.innerText.replaceAll(" ", ""));
n && (t.innerText = n);
});
})();
});