PageSourceSearch

https://commonzfield.kr/assets/controllers/base/auto_show_controller-5ac21cf2.js

js commonzfield.kr collected 2026-10-08 05:06:37 UTC 814 bytes, 23 lines download raw bytes

1import { Controller } from '@hotwired/stimulus';
2
3/**
4 * @domain UI 표시 상태
5 * @concern 자식 요소 존재 여부에 따른 표시/숨김 전환
6 * @description MutationObserver로 자식 요소의 추가·제거를 감지해 컨텐츠가 있으면 표시하고 없으면 hidden 클래스를 붙여 숨기는 컨트롤러
7 */
8export default class extends Controller {
9  connect() {
10    this.toggleVisibility();
11    this.observer = new MutationObserver(() => this.toggleVisibility());
12    this.observer.observe(this.element, { childList: true, subtree: true });
13  }
14
15  toggleVisibility() {
16    const hasContent = this.element.children.length > 0 || this.element.textContent.trim() !== '';
17    this.element.classList.toggle('hidden', !hasContent);
18  }
19
20  disconnect() {
21    this.observer.disconnect();
22  }
23}

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.