`;
for ( let i = 0; i < menuName.length; i++ ) {
html += `${menuName[i]}`;
}
html += `
`;
$('.breadcrumb-navbar .container-xl').append(html);
}
// new page
function newpage_init() {
if ( !$('section.new-page').length ) return false;
var poster_swiper_thumb = new Swiper(".poster-swiper-thumb", {
spaceBetween: 10,
slidesPerView: 3,
watchSlidesProgress: true,
pagination: {
el: ".poster-swiper-thumb .swiper-pagination",
clickable: true,
bulletClass: "tera-bullet",
bulletActiveClass: "tera-bullet-active"
},
breakpoints: {
768: {
slidesPerView: 4,
spaceBetween: 14,
},
},
});
var poster_swiper = new Swiper(".poster-swiper", {
spaceBetween: 0,
speed: 800,
autoplay: {
delay: 4500,
disableOnInteraction: false,
},
thumbs: {
swiper: poster_swiper_thumb,
},
});
var newmenu_swiper = new Swiper(".newmenu-swiper", {
spaceBetween: 10,
slidesPerView: 1,
pagination: {
el: ".newmenu-swiper .swiper-pagination",
clickable: true,
bulletClass: "tera-bullet",
bulletActiveClass: "tera-bullet-active"
},
breakpoints: {
768: {
slidesPerView: 3,
spaceBetween: 14,
},
},
});
}
// drink, dessert page
function popup_board_init() {
if ( !$('section.popup-board').length ) return false;
let articles = $("section.popup-board table.photo-article-list table table");
let html = '
';
window.factorArray = [];
articles.each(function(idx, article){
let src = $(article).find("img")[0].src;
let href = $(article).find("a")[0].href;
let title = $(article).find(".gallery_title").text();
let content = $(article).find(".gallery_cont").text();
let fonts = $(article).find(".gallery_etc font");
let factors = [];
fonts.each(function(){
let text = $(this).text().split(" : ");
factors.push({"name": text[0], "value": text[1]});
});
fonts.remove();
window.factorArray.push(factors);
let eng = $(article).find(".gallery_etc").text().replace(/[\t\,\[\]\n]/ig, '');
eng = eng.trim().replace('이름 : ', '');
html += `
${title}
`;
});
html += '
';
$("section.popup-board .article-wrapper").empty().append(html);
$("section.popup-board .article-card").on("click", function(e){
let idx = $(this).data("teraIdx");
let factors = window.factorArray[idx];
let src = $(this).find("img")[0].src;
let title = $(this).find("h4").text();
let engname = $(this).data("engName");
$("#popupBoardModal").find(".factor-wrapper img")[0].src = src;
$("#popupBoardModal").find(".name-box h6").text(title);
$("#popupBoardModal").find(".name-box .eng").text(engname);
let html = "";
factors.forEach(function(factor, i){
if (factor.name!="카테고리") {
if (factor.name=="설명글") {
$("#popupBoardModal").find(".name-box .desc").text(factor.value);
} else {
html += `
`;
}
}
})
$("#popupBoardModal").find(".factor-box .row").html(html);
});
$("#popupBoardModal .btn-close").on("click", function(){
$("#popupBoardModal").modal("hide");
})
}
// find page
function find_map_init() {
if ( !$('section.map-type').length ) return false;
let mapList = $(".board-gallery.map-type .photo-article-list table table");
let latList = [];
let infoList = [];
let html = '
';
mapList.each((i, _this) => {
let name = $(_this).find(".gallery_title").text();
let src = $(_this).find("img")[0].src;
let fonts = $(_this).find("font");
let addr = "";
let phone = "";
let time = "";
let regex = new RegExp(/\[[0-9.\,\s]+\]/g);
fonts.each(function(j, font){
let split = $(font).text().split(" : ");
let lat_test = regex.exec(split[1]);
if (lat_test && lat_test[0]) {
let ll = lat_test[0].slice(1, lat_test[0].length-1);
latList.push(ll);
} else if (j==0) {
addr = split[1];
} else if (j==1) {
phone = split[1];
} else if (j==2) {
time = split[1];
}
});
infoList.push({name: name, src: src, addr: addr, phone: phone, time: time});
html += `
전화번호${phone}
운영시간${time}
`;
});
html += '
';
$(".article-wrapper").html(html);
// 지도
let map = new naver.maps.Map('map', {
center: new naver.maps.LatLng(37.572283, 126.869909),
zoom: 12
});
latList.forEach((ll, i) => {
let latLng = ll.replaceAll(" ", "").split(",");
let pos = new naver.maps.LatLng(latLng[0], latLng[1]);
let marker = makeMarker(map, pos);
let contentString = makeContentString(infoList[i]);
let infowindow = new naver.maps.InfoWindow({
content: contentString
});
naver.maps.Event.addListener(marker, "click", function(e) {
if (infowindow.getMap()) {
infowindow.close();
} else {
infowindow.open(map, marker);
}
});
infowindow.open(map, marker);
});
function makeContentString(obj) {
return `
${obj.name}
${obj.addr}
${obj.phone}
${obj.time}
`;
}
}
function makeMarker(map, position) {
let HOME_PATH = $("#tplCode").val();
let ICON_SPRITE_IMAGE_URL = HOME_PATH +'/img/onepixel/images/sub/tera-pin.png';
let marker = new naver.maps.Marker({
map: map,
position: position,
icon: {
url: ICON_SPRITE_IMAGE_URL,
size: new naver.maps.Size(65, 64), // 이미지 크기
origin: new naver.maps.Point(0, 0), // 스프라이트 이미지에서 클리핑 위치
anchor: new naver.maps.Point(32, 32), // 지도상 위치에서 이미지 위치의 offset
}
});
return marker;
}
// map page
function office_map_init() {
if ( !$('section.location').length ) return false;
let map = new naver.maps.Map('map', {
center: new naver.maps.LatLng(37.501551, 126.791679),
zoom: 15
});
let pos = new naver.maps.LatLng(37.501551, 126.791679);
let marker = makeMarker(map, pos);
}
});