$(function() { $(document).on('click', '.no_auth', function() { alert('권한이 없습니다.'); return false; }); $(document).on('click', '.no_authM', function() { alert('회원만 가능합니다. 로그인을 해주세요.'); return false; }); $(document).on('click', '.no_authA', function() { alert('관리자만 가능합니다.'); return false; }); $(document).on('click', '.btn_ord', function() { var ord = $(this).hasClass('init') ? '' : $(this).data('fld')+($(this).hasClass('down') ? ' DESC' : ''); $('#frm_search input[name=ord]').val(ord).closest('form').submit(); return false; }); $(document).on('click', '.act_board_search', function() { $(this).closest('form').submit(); return false; }); $(document).on('click', '.act_save', function() { $('#frm_write').submit(); return false; }); $(document).on('submit', '#frm_write', function() { get_editor_contents(); if (form_val_chk($(this))) { $(this).attr({target:'_self', action:'/common/board/proc.php'}); return true; } return false; }); $(document).on('click', '.board_secretY', function() { pop_password($(this).data('idno'), $(this).attr('href'), $(this).hasClass('act_delete') ? 'delete' : ''); return false; }); $(document).on('click', '.act_delete:not(.board_secretY)', function() { var idno = $(this).data('idno'); var goto = $(this).attr('href'); if (confirm('삭제하시겠습니까?')) { $.ajax({ type: 'post', dataType: 'json', data: {s:'1', m:'journal', act:'delete', idno:idno}, url: '/common/board/proc.php', success: function(resp) { if (resp.message != '') alert(resp.message); if (resp.result == 'success') { if (goto == '#') location.reload(); else location.href = goto; } }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); } return false; }); $(document).on('click', '.act_password', function() { $('#frm_board_password').submit(); return false; }); $(document).on('submit', '#frm_board_password', function() { if (form_val_chk($(this))) { $(this).attr({action:'/common/board/proc.php'}); return true; } return false; }); $(document).on('click', '.act_reply_save', function() { $('#frm_reply').submit(); return false; }); $(document).on('submit', '#frm_reply', function() { if (form_val_chk($(this))) { $.ajax({ type: 'post', dataType: 'json', data: $('#frm_reply').serialize(), url: '/common/board/proc.php', success: function(resp) { if (resp.message != '') alert(resp.message); if (resp.result == 'success') { location.reload(); } }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); } return false; }); $(document).on('change', 'input[name=link_url_yn]', function() { $('input[name=link_url]').removeClass('req'); $('textarea[name=contents]').removeClass('req'); if ($(this).val() == 'Y') { $('input[name=link_url]').addClass('req'); $('#cont_link_url').show(); $('#cont_contents').hide(); } else { $('textarea[name=contents]').addClass('req'); $('#cont_link_url').hide(); $('#cont_contents').show(); } }); $(document).on('click', '.tab.category button', function() { var idno = $(this).data('idno'); $('#frm_search input[name=category_idno]').val(idno); $('#frm_search').trigger('submit'); return false; }); $(document).ready(function() { if ($('input[name=link_url_yn]:checked').length > 0) $('input[name=link_url_yn]:checked').trigger('change'); if ($('iframe._proc_hidden').length < 1) $('body').append(''); }); function pop_noauth() { var contents = '
'+ '

권한이 없습니다.

'+ '
'; popup('board_password', '알림', contents, ''); } function pop_password(idno, goto, proc) { var contents = ''+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
'+ '

글 등록시 입력한 비밀번호를 입력해 주세요.

'+ '
'+ ' '+ ' 확인'+ '
'+ '
'; '
'; popup('board_password', '비밀번호확인', contents, 'data-idno="'+idno+'" data-goto="'+goto+'" data-proc="'+proc+'"'); } });