$(document).ready(function(){ $(".btn_next, .btn_prev").click(function(e){e.preventDefault()}); // ¸Ç À§·Î °¡±â $('.btn_top').click(function(e){ e.preventDefault(); $(window).scrollTop(0); }); // Åä±Û ¿­°í ´Ý±â °øÅë ½ºÅ©¸³Æ® $('a.tog_open').click(function(e){ e.preventDefault(); $( $(this).attr('href') ).toggle(); }); // °øÅë ÅÇ ¸Þ´º $('.in_tabs').each(function(){ var active, content, links = $(this).find('a'); active = links.first().parents('li').addClass('on'); content = $(active.children('a').attr('href')); links.not(':first').each(function () { $($(this).attr('href')).hide(); }); $(this).on('click', 'a', function(e){ active.removeClass('on'); content.hide(); active = $(this).parents('li'); content = $($(this).attr('href')); active.addClass('on'); content.show(); e.preventDefault(); }); }); var fontSize = getCookie('fontSize'); var font_basic = 16; //±Û¾¾Å©±â ÀÛ°Ô(±âº») $("#btn_fs_dn").on('click',function(){ if(font_basic > 10){ font_basic = Number(font_basic) - 2; $(".view_body").css('font-size',font_basic+'px'); setCookie('fontSize',font_basic,1); } }); //±Û¾¾Å©±â Å©°Ô $("#btn_fs_up").on('click',function(){ if(font_basic < 20){ font_basic = Number(font_basic) + 2; $(".view_body").css('font-size',font_basic+'px'); setCookie('fontSize',font_basic,1); } }); $('a.modal_open').click(function(e){ // a ű׿¡ Ŭ·¡½º¸¦ ÁÖ¾úÀ» ¶§ ¸ð´Þ ¿­±â e.preventDefault(); modalName = $(this).attr('href'); modal_open(modalName); }); $('a.m_modal_open').click(function(e){ // Àüüȭ¸é ²Ë Â÷´Â ¸ð¹ÙÀÏ¿ë ¸ð´Þâ e.preventDefault(); modalName = $(this).attr('href'); m_modal_open(modalName); }); $('.modal .btn_close').click(function(e){ // ¸ð´Þ ¹öÆ° ´Ý±â e.preventDefault(); modal_close(); false; }); }); function tabs(id) { /* ¸ÞÀο¡¼­¸¸ »ç¿ëÇÏ´Â tab½ºÅ©¸³Æ® */ $('#'+id).each(function(){ var active, content, links = $(this).find('a'); var first_on = false; for(i=0; i< links.first().parent().parent().find( "li" ).length; i++){ if(links.first().parent().parent().find( "li:nth-of-type("+(i+1)+")" ).hasClass('on')){ //console.log(i); first_on = true; active = links.parents("li:nth-of-type("+(i+1)+")"); break; } } if(first_on != true){ active = links.first().parents('li').addClass('on'); } content = $(active.children('a').attr('href')); //console.log(content); /*links.not(':first').each(function () { $($(this).attr('href')).hide(); });*/ $(this).on('click', 'a', function(e){ active.removeClass('on'); content.hide(); active = $(this).parents('li'); content = $($(this).attr('href')); active.addClass('on'); content.show(); e.preventDefault(); $('.swiper-container').height( $(this).parents('.page_wrap_in').height() + 20); }); }); } /* ÄíÅ°»ý¼ºÇÔ¼ö */ function setCookie(name,value,expiredays) { var todayDate = new Date(); todayDate.setDate( todayDate.getDate() + expiredays ); if(document.location.protocol == 'https:'){ document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + "; SameSite=None; Secure"; }else{ document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"; } } function setCookie_all(name,value,expiredays) { var todayDate = new Date(); todayDate.setDate( todayDate.getDate() + expiredays ); if(document.location.protocol == 'https:'){ document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + "; SameSite=None; Secure; domain=.daily.co.kr"; }else{ document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + "; domain=.daily.co.kr"; } } //ÄíÅ°°ª°¡Á®¿À±â function getCookie (cookieName) { var cookieValue = null; var posName = document.cookie.indexOf(escape(cookieName) + '='); if (posName != -1) { var posValue = posName + (escape(cookieName) + '=').length; var endPos = document.cookie.indexOf(';', posValue); if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos)); else cookieValue = unescape(document.cookie.substring(posValue)); } return cookieValue; } //ÄíÅ°»èÁ¦ function deleteCookie(name) { var expdate = new Date(); // Delete the named cookie. expdate.setTime(expdate.getTime() - (1000 * 60 * 60 * 24 * 30 * 12 )); setCookie(name, "", expdate); } /*À§Ä¡ Á¤º¸ ¼öÁý*/ var nav = null; function requestPosition() { if (nav == null) { nav = window.navigator; } var geoloc = nav.geolocation; if (geoloc != null) { geoloc.getCurrentPosition(successCallback, errorCallback); } } function successCallback(position) { //alert(position.coords.latitude+'|'+position.coords.longitude); //setCookie_all('Myposition', position.coords.latitude+'|'+position.coords.longitude, 30); location.href = '/weather/?p=myposition&latitude='+position.coords.latitude+'&longitude='+position.coords.longitude+'&gourl='+encodeURIComponent(document.location.href); /* $.ajax({ url:'/weather/?p=myposition&latitude='+position.coords.latitude+'&longitude='+position.coords.longitude, type:'get', dataType:'html', error:function(){ alert('Á˼ÛÇÕ´Ï´Ù. Åë½Å ¿À·ù ÀÔ´Ï´Ù.'); }, success:function(obj){ //alert(obj); //setCookie_all('Myposition', obj, 30); ¾ÆÀÛ½º¿¡¼­ ÄíÅ°»ý¼ºÇÑ´Ù } }); var reloadurl = document.location.href; if(reloadurl.indexOf("meopen=ok") == -1){ if(reloadurl.indexOf("?") == -1){ reloadurl += '?meopen=ok'; }else{ reloadurl += '&meopen=ok'; } } //alert(reloadurl); location.href = reloadurl; */ } function post_ajax(url, param, callback){ $.ajax({ url : url, data : param, type : "POST", dataType:'html', error : function(r){ //alert('ajax error'); }, success : function(aData){ callback(aData); } }); } //[ÁÁ¾Æ¿ä]¿¡ ºÒµé¾î¿À°Ô ÇÏ´Â ±â´ÉÀ¸·Î list, read µÑ ´Ù »ç¿ë. function painting_good(goods_id){ var goods_data = getLocalStorage("goods_" + goods_id); if(goods_data){ var d = goods_data.split('|'); for(var i=0; i 0){ $("#"+d[i]).addClass("on"); } } } } /* °øÅë ¸ð´Þâ ½ºÅ©¸³Æ® */ $(window).bind('load resize scroll',function(){ winScroll = $(this).scrollTop(); }); var winScroll; var modalOverlay; function modal_open(modalName) { modal = $(modalName); modalBody = $(modal).children('.modal_wrap'); modalW = modalBody.outerWidth(); modalH = modalBody.outerHeight(); modalOverlay = $('.modal_bg'); if ( modalH >= $(window).height() ) { modalBody.css({ 'top':'50px', 'left':'50%', 'margin-left':-modalW/2, 'margin-top':'auto' }); modalOverlay.height(modalH+100); modal.addClass('modalScroll'); } else { modalBody.css({ 'top':'50%', 'left': '50%', 'margin-left':-modalW/2, 'margin-top':-modalH/2 }); } $('body').addClass('winFix'); $('#wrap').addClass('modalFix').css('top',-winScroll); $(modal).stop().fadeIn(150); } function modal_close() { // ¸ð´Þ ´Ý±â °øÅë winTop = Math.abs(parseInt($('#wrap').css('top'))); modal.fadeOut(100); modal.removeClass('modalScroll'); $('body').removeClass('winFix winOverflow'); $('#wrap').removeClass('modalFix').css('top',''); if(modalOverlay!=undefined) { modalOverlay.height(''); modalBody.attr('style',''); } $(window).scrollTop(winTop); winTop = 0; } // ¸ð¹ÙÀÏ ¸ð´Þ ¿­±â °øÅë function m_modal_open(modalName) { modal = $(modalName); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â winScroll = $(this).scrollTop(); $(modal).stop().show(); $('#wrap').addClass('modalFix').css('top',-winScroll); // ½ºÅ©·Ñ¹Ù ¸·°í, »çÀÌÁî °íÁ¤ $('body').addClass('winOverflow'); // body¿¡ ½ºÅ©·Ñ¹Ù ¸·±â } // ¸ð¹ÙÀÏ ¸ð´Þ ¿­±â °øÅë function m_modal_close(modalName) { modal = $(modalName); // ¸ð´Þâ ID°ªÀ¸·Î ¿­±â $(modal).hide(); $('#wrap').removeClass('modalFix').css('top',-winScroll); // ½ºÅ©·Ñ¹Ù ¸·°í, »çÀÌÁî °íÁ¤ $('body').removeClass('winOverflow'); // body¿¡ ½ºÅ©·Ñ¹Ù ¸·±â } var news_link_target = 'self';//´º½º¸µÅ© »óÅ //ÆäÀÌÁöºä Ä«¿îÆà ´ÙÀÌ·ºÆ® ¹öÁ¯ function outlink_pv(pvurl){ if(news_link_target == 'self'){ event.stopPropagation(); //event.preventDefault(); if(event.target.tagName.toLowerCase() != 'a'){ if(event.target.parentElement.tagName.toLowerCase() == 'a'){ //alert(event.target.parentElement.href); event.target.parentElement.href = pvurl+'&url='+encodeURIComponent(event.target.parentElement.href); }else if(event.target.parentElement.parentElement.tagName.toLowerCase() == 'a'){ //alert(event.target.parentElement.parentElement.href); event.target.parentElement.parentElement.href = pvurl+'&url='+encodeURIComponent(event.target.parentElement.parentElement.href); }else if(event.target.parentElement.parentElement.parentElement.tagName.toLowerCase() == 'a'){ //alert(event.target.parentElement.parentElement.parentElement.href); event.target.parentElement.parentElement.parentElement.href = pvurl+'&url='+encodeURIComponent(event.target.parentElement.parentElement.parentElement.href); } }else if(event.target.tagName.toLowerCase() == 'a'){ event.target.href = pvurl+'&url='+encodeURIComponent(event.target.href); } setMainStorageTime(); }else{ proc.location.href = pvurl; setMainStorageTime(); } } /* $(".tagetcheck").onclick(function(e) { e.preventDefault(); alert($(this).attr("href")); }); */ //ÆäÀÌÁöºä Ä«¿îÆà ´ÙÀÌ·ºÆ® ¹öÁ¯ function outlink_pv_sub(pvurl){ proc.location.href = pvurl; } function tagetset(){ var os_UserAgent = navigator.userAgent.toLowerCase(); var os_BlockDevice1 = os_UserAgent.indexOf("iphone"); var os_BlockDevice2 = os_UserAgent.indexOf("ipad"); var os_BlockDevice = os_BlockDevice1 + os_BlockDevice2; if(os_BlockDevice == -2){ //¾ÆÀÌÆùÀÌ ¾Æ´Ò°æ¿ì´Â »õâ ¸µÅ© $('.tagetcheck').attr("target", "_blank"); news_link_target = 'blank';//´º½º¸µÅ© »óÅ } } function setMainStorageTime(){ newtime = new Date(); var dbtime = getLocalStorage('MainStorageTime');//ÀúÀåÇصРŸÀÓ //¸ÞÀÎ ½ºÅ丮Áö ŸÀÓ ÁöÁ¤ -> 5ºÐÀÌ ³ÑÀ¸¸é ½ºÅ丮Áö Àç»ý¼º ÇÑ´Ù if(!dbtime || Math.ceil((newtime.getTime() - dbtime) / 60000) > 2){ //console.log('Àç»ý¼º'); setLocalStorage('MainStorageTime', newtime.getTime()); if(Swiperdatas.category){ for(var i in Swiperdatas.category) { delete localStorage[Swiperdatas.category[i]];//¸ÞÀÎ ·ÎÄýºÅ丮Áö Á¦°Å } } } } function getInternetExplorerVersion() { var rv = -1; // Return value assumes failure. if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat(RegExp.$1); } return rv; } function formatCurrency_social(amount){ amount = new String(amount); var amountLength = amount.length; var modulus = amountLength % 3; var currencyString = amount.substr(0,modulus); for(i=modulus; i 0){ alert('ÁÁ¾Æ¿ä Çϼ̽À´Ï´Ù.'); $("#goods_"+countid+" span").html(parseInt($("#goods_"+countid+" span").html())+1); $("#goods_"+countid).addClass("on"); var delStorage = param.cate; delete localStorage[delStorage]; }else{ alert('ÀÌ¹Ì ÁÁ¾Æ¿ä Çϼ̽À´Ï´Ù.'); } }); var goods_id = document.cookie.indexOf('user[id]'); if(goods_id < 0){ goods_id = "guest"; }else{ goods_id = document.cookie.substr(goods_id); var startNo = goods_id.indexOf("=") + 1; var lastNo = goods_id.indexOf(";") - startNo; goods_id = goods_id.substr(startNo, lastNo); } var get_goods_id = getLocalStorage("goods_" + goods_id); if( !get_goods_id ){ //ajax È£Ãâ post_ajax('/reply/?p=click_ajax', {mode : 'goodlist'}, function(aData){ setLocalStorage("goods_" + goods_id, aData); }); }else{ if(get_goods_id=='no_data'){ get_goods_id=''; }else{ get_goods_id += '|'; } setLocalStorage("goods_" + goods_id, get_goods_id + "goods_" + param.cate + param.tb_date + param.uniqids); } } function add_good(param, countid){ post_ajax('/reply/?p=click_ajax', param, function (data){ if(data.length > 0){ alert('ÁÁ¾Æ¿ä Çϼ̽À´Ï´Ù.'); $("#"+countid).html(parseInt($("#"+countid).html())+1); $("#"+countid).parent().addClass("on"); var delStorage = param.cate; delete localStorage[delStorage]; }else{ alert('ÀÌ¹Ì ÁÁ¾Æ¿ä Çϼ̽À´Ï´Ù.'); } }); var goods_id = document.cookie.indexOf('user[id]'); if(goods_id < 0){ goods_id = "guest"; }else{ goods_id = document.cookie.substr(goods_id); var startNo = goods_id.indexOf("=") + 1; var lastNo = goods_id.indexOf(";") - startNo; goods_id = goods_id.substr(startNo, lastNo); } var get_goods_id = getLocalStorage("goods_" + goods_id); if( !get_goods_id ){ //ajax È£Ãâ post_ajax('/reply/?p=click_ajax', {mode : 'goodlist'}, function(aData){ setLocalStorage("goods_" + goods_id, aData); }); }else{ if(get_goods_id=='no_data'){ get_goods_id=''; }else{ get_goods_id += '|'; } setLocalStorage("goods_" + goods_id, get_goods_id + "goods_" + param.cate + param.tb_date + param.uniqids); } } function get_ajax(url, param, callback){ $.ajax({ url : url, data : param, type : "GET", dataType:'html', error : function(r){ //alert('ajax error'); }, success : function(aData){ callback(aData); } }); }