5) {
alert("메뉴 설정은 최대 5개까지 가능합니다.");
field.checked = false;
selectedElementsCnt -= 1;
}
}
*/
//My Library
const btnToggle = document.querySelector('.btn-toggle');
$('.btn-toggle').on('click', function () {
$(this).toggleClass('active');
$(this).siblings('.toggle').toggleClass('active');
const isActive = $(this).hasClass('active');
localStorage.setItem('btnToggleActive', isActive);
if (isActive) {
$('.myFavItem').addClass('active');
$(this).text("접기");
} else {
$('.myFavItem').removeClass('active');
$(this).text("열기");
}
});
$(document).ready(function() {
$("#q").on("keyup", function(e){
if(e.keyCode == 13) {
fn_search();
}
});
const savedState = localStorage.getItem('btnToggleActive');
$("#btnSaveFavorite").click(function() {
var menuList = [];
$(".menu_id:checked").each(function() {
menuList.push($(this).val());
});
/*
if (menuList.length > 5) {
alert("메뉴 설정은 최대 5개 까지 가능합니다.");
return false;
} */
$.ajax({
url: "/favorite/save.do",
type: "POST",
traditional: true,
data: { "menu_id" : menuList },
dataType: 'json',
success: function(res) {
if(res.result === "SUCCESS") {
alert("저장되었습니다!");
location.reload();
} else if (res.result === "NO_ACTION") {
alert("즐겨찾기를 등록 해주세요!");
return;
} else if (res.result === "NO_SESSION") {
alert("로그인이 필요합니다.");
} else {
alert("오류가 발생했습니다.");
}
},
error: function() {
alert("통신 오류");
}
});
});
if (savedState === 'true') {
const $btn = $('.btn-toggle');
$btn.addClass('active');
$('.myFavItem').addClass('active');
$btn.text("접기");
$btn.siblings('.toggle').addClass('active');
}
});
/*$(document).ready(function() {
var $popArea = $('#popArea');
if (currentDate >= term_sub1 && currentDate < term_sub2) {
$popArea.html(
'
' +
'' +
'

' +
'
' +
'' +
'

' +
'
' +
'' +
'

' +
'
' +
'' +
'
'
);
} else {
$popArea.html(
'
' +
'

' +
'
' +
'
' +
'

' +
'
' +
'
' +
'

' +
'
' +
'
'
);
}
});*/
/*==========================================*/
/*=============== 다국어입력 시작 ================*/
/*==========================================*/
var textObj = null;
function setTextObj(obj) {
textObj = obj;
}
function addCharacter(character) {
if(textObj == null) textObj = $('input[name="1"]').eq(0);
var val = $(textObj).val();
$(textObj).val(val+character);
}
$(document).ready(function($) {
$('.Area_atoz a').click(function(){
addCharacter($(this).text());
});
});
/*==========================================*/
/*================ 다국어입력 끝 ================*/
/*==========================================*/
/*
if(false && true) {
alert("시범운영 홈페이지에서 외부접속 시 학술DB를 이용할 수 없습니다.");
}
*/
//카테고리별 도서 목록
const bookListSwiper = new Swiper('#newBookListSlide', {
spaceBetween: 64,
speed: 400,
loop: true,
breakpoints: {
600: {
slidesPerView: 1,
},
840: {
slidesPerView: 3,
},
1280: {
slidesPerView: 5,
},
},
navigation: {
nextEl: '#newBookListSlideNext',
prevEl: '#newBookListSlidePrev',
},
});
//카테고리별 도서 목록
const bookListSwiper2 = new Swiper('#rdaBookListSlide', {
spaceBetween: 64,
speed: 400,
loop: true,
breakpoints: {
600: {
slidesPerView: 1,
},
840: {
slidesPerView: 3,
},
1280: {
slidesPerView: 5,
},
},
navigation: {
nextEl: '#rdaBookListSlideNext',
prevEl: '#rdaBookListSlidePrev',
},
});
//카테고리별 도서 목록
const bookListSwiper3 = new Swiper('#priBookListSlide', {
spaceBetween: 64,
speed: 400,
loop: true,
breakpoints: {
600: {
slidesPerView: 1,
},
840: {
slidesPerView: 3,
},
1280: {
slidesPerView: 5,
},
},
navigation: {
nextEl: '#priBookListSlideNext',
prevEl: '#priBookListSlidePrev',
},
});
//알림판 배너
const eleBanSwiper = new Swiper('.main-d-ban-swiper .swiper', {
slidesPerView: 1,
spaceBetween: 16,
speed: 400,
loop: true,
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
navigation: {
nextEl: '.popupzone .swiper-button-next',
prevEl: '.popupzone .swiper-button-prev',
},
pagination: {
el: ".popupzone .swiper-pagination",
type: "fraction",
},
});
const $eleBanSwiperPlay = document.querySelector('.popupzone .swiper-button-play');
const $eleBanSwiperStop = document.querySelector('.popupzone .swiper-button-stop');
$eleBanSwiperPlay.style.display = "none";
$eleBanSwiperPlay.addEventListener("click", () => {
eleBanSwiper.autoplay.start();
$eleBanSwiperStop.style.display = "";
$eleBanSwiperPlay.style.display = "none";
});
$eleBanSwiperStop.addEventListener("click", () => {
eleBanSwiper.autoplay.stop();
$eleBanSwiperStop.style.display = "none";
$eleBanSwiperPlay.style.display = "";
});
//디지털컬렉션
const digitalSwiper = new Swiper('.main-digital-swiper .swiper', {
loop: true,
autoplay: false,
breakpoints: {
300: {
slidesPerView: 1,
},
500: {
slidesPerView: 2,
},
640: {
slidesPerView: 3,
},
1024: {
slidesPerView: 4,
},
1280: {
slidesPerView: 6,
},
},
navigation: {
nextEl: '.main-digital-wrap .swiper-button-next',
prevEl: '.main-digital-wrap .swiper-button-prev',
},
});
//학술 DB
const dblinkSwiper = new Swiper('.main-db-link-list .swiper', {
spaceBetween: 40,
loop: true,
autoplay: {
delay: 10000,
disableOnInteraction: false,
},
breakpoints: {
600: {
slidesPerView: 3,
},
840: {
slidesPerView: 6,
},
1280: {
slidesPerView: 7,
},
},
navigation: {
nextEl: '.main-db-link-list .swiper-button-next',
prevEl: '.main-db-link-list .swiper-button-prev',
},
});