var myeditor = []; $(function() { $(document).on('click', '.act_back', function() { history.back(); return false; }); $(document).on('click', '.pn_paging,.pn_first,.pn_prev,.pn_next,.pn_last', function() { if (!$(this).closest('.page_navi').data('gofunc')) go_page($(this).data('page')); else eval($(this).closest('.page_navi').data('gofunc')+'('+$(this).data('page')+')'); return false; }); $(document).on('change', '.check_all', function() { $('.'+$(this).data('check')).prop('checked', $(this).prop('checked')); }); $(document).on('keyup', 'input.chknum,input.chkeng,input.chkengnum,input.chkfloat', function() { var val = $(this).val(); if ($(this).hasClass('chkeng')) $(this).val(val.replace(/[^a-z*^A-Z]/gi, '')); if ($(this).hasClass('chkengnum')) $(this).val(val.replace(/[^a-z*^A-Z*^0-9]/gi, '')); if ($(this).hasClass('chknum')) $(this).val(val.replace(/[^0-9]/gi, '')); if ($(this).hasClass('chkfloat')) $(this).val(val.replace(/[^.*^0-9]/gi, '')); }); $(document).on('keydown', 'input.calendar', function(e) { if (e.keyCode == 46) $(this).val(''); }); $(document).on('change', 'select.femail', function() { $(this).prev('input:text').val($(this).val()); if ($(this).val() == '') $(this).prev('input:text').focus(); }); $(document).on('click', '.search_address', function() { search_address($(this).closest('.addr')); return false; }); $(document).on('change', '.btn_file input', function() { $(this).parent().prev('input').val($(this).val()); }); $(document).on('click', '.act_file_add', function() { if ($(this).parent().parent().find('.in_file').length + $(this).parent().parent().find('.filelist>div').length >= parseInt($(this).data('max'))) { alert('파일 등록은 '+$(this).data('max')+'개까지 가능합니다.'); return false; } $obj = $(this).parent().clone(); $obj.find('input').val(''); $obj.find('.act_file_add').remove(); $obj.find('.act_file_del').css('display','inline-block'); $(this).parent().parent().find('.in_file:last').after($obj); return false; }); $(document).on('click', '.act_file_del', function() { $(this).parent().remove(); return false; }); $(document).on('click', '.act_submit', function() { $(this).closest('form').trigger('submit'); return false; }); $(document).on('click', '.file-download', function() { if ($(this).data('part') && $(this).data('encname') && $(this).data('filename')) { location.href = '/common/download.php?part='+$(this).data('part')+'&encname='+$(this).data('encname')+'&filename='+encodeURIComponent($(this).data('filename')); } return false; }); $(document).on('click', '.btn_file_delete', function() { var iname = $(this).closest('.filelist').parent().data('iname'); if ($(this).siblings('[name*=idno]').length > 0) { $(this).closest('.filelist').append(''); } $(this).parent().remove(); return false; }); $(document).on('click', '.btn_file_delete1', function() { var iname = $(this).closest('.filelist1').parent().data('iname'); if ($(this).siblings('[name*=idno]').length > 0) { $(this).closest('.filelist1').append(''); } $(this).parent().remove(); return false; }); $(document).on('click', '.btn_file_delete2', function() { var iname = $(this).closest('.filelist2').parent().data('iname'); if ($(this).siblings('[name*=idno]').length > 0) { $(this).closest('.filelist2').append(''); } $(this).parent().remove(); return false; }); var no = 0; $(document).on('click', '.filebox.bs3-primary button.add', function() { if ($('.filebox.bs3-primary .fileinput').length >= 5) { alert('5개까지 첨부 가능합니다.'); return false; } $obj = $(this).closest('.fileinput').clone(); $obj.find('input').val(''); $obj.find('input:file').attr('id', 'input_file'+(++no)); $obj.find('label').attr('for', 'input_file'+no); $obj.find('button.add').removeClass('add').addClass('del').text('삭제'); $('.filebox.bs3-primary .fileinput:last').after($obj); }); $(document).on('click', '.filebox.bs3-primary button.del', function() { $(this).closest('.fileinput').remove(); }); $(document).on('change', 'select.goods_category', function() { var defaults = $(this).data('idno').split('|'); var index = $(this).index('select.goods_category'); $('select.goods_category:gt('+index+')').remove(); if ($(this).val() != '') { var p_idno = $(this).val(); var lev = isNaN($(this).data('lev')) ? 2 : parseInt($(this).data('lev')) +1; var $obj = $(this); $.ajax({ type: 'post', dataType: 'json', data: {'act':'category', 'p_idno':p_idno}, url: '/common/goods/proc.php', success: function(resp) { if (resp.length > 0) { $obj.after($obj.clone()); $obj = $obj.next('select.goods_category'); $obj.data('lev', lev); $obj.find('option:gt(0)').remove(); $.each(resp, function(idx, data) { $obj.append(''); }); if (defaults.length) { $obj.find('option[value="'+defaults[index+2]+'"]').prop('selected', true); $obj.trigger('change'); } } }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); } }); $(document).on('change', '#frm_list_search input[name=ord]', function() { $('#frm_list_search').trigger('submit'); }); $(document).on('change', '#frm_list_search select[name=page_size]', function() { $('#frm_list_search').trigger('submit'); }); $(document).on('click', 'button.search', function() { $(this).next().find('input:text').focus(); }); $(document).on('keyup', 'input:text.search_text', function(e) { if (e.keyCode == 13) $(this).siblings('.act_search').trigger('click'); }); $(document).on('click', '.act_search', function() { var search_text = $.trim($(this).siblings('input:text').val()); if (search_text == '') { alert('검색어를 입력해주세요.'); $(this).siblings('input:text').focus(); return false; } else { location.href = '/search/result?text='+encodeURIComponent(search_text); } return false; }); $(document).on('click', '.goods-category button', function() { location.href = '/brands?category='+$(this).data('no'); return false; }); $(document).on('click', '.brandList>li>p', function() { if ($(this).closest('li').find('.goods-list > li').length > 0) $(this).closest('li').find('.goods-list > li:eq(0)').trigger('click'); else show_goods($(this).closest('li').find('.hideContent')); }); $(document).on('click', '.goods-list > li', function() { var $li = $(this); var idno = $li.data('idno'); var $cont = $li.closest('.hideContent'); $.ajax({ type: 'post', dataType: 'json', data: {'act':'data', 'idno':idno}, url: '/common/goods/proc.php', success: function(resp) { $cont.find('.goods-list > li').removeClass('active'); $li.addClass('active'); $cont.find('.productBanner').slick('unslick').empty(); $.each(resp.file.image, function(idx, data) { $cont.find('.productBanner').append('
'+resp.goods_name+'
'); }); $cont.find('.product_location').empty().append('
  • '+resp.category_title+'
  • '); $cont.find('.productTitle').empty().append(resp.goods_name); $cont.find('.subTtitle').empty().append(resp.sub_title); $cont.find('.productInfo').empty().append(resp.contents); $cont.find('.productInfo2').empty(); $.each(resp.info, function(idx, data) { $cont.find('.productInfo2').append('
  • - '+data.name+' : '+data.value+'
  • '); }); $cont.find('.productBanner').slick({ arrows: false, dots: true }); var t = setTimeout(function(){ show_goods($cont); }, 150); }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); }); $(document).on('click', '.act_popup_close', function() { if ($(this).closest('.lyr_popup').find('input[name=no_popup]:checked').length > 0) { setCookie( 'popup_'+$(this).closest('.lyr_popup').find('input[name=no_popup]:checked').val(), 'Y', 1); } $(this).closest('.lyr_popup').hide(); return false; }); $(document).on('change', '.lyr_popup input[name=no_popup]', function() { if ($(this).prop('checked')) { $('.act_popup_close').trigger('click'); } return false; }); $(document).ready(function() { $.each($('input.calendar'), function() { set_datepicker($(this)); }); $.each($('textarea.editor'), function() { if ($(this).attr('id')) { $script = $('