(function(window, $) { var CommonUI = (function($, undefined) { var _CommonUI = function() { // property---------------- } _CommonUI.extend = function(a, b) { var spp = a.prototype; for ( var property in b) { spp[property] = b[property]; } return a; }; _CommonUI.prototype._applyOptions = function(op, applyO) { var margeO = {}; for ( var attrname in op) { margeO[attrname] = op[attrname]; } for ( var attrname in applyO) { margeO[attrname] = applyO[attrname]; } return margeO }; return _CommonUI; })(!!jQuery ? jQuery : false); // TAB UI /* * var tab = new rs.ui.Tab(); tab.show({selector : {menu : $("a"), content : * $("b")} , start : 0 , tabClass : "on", contClass:"off" }); */ CommonUI.Tab = function() { CommonUI.call(this, arguments); this._options = { selector : { menu : null, content : null }, start : 0, tabClass : "on", callback : null, setIndex: false, hashEvent: false, } this.menu = null; this.content = null; this.cIdx = 0; this.tg = null; this.setIndex = false; } CommonUI.Tab.prototype = new CommonUI(); CommonUI.extend(CommonUI.Tab, { show : function(opt) { if (opt) { this._options = this._applyOptions(this._options, opt); } this._init(); }, _init : function() { var opt = this._options; this.menu = opt.selector.menu; this.content = opt.selector.content; this.callback = opt.callback; this.setIndex = opt.setIndex; this.hashEvent = opt.hashEvent; this.start = opt.start; if(this.setIndex){ this.menu.each(function(){ $(this).attr("idx",$(this).index()); }) } if(this.hashEvent == false){ this._changeTab(opt.start); } this._hashHandler(); this._setEvent(); }, _hashHandler : function(){ var that = this; var hash = window.location.hash; if(hash != ""){ this.menu.each(function(){ if($(this).find("a").attr("href") == hash){ var idx = $(this).index(); that.cIdx = idx that._changeTab(idx); } }) }else{ that._changeTab(this.start); } } , _setEvent : function() { var that = this; $(document).on("click",this.menu.selector,{ me : this }, function(e) { if(!that.hashEvent){ e.preventDefault(); } var me = e.data.me; if(me.setIndex){ me.cIdx = $(this).attr("idx"); }else{ me.cIdx = $(this).index(); } me._changeTab(me.cIdx); }) }, _changeTab : function(idx) { var tabClass = this._options.tabClass; var contClass = this._options.contClass; if(this.setIndex){ $(this.menu.selector).find("a").removeClass(tabClass); $(this.menu.selector).each(function(){ if($(this).attr("idx") == idx){ $(this).find("a").addClass(tabClass); } }) }else{ this.menu.find("a").removeClass(tabClass); this.menu.find("a").eq(idx).addClass(tabClass); } this.content.addClass(contClass); this.content.eq(idx).removeClass(contClass); this.tg = this.content.eq(idx); if(this.callback != null)this.callback(); }, getMe : function(){ return this.tg; } }) // �ì늽�뉛¿½�°ï¿½ UI /* * var dirCir = new rs.ui.Cir(); dirCir.show({selector : {menu : $("a"), * content : $("b")}}); */ CommonUI.Cir = function() { CommonUI.call(this, arguments); this._options = { selector : { menu : null, content : null } } this.menu = null; this.content = null; } CommonUI.Cir.prototype = new CommonUI(); CommonUI.extend(CommonUI.Cir, { show : function(opt) { if (opt) { this._options = this._applyOptions(this._options, opt); } this._init(); }, _init : function() { var opt = this._options; this.menu = opt.selector.menu; this.content = opt.selector.content; this._setEvent(); }, _setEvent : function() { this.menu.off("click").on("click", { me : this }, function(e) { e.preventDefault(); var me = e.data.me; me._goCton($(this).index()); }) }, _goCton : function(idx) { var top = this.content.eq(idx).offset().top - 70; this.content.eq(idx).velocity("scroll",{duration: 600, easing: "easeInOutQuart"}) } }) // �Ñ됱뵬�ë�ë±� UI /* * var slide = new rs.ui.Slide({item : $("a"), next : $("b"), prev :$("c")}); slide.show({dir : 'vertical'}); */ CommonUI.Slide = function() { CommonUI.call(this, arguments); this._options = { dir : "vertical" }; this.content = arguments[0] || null; this.cIdx = 0; this.pIdx = 0; this.totalNum = 0; this.timerID = null; } CommonUI.Slide.prototype = new CommonUI(); CommonUI.extend(CommonUI.Slide, { show : function(opt) { if (opt) { this._options = this._applyOptions(this._options, opt); } this._init(); }, _init : function() { var opt = this._options; var arg = this.content; this.item = arg.item; this.next = arg.next; this.prev = arg.prev; this.dir = opt.dir; this.itemH = this.item.outerHeight(true); this.totalNum = this.item.size(); this._setNode(); if(this.item.size() > 1){ this._setEvent(); this._timer(); } }, _setNode : function(){ var node = this.item; var taht = this; node.css("position","absolute"); node.each(function(i){ var tg = $(this); tg.css("top",taht.itemH * i); }) }, _setEvent : function() { var that = this; this.next.off("click").on("click", { me : this }, function(e) { e.preventDefault(); var me = e.data.me; me._next(); }) this.prev.off("click").on("click",{ me : this }, function(e) { e.preventDefault(); var me = e.data.me; me._prev(); }) $(".notice_main").on({ "mouseenter" : function(){ clearInterval(that.timerID); }, "mouseleave" : function(){ that._timer(); }, }) }, _timer :function(){ var that = this; that.timerID = setInterval(function(){that._next()},5000); }, _next : function(){ this.pIdx = this.cIdx; this.cIdx++; if(this.cIdx >= this.totalNum -1){ this.cIdx = 0; } this._moveNode("next"); }, _prev : function(){ this.pIdx = this.cIdx; this.cIdx--; if(this.cIdx <= 0){ this.cIdx = this.totalNum -1; } this._moveNode("prev"); }, _getCurrent : function(){ return this.item.eq(this.cIdx); }, _moveNode : function(dir){ var node = this.item; var cInitPos = 0; var pEndPos = 0; if(dir == "next"){ cInitPos = this.itemH; pEndPos = -1*(this.itemH); }else{ cInitPos = -1*(this.itemH); pEndPos = this.itemH; } node.eq(this.pIdx).velocity("stop"); node.eq(this.pIdx).stop().velocity({top:[ pEndPos , 0 ]},{duration: 400}) node.eq(this.cIdx).velocity("stop"); node.eq(this.cIdx).stop().velocity({top:[ 0 , cInitPos ]},{duration: 400}) } }) // �꾩�«ï¿½ë¶¿ë¼µ UI /* * var Aco = new rs.ui.Aco(); Aco.show({list : $('a li'), openClass : " library_open", closeClass : " library_close" ,content : "library_con"}); */ CommonUI.Aco = function() { CommonUI.call(this, arguments); this._options = { list : null, openClass: null, closeClass : null, content : null, clickArea : null, callback : null } this.list = null; this.content = null; this.clickTg = null; this.tg = null; } CommonUI.Aco.prototype = new CommonUI(); CommonUI.extend(CommonUI.Aco, { show : function(opt) { if (opt) { this._options = this._applyOptions(this._options, opt); } this._init(); }, _init : function() { var opt = this._options; this.list = opt.list; this.contentClass = opt.content; this.closeClass= opt.closeClass; this.openClass= opt.openClass; this.callback = opt.callback; this.clickArea = opt.clickArea; this._setEvent(); $("." + this.contentClass).css("display","none"); this.list.find("a").removeClass(this.openClass).addClass(this.closeClass); }, _setEvent : function() { var area = (this.clickArea == null)? this.list : this.list.find(this.clickArea); area.off("click").on("click", { me : this }, function(e) { e.preventDefault(); var me = e.data.me; var mv = (me.clickArea == null)? $(this) : $(this).parents("li"); me.clickTg = mv; me._openAco(mv); }) }, _openAco : function(target){ var tg = target; var cont = tg.find("." + this.contentClass); if(!tg.data("open")){ tg.data("open",true); cont.stop().slideDown(400); tg.find("a").removeClass(this.closeClass).addClass(this.openClass); }else{ tg.data("open",false); cont.stop().slideUp(400); tg.find("a").removeClass(this.openClass).addClass(this.closeClass); } this.tg = cont; if(this.callback != null)this.callback(); }, reset : function(){ var that = this; this.list.each(function(){ var tg = $(this) var cont = tg.find("." + that.contentClass); if(tg.data("open")){ tg.find("a").removeClass(that.openClass).addClass(that.closeClass); cont.css("display","none"); tg.data("open",false); } }) } }) // �´Ñ덌¿½ï§랃¿½ UI /* * var GoogleMap = new rs.ui.GoogleMap(); * GoogleMap.show({area : $('a'), lat : " 36.905411", lng : " 128.5585426" , markerTitle : "å¯껋럥쪣��덉졃��"}); */ /* CommonUI.GoogleMap = function() { CommonUI.call(this, arguments); this._options = { area : null, lat: null, lng: null, title: null, } this.map = null; this.zoom = 12; this.marker = null; this.myLatLng = null; } CommonUI.GoogleMap.prototype = new CommonUI(); CommonUI.extend(CommonUI.GoogleMap, { show : function(opt) { if (opt) { this._options = this._applyOptions(this._options, opt); } this._init(); }, _init : function() { var opt = this._options; this.area = opt.area; this.lat = opt.lat; this.lng= opt.lng; this.title= opt.markerTitle; this.myLatLng = { lat : this.lat, lng : this.lng }; var appendBool = this.area.data("append"); if(!appendBool){ setTimeout(this._setMap(), 30); } }, _setMap : function(){ this._makeMap(); this._makeMarker(); this._makeInfo(); this._setEvent(); this.area.data("append",true); this.infowindow.open(this.map, this.marker); }, _setEvent : function() { var that = this; naver.maps.Event.addListener(that.marker, "click", function(e) { that.infowindow.open(that.map, that.marker); }); }, _makeMap : function(){ var that = this; that.map = new naver.maps.Map(this.area[0], { zoom : that.zoom, // �뺣�é뜮꾩ì몛 �ã끉�� center : new naver.maps.LatLng(that.myLatLng.lat,that.myLatLng.lng) // ï§욑¿½ï¿½ê¾©ë¿됵¿½ï¿� �ã끉�숋¿½ï¿� äº뚯눘�¼ç몴ï¿� 以ë쵐븰�ï¿� �꾩�� mapTypeControl : false, scaleControl : false, streetViewControl : false, rotateControl : false }); }, _makeInfo : function(){ var contentString = '