"use strict";
var lastScroll = 0;
//check for browser os
var isMobile = false;
var isiPhoneiPad = false;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
isMobile = true;
}
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
isiPhoneiPad = true;
}
$(window).on('scroll', function () {
if ($(this).scrollTop() > 120) {
$('#header').addClass("sticky")
} else {
$('#header').removeClass("sticky")
}
});
$(document).on('click', '.inner-link', function (e) {
e.preventDefault();
var gnb_height = $("#header").data("height") ? $("#header").data("height") : $("#header").height();
var _this = $(this);
setTimeout(function () {
var target = _this.attr("href");
if ($(target).length > 0) {
$('html, body').stop()
.animate({
'scrollTop': $(target).offset().top - gnb_height - 0
}, 800); // 원하는 경우 지연 시간을 여기에 밀리초 단위로 지정할 수 있습니다.
}
}, 0); // 밀리초 단위의 지연 시간을 여기에 지정하세요.
});
$(document).ready(function () {
"use strict";
$('.mobile-btn').on('click', function () {
$(this).toggleClass('active');
$('header').toggleClass('active');
return false;
});
// $('#main-body .main-menu ul').onePageNav({
// currentClass: 'active',
// scrollSpeed: 500
// });
/* ===================================
video-player
====================================== */
// var video = document.querySelectorAll(".video");
// var playButton = document.querySelectorAll(".playButton");
var playButton = $(".playButton");
playButton.click(function () {
var video = $(this).parent().find("video")[0];
if (video.paused) {
video.play();
$(this).hide();
} else {
video.pause();
$(this).show();
}
});
$('.video-container video').on('ended', function () {
$(this).siblings(".playButton").show();
});
$('.video-container video').click(function () {
var video = $(this)[0];
if (!video.paused) {
video.pause();
$(this).siblings(".playButton").show();
}
});
/* ===================================
swiper slider
====================================== */
var normal = new Swiper('.normal-slider', {
allowTouchMove: true,
slidesPerView: 1,
loop: true,
paginationClickable: true,
preventClicks: true,
autoplay: {
delay: 3000,
disableOnInteraction: true
},
on: {
resize: function () {
normal.update();
}
}
});
var fadeSlider = new Swiper('.fadeSlider-slider', {
effect: "fade",
fadeEffect: {
crossFade: true
},
slidesPerView: 1,
loop: true,
loopAdditionalSlides: 1,
watchOverflow: true,
allowTouchMove: false,
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
on: {
resize: function () {
fadeSlider.update();
}
}
});
/*==============================================================
lightbox gallery
==============================================================*/
/* for group gallery */
var lightboxgallerygroups = {};
$('.lightbox-group').each(function () {
var id = $(this).attr('data-group');
if (!lightboxgallerygroups[id]) {
lightboxgallerygroups[id] = [];
}
lightboxgallerygroups[id].push(this);
});
$.each(lightboxgallerygroups, function () {
$(this).magnificPopup({
type: 'image',
mainClass: 'mfp-fade',
fixedContentPos: true,
closeOnContentClick: true,
closeBtnInside: false,
gallery: {
enabled: true
}
});
});
/* video magnific popup */
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 200,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: true,
closeBtnInside: false
});
$('.space-grid').imagesLoaded(function () {
var initial_items = 8;
var next_items = 8;
var $grid = $('.space-grid').isotope({
itemSelector: '.element-item',
layoutMode: 'masonry',
stamp: '.element-item--static'
});
// bind filter button click
$('.button-group-home').on('click', 'button', function () {
var filterValue = $(this).attr('data-filter');
// use filterFn if matches value
$grid.isotope({
filter: filterValue
});
updateFilterCounts();
});
function updateFilterCounts() {
// get filtered item elements
var itemElems = $grid.isotope('getFilteredItemElements');
var count_items = $(itemElems).length;
if (count_items > initial_items) {
$('#showMore').show();
} else {
$('#showMore').hide();
}
if ($('.element-item').hasClass('visible_item')) {
$('.element-item').removeClass('visible_item');
}
var index = 0;
$(itemElems).each(function () {
if (index >= initial_items) {
$(this).addClass('visible_item');
}
index++;
});
$grid.isotope('layout');
}
// change is-checked class on buttons
$('.button-group-home').each(function (i, buttonGroup) {
var $buttonGroup = $(buttonGroup);
$buttonGroup.on('click', 'button', function () {
$buttonGroup.find('.is-checked').removeClass('is-checked');
$(this).addClass('is-checked');
});
});
function showNextItems(pagination) {
var itemsMax = $('.visible_item').length;
var itemsCount = 0;
$('.visible_item').each(function () {
if (itemsCount < pagination) {
$(this).removeClass('visible_item');
itemsCount++;
}
});
if (itemsCount >= itemsMax) {
$('#showMore').hide();
}
$grid.isotope('layout');
}
// function that hides items when page is loaded
function hideItems(pagination) {
var itemsMax = $('.element-item').length;
var itemsCount = 0;
$('.element-item').each(function () {
if (itemsCount >= pagination) {
$(this).addClass('visible_item');
}
itemsCount++;
});
if (itemsCount < itemsMax || initial_items >= itemsMax) {
$('#showMore').hide();
}
$grid.isotope('layout');
}
$('#showMore').on('click', function (e) {
e.preventDefault();
showNextItems(next_items);
});
hideItems(initial_items);
});
// fitty('.text-fitty > h2', {
// });
});
/*==============================================================
board
==============================================================*/
$(document).ready(function () {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
if ($('.cate-list .board-category').length) {
if ($('.cate-list .board-category').find('select').length) {
var $ca_link = [];
var $ca_name = [];
var $ca_current = getUrlParameter('com_board_category_code');
var $html = '
';
$('.cate-list .board-category select option').each(function (i) {
$ca_name[i] = $(this).text();
$ca_link[i] = $(location).attr('pathname') + '?com_board_category_code=' + $(this).val();
$html += '#' + $ca_name[i] + ' ';
});
$html += ' ';
$('.cate-list .board-category').html($html);
$('.cate-list .board-category ul li').each(function () {
if ($(this).find('a').attr('href').indexOf($ca_current) > -1 && $ca_current != '') $(this).addClass('active');
});
if (!$('.cate-list .board-category .active').length) $('.cate-list .board-category ul li:first-child').addClass('active');
}
}
// var otherPageURL = 'http://bdmp-003.cafe24.com/bizdemo146042/recruit.php';
// iframe이 로드된 후에 내용을 가져오기
// $('#recruit-board-frame').on('load', function () {
// var iframeContent = $(this).contents().find('.board-category').html();
// // 가져온 내용을 다른 위치에 추가
// $(".recruit-board-cate").html(iframeContent);
// });
var otherPageURL = $("#recruit-board-frame").attr('src');
// 비동기적으로 특정 클래스 내용을 가져옴
$.ajax({
url: otherPageURL,
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 board_cate = $(data).find('.board-category').html();
// 해당 내용을 현재 페이지의 recruit-board-cate에 추가
$('.recruit-board-cate').html(board_cate);
// 두 번째 부분의 코드를 이 위치로 이동
if ($('.recruit-board-cate').find('select').length) {
var $ca_link = [];
var $ca_name = [];
// var $ca_current = getUrlParameter('com_board_category_code');
var $html_cate = '';
$('.recruit-board-cate select option').each(function (i) {
$ca_name[i] = $(this).text();
$ca_link[i] = $(location).attr('pathname') + 'recruit.php?com_board_category_code=' + $(this).val();
$html_cate += '#' + $ca_name[i] + ' ';
});
$html_cate += ' ';
$('.recruit-board-cate').html($html_cate);
$('.recruit-board-cate > ul > li:first-child').addClass('active');
}
},
});
$.ajax({
url: otherPageURL,
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 board_content = $(data).find('.board-contents').prop('outerHTML');
$('.recruit-board-content').html(board_content);
},
});
$(document).on('click', '.recruit-board-cate a', function (e) {
e.preventDefault();
// 클릭한 a 태그의 data-cate 값을 가져옴
var targetPage = $(this).data('cate');
// 새로운 페이지의 board-contents 내용을 비동기적으로 가져옴
$.ajax({
url: targetPage,
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 newBoardContent = $(data).find('.board-contents').prop('outerHTML');
// 처음 로드된 board-contents의 내용을 변경
$('.recruit-board-content').html(newBoardContent);
},
});
// 클릭한 a 태그의 부모 li에 'active' 클래스 추가
$(this).parent('li').addClass('active').siblings().removeClass('active');
});
$(".board-table img").each(function () {
var src = $(this).attr('src');
if (src.indexOf('arr_page_pre') > -1) {
$(this).parent('a').addClass('board-arrow board-page-pre').append(" ");
$(this).remove();
}
if (src.indexOf('arr_page_back.gif') > -1) {
$(this).parent('a').addClass('board-arrow board-page-back').append(" ");
$(this).remove();
}
if (src.indexOf('arr_page_go.gif') > -1) {
$(this).parent('a').addClass('board-arrow board-page-go').append(" ");
$(this).remove();
}
if (src.indexOf('arr_page_next.gif') > -1) {
$(this).parent('a').addClass('board-arrow board-page-next').append(" ");
$(this).remove();
}
});
$('td.board_admin_bgcolor').closest('table').addClass('admin-button');
});
$('.board-gallery .board-contents').replaceWith(function () {
return $('').append($(this).contents());
});
$(document).ready(function () {
if ($('.board-gallery').find('.bbsnewf5').length) {
$('table.board-contents').replaceWith(function () {
return $('
').append($(this).contents());
});
var $html;
if ($(('.board-gallery')).hasClass('masonry-board')) {
$html = '
';
} else {
$html = '
';
}
$('.board-gallery .bbsnewf5').each(function () {
var $galleryBoard = $(this).closest('.board-gallery');
var $galleryItem = $(this).closest('tr');
var $checkbox = $galleryItem.find('input[type="checkbox"][name="delete_check_notice[]"]');
var $imageLink = $galleryItem.find('a');
var $imageUrl = $imageLink.find('img').attr('src');
var $galleryTitle = $galleryItem.find('.gallery_subject > a');
var $galleryEtc = $galleryItem.find('.gallery_etc');
var galleryItemTag = $galleryBoard.hasClass('masonry-board') ? '
' : '
';
if ($galleryBoard.hasClass('ect-hidden')) {
// ect-hidden 클래스가 있을 경우 ':' 이후의 텍스트만 추출
$galleryEtc.find("font").each(function () {
var text = $(this).text().trim();
var startIndex = text.indexOf(':') + 1;
var newText = text.substring(startIndex).trim();
$(this).replaceWith("
" + newText + "
");
});
} else {
$galleryEtc.html(function (_, html) {
return html.replace(/
/g, '').replace(/<\/font>/g, '
').replace(/style="(.*?)"/g, '');
});
}
$html += `
${galleryItemTag}
${$checkbox.length ? '' + $checkbox.prop('outerHTML') + '
' : ''}
${$galleryTitle.length ? '
' + $$galleryTitle.html() + ' ' : ''}
${$galleryEtc.length ? '
' + $galleryEtc.html() + '
' : ''}
`;
});
$html += '
';
// 기존의 테이블 대신에 생성한 div를 삽입
$('.board-gallery .board-contents').empty().prepend($html);
}
});
$(document).ready(function () {
$('.main-masonry-gallery > table').each(function () {
var $table = $(this);
// 이미지를 담고 있는 행 선택
var $imageRow = $table.find('tr:first');
var $imageCell = $imageRow.find('.board_output_gallery_img');
var $imageLink = $imageCell.find('a');
var imageUrl = $imageLink.find('img').attr('src');
// 텍스트를 담고 있는 행 선택
var $textRow = $table.find('tr:not(:first)');
var $textContent = $textRow.find('.board_output_gallery_etc').text();
// 새로운 div 엘리먼트 생성 및 figure 추가
var $div = $('
');
$div.append(`
${$textContent}
`);
// 기존 테이블을 대체
$table.replaceWith($div);
});
$(window).on('load', function () {
$('.main-masonry-gallery').isotope({
itemSelector: '.gallery-item',
layoutMode: 'masonry'
});
});
$(window).on('load', function () {
$('.masonry-list').isotope({
itemSelector: '.gallery-item',
layoutMode: 'masonry'
});
});
});
/* ---------- js ---------- */
jQuery(function($) {
$(function() {
$(".formmail_title_bgcolor").each(function() {
var placeholder_text = $(this).find("font").text();
$(this).parent("tr").find(".formmail_cell_bgcolor input:first-of-type").attr("placeholder", placeholder_text);
$(this).parent("tr").find(".formmail_cell_bgcolor textarea:first-of-type").attr("placeholder", placeholder_text);
});
$("table.base_formmail > tbody > tr > td input[name=com_formmail_check_safe]").each(function() {
$(this).parent().parent().parent().parent().parent().parent().addClass("check_safe");
});
$("table.base_formmail > tbody > tr > td .formmail_textarea_style").each(function() {
$(this).closest("tr").addClass("textarea_Message");
});
$("table.base_formmail > tbody > tr > td input[name=captcha_code]").each(function() {
$(this).parent("td").parent("tr").addClass("captcha_code");
});
});
});