1// Menü bar kontrolü: Unified Action Bar - Basit/Pro tema geçiÅi 2(function(){ 3 // Global mod yardımcıları: TKGM/Pro modu 2D/3D'den baÄımsız 4 if (typeof window.isTkgmModeActive !== 'function') { 5 window.isTkgmModeActive = function(){ return !!window.IS_TKGM_MODE; }; 6 } 7 if (typeof window.isProModeActive !== 'function') { 8 window.isProModeActive = function(){ return !window.IS_TKGM_MODE; }; 9 } 10 11 function clearModeDataAndDrawings(){ 12 // Butonları resetle (parameters) 13 try { window.parametersButtonManager?.resetAllParametersButtons?.(); } catch(_) {} 14 15 // Ãizimleri temizle: parsel özel temizliÄi 16 const map = window.mapManager?.getCurrentMap?.(); 17 if (map && typeof map.getLayer === 'function') { 18 const emptyFC = { type:'FeatureCollection', features: [] }; 19 const ids = ['parcel_polygon']; 20 ids.forEach(id => { 21 try { if (map.getLayer(id)) map.setLayoutProperty(id, 'visibility', 'none'); } catch(_) {} 22 try { if (map.getSource(id) && map.getSource(id).setData) map.getSource(id).setData(emptyFC); } catch(_) {} 23 }); 24 25 // Yükselti görünümü katmanlarını temizle 26 const elevationLayerIds = ['parcel_elevation_view_all', 'parcel_elevation_view_all-fill', 27 'quarter_elevation_view_all', 'quarter_elevation_view_all-fill']; 28 elevationLayerIds.forEach(id => { 29 if (map.getLayer(id)) { 30 map.setLayoutProperty(id, 'visibility', 'none'); 31 } 32 if (map.getSource(id) && map.getSource(id).setData) { 33 map.getSource(id).setData(emptyFC); 34 } 35 }); 36 37 // Global veriyi temizle 38 if (window.globalLayers) { 39 delete window.globalLayers['parcel_elevation_view_all']; 40 delete window.globalLayers['quarter_elevation_view_all']; 41 } 42 window.currentElevationViewData = null; 43 window.currentQuarterElevationViewData = null; 44 45 // clearElevationView fonksiyonunu çaÄır (eÄer varsa) 46 if (typeof window.clearElevationView === 'function') { 47 window.clearElevationView(); 48 } 49 } 50 51 // Parcel butonu görsel durumunu pasife çek 52 try { window.geolocationManager?.setParcelButtonActive(false); } catch(_) {} 53 } 54 55 // Araç kutusu / ölçüm / kullanıcı çizimleri â parsel poligon katmanına dokunmaz 56 window.ppClearMapOverlaysKeepParcel = function(){ 57 try { window.mapAnnotationManager?.clearAll?.(); } catch(_) {} 58 try { window.measurementManager?.clearMeasurements?.(); } catch(_) {} 59 try { window.UserAdding?.clearDrawingOnly?.(); } catch(_) {} 60 }; 61 62 // Tüm çizimleri temizle (parsel sorgu sonuçlarını etkilemez) 63 window.ppClearAllDrawings = function(){ 64 try { window.ppClearMapOverlaysKeepParcel?.(); } catch(_) {} 65 try { window.proParcelApp?.clearAllDrawings?.(); } catch(_) {} 66 }; 67 68 // Action bar refresh: ekrandaki parselleri ve çizimleri temizle 69 window.ppActionBarRefreshClear = function(){ 70 try { if (typeof window.clearAllMultipleParcels === 'function') window.clearAllMultipleParcels(); } catch(_) {} 71 try { window.ppClearAllDrawings?.(); } catch(_) {} 72 try { window.parametersButtonManager?.resetAllParametersButtons?.(); } catch(_) {} 73 }; 74 75 // Mod butonu hover/tıklama UX düzeltmesi için durum deÄiÅkenleri 76 let __modeBtnHovering = false; 77 let __pendingModeVisual = null; 78 79 // Mod butonu görselini (ön/arka yüz metni) moda göre ayarla 80 function applyModeButtonVisual(modBtn, mode){ 81 if (!modBtn) return; 82 if (mode === 'pro') { 83 modBtn.setAttribute('data-front','ð´ Pro Analiz'); 84 modBtn.setAttribute('data-back','â« Basit Sorgu'); 85 modBtn.textContent = 'ð´ Pro Analiz'; 86 } else { 87 modBtn.setAttribute('data-front','â« Basit Sorgu'); 88 modBtn.setAttribute('data-back','ð´ Pro Analiz'); 89 modBtn.textContent = 'â« Basit Sorgu'; 90 } 91 } 92 93 function scheduleModeButtonVisual(mode){ 94 const modBtn = document.getElementById('modeSwitchBtn') || document.getElementById('modButonu'); 95 if (!modBtn) return; 96 if (__modeBtnHovering) { 97 __pendingModeVisual = mode; 98 } else { 99 applyModeButtonVisual(modBtn, mode); 100 __pendingModeVisual = null; 101 } 102 } 103 104 // Unified bar tema geçiÅi: mode-simple (beyaz) <-> pro (lacivert) 105 function setBarTheme(isSimple){ 106 const bar = document.getElementById('top-button-container'); 107 const toolbar = document.getElementById('top-menu-bar'); 108 if (bar) { 109 if (isSimple) { 110 bar.classList.add('mode-simple'); 111 } else { 112 bar.classList.remove('mode-simple'); 113 } 114 } 115 if (toolbar) { 116 if (isSimple) { 117 toolbar.classList.add('mode-simple'); 118 } else { 119 toolbar.classList.remove('mode-simple'); 120 } 121 } 122 syncToolbarModeButtons(); 123 } 124 125 function syncToolbarModeButtons(){ 126 const isTkgm = !!window.IS_TKGM_MODE; 127 const clickOn = !!window.enableMapClick; 128 const proBtn = document.getElementById('toolbarModeProBtn'); 129 const mapClickBtn = document.getElementById('toggleMapClick'); 130 const simpleActive = isTkgm && clickOn; 131 const proActive = !isTkgm && clickOn; 132 133 if (mapClickBtn) { 134 mapClickBtn.classList.toggle('active', simpleActive); 135 mapClickBtn.title = simpleActive 136 ? 'Tıklama Modunu Kapat' 137 : (isTkgm ? 'Tıklama Modu (Cursor)' : 'Basit Sorguya Geç'); 138 } 139 if (proBtn) { 140 proBtn.classList.toggle('active', proActive); 141 proBtn.title = proActive 142 ? 'Tıklama Modunu Kapat' 143 : 'Pro Analize Geç'; 144 } 145 } 146 window.ppSyncToolbarModeButtons = syncToolbarModeButtons; 147 148 function setToolbarMapClickEnabled(wantOn){ 149 const target = !!wantOn; 150 if (!!window.enableMapClick === target) { 151 syncToolbarModeButtons(); 152 return; 153 } 154 try { window.toggleMapClick && window.toggleMapClick(); } catch(_) {} 155 syncToolbarModeButtons(); 156 } 157 158 /** Pro oturumundan sonra basit map-click'e geçerken tüm Pro kalıntılarını sil. */ 159 function forceEnterSimpleMapClickMode(){ 160 if (!window.IS_TKGM_MODE) {
161 try { window.toggleTopMenus && window.toggleTopMenus(); } catch(_) {} 162 } 163 try { window.IS_TKGM_MODE = true; } catch(_) {} 164 try { setBarTheme(true); } catch(_) {} 165 try { scheduleModeButtonVisual('tkgm'); } catch(_) {} 166 // Ãnce kapat: eski Pro click handler / intent temizlensin 167 try { window.ppDisableMapClickMode && window.ppDisableMapClickMode(); } catch(_) {} 168 try { window.__ppMapClickQueryMode = 'simple'; } catch(_) {} 169 try { window.__ppForceProLoader = false; } catch(_) {} 170 try { window.__ppUseAnimatedLoader = false; } catch(_) {} 171 setToolbarMapClickEnabled(true); 172 const mapClickBtn = document.getElementById('toggleMapClick'); 173 const proBtn = document.getElementById('toolbarModeProBtn'); 174 try { if (mapClickBtn) mapClickBtn.classList.add('active'); } catch(_) {} 175 try { if (proBtn) proBtn.classList.remove('active'); } catch(_) {} 176 syncToolbarModeButtons(); 177 } 178 179 function forceEnterProMapClickMode(){ 180 if (window.IS_TKGM_MODE) { 181 try { window.toggleTopMenus && window.toggleTopMenus(); } catch(_) {} 182 } 183 try { window.IS_TKGM_MODE = false; } catch(_) {} 184 try { setBarTheme(false); } catch(_) {} 185 try { scheduleModeButtonVisual('pro'); } catch(_) {} 186 try { window.ppDisableMapClickMode && window.ppDisableMapClickMode(); } catch(_) {} 187 try { window.__ppMapClickQueryMode = 'pro'; } catch(_) {} 188 setToolbarMapClickEnabled(true); 189 const mapClickBtn = document.getElementById('toggleMapClick'); 190 const proBtn = document.getElementById('toolbarModeProBtn'); 191 try { if (proBtn) proBtn.classList.add('active'); } catch(_) {} 192 try { if (mapClickBtn) mapClickBtn.classList.remove('active'); } catch(_) {} 193 syncToolbarModeButtons(); 194 } 195 196 window.ppToolbarProModeClick = function(){ 197 if (typeof window.ppRequireAuth === 'function' && !window.ppRequireAuth()) return; 198 const isTkgm = !!window.IS_TKGM_MODE; 199 const clickOn = !!window.enableMapClick; 200 const proArmed = !isTkgm && clickOn && window.__ppMapClickQueryMode === 'pro'; 201 202 // Zaten Pro tıklama modundaysa kapat 203 if (proArmed || (!isTkgm && clickOn && document.getElementById('toolbarModeProBtn')?.classList.contains('active'))) { 204 setToolbarMapClickEnabled(false); 205 try { window.__ppMapClickQueryMode = null; } catch(_) {} 206 syncToolbarModeButtons(); 207 return; 208 } 209 210 forceEnterProMapClickMode(); 211 }; 212 213 window.ppToolbarMapClickOrSimple = function(){ 214 if (typeof window.ppRequireAuth === 'function' && !window.ppRequireAuth()) return; 215 const isTkgm = !!window.IS_TKGM_MODE; 216 const clickOn = !!window.enableMapClick; 217 const simpleArmed = isTkgm && clickOn && ( 218 window.__ppMapClickQueryMode === 'simple' || 219 document.getElementById('toggleMapClick')?.classList.contains('active') 220 ); 221 222 // Zaten Basit tıklama modundaysa kapat 223 if (simpleArmed) { 224 setToolbarMapClickEnabled(false); 225 try { window.__ppMapClickQueryMode = null; } catch(_) {} 226 syncToolbarModeButtons(); 227 return; 228 } 229 230 // Pro oturumu sonrası dahil: her zaman temiz Basit map-click'e geç 231 forceEnterSimpleMapClickMode(); 232 }; 233 234 function ensureToolbarModeProBtn(){ 235 const mapClickBtn = document.getElementById('toggleMapClick'); 236 if (!mapClickBtn) return null; 237 238 if (!mapClickBtn.__ppModeBound) { 239 mapClickBtn.__ppModeBound = true; 240 mapClickBtn.removeAttribute('onclick'); 241 mapClickBtn.addEventListener('click', function(e){ 242 e.preventDefault(); 243 e.stopPropagation(); 244 try { window.ppToolbarMapClickOrSimple && window.ppToolbarMapClickOrSimple(); } catch(_) {} 245 }); 246 } 247 248 let proBtn = document.getElementById('toolbarModeProBtn'); 249 if (proBtn) { 250 const icon = proBtn.querySelector('i.pp-toolbar-mode-icon, i.fa-mouse-pointer'); 251 if (!icon || !icon.classList.contains('fa-mouse-pointer')) { 252 proBtn.innerHTML = '<i class="fa fa-mouse-pointer pp-toolbar-mode-icon" aria-hidden="true"></i>'; 253 } 254 if (!proBtn.__ppModeBound) { 255 proBtn.__ppModeBound = true; 256 proBtn.removeAttribute('onclick'); 257 proBtn.addEventListener('click', function(e){ 258 e.preventDefault(); 259 e.stopPropagation(); 260 try { window.ppToolbarProModeClick && window.ppToolbarProModeClick(); } catch(_) {} 261 }); 262 } 263 return proBtn; 264 } 265 266 proBtn = document.createElement('button'); 267 proBtn.id = 'toolbarModeProBtn'; 268 proBtn.type = 'button'; 269 proBtn.className = 'toggle-btn pp-toolbar-mode-pro-btn'; 270 proBtn.title = 'Pro Analize Geç'; 271 proBtn.setAttribute('aria-label', 'Pro Analize Geç'); 272 proBtn.innerHTML = '<i class="fa fa-mouse-pointer pp-toolbar-mode-icon" aria-hidden="true"></i>'; 273 proBtn.__ppModeBound = true; 274 proBtn.addEventListener('click', function(e){ 275 e.preventDefault(); 276 e.stopPropagation();
277 try { window.ppToolbarProModeClick && window.ppToolbarProModeClick(); } catch(_) {} 278 }); 279 mapClickBtn.insertAdjacentElement('afterend', proBtn); 280 return proBtn; 281 } 282 283 function enforceRequestedMenuLayout(){ 284 const actionBar = document.getElementById('top-button-container'); 285 if (actionBar) { 286 Array.from(actionBar.querySelectorAll('a,button')).forEach(el => { 287 const text = (el.textContent || '').replace(/\s+/g, ' ').trim().toLocaleLowerCase('tr-TR'); 288 const href = String(el.getAttribute('href') || ''); 289 const id = String(el.id || ''); 290 if (id === 'proAdaParselSorguBtn') return; 291 const isBuildingProject = id === 'pp-building3d-toolbar-link' || 292 text === '3d proje' || 293 href.indexOf('target=building3d') !== -1 || 294 href.indexOf('/building3d/start') !== -1; 295 const isActionPriceMap = text === 'fiyat haritası' || href.indexOf('/fiyat-haritasi/') !== -1; 296 if (isBuildingProject || isActionPriceMap) { 297 const prev = el.previousElementSibling; 298 el.remove(); 299 if (prev && prev.classList && prev.classList.contains('btn-separator')) { 300 const next = prev.nextElementSibling; 301 if (!next || (next.classList && next.classList.contains('btn-separator'))) prev.remove(); 302 } 303 } 304 }); 305 } 306 307 const mainMenu = document.querySelector('#main-menu-dropdown .dropdown-menu'); 308 if (!mainMenu) return; 309 310 Array.from(mainMenu.querySelectorAll('a,button')).forEach(el => { 311 const text = (el.textContent || '').replace(/\s+/g, ' ').trim().toLocaleLowerCase('tr-TR'); 312 const href = String(el.getAttribute('href') || ''); 313 if (text === 'building3d' || href.indexOf('building3d_viewer') !== -1 || href.indexOf('/viewer/building') !== -1) { 314 el.remove(); 315 } 316 }); 317 318 const hasPriceMap = Array.from(mainMenu.querySelectorAll('a')).some(a => String(a.getAttribute('href') || '').indexOf('/fiyat-haritasi/') !== -1); 319 if (!hasPriceMap) { 320 const priceLink = document.createElement('a'); 321 priceLink.href = '/fiyat-haritasi/'; 322 priceLink.className = 'toggle-btn'; 323 priceLink.title = 'Fiyat Haritası'; 324 priceLink.style.textDecoration = 'none'; 325 priceLink.innerHTML = '<i class="fas fa-map-marked-alt"></i><span>Fiyat Haritası</span>'; 326 const aranacaklar = Array.from(mainMenu.querySelectorAll('a,button')).find(el => { 327 return (el.textContent || '').replace(/\s+/g, ' ').trim().toLocaleLowerCase('tr-TR') === 'aranacaklar'; 328 }); 329 if (aranacaklar && aranacaklar.nextSibling) mainMenu.insertBefore(priceLink, aranacaklar.nextSibling); 330 else mainMenu.appendChild(priceLink); 331 } 332 } 333 334 window.toggleTopMenus = function(){ 335 // GİRİŠKONTROLÃ: Kullanıcı giriÅ yapmamıÅsa mod geçiÅini engelle 336 if (typeof window.ppRequireAuth === 'function' && !window.ppRequireAuth()) { 337 return; 338 } 339 340 const bar = document.getElementById('top-button-container'); 341 const title = document.getElementById('topbarToggleTitle'); 342 const modBtn = document.getElementById('modeSwitchBtn') || document.getElementById('modButonu'); 343 const modIcon = modBtn && modBtn.querySelector && modBtn.querySelector('i'); 344 const isTkgm = !!window.IS_TKGM_MODE; 345 346 if (isTkgm){ 347 // Basitten geliÅmiÅe (TKGM -> Pro) 348 setBarTheme(false); 349 if (title) title.textContent = 'Sorguya Geç'; 350 if (modBtn) { 351 modBtn.setAttribute('data-target', 'proparcel'); 352 } 353 scheduleModeButtonVisual('pro');
354 try { window.IS_TKGM_MODE = false; } catch(_) {} 355 try { window.geolocationManager && window.geolocationManager.setButtonsActive && window.geolocationManager.setButtonsActive(!!window.__GEO_ACTIVE); } catch(_) {} 356 // Moda geçiÅte çizimleri/verileri temizle 357 clearModeDataAndDrawings(); 358 // Pro Mod butonlarına event listener'ları baÄla (ölçüm butonları için) 359 if (window.proParcelApp && typeof window.proParcelApp.setupMeasurementButtons === 'function') { 360 window.proParcelApp.setupMeasurementButtons(); 361 } 362 // Pro moda geçiÅ: TKGM geçici verisini temizle 363 try { window.lastTkgmData = null; } catch(_) {} 364 // Pro modunda Parametre tabını etkinleÅtir 365 const tabs = document.querySelector('.sidebar-tabs'); 366 if (tabs) { 367 const liParam = tabs.querySelector('#Parametre'); 368 if (liParam) { liParam.classList.remove('disabled'); liParam.removeAttribute('aria-disabled'); } 369 const toHideIds = ['parametre-content','analysis-tab','parameters','parameters-tab']; 370 toHideIds.forEach(id => { const el = document.getElementById(id); if (el) el.style.display = 'none'; }); 371 try { if (typeof window.switchTab === 'function') window.switchTab('parcel'); } catch(_) {} 372 } 373 // BaÅlık rengi: Sorguya Geç normal (default) 374 try { if (title) title.style.color = ''; if (modIcon) modIcon.style.color = ''; } catch(_) {} 375 } else { 376 // GeliÅmiÅten basite (Pro -> TKGM) 377 setBarTheme(true); 378 if (title) title.textContent = 'Pro Analize Geç'; 379 if (modBtn) { 380 modBtn.setAttribute('data-target', 'tkgm'); 381 } 382 scheduleModeButtonVisual('tkgm'); 383 try { window.IS_TKGM_MODE = true; } catch(_) {} 384 try { window.geolocationManager && window.geolocationManager.setButtonsActive && window.geolocationManager.setButtonsActive(!!window.__GEO_ACTIVE); } catch(_) {} 385 // TKGM moda geçiÅte 2D modunu zorla 386 const mm = window.mapManager; 387 if (mm && typeof mm.is3DModeActive === 'function' && typeof mm.toggle2D3D === 'function') { 388 if (mm.is3DModeActive()) mm.toggle2D3D(false); 389 } 390 // Moda geçiÅte çizimleri/verileri temizle 391 clearModeDataAndDrawings(); 392 // TKGM moda geçiÅ: Pro veri önbelleklerini temizle 393 try { window.lastParcelResponse = null; } catch(_) {} 394 try { if (window.proParcelApp) window.proParcelApp.lastQueryData = null; } catch(_) {} 395 // TKGM modunda Parametre tabını devre dıÅı bırak 396 const tabs = document.querySelector('.sidebar-tabs'); 397 if (tabs) { 398 const liParam = tabs.querySelector('#Parametre'); 399 if (liParam) { liParam.classList.add('disabled'); liParam.setAttribute('aria-disabled','true'); } 400 } 401 const paramContent = document.getElementById('parametre-content'); 402 if (paramContent) paramContent.style.display = 'none'; 403 // BaÅlık rengi: Pro Analize Geç turuncu
404 try { if (title) title.style.color = '#f97316'; if (modIcon) modIcon.style.color = '#f97316'; } catch(_) {} 405 } 406 try { window.ppDisableMapClickMode && window.ppDisableMapClickMode(); } catch(_) {} 407 try { window.__ppMapClickQueryMode = null; } catch(_) {} 408 syncToolbarModeButtons(); 409 }; 410 411 // İlk yükleme kurulumu (DOMContentLoaded sonrası veya hemen) 412 function initializeTopMenus(){ 413 ensureToolbarModeProBtn(); 414 enforceRequestedMenuLayout(); 415 setTimeout(function(){ 416 ensureToolbarModeProBtn(); 417 enforceRequestedMenuLayout(); 418 syncToolbarModeButtons(); 419 }, 250); 420 setTimeout(function(){ 421 ensureToolbarModeProBtn(); 422 enforceRequestedMenuLayout(); 423 syncToolbarModeButtons(); 424 }, 1000); 425 426 const bar = document.getElementById('top-button-container'); 427 const modBtn = document.getElementById('modeSwitchBtn') || document.getElementById('modButonu'); 428 const modIcon = modBtn && modBtn.querySelector && modBtn.querySelector('i'); 429 430 // Yeni mod butonunu oluÅtur ve yerleÅtir (eski #modButonu pasif kalacak) 431 let newBtn = document.getElementById('modeSwitchBtn'); 432 if (!newBtn) { 433 newBtn = document.createElement('button'); 434 newBtn.id = 'modeSwitchBtn'; 435 newBtn.className = 'btn-flip'; 436 newBtn.setAttribute('data-front','â« Basit Sorgu'); 437 newBtn.setAttribute('data-back','ð´ Pro Analiz'); 438 newBtn.setAttribute('aria-label', 'Mod DeÄiÅtir'); 439 newBtn.title = 'Mod DeÄiÅtir'; 440 if (!newBtn.textContent || !newBtn.textContent.trim()) newBtn.textContent = 'â« Basit Sorgu'; 441 newBtn.addEventListener('click', function(e){ 442 e.preventDefault(); e.stopPropagation(); 443 try { window.toggleTopMenus && window.toggleTopMenus(); } catch(_) {} 444 }); 445 (function placeNearLogin(btn){ 446 let loginEl = document.getElementById('user-menu-dropdown'); 447 if (!loginEl) loginEl = document.querySelector('#login,#loginBtn,.login-btn,.user-menu,.userMenu,.user-dropdown,#user-menu,#userMenu'); 448 if (!loginEl) loginEl = document.querySelector('a[href*="login"],a[href*="signin"],button[id*="login"],button[id*="signin"]'); 449 if (!loginEl) { 450 const candidates = Array.from(document.querySelectorAll('button,a,div')); 451 loginEl = candidates.find(el => { 452 try { return (el.textContent || '').trim().toLowerCase().includes('giriÅ'); } catch(_) { return false; } 453 }) || null; 454 } 455 const oldBtn = document.getElementById('modButonu'); 456 const titleEl = document.getElementById('topbarToggleTitle'); 457 const barEl = document.getElementById('top-button-container'); 458 if (loginEl) { 459 const findFlexContainer = (node) => { 460 let child = node, lvl = 0; 461 while (child && child.parentElement && lvl < 6) { 462 const parent = child.parentElement; 463 const cs = window.getComputedStyle(parent); 464 if (cs && cs.display === 'flex') { 465 return { flexContainer: parent, flexChild: child }; 466 } 467 child = parent; 468 lvl++; 469 } 470 return null; 471 }; 472 const found = findFlexContainer(loginEl); 473 if (found && found.flexContainer && found.flexChild) { 474 let wrap = document.getElementById('topbarRightGroup'); 475 if (!wrap) { 476 wrap = document.createElement('div'); 477 wrap.id = 'topbarRightGroup'; 478 wrap.className = 'topbar-right-group'; 479 try { wrap.setAttribute('role','group'); } catch(_) {} 480 found.flexContainer.insertBefore(wrap, found.flexChild); 481 wrap.appendChild(btn); 482 wrap.appendChild(found.flexChild); 483 } else { 484 wrap.insertBefore(btn, wrap.firstChild); 485 } 486 try { btn.classList.add('topbar-right-btn'); } catch(_) {} 487 return; 488 } 489 if (loginEl.parentElement) { 490 loginEl.parentElement.insertBefore(btn, loginEl); 491 try { btn.classList.add('topbar-right-btn'); } catch(_) {} 492 return; 493 } 494 } 495 if (oldBtn && oldBtn.parentElement) { 496 oldBtn.parentElement.insertBefore(btn, oldBtn); 497 return; 498 } 499 if (titleEl && titleEl.parentElement) { 500 titleEl.parentElement.appendChild(btn); 501 return; 502 } 503 if (barEl) { barEl.appendChild(btn); return; } 504 document.body.appendChild(btn); 505 })(newBtn); 506 } 507 508 // Unified bar: baÅlangıçta basit (mode-simple) tema 509 setBarTheme(true); 510 511 // Mod butonunu yeniden bul 512 const finalModeBtn = document.getElementById('modeSwitchBtn') || document.getElementById('modButonu'); 513 if (finalModeBtn) { 514 finalModeBtn.addEventListener('mouseenter', function(){ 515 __modeBtnHovering = true; 516 }); 517 finalModeBtn.addEventListener('mouseleave', function(){ 518 __modeBtnHovering = false;
519 if (__pendingModeVisual) { 520 applyModeButtonVisual(finalModeBtn, __pendingModeVisual); 521 __pendingModeVisual = null; 522 } 523 }); 524 finalModeBtn.setAttribute('data-target', 'tkgm'); 525 applyModeButtonVisual(finalModeBtn, 'tkgm'); 526 } 527 try { window.IS_TKGM_MODE = true; } catch(_) {} 528 syncToolbarModeButtons(); 529 try { window.geolocationManager && window.geolocationManager.setButtonsActive && window.geolocationManager.setButtonsActive(!!window.__GEO_ACTIVE); } catch(_) {} 530 try { const title = document.getElementById('topbarToggleTitle'); if (title) title.style.color = '#f97316'; } catch(_) {} 531 try { const title = document.getElementById('topbarToggleTitle'); const mi = document.querySelector('#modButonu i'); if (mi) mi.style.color = '#f97316'; } catch(_) {} 532 533 // İlk yüklemede TKGM modunda: Parametre tabını devre dıÅı bırak 534 const tabs = document.querySelector('.sidebar-tabs'); 535 if (tabs) { 536 const liParam = tabs.querySelector('#Parametre'); 537 if (liParam) { liParam.classList.add('disabled'); liParam.setAttribute('aria-disabled','true'); } 538 } 539 const paramContent = document.getElementById('parametre-content'); 540 if (paramContent) paramContent.style.display = 'none'; 541 542 // GeliÅmiÅ menü geolocate butonu 543 const toolbarGeoBtn = document.getElementById('toolbarGeoBtn'); 544 if (toolbarGeoBtn){ 545 toolbarGeoBtn.addEventListener('click', function(e){ 546 e.preventDefault(); e.stopPropagation(); 547 try { window.mapManager?.geolocateNow?.(); } catch(_) {} 548 setTimeout(()=>{ try { window.geolocationManager?.setButtonsActive(!!window.__GEO_ACTIVE); } catch(_) {} }, 0); 549 }); 550 } 551 552 // ResizeObserver: Header yüksekliÄi deÄiÅtiÄinde sidebar/map konumunu güncelle 553 setupHeaderResizeObserver(); 554 } 555 556 // Dinamik header yükseklik takibi (toolbar wrap olduÄunda sidebar/map uyum saÄlasın) 557 function setupHeaderResizeObserver(){ 558 const header = document.querySelector('.pp-header'); 559 if (!header || typeof ResizeObserver === 'undefined') return; 560 561 const updateHeaderHeight = () => { 562 const h = header.offsetHeight; 563 document.documentElement.style.setProperty('--header-total-height', h + 'px'); 564 }; 565 566 const ro = new ResizeObserver(() => { 567 requestAnimationFrame(updateHeaderHeight); 568 }); 569 ro.observe(header); 570 571 // İlk hesaplama 572 updateHeaderHeight(); 573 } 574 575 // İlk yüklemede: unified bar basit mod temasıyla açık 576 if (document.readyState === 'loading') { 577 document.addEventListener('DOMContentLoaded', initializeTopMenus); 578 } else { 579 initializeTopMenus(); 580 } 581 582 function handleMenuLaunchParams() { 583 try { 584 const params = new URLSearchParams(window.location.search); 585 const launch = params.get('launch'); 586 if (!launch) return; 587 588 setTimeout(function () { 589 if (launch === 'basit') { 590 try { window.ppToolbarMapClickOrSimple && window.ppToolbarMapClickOrSimple(); } catch (_) {} 591 } else if (launch === 'my-queries') { 592 try { 593 const sidebar = document.getElementById('sidebar'); 594 if (sidebar && !sidebar.classList.contains('active') && typeof window.toggleSidebar === 'function') { 595 window.toggleSidebar(); 596 } 597 if (typeof window.switchTab === 'function') { 598 window.switchTab('sorgularim-tab'); 599 } 600 } catch (_) {} 601 } 602 }, 350); 603 604 if (window.history && window.history.replaceState) { 605 params.delete('launch'); 606 const qs = params.toString(); 607 const url = window.location.pathname + (qs ? '?' + qs : '') + window.location.hash; 608 window.history.replaceState({}, '', url); 609 } 610 } catch (_) {} 611 } 612 613 if (document.readyState === 'loading') { 614 document.addEventListener('DOMContentLoaded', handleMenuLaunchParams); 615 } else { 616 handleMenuLaunchParams(); 617 } 618})();
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.