/*
* Name : board.js
* Version : 1.2.3
* Author : 1px studio
* Date : 2024-03-18
* Desc : member alert bug fix.
* ------------------------------------------------
*/
$(function () {
// script break in main page
if (document.getElementById("isIndex")!=null) { return; }
let input_image, btn_img, btn_names;
$("#ext_search select").after(' ');
(function t() {
let e = "",
a = [],
i = [],
n = window.location.search,
r = new URLSearchParams(n);
if ($("select[name=com_board_category_code]").length) {
let l = r.get("com_board_category_code"),
s = $("select[name=com_board_category_code]").attr("onchange").split("'")[1] + "com_board_category_code=",
c = "";
$("select[name=com_board_category_code] option").each(function () {
let t = $(this);
a.push(t.text()), i.push(t.val());
});
for (let o = 0; o < a.length; o++) e += `${a[o]} `;
$(".category-button-wrapper").empty().append(e);
}
})(),
(input_image = $("input[type=image]")),
(btn_img = $("img")),
(btn_names = ["검색", "확인", "댓글작성", "삭제", "이동", "복사", "이전", "목록", "다음", "스팸신고", "수정", "삭제", "답변", "글쓰기", "작성완료", "취소", "다운로드"]),
input_image.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());
}),
btn_img.each(function () {
let t = $(this).attr("src"),
e = $(this).attr("onclick");
t.indexOf("btn_sdel.gif") > -1 && ($(this).before(`${btn_names[3]} `), $(this).remove()),
t.indexOf("move.gif") > -1 && ($(this).before(`${btn_names[4]} `), $(this).remove()),
t.indexOf("copy.gif") > -1 && ($(this).before(`${btn_names[5]} `), $(this).remove()),
t.indexOf("/prev.gif") > -1 && $(this).parent().addClass("button-b button--default move-page").text(btn_names[6]),
t.indexOf("list.gif") > -1 && $(this).parent().addClass("button-b button--dark").text(btn_names[7]),
t.indexOf("/next.gif") > -1 && $(this).parent().addClass("button-b button--default move-page").text(btn_names[8]),
t.indexOf("spam.gif") > -1 && ($(this).before(`${btn_names[9]} `), $(this).remove()),
t.indexOf("modify.gif") > -1 && $(this).parent().addClass("button-b button--default").text(btn_names[10]),
t.indexOf("delete.gif") > -1 && $(this).parent().addClass("button-b button--default").text(btn_names[11]),
t.indexOf("reply.gif") > -1 && $(this).parent().addClass("button-b button--default").text(btn_names[12]),
t.indexOf("write.gif") > -1 && $(this).parent().addClass("button-b button--dark size--3").text(btn_names[13]),
t.indexOf("btn_confirm.gif") > -1 && $(this).parent().addClass("button-b button--primary").text(btn_names[14]),
t.indexOf("cancel.gif") > -1 && $(this).parent().addClass("button-b button--default button--lg").text(btn_names[15]),
t.indexOf("download.gif") > -1 && $(this).parent().addClass("button-download").text(btn_names[16]);
}),
(function t() {
if (!$(".board-gallery").length) return !1;
let e = [],
a = [],
i = [],
n = [],
r = "",
l = $(".board-gallery .gallery-list").data("column") ? $(".board-gallery .gallery-list").data("column") : 3,
s = "";
switch (l) {
case 1:
s = "col-xl-12";
break;
case 2:
s = "col-xl-6";
break;
case 3:
default:
s = "col-xl-4";
break;
case 4:
s = "col-xl-3";
break;
case 5:
s = "col-xl-2-5";
break;
case 6:
s = "col-xl-2";
}
if ($(".board-gallery").hasClass("type-a")) {
$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function () {
let t = $(this).find(".bbsnewf5"),
r = t.find(".gallery_etc").text().split(":")[1];
e.push(t.find("img").attr("src")), a.push(t.find(".gallery_subject>a").attr("href")), i.push(t.find(".gallery_title").text()), n.push(void 0 == r ? "" : '' + r.replace("]", "") + " ");
}),
(r = '
');
for (let c = 0; c < e.length; c++)
r += `
`;
(r += "
"), $(".board-gallery .article-wrapper").empty().append(r);
} else if ($(".board-gallery").hasClass("type-b")) {
$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function () {
let t = $(this).find(".bbsnewf5"),
r = t.find(".gallery_etc").text().split(":")[1];
e.push(t.find("img").attr("src")), a.push(t.find(".gallery_subject>a").attr("href")), i.push(t.find(".gallery_title").text()), n.push(void 0 == r ? "" : '' + r.replace("]", "") + " ");
}),
(r = '');
for (let o = 0; o < e.length; o++)
r += `
`;
(r += "
"), $(".board-gallery .article-wrapper").empty().append(r);
}
})(),
(function t() {
if (!$(".faq-list .table-article-list .titdesign").length) return !1;
let e = `
`;
$(".faq-list .table-article-list .bbsnewf5 > a").on("click", (t) => {
if (!$('input[name="delete_check_notice[]"]').length) {
t.preventDefault();
let a = $(t.currentTarget),
i = a.attr("href"),
n = "";
$.ajax({
url: i,
method: "GET",
contentType: "application/x-www-form-urlencoded;charset=euc-kr",
dataType: "html",
async: !1,
success: function (t) {
(n = `
${$(t).find("#post_area").html()}
`),
a.closest(".titdesign").hasClass("article--open")
? (a.parent().siblings(".reply-content").remove(), a.closest(".titdesign").removeClass("article--open"))
: ($(".titdesign").removeClass("article--open"), $(".reply-content").remove(), a.parent().after(n), a.closest(".titdesign").addClass("article--open"));
},
error: function (t) {
alert("오류가 발생하였습니다.");
},
beforeSend: function (t) {
t.overrideMimeType("application/x-www-form-urlencoded;charset=euc-kr"), $("body").prepend(e);
},
complete: function () {
$("#ajax-loader").remove();
},
});
}
});
})(),
(function t() {
if (!$(".board-event").length) return !1;
let e = [],
a = [],
i = [],
n = [],
l = "";
$(".board-event .article-wrapper > .event-article-list > tbody > tr").each(function () {
let t = $(this).find(".bbsnewf5");
let ev_date = t.find(".gallery_etc").text().trim();
let span_s = ev_date.length == 0 ? '' : ev_date.split(":")[1].replace(",", "").replace("이벤트 종료일", "");
let span_e = ev_date.length == 0 ? '' : ev_date.split(":")[2].replace("]", "");
e.push(t.find("img").attr("src")),
a.push(t.find(".gallery_subject>a").attr("href")),
i.push(t.find(".gallery_title").text()),
n.push(ev_date.length == 0 ? '' : ''+span_s+' ~ '+span_e+' ');
}),
(l = '');
for (let s = 0; s < e.length; s++)
l += `
${n[s]}
${i[s]}
`;
(l += "
"), $(".board-event .article-wrapper").empty().append(l);
})(),
(function bloglist_modify() {
if (!$(".board-blog").length) return !1;
let no = [],
title = [],
write_date = [],
category = [],
desc = [],
src = [],
link = [],
html = "";
$(".board-blog .article-wrapper > .blog-article-list .webzine_type2 > tbody > tr").each(function () {
let txt_td = $(this).find(".webzine_type_text_td_left");
if (txt_td.length == 0) { return; }
let img_td = $(this).find(".webzine_type_img_td");
no.push(txt_td.find(".webzine_no .obj_value").text().trim());
title.push(txt_td.find(".webzine_subject .news_title").text().trim());
write_date.push(txt_td.find(".webzine_dateof_write .obj_value").text());
category.push(txt_td.find(".webzine_category .obj_value").text().trim());
desc.push(txt_td.find(".webzine_description .obj_value").text().trim());
src.push(img_td.find("img").attr("src"));
link.push(img_td.find("a").attr("href"));
}),
(html = '');
for (let j = 0; j < src.length; j++)
html += `
NO. ${no[j]}
#${category[j]}
${write_date[j]}
${desc[j]}
`;
(html += "
"),
$(".board-blog .article-wrapper").empty().append(html);
})(),
(function blog_modify() {
if (!$(".board-blog #post_area").length) return !1;
let trs = $(".board-blog .table-article-common tr");
let html = '';
let postTag;
trs.each(function(i){
let label, desc;
if ($(this).find("#post_area").length > 0) {
postTag = $(this).find("#post_area");
}
if (i==0) {
desc = $(this).find(".board_desc").text().trim();
html += `
${desc}
`;
} else {
label = $(this).find(".board_bgcolor").text().trim();
desc = $(this).find(".board_desc").text().trim();
if (label.length == 0) {return;}
html += `
${label} ${desc}
`;
}
});
html += '
';
$(".board-blog .table-article-common").replaceWith(html);
$(".board-blog").find(".post-body").html(postTag);
let thumbnails = $(".board-view-thumbnails").find("a");
let html2 = `Previous posts `;
thumbnails.each(function(){
let href = $(this).attr("href");
let src = $(this).find("img").attr("src");
html2 += `
`;
});
html2 += '
';
$(".board-blog").find(".post-body").append(html2);
$(".board-view-thumbnails").remove();
let html3 = ``;
let move_btns = $(".board-blog .move-page");
move_btns.each(function(){
let text = $(this).text().trim();
let direction = text == "이전" ? "prev" : "next";
let icon = text == "이전" ? '
이전글 ' : '
다음글 ';
let link = $(this).attr("href");
html3 += `
${icon} `;
});
html3 += `
`;
move_btns.remove();
$(".board-blog").find(".post-wrap").append(html3);
$(".board-blog").find(".move-btn").on("mouseover", function(){
$(this).addClass('on');
});
$(".board-blog").find(".move-btn").on("mouseout", function(){
$(this).removeClass('on');
});
})(),
(function blogwrite_modify() {
if ($(".board-blog #post_area").length) return !1;
let target = $(".board-blog .table-article-common tr input[name='com_board_notice']");
if (target.length > 0 ) {
target.closest("tr").remove();
}
})();
});