function toggleMenu(selectedMenuId) { const allMenus = document.querySelectorAll("div[id$='-container']"); allMenus.forEach(menu => { if (menu.id !== "menu-container") { // "menu-container" hari� di�erlerine hidden ekle menu.classList.add("hidden"); } }); const selectedMenuContainer = document.getElementById(selectedMenuId); if (selectedMenuContainer) { selectedMenuContainer.classList.remove("hidden"); } } function showHeaderForPage(pageId) { const allHeaders = document.querySelectorAll(".header"); const defaultHeader = document.getElementById("default-header"); console.log("SHP:" + pageId); // �zel header'lar� tan�ml�yoruz const specialHeaders = { "genel-basliklar-container": "genel-basliklar-container", "son-dakika-container": "son-dakika-container", "spor-container": "spor-container", "kripto-container": "kripto-container", "ekonomi-container": "ekonomi-container", "yeni-kadin-container": "kadin-container", "gamegar-container": "gamegar-container", "secim-container": "secim-container", "finans-container": "finans-container" }; let isCustomHeaderVisible = false; allHeaders.forEach(header => { console.log("SH:" + pageId + "HDI:" + header.id); if (specialHeaders[pageId] && header.id === specialHeaders[pageId]) { header.classList.remove("hidden"); isCustomHeaderVisible = true; } else if (header.id !== defaultHeader.id) { header.classList.remove("hidden"); } }); if (!isCustomHeaderVisible) { defaultHeader.classList.remove("hidden"); } else { defaultHeader.classList.add("hidden"); } } document.addEventListener("DOMContentLoaded", function () { const menuButtons = document.querySelectorAll(".header-menu li a"); const yellowHeaders = document.querySelectorAll(".finance-blue-header"); const finansSubheadingLeft = document.querySelector(".finance-subheading-left"); if (window.location.pathname.includes("/ekonomi/")) { let elements = document.querySelectorAll(".hbftTerms"); elements.forEach(element => { element.style.marginBottom = "30px"; }); } const paths = ["/finans/", "/finans/emtia/", "/finans/akaryakit/"]; if (paths.includes(window.location.pathname)) { const targetDiv = document.querySelector(".hbMain.stickyNo"); if (targetDiv) { targetDiv.style.marginTop = "0"; } } function hideAllContainers() { //yellowHeaders.forEach(header => header.classList.add("hidden")); //finansSubheadingLeft?.classList.remove("finance-subheading-double"); } function showContainer(targetId) { const relatedContainer = document.getElementById(`sub-${targetId}`); //if (relatedContainer) { // hideAllContainers(); // relatedContainer.classList.remove("hidden"); // /*finansSubheadingLeft?.classList.add("finance-subheading-double");*/ // console.log(`Container "${relatedContainer.id}" a��ld�.`); //} else { // console.error(`No related container found for target ID: ${targetId}`); //} } menuButtons.forEach(button => { const targetId = button.getAttribute("data-target"); const href = button.getAttribute("href"); if (window.location.pathname.includes(href)) { showContainer(targetId); } }); menuButtons.forEach(button => { button.addEventListener("click", function (event) { const targetId = this.getAttribute("data-target"); const href = this.getAttribute("href"); if (targetId) { // Varsay�lan davran��� engellemeden do�rudan y�nlendirme console.log(`"${href}" sayfas�na y�nlendiriliyor...`); window.location.href = href; // Sayfa y�nlendirmesi yap�l�r } }); }); window.onload = function () { const currentPath = window.location.pathname; menuButtons.forEach(button => { const targetId = button.getAttribute("data-target"); const href = button.getAttribute("href"); if (currentPath.includes(href) && targetId) { showContainer(targetId); // Do�ru container'� otomatik g�ster console.log(`"${targetId}" container'� sayfa y�klendi�inde a��ld�.`); } }); }; window.addEventListener("DOMContentLoaded", function () { //const currentPath = window.location.pathname; //menuButtons.forEach(button => { // const targetId = button.getAttribute("data-target"); // const href = button.getAttribute("href"); // if (currentPath.includes(href) && targetId) { // showContainer(targetId); // Do�ru container'� otomatik g�ster // console.log(`"${targetId}" container'� sayfa y�klendi�inde a��ld�.`); // } //}); }); window.addEventListener("popstate", function () { const currentPath = window.location.pathname; menuButtons.forEach(button => { const targetId = button.getAttribute("data-target"); const href = button.getAttribute("href"); if (currentPath.includes(href)) { showContainer(targetId); } }); }); }); /* KRIPTO MENU */ document.addEventListener("DOMContentLoaded", function () { const currentPath = window.location.pathname; const kriptoUrls = [ "/kripto-para/", "/bitcoin-nedir/", "/airdrop/", "/bitcoin/", "/blockchain/", "/ethereum/", "/nft/", "/metaverse/", "/kripto-yapay-zeka/", "/coin-fiyatlari/", "/launchpad/", "/blockchain-nedir/", "/ethereum-nedir/", "/nft-nedir/", "/metaverse-nedir/", "/yapay-zeka-nedir/", "/airdrop/aktif/", "/airdrop/gelecek/", "/airdrop/eski/", "/launchpad/aktif/", "/launchpad/gelecek/", "/launchpad/eski/" ]; const kriptoCoinUrls = [ "/coin-fiyatlari/" ]; if (kriptoUrls.includes(currentPath)) { const header = document.querySelector('header'); if (header) { const applyMargin = () => { if (window.matchMedia("(min-width: 1025px)").matches) { header.style.setProperty('margin-bottom', '60px'); // De�eri !important ile uygula } else { header.style.removeProperty('margin-bottom'); // Ekran k���kse kald�r } }; applyMargin(); window.addEventListener("resize", applyMargin); } } if (currentPath.includes(kriptoCoinUrls)) { hideAllSubContainers(); } else { } function hideAllSubContainers() { const yellowHeaders = document.querySelectorAll('.yellow-header'); yellowHeaders.forEach(header => header.classList.add('hidden')); const subheadingLeft = document.querySelector('.subheading-left'); if (subheadingLeft) { subheadingLeft.classList.remove('subheading-double'); } } // Belirli bir container'� g�sterir ve di�erlerini gizler function showSubContainer(submenuId) { hideAllSubContainers(); const submenu = document.getElementById(submenuId); if (submenu) { submenu.classList.remove('hidden'); } const subheadingLeft = document.querySelector('.subheading-left'); if (subheadingLeft && submenu) { subheadingLeft.classList.add('subheading-double'); } } if (kriptoUrls.includes(currentPath)) { const showSubmenu = function (submenuId) { const submenu = document.getElementById(submenuId); if (submenu) { submenu.classList.remove('hidden'); } }; //if (currentPath.includes("/kripto-para/") || currentPath.includes("/bitcoin/") || currentPath.includes("/blockchain/") || currentPath.includes("/ethereum/") || currentPath.includes("/nft/") || currentPath.includes("/metaverse/") || currentPath.includes("/kripto-yapay-zeka/")) { // showSubmenu('sub-kripto-para'); //} //if (currentPath.includes("/blockchain-nedir/") || currentPath.includes("/ethereum-nedir/") || currentPath.includes("/nft-nedir/") || currentPath.includes("/metaverse-nedir/") || currentPath.includes("/yapay-zeka-nedir/")) { // showSubmenu('sub-kripto-rehber'); //} //if (currentPath.includes("/airdrop/")) { // showSubmenu('sub-airdrop'); //} //if (currentPath.includes("/launchpad/")) { // showSubmenu('sub-launchpad'); //} const mainLinks = document.querySelectorAll('.header-menu li a'); //mainLinks.forEach(link => { // link.addEventListener('click', function (e) { // e.preventDefault(); // const target = link.dataset.target; // // Sayfa ge�i�ini hemen yap�yoruz // const targetUrl = link.getAttribute('href'); // if (targetUrl) { // window.location.href = targetUrl; // } // // Sayfa ge�i�inden sonra alt ba�l�klar� g�ster // setTimeout(function () { // if (target) { // showSubContainer(`sub-${target}`); // } // }, 500); // Bu 100 ms'lik gecikme sayfa ge�i�i sonras� �al��acak // }); //}); const handleSubmenuLinks = function (submenuSelector) { const subLinks = document.querySelectorAll(`${submenuSelector} li a`); subLinks.forEach(link => { link.addEventListener('click', function (e) { const target = link.getAttribute('href'); if (target) { window.location.href = target; } }); }); }; handleSubmenuLinks('#sub-kripto-para'); handleSubmenuLinks('#sub-kripto-rehber'); handleSubmenuLinks('#sub-airdrop'); handleSubmenuLinks('#sub-launchpad'); } }); window.onload = function () { //setTimeout(function () { ////let pageName; ////let fullUrl = "/spor/"; //console.log("FL:" + 0); ////if (fullUrl.includes("/spor/")) { //// console.log("FLI:" + fullUrl); //// pageName = "spor-container"; ////} ////else if (fullUrl.includes("/magazin/")) { //// console.log("FLI:" + fullUrl); //// pageName = "yeni-kadin-container"; ////} ////else { //// pageName = "standart-container"; ////} ////console.log("PN:" + pageName); // //handleMenuAndHeader(pageName); //}, 5000); }; //sayfalar�n kendi headerlar�n�n g�sterilmesi function delayedFunction() { let pageName; const kriptoUrls = ["/kripto-para/", "/bitcoin-nedir/", "/airdrop/", "/bitcoin/", "/blockchain/", "/ethereum/", "/nft/", "/metaverse/", "/kripto-yapay-zeka/", "/coin-fiyatlari/", "/launchpad/", "/blockchain-nedir/", "/ethereum-nedir/", "/nft-nedir/", "/metaverse-nedir/", "/yapay-zeka-nedir/"]; const yeniKadinUrls = ["/anne-cocuk/", "/ask-iliskiler/", "/cinsellik/", "/dekorasyon/", "/evlilik/", "/guzellik/", "/moda/", "/yemek-tarifi/", "/kadin/"]; const gamegarUrls = ["/gamegar/", "/espor/", "/oyun-inceleme/", "/rehber/", "/konsol-oyunlari/", "/pc-oyunlari/", "/mobil-oyunlar/"]; const fullUrl = window.location.href; console.log("LINK:" + window.location.pathname); console.log("FL:" + fullUrl); if (fullUrl.includes("/son-dakika/")) { pageName = "son-dakika-container"; } else if (fullUrl.includes("/spor/")) { pageName = "spor-container"; } else if (fullUrl.includes("/ekonomi/")) { pageName = "ekonomi-container"; console.log("EKONOMI LOG"); } else if (fullUrl.includes("/secim/")) { pageName = "secim-container"; } else if (fullUrl.includes("/finans/")) { pageName = "finans-container"; console.log("FINANS LOG"); } else { pageName = "genel-basliklar-container"; console.log("GENEL LOG"); } if (gamegarUrls.some(url => fullUrl.includes(url))) { pageName = "gamegar-container"; console.log("GAMEGAR LOG"); } else if (yeniKadinUrls.some(url => fullUrl.includes(url))) { pageName = "yeni-kadin-container"; console.log("YENI KADIN LOG"); } else if (kriptoUrls.some(url => fullUrl.includes(url))) { pageName = "kripto-container"; console.log("KRIPTO LOG"); } handleMenuAndHeader(pageName); } //setTimeout(delayedFunction, 20); function handleMenuAndHeader(targetId2) { console.log("TPI:" + targetId2); if (targetId2) { showHeaderForPage(targetId2); requestAnimationFrame(() => toggleMenu(targetId2)); } const link = this.querySelector("a"); if (link) { const targetPageId = link.getAttribute("href").replace("/", ""); toggleMenu(targetPageId); showHeaderForPage(targetPageId); } //if (this.textContent.trim() === "F�NANS") { // finansSubheadingLeft.classList.remove("finance-subheading-double"); // yellowHeader.classList.add("hidden"); // return; //} } window.onhashchange = function () { const pageId = window.location.hash.replace('#', ''); showHeaderForPage(pageId); }; document.addEventListener('DOMContentLoaded', function () { const menuItems = document.querySelectorAll('.mobile-menu-items a'); menuItems.forEach(item => { item.addEventListener('click', function () { menuItems.forEach(i => i.classList.remove('active', 'no-separator')); this.classList.add('active'); const prevSibling = this.previousElementSibling; if (prevSibling) { prevSibling.classList.add('no-separator'); } }); }); const currentUrl = window.location.href; menuItems.forEach(item => { if (item.href === currentUrl) { item.classList.add('active'); const prevSibling = item.previousElementSibling; if (prevSibling) { prevSibling.classList.add('no-separator'); } } }); }); document.addEventListener('DOMContentLoaded', function () { const menuToggle = document.getElementById('mobile-menu-toggle'); const mobileMenu = document.getElementById('mobile-menu'); const overlay = document.querySelector('.overlay'); const icon = document.querySelector('#mobile-menu-toggle img'); menuToggle.addEventListener('click', function (event) { event.preventDefault(); mobileMenu.classList.toggle('active'); overlay.classList.toggle('active'); if (mobileMenu.classList.contains('active')) { icon.src = '/mstatic/assets/img/headerimages/close.png'; overlay.style.visibility = 'visible'; overlay.style.opacity = '1'; } else { icon.src = '/mstatic/assets/img/headerimages/hamburger.svg'; overlay.style.opacity = '0'; setTimeout(() => { overlay.style.visibility = 'hidden'; }, 0); } }); overlay.addEventListener('click', function () { mobileMenu.classList.remove('active'); overlay.classList.remove('active'); icon.src = '/mstatic/assets/img/headerimages/hamburger.svg'; overlay.style.opacity = '0'; setTimeout(() => { overlay.style.visibility = 'hidden'; }, 300); }); const searchButton = document.getElementById('mobile-search-button'); const searchContainer = document.getElementById('search-container'); const mobileMenuContainer = document.querySelector('.mobile-menu-container'); searchButton.addEventListener('click', function (e) { e.preventDefault(); searchContainer.classList.toggle('hidden'); if (!searchContainer.classList.contains('hidden')) { mobileMenuContainer.style.marginTop = '0'; } else { mobileMenuContainer.style.marginTop = ''; } }); }); //document.getElementById('contact-toggle').addEventListener('click', function (event) { // event.preventDefault(); // Sayfan�n yenilenmesini engeller. // const submenu = document.querySelector('.sidebar-submenu.third-level'); // submenu.classList.toggle('menu-open'); //}); document.addEventListener('DOMContentLoaded', function () { const contactToggle = document.getElementById('contact-toggle'); if (contactToggle) { // contact-toggle var m� kontrol et contactToggle.addEventListener('click', function (event) { event.preventDefault(); // Sayfan�n yenilenmesini engeller. const submenu = document.querySelector('.sidebar-submenu.third-level'); const icon = contactToggle.querySelector('.subdownup'); // subdownup s�n�f�na sahip img etiketi submenu.classList.toggle('menu-open'); // Men� durumu kontrol edilip ikon de�i�tirilir if (submenu.classList.contains('menu-open')) { icon.src = '/mstatic/assets/img/headerimages/arrow-up.svg'; } else { icon.src = '/mstatic/assets/img/headerimages/arrow-down.svg'; } }); } }); document.addEventListener("DOMContentLoaded", () => { // Sayfan�n mevcut URL'sini al const currentURL = window.location.pathname; // Kategorileri URL'lerle e�le�tir const categoryMapping = { spor: ["/spor/"], finans: ["/finans/"], gamegar: ["/gamegar/", "/espor/", "/oyun-inceleme/", "/rehber/", "/konsol-oyunlari/", "/pc-oyunlari/", "/mobil-oyunlar/"], sondk: ["/son-dakika/"], ekonomi: ["/ekonomi/"], kripto: ["/kripto-para/", "/bitcoin-nedir/", "/airdrop/", "/bitcoin/", "/blockchain/", "/ethereum/", "/nft/", "/metaverse/", "/kripto-yapay-zeka/", "/coin-fiyatlari/", "/launchpad/", "/blockchain-nedir/", "/ethereum-nedir/", "/nft-nedir/", "/metaverse-nedir/", "/yapay-zeka-nedir/"], kadin: ["/anne-cocuk/", "/ask-iliskiler/", "/cinsellik/", "/dekorasyon/", "/evlilik/", "/guzellik/", "/moda/", "/yemek-tarifi/", "/kadin/"], }; // T�m kategorileri gizle const menuItems = document.querySelectorAll(".mobile-menu-items"); menuItems.forEach((item) => { item.style.display = "none"; }); // �lgili kategoriyi g�ster Object.keys(categoryMapping).forEach((category) => { if (categoryMapping[category].some((path) => currentURL.startsWith(path))) { const categoryElement = document.querySelector(`.mobile-menu-items[data-category="${category}"]`); if (categoryElement) { categoryElement.style.display = "block"; } } }); let shouldUpdatePadding = false; for (const category in categoryMapping) { if (categoryMapping[category].some(path => currentURL.startsWith(path))) { // E�er kategori "kadin", "kripto", "gamegar" veya "ekonomi" ise padding g�ncellenir if (["kadin", "kripto", "gamegar", "spor"].includes(category)) { shouldUpdatePadding = true; break; } } } // Ekran geni�li�ini kontrol et if (shouldUpdatePadding && window.innerWidth <= 1024) { document.body.style.padding = "88px 0 0"; } // Ekran boyutlar� de�i�ti�inde kontrol etmek i�in bir event listener ekleyelim window.addEventListener("resize", () => { if (shouldUpdatePadding && window.innerWidth <= 1024) { document.body.style.padding = "88px 0 0"; } }); });