/********************************************************************************************************* ## Web's Republic Common Script ## * 본 스크립트의 저작권은 (주)웹스리퍼블릭에 있습니다. * 본 스크립트를 무단으로 이용하거나 복제 또는 수정 사용시 저작권법에 의거 처벌받을 수 있습니다. * version : 1.0 * date : 2017-08-04 * author : Park Soo Hyun (shpark7502@naver.com) *********************************************************************************************************/ // URL 파라미터 불러오기 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]; } } }; // 모바일 접속시 모바일 웹으로 연결 var mobileKeyWords = new Array('iPhone', 'iPod','iPad', 'BlackBerry', 'Android', 'Windows CE', 'LG', 'MOT', 'SAMSUNG', 'SonyEricsson'); for (var word in mobileKeyWords){ if (navigator.userAgent.match(mobileKeyWords[word]) != null){ var qp = location.pathname, qm = "/default/mobile/"; var qmap = {"about/sub1":"01/sub1","about/sub2":"01/sub2","about/sub3":"01/sub3","about/sub4":"01/sub4","about/sub5":"01/sub5","02/sub1":"02/sub1","02/sub2":"02/sub2","02/sub3":"02/sub3","02/sub4":"02/sub4","02/sub6":"02/sub5","02/sub7":"02/sub6","03/sub1":"03/sub1","03/sub2":"03/sub2","03/sub3":"03/sub3","03/sub4":"03/sub4","03/sub5":"03/sub5","03/sub6":"03/sub6","03/sub7":"03/sub7","03/sub8":"03/sub8","04/sub1":"04/sub1","05/sub1":"05/sub1","04/sub2":"04/sub2","05/sub2":"05/sub2","04/sub3":"04/sub3","05/sub3":"05/sub3","04/sub4":"04/sub4","05/sub4":"05/sub4","04/sub5":"04/sub5","05/sub5":"05/sub5","06/sub1":"06/sub1","06/sub2":"06/sub2","06/sub3":"06/sub3","06/sub4":"06/sub4","07/sub1":"07/sub1","07/sub2":"07/sub2"}; var qk = qp.replace(/^\/default\//, "").replace(/\.php$/, ""); location.href = qmap[qk] ? qm + qmap[qk] + ".php" : qm; break; } } /* ----------------- 메뉴 관련 스크립트 ----------------- */ $(document).ready(function(){ $headerWrap=$("#header"); $mainMenu=$("#mainmenu_list>li"); $subMenu=$(".submenu01"); $subMenu.css("opacity",0); $subMenu.hide(); $mainMenu.bind("mouseenter",onOver); $headerWrap.bind("mouseleave",onOut); }) function onOver(){ overNum=$mainMenu.index($(this)); mainOver(); } function onOut(){ mainOut(); $subMenu.stop(); $subMenu.hide(); $headerWrap.stop(); $headerWrap.css({"min-height":"100px"}); $subMenu.animate({"opacity":0},600,"easeOutQuint",function(){ $(this).hide(); }) } function mainOver(){ $mainMenu.stop(); $headerWrap.stop(); $headerWrap.css({"min-height":"100px"}); $subMenu.hide(); $subMenu.eq(overNum).show(); $subMenu.eq(overNum).stop(); $subMenu.eq(overNum).animate({"opacity":1},600,"easeOutQuint"); } function mainOut(){ $mainMenu.stop(); $mainMenu.animate({"color":"#666"},400,"easeOutQuint"); } /* ----------------------------- 헤더 서브메뉴 롤오버 이미지 변경 스크립트 ------------------------ */ $(document).ready(function() { $subUl = $("ul.sub_ul"); $subImg01 = $("img.sub_ul01"); $subList03 = $("li.sub_ul03"); $subUl.bind("mouseover", onOver_all); $subUl.bind("mouseout", onOut_all); }); function onOver_all(){ $(this).children().css({"background":"#b98d62"}) $(this).children().children().css({"color":"#fff"}) $(this).children().children().children().attr("src", $(this).children().children().children().attr("src").replace(/^(.+)_off(\.[a-z]+)$/, "$1_on$2")); } function onOut_all(){ $(this).children().css({"background":"#fff"}) $(this).children().children().css({"color":"#404040"}) $(this).children().children().children().attr("src", $(this).children().children().children().attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1_off$2")); } /* ----------------- 스크롤 헤더 고정 ----------------- */ $(window).scroll(function() { var scroll_h = $(this).scrollTop(); var hd_h = $("#header > .top").outerHeight(); if(scroll_h > hd_h) { if(!$("body").hasClass('scroll')) $("body").addClass('scrollfix'); } else { $("body").removeClass('scrollfix') } }); /* ----------------- 메뉴 및 탭 활성화 스크립트 ----------------- */ $(document).ready(function() { var depth1 = getUrlParameter('top') - 1; var depth2 = getUrlParameter('sub') - 1; $("#nav > li").eq(depth1).addClass('on'); $("#subnav .menu-item").eq(depth1).find('ul').children().eq(depth2).addClass('on'); $("#tab_menu[data-role=menu]").children().eq(depth2).addClass('on'); }); /* ----------------- 메인페이지 전용 스크립트 ----------------- */ // BEFORE&AFTER 섹션 탭 기능 $(document).ready(function() { $("#section1 .tab-list > li").click(function() { var tab_index = $(this).index(); $("#section1 .tab-list > li").removeClass('active'); $(this).addClass('active'); $("#rollingBox > .rolling-box").removeClass('active'); $("#rollingBox > .rolling-box").eq(tab_index).addClass('active'); }); }); // BEFORE&AFTER 섹션 롤링 $(document).ready(function() { var slide_index = []; var count = []; var elem; var item_size = $("#rollingBox .rolling-box > .imgList > li").width(); var easeEffect = "easeInOutCubic"; // 인덱스 배열 초기화 $("#rollingBox .rolling-box").each(function(i) { slide_index[i] = 0; count[i] = $(this).find('.imgList').children().length; i++; }); // 슬라이드 처리 function slide(index) { elem = $("#rollingBox .rolling-box.active"); if(slide_index[index] < 0) { slide_index[index] = count[index] - 1; } else if(slide_index[index] >= count[index]) { slide_index[index] = 0; } elem.find('.imgList').stop().animate({'left':-(item_size*slide_index[index]) + 'px'}, 400, easeEffect); } // 이전 버튼 클릭 $("#section1 .control-box .prev").click(function() { elem = $("#rollingBox .rolling-box.active > .imgList"); var active_index = elem.index(); if(!elem.is(':animated')) { slide_index[active_index]--; slide(active_index); } }); // 다음 버튼 클릭 $("#section1 .control-box .next").click(function() { elem = $("#rollingBox .rolling-box.active > .imgList"); var active_index = elem.index(); if(!elem.is(':animated')) { slide_index[active_index]++; slide(active_index); } }); }); // 3단 그리드 롤링 섹션 $(document).ready(function() { var grid_index = 0; var elem = $("#grid-rolling > .slide-wrapper > .imgList"); var count = elem.children().length; var item_size = elem.children().width(); var easeEffect = "easeInOutQuint"; // 그리드 롤링 초기화 function gridInit() { elem.css('width', item_size*count + 'px'); } // 슬라이드 처리 function slide() { if(grid_index < 0) { grid_index = count - 3; } else if(grid_index > count - 3) { grid_index = 0; } elem.stop().animate({left:-grid_index*item_size + 'px'}, 600, easeEffect); } // 이전 버튼 클릭 $("#grid-rolling .control-btn .prev").click(function() { if(!elem.is(':animated')) { grid_index--; slide(); } }); // 다음 버튼 클릭 $("#grid-rolling .control-btn .next").click(function() { if(!elem.is(':animated')) { grid_index++; slide(); } }); }); /* ---------------- 동영상 영역 스크립트 ------------------ */ var $closeVideo var $openVideo var $video01 $(document).ready(function(){ $closeVideo=$("#movie_close_btn img"); $openVideo=$(".video_icon>a"); $video01=$("#videoWrap01"); $openVideo.bind("click",onShowvideo); $closeVideo.bind("click",onHidevideo); }) function onShowvideo(){ $video01.show(); $openVideo.hide(); return false; } function onHidevideo(){ $video01.hide(); $openVideo.show(); return false; } /* ----------------------- 동영상 아래 스크롤 다운 -------------------- */ $(window).load(function(){ setInterval(onScrolldwn,1400); }); function onScrolldwn(){ $("#scroll_down").animate({"bottom":40},700,"easeOutQuart",function(){ $(this).animate({"bottom":60},700,"easeOutQuart"); }); } /* ------------------------- 메인 텍스트 포지션 변경 스크립트 --------------------- */ var scrollPostext; $(document).ready(function(){ $(window).bind("scroll",onScrolltxt); }) function onScrolltxt(){ scrollPostext=$(window).scrollTop(); if(scrollPostext>=1500){ $("ul.main01_text").animate({"margin-left":"50%", "opacity":1},2000,"easeOutQuint") } if(scrollPostext>=2900){ $("ul.main03_text").animate({"margin-left":"5%", "opacity":1},2000,"easeOutQuint") } } /* ----------------- 숫자 카운트 영역 스크립트 --------------------- */ var $countBox; var timer; var isPlay = false; $(document).ready(function(){ $countBox = $(".section_count_num"); $(window).bind("scroll",onScrollnum); }); function onScrollnum(){ if(isPlay == false && $(window).scrollTop()>=3600){ timer = setInterval(function(){ $countBox.html(parseInt(Math.random()*29990)+10);}, 50); setTimeout(stopCount,1200) isPlay = true; } }; function stopCount(){ clearInterval(timer); $countBox.html('38'+','+'672'); }; /* --------------------- 스타 이미지 슬라이드 ------------------------ */ var $slideWrap; $(document).ready(function() { $slideWrap=$("#slideInner"); $slideWrap.css("width",1400*$slideWrap.children().size()); $slideWrap.children().last().prependTo($slideWrap); $slideWrap.css("margin-left",-2000); $("#starImg_btn_left").bind("click", onstarLeft); $("#starImg_btn_right").bind("click", onstarRight); }); function onstarLeft(){ $("#slideInner:not(:animated)").animate({marginLeft: parseInt($slideWrap.css("margin-left"))-2000},500,"easeOutCubic", function(){ $slideWrap.children().first().appendTo($slideWrap); $slideWrap.css("margin-left",-2000+"px"); }) } function onstarRight(){ $("#slideInner:not(:animated)").animate({marginLeft: parseInt($slideWrap.css("margin-left") )+2000},500,"easeOutCubic", function(){ $slideWrap.children().last().prependTo($slideWrap); $slideWrap.css("margin-left",-2000+"px"); }) } /* ----------------- 서브페이지 전용 스크립트 ----------------- */ // 퀵메뉴 관련 스크립트 $(document).ready(function() { var easeEffect = "easeInOutExpo"; var btn_pos = parseInt($("#quickmenu").css('right')); var layer_pos = $("#quickmenu .quick-layer").outerWidth(); $("#quickmenu .iconlist > li").click(function() { var match = $(this).data('match'); $("#quickmenu .iconlist > li").removeClass('on'); $(this).addClass('on'); if(!$("#quickmenu").hasClass('open')) { $("#quickmenu").addClass('open'); $("#quickmenu .quick-layer[data-icon=" + match + "]").css('display','block'); $("#quickmenu .quick-layer[data-icon=" + match + "]").stop().animate({right:0}, 600, easeEffect); $("#quickmenu").stop().animate({right:layer_pos + 'px'}, 600, easeEffect); } else { $("#quickmenu .quick-layer").css('display','none'); $("#quickmenu .quick-layer[data-icon=" + match + "]").css({'display':'block', 'right':0}); } }); $("#quickmenu .quick-layer .btn-close").click(function() { $("#quickmenu").removeClass('open'); $("#quickmenu .iconlist > li").removeClass('on'); $("#quickmenu .quick-layer").stop().animate({right:-layer_pos}, 600, easeEffect); $("#quickmenu").stop().animate({'right':btn_pos}, 600, easeEffect); }); }); // 둘러보기 스크립트 $(document).ready(function() { var old_images = []; // 최초 상태의 각 탭 메인 썸네일을 변수에 저장 $("#facilitySlider .big-thumb .thumb-list > li").each(function(i) { old_images[i] = $(this).find('img').attr('src'); i++; }); // 1단계 : 층별 탭 클릭시 보여지는 탭 내용을 교체 & 각 층의 대표 이미지로 초기화 $("#facilitySlider .big-thumb .floor-tab > li").click(function() { var tab_index = $(this).index(); $("#facilitySlider .big-thumb .floor-tab > li").removeClass('active'); $(this).addClass('active'); $("#facilitySlider .big-thumb .thumb-list > li").removeClass('active'); $("#facilitySlider .big-thumb .thumb-list > li").eq(tab_index).find('img').attr('src', old_images[tab_index]); $("#facilitySlider .big-thumb .thumb-list > li").eq(tab_index).addClass('active'); $("#facilitySlider .floor-container > .floor-info .thumb-list > li").removeClass('selected'); $("#facilitySlider .floor-container > .floor-info").removeClass('active'); $("#facilitySlider .floor-container > .floor-info").eq(tab_index).addClass('active'); }); // 2단계 : 각 층별 내부 썸네일 클릭시 대형 썸네일 교체 $("#facilitySlider .floor-container > .floor-info .thumb-list > li").click(function() { var thumb_img = $(this).find('img').attr('src'); $("#facilitySlider .floor-container > .floor-info .thumb-list > li").removeClass('selected'); $(this).addClass('selected'); $("#facilitySlider .big-thumb .thumb-list > li.active").find('img').attr('src', thumb_img); }); }); /* ----------------- 게시판 전용 스크립트 ----------------- */ // 이미지 버튼 텍스트로 대체 $(document).ready(function() { // 관리자 전용 버튼 replace function admBtnReplace() { var $url = window.location.href; var $readpage = $url.indexOf('read_form'); $("#container .innerContainer img").each(function() { var $src = $(this).attr('src'); // 삭제 if($src.indexOf('btn_sdel.gif') > -1 && $readpage < 0) { var $opt = $(this).attr('onclick'); var $link = "삭제"; $(this).before($link); $(this).remove(); } // 이동 if($src.indexOf('move.gif') > -1 && $readpage < 0) { var $opt = $(this).attr('onclick'); var $link = "이동"; $(this).before($link); $(this).remove(); } // 복사 if($src.indexOf('copy.gif') > -1 && $readpage < 0) { var $opt = $(this).attr('onclick'); var $link = "복사"; $(this).before($link); $(this).remove(); } // 이동 (뷰페이지) if($src.indexOf('move.gif') > -1 && $readpage > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('이동'); $(this).remove(); } // 복사 (뷰페이지) if($src.indexOf('copy.gif') > -1 && $readpage > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('복사'); $(this).remove(); } // 수정 (뷰페이지) if($src.indexOf('modify.gif') > -1 && $readpage > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('수정'); $(this).remove(); } // 삭제 (뷰페이지) if($src.indexOf('delete.gif') > -1 && $readpage > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('삭제'); $(this).remove(); } // 답글 (뷰페이지) if($src.indexOf('reply.gif') > -1 && $readpage > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('답글쓰기'); $(this).remove(); } }); } // 일반 기능버튼 replace function btnReplace() { $("#container .innerContainer img").each(function() { var $src = $(this).attr('src'); // 글쓰기 if($src.indexOf('write.gif') > -1) { $(this).parent('a').addClass('btn btn-primary'); $(this).parent('a').html('글쓰기'); $(this).remove(); } // 이전 if($src.indexOf('prev.gif') > -1) { $(this).parent('a').addClass('btn btn-default'); $(this).parent('a').html('이전'); $(this).remove(); } // 목록보기 if($src.indexOf('list.gif') > -1) { $(this).parent('a').addClass('btn btn-secondary'); $(this).parent('a').html('목록'); $(this).remove(); } // 다음 if($src.indexOf('next.gif') > -1) { $(this).parent('a').addClass('btn btn-default right-icon'); $(this).parent('a').html('다음'); $(this).remove(); } // 스팸신고 if($src.indexOf('spam.gif') > -1) { var $opt = $(this).attr('onclick'); var $link = '스팸신고'; $(this).before($link); $(this).remove(); } // 글 작성/수정/답변 취소 if($src.indexOf('cancel.gif') > -1) { $(this).parent('a').attr('href','javascript:history.go(-1);'); $(this).parent('a').addClass('btn btn-secondary'); $(this).parent('a').html('취소'); $(this).remove(); } }); // 검색 $("#ext_search input[type=image]").before(''); $("#ext_search input[type=image]").css('display','none'); $(document).on('click', '#ext_search input[type=submit]', function() { $("#ext_search input[type=image]").trigger('click'); }); // 글 작성/수정/답변 $(".bbsnewf5 input[src*='confirm.gif']").before(''); $(".bbsnewf5 input[src*='confirm.gif']").css('display','none'); $(document).on('click', '.bbsnewf5 .btn-confirm', function() { $(".bbsnewf5 input[src*='confirm.gif']").trigger('click'); }); } // 회원 관련 버튼 replace function memBtnReplace() { $("#container .innerContainer img").each(function() { var $src = $(this).attr('src'); // 아이디 중복확인 if($src.indexOf('btn_iddupl.gif') > -1) { var $opt = $(this).parent().attr('href'); var $link = '아이디 중복확인'; $(this).parent().before($link); $(this).parent().remove(); } }); } admBtnReplace(); btnReplace(); memBtnReplace(); }); // 게시판 카테고리 자동 생성 $(document).ready(function() { var cate_link = [], cate_title = [], currentURL = $(location).attr('pathname'), param = "?&com_board_category_code=", currentParam = "", insertHTML = "", idx = 0; if($("select[name='com_board_category_code']").length > 0) { currentParam = getUrlParameter('com_board_category_code'); $("select[name='com_board_category_code'] > option").each(function() { cate_link[idx] = $(this).val(); cate_title[idx] = $(this).text(); idx++; }); insertHTML = '


';
document.body.appendChild(d);
var t = d.querySelector('.t-btn');
if (t) t.onclick = function(e){ if(e&&e.preventDefault) e.preventDefault(); if (window.jQuery) { jQuery('html,body').stop().animate({scrollTop:0},600); } else { window.scrollTo(0,0); } return false; };
}
if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mount); } else { mount(); }
})();