PageSourceSearch

https://proparcel.com/static/js/layout/layout_manager.js

js proparcel.com collected 2026-09-24 14:51:20 UTC 3,948 bytes, 132 lines download raw bytes

1/**
2 * ProParcel - Layout Manager
3 * Modern layout sistemini yöneten merkezi JavaScript modülü
4 */
5
6(function() {
7  'use strict';
8
9  // Layout Manager
10  const LayoutManager = {
11    // Elements
12    sidebar: null,
13    sidebarOverlay: null,
14    header: null,
15    main: null,
16    
17    // State
18    sidebarOpen: false,
19    
20    // Initialize
21    init() {
22      this.cacheElements();
23      this.attachEventListeners();
24      this.updateViewportHeight();
25    },
26    
27    // Cache DOM elements
28    cacheElements() {
29      this.sidebar = document.getElementById('sidebar') || document.querySelector('.pp-sidebar');
30      this.sidebarOverlay = document.getElementById('sidebar-overlay') || document.querySelector('.pp-sidebar-overlay');
31      this.header = document.querySelector('.pp-header');
32      this.main = document.querySelector('.pp-main') || document.getElementById('main-content');
33    },
34    
35    // Attach event listeners
36    attachEventListeners() {
37      // Sidebar overlay click event kaldırıldı - overlay kullanılmıyor
38      // Haritaya tıklanabilsin diye overlay tıklama event'i yok
39      
40      // Escape key - close sidebar
41      document.addEventListener('keydown', (e) => {
42        if (e.key === 'Escape' && this.sidebarOpen) {
43          this.closeSidebar();
44        }
45      });
46      
47      // Window resize - update viewport height
48      window.addEventListener('resize', () => {
49        this.updateViewportHeight();
50      });
51      
52      // Observe sidebar class changes (for compatibility with existing code)
53      if (this.sidebar) {
54        const observer = new MutationObserver((mutations) => {
55          mutations.forEach((mutation) => {
56            if (mutation.attributeName === 'class') {
57              const isActive = this.sidebar.classList.contains('active');
58              this.sidebarOpen = isActive;
59              this.syncOverlay();
60            }
61          });
62        });
63        
64        observer.observe(this.sidebar, { attributes: true });
65      }
66    },
67    
68    // Open sidebar
69    openSidebar() {
70      if (this.sidebar) {
71        this.sidebar.classList.add('active');
72        this.sidebarOpen = true;
73        this.syncOverlay();
74        document.body.classList.add('pp-no-scroll');
75      }
76    },
77    
78    // Close sidebar
79    closeSidebar() {
80      if (this.sidebar) {
81        this.sidebar.classList.remove('active');
82        this.sidebarOpen = false;
83        this.syncOverlay();
84        document.body.classList.remove('pp-no-scroll');
85      }
86    },
87    
88    // Toggle sidebar
89    toggleSidebar() {
90      if (this.sidebarOpen) {
91        this.closeSidebar();
92      } else {
93        this.openSidebar();
94      }
95    },
96    
97    // Sync overlay with sidebar state
98    syncOverlay() {
99      // Overlay kaldırıldı - kullanıcı haritaya tıklayabilmeli
100      // Sidebar açıkken haritaya tıklamaya engel olmaması için overlay eklenmez
101      return;
102    },
103    
104    // Update CSS custom property for viewport height (mobile fix)
105    updateViewportHeight() {
106      const vh = window.innerHeight * 0.01;
107      document.documentElement.style.setProperty('--vh', `${vh}px`);
108    }
109  };
110  
111  // Auto-initialize when DOM is ready
112  // 200ms gecikme ile init - parcel_query_buttons_sync.js'in wrap'ini bekle
113  if (document.readyState === 'loading') {
114    document.addEventListener('DOMContentLoaded', () => {
115      setTimeout(() => {
116        LayoutManager.init();
117      }, 200);
118    });
119  } else {
120    setTimeout(() => {
121      LayoutManager.init();
122    }, 200);
123  }
124  
125  // Expose globally for compatibility with existing code
126  window.LayoutManager = LayoutManager;
127  
128  // Backward compatibility DEVRE DIŞI
129  // layout_manager.js'in toggleSidebar wrap'i kaldırıldı
130  // Sebep: parcel_query_buttons_sync.js zaten wrap ediyor ve çifte çağrıya neden oluyor
131  
132})();

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.