/* * Name : board.min.js * Version : 3.0.0 * Product : prime series (board pro EN) * Author : 1px studio * Date : 2024-08-22 * Desc : 게시판 Pro 버전 영문 게시판 스크립트 * ------------------------------------------------ */ $(function(){if(null!=document.getElementById("isIndex"))return;let e="en"==$("html").attr("lang")&&"1px"==$("html").data("tpl");function t(t){if(!e)return!1;if(RegExp(/^\d{4}[\.\-년](0[1-9]|1[012])[\.\-월](0[1-9]|[12][0-9]|3[01])[일]?$/).test(t)){var a;let n;return a=(a=t).substr(0,4)+"-"+a.substr(5,2)+"-"+a.substr(8,2),["January","February","March","April","May","June","July","August","September","October","November","December"][(n=new Date(a)).getMonth()]+" "+n.getDate()+", "+n.getFullYear()}return!1}function a(t,a){let n=1,i="contact-form"==a[0].className;if($("#privacy_terms_context").length){let l=$(".formmail_cell_bgcolor textarea[readonly]").val(),s=$("#privacy_terms_context");s.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(console.log(c),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 b=$(l).children();$(l).html(b);a.find(".file-upload .upload-hidden").on("change",function(){let e=$(this)[0].files[0].name;$(this).siblings(".upload-name").val(e)})}})}function n(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(''),t(),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[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;a(t.find(".board_desc"),t)}(),function e(){if(!$(".board-gallery").length)return!1;let t=$(".board-gallery .gallery-list").data("column")?$(".board-gallery .gallery-list").data("column"):3,a="";switch(t){case 1:a="col-xl-12";break;case 2:a="col-xl-6";break;case 3:default:a="col-xl-4";break;case 4:a="col-xl-3";break;case 5:a="col-xl-2-5";break;case 6:a="col-xl-2"}let i="",l="",s="",r="",o="",c="";$(".board-gallery").hasClass("type-a")?(c='
',$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function(){let e=$(this).find(".bbsnewf5"),t=n(e,1);if(t.length>0){let d='';t.forEach(function(e,t){d+=`${e.name}${e.text}`}),d+="",o=d}i=e.find("img").attr("src"),l=e.find(".gallery_subject>a").attr("href"),s=e.find(".gallery_title").text();let p=e.find(".gallery_cont");c+=`
${s}
${o}
${s}
${r=p.length?'

'+p.text()+"

":""}
`}),c+="
",$(".board-gallery .article-wrapper").empty().append(c)):$(".board-gallery").hasClass("type-b")&&(c='
',$(".board-gallery .article-wrapper > .photo-article-list > tbody > tr").each(function(){let e=$(this).find(".bbsnewf5"),t=n(e,1);if(t.length>0){let d='';t.forEach(function(e,t){d+=`${e.name}${e.text}`}),d+="",o=d}i=e.find("img").attr("src"),l=e.find(".gallery_subject>a").attr("href"),s=e.find(".gallery_title").text();let p=e.find(".gallery_cont");c+=`
${s}
${o}
${s}
${r=p.length?'

'+p.text()+"

":""}
`}),c+="
",$(".board-gallery .article-wrapper").empty().append(c))}(),function t(){if(!$(".faq-list .table-article-list .titdesign").length)return!1;let a=`
`;$(".faq-list .table-article-list .bbsnewf5 > a").on("click",t=>{if(!$('input[name="delete_check_notice[]"]').length){t.preventDefault();let n=$(t.currentTarget),i=n.attr("href"),l="";$.ajax({url:i,method:"GET",contentType:"application/x-www-form-urlencoded;charset=euc-kr",dataType:"html",async:!1,success:function(e){l=` ${$(e).find("#post_area").html()} `,n.closest(".titdesign").hasClass("article--open")?(n.parent().siblings(".reply-content").remove(),n.closest(".titdesign").removeClass("article--open")):($(".titdesign").removeClass("article--open"),$(".reply-content").remove(),n.parent().after(l),n.closest(".titdesign").addClass("article--open"))},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 i='
';$(".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=n(a),b=f.dateList,h=f.etcList;if(b.length>0){let u='';b.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(h.length>0){let m='';h.forEach(function(e,t){m+=`${e.name}${e.text}`}),m+="",p=m}i+=`
${r}
${p} ${d}

${r}

${o}
`}),i+="
",$(".board-event .article-wrapper").empty().append(i)}(),function e(){if(!$(".board-blog").length)return!1;let a,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();a=f.length?'NO. '+f+"":"",e.find(".webzine_no").remove(),n=e.find(".webzine_subject .obj_value").text().trim(),e.find(".webzine_subject").remove();let b=e.find(".webzine_dateof_write .obj_value").text().trim();i=(b=t(b)).length?''+b+"":"",e.find(".webzine_dateof_write").remove();let h=e.find(".webzine_category .obj_value").text().trim();l=h.length?'#'+h+"":"",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='
';m.each(function(e){g+=`${$(this).find(".obj_name").text()}${$(this).find(".obj_value").text().trim()}`}),g+="
",c=g}d+=`
${a} ${l} ${i}

${n}

${s} ${c}
`}),d+="
",$(".board-blog .article-wrapper").empty().append(d)}(),function a(){if(!$(".board-blog #post_area").length)return!1;let n=$(".board-blog .table-article-common tr"),i='
',l='
',s=!1,r,o=!0;$(".table-article-common .board_desc").each(function(e,a){let n=t(a.innerText.trim());n&&(a.innerText=n)}),n.each(function(e){let t,a;if($(this).find("#post_area").length>0&&(r=$(this).find("#post_area"),o=!1),0==e)i+=`

${a=$(this).find(".board_desc").text().trim()}

`;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;p+=`
`}),p+="
",$(".board-blog").find(".post-body").append(p),$(".board-view-thumbnails").remove();let f='
',b=$(".board-blog .move-page");b.each(function(){let t=$(this).text().trim(),a;a=e?"Prev"==t?'Prev':'Next':"이전"==t?'이전글':'다음글';f+=`${a}`}),f+="
",b.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;a($(".contact-form .table-form > tbody > tr .formmail_cell_bgcolor"),t)}(),function a(){if(!e||!$(".table-article-common").length||$(".board-blog").length)return!1;$(".table-article-common tr td").each((e,a)=>{let n=t(a.innerText.replaceAll(" ",""));n&&(a.innerText=n)})}()});