PageSourceSearch

https://on-nuri.co.kr/wp-content/themes/onnuri/assets/js/theme.js?ver=1790926266

js on-nuri.co.kr collected 2026-10-09 00:00:20 UTC 2,747 bytes, 81 lines download raw bytes

1/* Onnuri WP theme interaction JS
2   shared/header.js 의 initScrollToggle + initMobileNav 만 이관.
3   마크업 주입(mount)은 header.php / footer.php 가 실렌더하므로 제거.
4   정적 사이트는 여전히 shared/header.js 를 사용한다. 이 파일은 WP 전용. */
5(function(){
6
7  function initScrollToggle(){
8    var h = document.getElementById('hdr');
9    if(!h) return;
10    function s(){
11      if(window.scrollY > 40) h.classList.add('scrolled');
12      else h.classList.remove('scrolled');
13    }
14    s();
15    window.addEventListener('scroll', s, {passive: true});
16  }
17
18  function initMobileNav(){
19    var burger = document.getElementById('moBurger');
20    var closeBtn = document.getElementById('moClose');
21    var dim = document.getElementById('moDim');
22    var drawer = document.getElementById('moDrawer');
23    if(!burger || !drawer) return;
24    function open(){
25      document.body.classList.add('mo-open');
26      burger.setAttribute('aria-expanded', 'true');
27      drawer.setAttribute('aria-hidden', 'false');
28      document.body.style.overflow = 'hidden';
29    }
30    function shut(){
31      document.body.classList.remove('mo-open');
32      burger.setAttribute('aria-expanded', 'false');
33      drawer.setAttribute('aria-hidden', 'true');
34      document.body.style.overflow = '';
35    }
36    burger.addEventListener('click', function(){
37      if(document.body.classList.contains('mo-open')) shut();
38      else open();
39    });
40    if(closeBtn) closeBtn.addEventListener('click', shut);
41    if(dim) dim.addEventListener('click', shut);
42    drawer.addEventListener('click', function(e){
43      if(e.target.tagName === 'A') shut();
44    });
45    var heads = drawer.querySelectorAll('.mo-grp-h');
46    heads.forEach(function(h){
47      h.addEventListener('click', function(){
48        var grp = h.parentElement;
49        var isOpen = grp.classList.toggle('is-open');
50        h.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
51      });
52    });
53    document.addEventListener('keydown', function(e){
54      if(e.key === 'Escape' && document.body.classList.contains('mo-open')) shut();
55    });
56    window.addEventListener('resize', function(){
57      if(window.innerWidth > 960 && document.body.classList.contains('mo-open')) shut();
58    });
59  }
60
61  function initAccordion(){
62    var triggers = document.querySelectorAll('.accordion .acc-trigger');
63    triggers.forEach(function(btn){
64      btn.addEventListener('click', function(){
65        btn.closest('.acc-item').classList.toggle('open');
66      });
67    });
68  }
69
70  function boot(){
71    initScrollToggle();
72    initMobileNav();
73    initAccordion();
74  }
75
76  if(document.readyState === 'loading'){
77    document.addEventListener('DOMContentLoaded', boot);
78  } else {
79    boot();
80  }
81})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.