OLDBOY/skin/board/maria_event/list/list.script.php
<?php if ($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<script>
function all_checked(sw) {
    var f = document.fboardlist;
    for (var i = 0; i < f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]")
            f.elements[i].checked = sw;
    }
}

function fboardlist_submit(f) {
    var chk_count = 0;
    for (var i = 0; i < f.length; i++) {
        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
            chk_count++;
    }

    if (!chk_count) {
        alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
        return false;
    }

    if (document.pressed == "선택복사") { select_copy("copy"); return; }
    if (document.pressed == "선택이동") { select_copy("move"); return; }

    if (document.pressed == "선택삭제") {
        if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다."))
            return false;
        f.removeAttribute("target");
        f.action = g5_bbs_url + "/board_list_update.php";
    }
    return true;
}

function select_copy(sw) {
    var f = document.fboardlist;
    var sub_win = window.open("", "move", "left=50,top=50,width=500,height=550,scrollbars=1");
    f.sw.value = sw;
    f.target   = "move";
    f.action   = g5_bbs_url + "/move.php";
    f.submit();
}

jQuery(function($) {
    $(".btn_more_opt.is_list_btn").on("click", function(e) {
        e.stopPropagation();
        $(".more_opt.is_list_btn").toggle();
    });
    $(document).on("click", function(e) {
        if (!$(e.target).closest('.is_list_btn').length)
            $(".more_opt.is_list_btn").hide();
    });
});
</script>
<?php } ?>

<script>
/* ── 필터 토글 ──────────────────────────────── */
var activeFilter = null;

function toggleFilter(type) {
    var rows    = document.querySelectorAll('#listTable tbody tr[data-' + type + ']');
    var btn     = document.getElementById('btn-' + type);
    var isActive = (activeFilter === type);

    // 모든 행 초기화
    document.querySelectorAll('#listTable tbody tr').forEach(function(r){ r.style.display = ''; });
    document.querySelectorAll('.ctrl-group button').forEach(function(b){ b.classList.remove('filter-active'); });

    if (!isActive) {
        activeFilter = type;
        btn.classList.add('filter-active');
        document.querySelectorAll('#listTable tbody tr').forEach(function(r){
            if (r.dataset[type] === 'false') r.style.display = 'none';
        });
    } else {
        activeFilter = null;
    }
}

/* ── 실시간 검색 ─────────────────────────────── */
function realtimeFilter(val) {
    var kw = val.toLowerCase().trim();
    document.querySelectorAll('#listTable tbody tr[data-search]').forEach(function(r){
        r.style.display = (!kw || r.dataset.search.indexOf(kw) > -1) ? '' : 'none';
    });
}

/* ── 모달 바깥 클릭 닫기 ─────────────────────── */
$(function(){
    $('#SCH').click(function(e){ if(e.target === this) $(this).fadeOut(); });

    /* ── 메모 사이드 패널 ────────────────────────── */
    var panelStateKey  = 'upbitMemoPanelOpen';
    var panelLayoutKey = 'upbitMemoPanelLayout';
    var $spaceWrap     = $('#SPACE_WRAP');
    var $memoPanel     = $('#memo_side_panel');
    var $memoToggleBtn = $('#memoPanelToggleBtn');
    var $memoCloseBtn  = $('#memoPanelCloseBtn');
    var $memoCardList  = $('#memoCardList');
    var $memoLayoutToggle = $('#memoLayoutToggle');

    if (!$memoPanel.length) return;

    function setMemoPanelState(isOpen) {
        $memoPanel.toggleClass('open', isOpen).attr('aria-hidden', isOpen ? 'false' : 'true');
        $spaceWrap.toggleClass('memo-open', isOpen);
        $memoToggleBtn.toggleClass('active', isOpen);
        try { localStorage.setItem(panelStateKey, isOpen ? '1' : '0'); } catch(e) {}
    }

    function setMemoLayout(layout) {
        var next = (layout === '2') ? '2' : '1';
        $memoCardList.removeClass('layout-1 layout-2').addClass('layout-' + next);
        $memoLayoutToggle.toggleClass('is-layout-2', next === '2').attr('aria-pressed', next === '2' ? 'true' : 'false');
        try { localStorage.setItem(panelLayoutKey, next); } catch(e) {}
        updateMemoScrollState();
    }

    function updateMemoScrollState() {
        if (!$memoCardList.length) return;
        var hasScroll = $memoCardList[0].scrollHeight > $memoCardList[0].clientHeight + 1;
        $memoCardList.toggleClass('has-scroll', hasScroll);
    }

    // 저장된 상태 복원
    var savedOpen   = '0';
    var savedLayout = '1';
    try { savedOpen   = localStorage.getItem(panelStateKey)  || '0'; } catch(e) {}
    try { savedLayout = localStorage.getItem(panelLayoutKey) || '1'; } catch(e) {}
    setMemoPanelState(savedOpen === '1');
    setMemoLayout(savedLayout);

    $memoToggleBtn.on('click', function() {
        setMemoPanelState(!$memoPanel.hasClass('open'));
    });

    $memoCloseBtn.on('click', function() {
        setMemoPanelState(false);
    });

    $memoLayoutToggle.on('click', function() {
        var next = $memoCardList.hasClass('layout-2') ? '1' : '2';
        setMemoLayout(next);
    });

    setTimeout(updateMemoScrollState, 0);
    $(window).on('resize', updateMemoScrollState);
});
</script>