/********************************************************************************************************* ## Main Script ## * º» ½ºÅ©¸³Æ®ÀÇ ÀúÀÛ±ÇÀº (ÁÖ)À¥½º¸®ÆÛºí¸¯¿¡ ÀÖ½À´Ï´Ù. * º» ½ºÅ©¸³Æ®¸¦ ¹«´ÜÀ¸·Î ÀÌ¿ë(¶Ç´Â µµ¿ë)Çϰųª º¹Á¦ ¶Ç´Â ¼öÁ¤ »ç¿ë½Ã ÀúÀ۱ǹý¿¡ ÀǰŠó¹ú¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù. * ±¸¸Å ÈÄ¿¡µµ Á¦ 2Â÷ »çÀÌÆ® µî ¶óÀ̼±½º°¡ Àû¿ëµÇÁö ¾Ê´Â »çÀÌÆ®¿¡ ´ëÇÏ¿© »ç¿ëÀº ±ÝÁöµÇ¾î ÀÖ½À´Ï´Ù. * À§ »çÇ׿¡ ´ëÇÏ¿© À§¹Ý½Ã Àý´ë ÇÕÀÇ´Â ¾ø½À´Ï´Ù ! * date : 2017-03-15 * author : Park Soo Hyun (shpark7502@naver.com) *********************************************************************************************************/ // ¸ÞÀÎ Æ÷½ºÆà ·Ñ¸µ $(function() { var $postElem = $(".postSlider"), $twElem = [], $iwElem = [], $postIndex = [], $postCount = [], $twSize = [], $iwSize = []; $postElem.each(function(i) { $twElem[i] = $(this).find('.textWrapper ul'); $iwElem[i] = $(this).find('.imgWrapper ul'); $postIndex[i] = 0; $postCount[i] = $twElem[i].children().length; i++; }); // ½½¶óÀÌ´õ ÃʱâÈ­ function postSliderInit() { for(i=0; i<$postElem.length; i++) { $twSize[i] = $twElem[i].parent().width(); $iwSize[i] = $iwElem[i].parent().width(); $twElem[i].children().css('width', $twSize[i] + 'px'); $twElem[i].css({'width':$twSize[i] * $postCount[i] + 'px', 'transform':'matrix(1,0,0,1,' + (-$twSize[i] * $postIndex[i]) + ',0)'}); $iwElem[i].children().css('width', $iwSize[i] + 'px'); $iwElem[i].css({'width':$iwSize[i] * $postCount[i] + 'px', 'transform':'matrix(1,0,0,1,' + (-$iwSize[i] * $postIndex[i]) + ',0)'}); } } // Æ÷½ºÆ® ½½¶óÀ̵å ÇÔ¼ö function postSliding(idx, easing) { if($postIndex[idx] < 0) { $postIndex[idx] = $postCount[idx] - 1; } else if($postIndex[idx] >= $postCount[idx]) { $postIndex[idx] = 0; } $twElem[idx].parents('.postSlider').find('.thumbList').children().removeClass('on'); $twElem[idx].parents('.postSlider').find('.thumbList').children().eq($postIndex[idx]).addClass('on'); if(!easing || easing == true) { TweenMax.to($iwElem[idx], 0.5, {x:-($iwSize[idx] * $postIndex[idx]), ease:Expo.easeInOut}); TweenMax.to($twElem[idx], 0.7, {x:-($twSize[idx] * $postIndex[idx]), ease:Expo.easeInOut}); } else if(easing == false) { TweenMax.to($iwElem[idx], 0.5, {x:-($iwSize[idx] * $postIndex[idx])}); TweenMax.to($twElem[idx], 0.7, {x:-($twSize[idx] * $postIndex[idx])}); } } // Æ÷½ºÆ® ½½¶óÀÌ´õ ½æ³×ÀÏ »ý¼º function postThumbInit() { var $thumbTag = [], $thumbImg = []; for(i=0; i<$postElem.length; i++) { for(n=0; n<$postCount[i]; n++) { $thumbImg[n] = $iwElem[i].children().eq(n).find('img').attr('src'); $thumbTag[n] = '
  • '; $postElem.eq(i).find('.thumbList').append($thumbTag[n]); } $postElem.eq(i).find('.thumbList').children().eq(0).addClass('on'); } } // »ó´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ½æ³×ÀÏ Å¬¸¯ $(document).on('click', '#postSliderType1 .thumbList > li', function() { var $tIndex = $(this).index(); $postIndex[0] = $tIndex; postSliding(0); }); // »ó´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ÀÌÀü $(".section1 .prev").click(function() { $postIndex[0]--; postSliding(0); }); // »ó´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ´ÙÀ½ $(".section1 .next").click(function() { $postIndex[0]++; postSliding(0); }); // ÇÏ´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ½æ³×ÀÏ Å¬¸¯ $(document).on('click', '#postSliderType2 .thumbList > li', function() { var $tIndex = $(this).index(); $postIndex[1] = $tIndex; postSliding(1); }); // ÇÏ´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ÀÌÀü $(".section3 .prev").click(function() { $postIndex[1]--; postSliding(1); }); // ÇÏ´Ü Æ÷½ºÆ® ½½¶óÀÌ´õ ´ÙÀ½ $(".section3 .next").click(function() { $postIndex[1]++; postSliding(1); }); postSliderInit(); postThumbInit(); // À©µµ¿ì »çÀÌÁî Á¶Àý½Ã Æ÷½ºÆ® ½½¶óÀÌ´õ »çÀÌÁî, À§Ä¡ ¸ÂÃã $(window).bind('resize', function() { postSliderInit(); }); }); // ¸ÞÀÎ ·Ñ¸µÀ̹ÌÁö $(function() { var $vIndex = 0; var $vElem = $("#mainSlider > .imgList"); var $vCount = $("#mainSlider > .imgList > li").length; var $vDuration = 3500; // ÀÚµ¿·Ñ¸µ ÁÖ±â (´ÜÀ§ : ms) var $vTimer; var swipeOptions = { // ÅÍÄ¡ ½º¿ÍÀÌÇÁ ¿É¼Ç triggerOnTouchEnd: true, swipeStatus: swipeStatus, allowPageScroll: "vertical", threshold: 0 }; $vElem.swipe(swipeOptions); // ÅÍÄ¡½º¿ÍÀÌÇÁ Ãß°¡ // ÅÍÄ¡½º¿ÍÀÌÇÁ À̺¥Æ® ÁöÁ¤ function swipeStatus(event, phase, direction, distance) { $vSize = $vElem.children().width(); if (phase == "move" && (direction == "left" || direction == "right")) { var duration = 0; if (direction == "left") { clearInterval($vTimer); TweenMax.to($vElem, duration, {x:-($vIndex * $vSize) - distance + 'px'}); } else if (direction == "right") { clearInterval($vTimer); TweenMax.to($vElem, duration, {x:-($vIndex * $vSize) + distance + 'px'}); } } else if (phase == "cancel") { visualSlide(); } else if (phase == "end") { if (direction == "right") { if($vIndex===0) { resetTimer(); $vIndex = 0; visualSlide(); return false; } resetTimer(); $vIndex--; visualSlide(); } else if (direction == "left") { if($vIndex===$vCount-1) { $vIndex = $vCount-1; resetTimer(); visualSlide(); return false; } resetTimer(); $vIndex++; visualSlide(); } } } // ¸ÞÀÎ ºñÁÖ¾ó »çÀÌÁî ¼¼Æà function visualInit() { var $winWidth = $(window).width(); var $vItem = $vElem.children(); var $initOpt = { 'transform':'matrix(1,0,0,1,' + (-$vIndex * $winWidth) + ', 0)', 'width':$winWidth * $vCount } $vElem.css($initOpt); $vItem.css({'width':$winWidth + 'px'}); } // ÆäÀÌÁö³×ÀÌ¼Ç ÃʱâÈ­ function pagingInit() { var $item = "
  • "; for(i=0; i<$vCount; i++) { $("#mainSlider > .pagination").append($item); } $("#mainSlider > .pagination > li:first").addClass('on'); } // ÆäÀÌÁö³×ÀÌ¼Ç Å¬¸¯ $(document).on('click', '#mainSlider > .pagination > li', function() { if(!TweenMax.isTweening($vElem)) { var $pIndex = $(this).index(); resetTimer(); $vIndex = $pIndex; visualSlide(); } }); // ¸ÞÀÎ ºñÁÖ¾ó ·Ñ¸µ ó¸® function visualSlide() { var $winWidth = $(window).width(); if($vIndex >= $vCount) $vIndex = 0; TweenMax.to($vElem, 0.8, {x:-$vIndex * $winWidth + 'px', ease:Expo.easeOut, delay:0}); $("#mainSlider > .pagination > li").removeClass('on'); $("#mainSlider > .pagination > li").eq($vIndex).addClass('on'); } // ŸÀÌ¸Ó ¼¼Æà $vTimer = setInterval(function() { $vIndex++; visualSlide(); }, $vDuration); // ŸÀÌ¸Ó ¸®¼Â function resetTimer() { $vElem.stop(); clearInterval($vTimer); $vTimer = setInterval(function() { $vIndex++; visualSlide(); }, $vDuration); } visualInit(); pagingInit(); // À©µµ¿ì ¸®»çÀÌ¡ ó¸® $(window).bind('resize', function() { visualInit(); }); }); // Æ÷Åä°¶·¯¸® ÃßÃâ Ä¿½ºÅ͸¶ÀÌ¡ $(function() { var tmpno = $(location).attr('pathname').split('/')[1]; var dir = $(".section2 .listWrapper").data('dir'); var page = $(".section2 .listWrapper").data('page'); var elem; var photoAll = $(".section2 .listWrapper .tableArea").html(); var subject = new Array(); // °¶·¯¸® ½æ³×ÀÏ Á¦¸ñ ¹è¿­º¯¼ö ¼±¾ð var content = new Array(); // °¶·¯¸® ½æ³×ÀÏ ³»¿ë ¹è¿­º¯¼ö ¼±¾ð var url = new Array(); // °¢ ½æ³×ÀϺ° ¸µÅ© ÀúÀå¿ë º¯¼ö var thumbCount; // ½æ³×ÀÏ °³¼ö (ÃßÃâ°³¼ö) var refHeight; // ³ôÀÌ µ¿±âÈ­¸¦ À§ÇÑ º¯¼ö // Æ÷Åä°¶·¯¸® Ä«Å×°í¸® °¡Á®¿À±â function getCategory() { if($(".section2 .tableArea > table").length > 0) { $("#cate-load").attr('src', '/' + tmpno + '/' + dir + '/' + page + '.php'); $("#cate-load").load(function() { var title = [], cate_no = [], cateHTML; $(".section2 .category").remove(); cateHTML = ''; $(".section2 .dropdown").append(cateHTML); $(".section2 .dropdown .category > li:first").addClass('on'); $("#cate-load").remove(); }); /* $("#cate-load").load('/' + tmpno + '/' + dir + '/' + page + '.php' + ' .brd_category select', function() { var title = [], cate_no = [], cateHTML; $(".section2 .category").remove(); cateHTML = ''; $(".section2 .dropdown").append(cateHTML); $(".section2 .dropdown .category > li:first").addClass('on'); }); */ /* $.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; $(".section2 .category").remove(); cateHTML = ''; $(".section2 .dropdown").append(cateHTML); $(".section2 .dropdown .category > li:first").addClass('on'); }, 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('.brd_photo_list').html(); $(".section2 .listWrapper .tableArea").html(temp); // $(".section2 .listWrapper .tableArea > table").each(function() { // if($(this).index() > maxCount -1) $(this).remove(); // }); galleryAlign(); elem = $(".section2 .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', '.section2 .category > li' ,function() { var $cate = $(this).find('a').data('cate'); var $activeText = $(this).find('a').text(); // var maxCount = 4; // Ä«Å×°í¸®º°·Î °¡Á®¿Ã ÃÖ´ë Æ÷½ºÆà °³¼ö $(".section2 .category > li").removeClass('on'); $(this).addClass('on'); if(!$cate) { $(".section2 .listWrapper .tableArea").css('opacity','0'); $(".section2 .listWrapper .tableArea").html(photoAll); // $(".section2 .listWrapper .tableArea > table").each(function() { // if($(this).index() > maxCount) $(this).remove(); // }); $(".section2 .listWrapper .tableArea").animate({'opacity':'1'}, 400, function() { $(".section2 .listWrapper .tableArea").css({'opacity':''}); }); galleryInit(); } else { getPhotoPost($cate); } $(".section2 .dropdown > a").text($activeText); }); // ÃÖ±Ù °¶·¯¸® µå·Ó´Ù¿î À̺¥Æ® $(".section2 .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 = $(".section2 .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] = $(".section2 .listWrapper .tableArea > table").eq(i).find('.board_output_gallery_subject a').text(); content[i] = $(".section2 .listWrapper .tableArea > table").eq(i).find('.board_output_gallery_etc').text(); // ½æ³×ÀÏ ÀÖ´Â td ³»ºÎ¿¡ hover È¿°ú¸¦ ÁÖ±â À§ÇÑ ¹Ú½º ÅÂ±× »ý¼º (°¢°¢ ½æ³×ÀÏ ³»¿¡ ¹Ýº¹¹®À¸·Î »ðÀÔ) $(".section2 .listWrapper .tableArea > table").eq(i).find('td:first').append('

    ' + subject[i] + '

    ' + $.trim(content[i]) + '

    '); $(".section2 .listWrapper .tableArea > table").eq(i).find('tr').eq(1).css('display','none'); } } } // Ä«Å×°í¸® Ŭ¸¯ ÈÄ ±¸Á¶ ÀçÁ¤·Ä function galleryAlign() { if($(".bbsnewf5").length > 0) { thumbCount = $(".section2 .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($(".section2 .listWrapper").length > 0) { $(".section2 .listWrapper .tableArea > table").each(function() { $(this).addClass('scrollreveal'); }); } } galleryInit(); $(".section2 .listWrapper .tableArea > table").addClass('scrollreveal'); }); // °øÁö»çÇ× ÃßÃâ ±¸Á¶ º¯°æ $(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 cnt = 0; $(".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); });