/*********************************************************************************************************
## Main Script ##
* º» ½ºÅ©¸³Æ®ÀÇ ÀúÀÛ±ÇÀº (ÁÖ)À¥½º¸®ÆÛºí¸¯¿¡ ÀÖ½À´Ï´Ù.
* º» ½ºÅ©¸³Æ®¸¦ ¹«´ÜÀ¸·Î ÀÌ¿ë(¶Ç´Â µµ¿ë)Çϰųª º¹Á¦ ¶Ç´Â ¼öÁ¤ »ç¿ë½Ã ÀúÀ۱ǹý¿¡ ÀǰŠó¹ú¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù.
* ±¸¸Å ÈÄ¿¡µµ Á¦ 2Â÷ »çÀÌÆ® µî ¶óÀ̼±½º°¡ Àû¿ëµÇÁö ¾Ê´Â »çÀÌÆ®¿¡ ´ëÇÏ¿© »ç¿ëÀº ±ÝÁöµÇ¾î ÀÖ½À´Ï´Ù.
* À§ »çÇ׿¡ ´ëÇÏ¿© À§¹Ý½Ã Àý´ë ÇÕÀÇ´Â ¾ø½À´Ï´Ù !
* date : 2017-03-15
* author : Park Soo Hyun (shpark7502@naver.com)
*********************************************************************************************************/
$(function() {
var tmpno = $(location).attr('pathname').split('/')[1];
var dir = $(".section5 .listWrapper").data('dir');
var page = $(".section5 .listWrapper").data('page');
var elem;
var subject = new Array(); // °¶·¯¸® ½æ³×ÀÏ Á¦¸ñ ¹è¿º¯¼ö ¼±¾ð
var content = new Array(); // °¶·¯¸® ½æ³×ÀÏ ³»¿ë ¹è¿º¯¼ö ¼±¾ð
var url = new Array(); // °¢ ½æ³×ÀϺ° ¸µÅ© ÀúÀå¿ë º¯¼ö
var thumbCount; // ½æ³×ÀÏ °³¼ö (ÃßÃâ°³¼ö)
var refHeight; // ³ôÀÌ µ¿±âȸ¦ À§ÇÑ º¯¼ö
// Æ÷Åä°¶·¯¸® Ä«Å×°í¸® °¡Á®¿À±â
function getCategory() {
if($(".section5 .tableArea > table").length > 0) {
$.ajax({
type: 'GET',
url: '/' + tmpno + '/' + dir + '/' + page + '.php',
contentType: 'application/x-www-form-urlencoded;charset=euc-kr',
beforeSend: function(x) {
x.overrideMimeType('application/x-www-form-urlencoded;charset=euc-kr');
},
success: function(data) {
var title = [],
cate_no = [],
cateHTML;
var moreURL = "/" + tmpno + "/" + dir + "/" + page + ".php";
$(".section5 .category").remove();
cateHTML = '
';
$(data).find('.cate_select option').each(function(i) {
title[i] = $(this).text();
cate_no[i] = $(this).val();
cateHTML += '- ' + title[i] + '
';
i++;
});
cateHTML += '
';
$(".section5 .dropdown").append(cateHTML);
$(".section5 .dropdown .category > li:first").addClass('on');
$(".section5 .btn-more > a").attr('href', moreURL);
},
error:function(xhr,status,error) {
console.log(error);
}
});
}
}
getCategory();
// Ä«Å×°í¸®º° Æ÷½ºÆà ÃßÃâ ÇÔ¼ö
function getPhotoPost(cate) {
var loadURL;
var maxCount = 4; // Ä«Å×°í¸®º°·Î °¡Á®¿Ã ÃÖ´ë Æ÷½ºÆà °³¼ö
if(cate === null) {
loadURL = '/' + tmpno + '/' + dir + '/' + page + '.php';
} else {
loadURL = '/' + tmpno + '/' + dir + '/' + page + '.php?com_board_category_code=' + cate;
}
$.ajax({
type: 'GET',
url: loadURL,
contentType: 'application/x-www-form-urlencoded;charset=euc-kr',
beforeSend: function(x) {
x.overrideMimeType('application/x-www-form-urlencoded;charset=euc-kr');
},
success: function(data) {
var temp = $(data).find('.gallery_inner').html();
$(".section5 .listWrapper .tableArea").html(temp);
$(".section5 .listWrapper .tableArea > table").each(function() {
if($(this).index() > maxCount -1) $(this).remove();
});
galleryAlign();
elem = $(".section5 .listWrapper .tableArea > table");
elem.css('opacity','0');
elem.animate({'opacity':'1'}, 400, function() {
elem.css({'opacity':''});
});
},
error:function(xhr,status,error) {
console.log(error);
}
})
}
// Ä«Å×°í¸®º° Æ÷½ºÆà ÃßÃâ
$(document).on('click', '.section5 .category > li' ,function() {
var $cate = $(this).find('a').data('cate');
var $activeText = $(this).find('a').text();
$(".section5 .category > li").removeClass('on');
$(this).addClass('on');
getPhotoPost($cate);
$(".section5 .dropdown > a").text($activeText);
});
// ÃÖ±Ù °¶·¯¸® µå·Ó´Ù¿î À̺¥Æ®
$(".section5 .dropdown").click(function() {
if(!$(this).hasClass('open')) {
$(this).addClass('open');
$(this).find('.category').css('display','block');
} else {
$(this).removeClass('open');
$(this).find('.category').css('display','none');
}
});
// °¶·¯¸® Ãʱ⼼ÆÃ
function galleryInit() {
elem = $(".section5 .listWrapper .tableArea > table");
if(elem.length > 0) {
thumbCount = elem.length;
if($(".hoverBox").length > 0) {
$(".hoverBox").parent('a').remove();
}
for(i=0; i table").eq(i).find('.board_output_gallery_subject a').attr('href');
subject[i] = $(".section5 .listWrapper .tableArea > table").eq(i).find('.board_output_gallery_subject a').text();
content[i] = $(".section5 .listWrapper .tableArea > table").eq(i).find('.board_output_gallery_etc').text();
// ½æ³×ÀÏ ÀÖ´Â td ³»ºÎ¿¡ hover È¿°ú¸¦ ÁÖ±â À§ÇÑ ¹Ú½º ÅÂ±× »ý¼º (°¢°¢ ½æ³×ÀÏ ³»¿¡ ¹Ýº¹¹®À¸·Î »ðÀÔ)
$(".section5 .listWrapper .tableArea > table").eq(i).find('td:first').append('' + subject[i] + '
' + $.trim(content[i]) + '
');
$(".section5 .listWrapper .tableArea > table").eq(i).find('tr').eq(1).css('display','none');
}
}
}
// Ä«Å×°í¸® Ŭ¸¯ ÈÄ ±¸Á¶ ÀçÁ¤·Ä
function galleryAlign() {
if($(".bbsnewf5").length > 0) {
thumbCount = $(".section5 .listWrapper .tableArea .bbsnewf5").length;
if($(".hoverBox").length > 0) {
$(".hoverBox").parent('a').remove();
}
for(i=0; i' + subject[i] + '
' + $.trim(content[i]) + '
');
}
// ±âÁ¸¿¡ º¸¿©Áö´Â º°µµ td ÀÇ Á¦¸ñ, ³»¿ëÀº ¼û±è
$(".gallery_subject, .gallery_etc").css('display','none');
}
}
// Å×ÀÌºí ¾Ö´Ï¸ÞÀ̼Ç
function tableShow() {
if($(".section5 .listWrapper").length > 0) {
$(".section5 .listWrapper .tableArea > table").each(function() {
$(this).addClass('');
});
}
}
galleryInit();
$(".section5 .listWrapper .tableArea > table").addClass('');
});
// °øÁö»çÇ× ÃßÃâ ±¸Á¶ º¯°æ
$(function() {
var tmpno = $(location).attr('pathname').split('/')[1];
var $subject = [],
$link = [],
$date = [],
$img = [],
$content = [];
var $innerHTML = "";
var $wrapper = $(".section4 .postWrapper");
var dir = $(".section4 .postWrapper").data('dir');
var page = $(".section4 .postWrapper").data('page');
var moreURL = "/" + tmpno + "/" + dir + "/" + page + ".php";
var cnt = 0;
$(".section4 .btn-more > a").attr('href', moreURL);
$(".section4 tr[class^=board_output_]").each(function() {
$subject[cnt] = $(this).find('a:first').text();
$link[cnt] = $(this).find('a').attr('href');
$date[cnt] = $(this).find('td[align=center]').text();
$content[cnt] = $(this).children().eq(-2).find('a').text();
$img[cnt] = $(this).find('.board_output_imgs').attr('src');
cnt++;
});
$wrapper.html('');
$innerHTML = '';
$wrapper.append($innerHTML);
});
// Çì´õ ¹× GNB °ü·Ã °øÅë ½ºÅ©¸³Æ®
$(function() {
var $gnbTrigger = $("#gnbTrigger");
// ¸ð¹ÙÀϸ޴º Åä±Û¹öÆ° Ŭ¸¯
$gnbTrigger.mouseenter(function() {
if(!$(this).hasClass('open')) {
$(this).addClass('open');
$("body").addClass('lock');
}
});
$gnbTrigger.mouseleave(function() {
$(this).removeClass('open');
$("body").removeClass('lock');
});
});
// Æû¸ÞÀÏ placehold Ãß°¡
$(function() {
if($(".tbl_formmail").length > 0) {
var $form = $(".tbl_formmail");
$form.find('input[name=name]').attr('placeholder','Name');
$form.find('input[name=receiver_email]').attr('placeholder','Email');
$form.find('textarea[name=description]').attr('placeholder','Message');
}
});
// Á¦Ç°¼Ò°³(Æ÷Åä°¶·¯¸®) À̹ÌÁö ¸µÅ© Á¦°Å
$(function() {
if($(".board_output_gallery_img a > div").length > 0) {
var img = $(".board_output_gallery_img a > div");
img.parent('a').removeAttr('href');
}
});