document.addEventListener('DOMContentLoaded', function (){
'use strict';
var body=document.body;
var main=document.getElementById('ghhMainbar');
var search=document.getElementById('ghhSearchBox');
var items=Array.prototype.slice.call(document.querySelectorAll('#ghhBreakingTrack .ghh-breaking-item'));
var current=0;
function setSticky(){
if(!main){
return;
}
main.classList.toggle('ghh-is-sticky', window.scrollY > 48);
}
function showItem(next){
if(!items.length){
return;
}
items[current].classList.remove('ghh-active');
current=(next + items.length) % items.length;
items[current].classList.add('ghh-active');
}
function closeDrawers(){
body.classList.remove('ghh-left-open', 'ghh-right-open');
}
function openSearch(){
if(!search){
return;
}
search.classList.add('ghh-open');
var input=search.querySelector('input');
if(input){
setTimeout(function (){
input.focus();
}, 80);
}}
function closeSearch(){
if(!search){
return;
}
search.classList.remove('ghh-open');
}
function toggleSearch(){
if(!search){
return;
}
if(search.classList.contains('ghh-open')){
closeSearch();
}else{
openSearch();
}}
window.addEventListener('scroll', setSticky, { passive: true });
setSticky();
document.querySelectorAll('[data-ghh-open-left]').forEach(function (btn){
btn.addEventListener('click', function (){
body.classList.add('ghh-left-open');
body.classList.remove('ghh-right-open');
});
});
document.querySelectorAll('[data-ghh-open-right]').forEach(function (btn){
btn.addEventListener('click', function (){
body.classList.add('ghh-right-open');
body.classList.remove('ghh-left-open');
});
});
document.querySelectorAll('[data-ghh-close-drawers]').forEach(function (btn){
btn.addEventListener('click', closeDrawers);
});
document.querySelectorAll('[data-ghh-toggle-search]').forEach(function (btn){
btn.addEventListener('click', function (){
closeDrawers();
toggleSearch();
});
});
document.querySelectorAll('[data-ghh-close-search]').forEach(function (btn){
btn.addEventListener('click', closeSearch);
});
document.querySelectorAll('[data-ghh-close-popup]').forEach(function (btn){
btn.addEventListener('click', function (){
var popup=document.getElementById('ghhPopup');
if(popup){
popup.remove();
}});
});
document.querySelectorAll('[data-ghh-prev]').forEach(function (btn){
btn.addEventListener('click', function (){
showItem(current - 1);
});
});
document.querySelectorAll('[data-ghh-next]').forEach(function (btn){
btn.addEventListener('click', function (){
showItem(current + 1);
});
});
if(items.length > 1){
setInterval(function (){
showItem(current + 1);
}, 4500);
}
document.addEventListener('keydown', function (event){
if(event.key==='Escape'){
closeDrawers();
closeSearch();
}});
});
document.addEventListener('DOMContentLoaded', function (){
'use strict';
var button=document.getElementById('gahArsivLoadMore');
var container=document.getElementById('gahArsivResults');
if(!button||!container||typeof gahArsivData==='undefined'){
return;
}
function parseJson(value){
try {
return JSON.parse(value||'{}');
} catch (error){
return {};}}
button.addEventListener('click', function (){
var page=parseInt(button.getAttribute('data-page')||'1', 10);
var maxPage=parseInt(button.getAttribute('data-max')||'1', 10);
var query=parseJson(button.getAttribute('data-query'));
if(button.disabled||page >=maxPage){
button.remove();
return;
}
button.disabled=true;
button.textContent=gahArsivData.loadingText||'Yükleniyor...';
var formData=new FormData();
formData.append('action', 'gah_arsiv_load_more');
formData.append('nonce', gahArsivData.nonce||'');
formData.append('page', String(page + 1));
formData.append('query', JSON.stringify(query));
fetch(gahArsivData.ajaxUrl, {
method: 'POST',
body: formData,
credentials: 'same-origin'
})
.then(function (response){
return response.json();
})
.then(function (payload){
if(!payload||!payload.success||!payload.data||!payload.data.html){
button.remove();
return;
}
container.insertAdjacentHTML('beforeend', payload.data.html);
var nextPage=page + 1;
button.setAttribute('data-page', String(nextPage));
button.disabled=false;
button.textContent=gahArsivData.loadText||'Daha Fazla Yükle';
if(nextPage >=maxPage||!payload.data.hasMore){
button.remove();
}})
.catch(function (){
button.disabled=false;
button.textContent=gahArsivData.errorText||'Hata oluştu';
});
});
});
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var button=document.getElementById('gahAuthorLoadMore');
var results=document.getElementById('gahAuthorResults');
if(!button||!results){
return;
}
var isLoading=false;
function getText(name, fallback){
var value=button.getAttribute(name);
return value&&value.trim()!=='' ? value:fallback;
}
function getNextUrlFromDocument(doc){
var nextButton=doc.querySelector('#gahAuthorLoadMore');
if(!nextButton){
return '';
}
return nextButton.getAttribute('data-next-url')||'';
}
function getMaxPageFromDocument(doc, fallback){
var nextButton=doc.querySelector('#gahAuthorLoadMore');
if(!nextButton){
return fallback;
}
var max=parseInt(nextButton.getAttribute('data-max')||String(fallback), 10);
return Number.isFinite(max)&&max > 0 ? max:fallback;
}
function removeButton(){
var wrapper=document.getElementById('gahAuthorMore');
if(wrapper){
wrapper.remove();
return;
}
button.remove();
}
function appendNewItems(doc){
var newItems=doc.querySelectorAll('[data-gah-author-result="1"]');
if(!newItems.length){
return false;
}
newItems.forEach(function (item){
results.appendChild(item.cloneNode(true));
});
return true;
}
button.addEventListener('click', function (){
if(isLoading){
return;
}
var nextUrl=button.getAttribute('data-next-url')||'';
var currentPage=parseInt(button.getAttribute('data-current')||'1', 10);
var maxPage=parseInt(button.getAttribute('data-max')||'1', 10);
var loadText=getText('data-load-text', 'DAHA FAZLA YÜKLE');
var loadingText=getText('data-loading-text', 'YÜKLENİYOR...');
var errorText=getText('data-error-text', 'TEKRAR DENE');
if(!Number.isFinite(currentPage)||currentPage < 1){
currentPage=1;
}
if(!Number.isFinite(maxPage)||maxPage < 1){
maxPage=1;
}
if(!nextUrl||currentPage >=maxPage){
removeButton();
return;
}
isLoading=true;
button.disabled=true;
button.textContent=loadingText;
button.classList.add('is-loading');
fetch(nextUrl, {
method: 'GET',
credentials: 'same-origin',
cache: 'no-store'
})
.then(function (response){
if(!response.ok){
throw new Error('HTTP ' + response.status);
}
return response.text();
})
.then(function (html){
var doc=new DOMParser().parseFromString(html, 'text/html');
var hasItems=appendNewItems(doc);
if(!hasItems){
removeButton();
return;
}
var nextPage=currentPage + 1;
var followingUrl=getNextUrlFromDocument(doc);
var nextMaxPage=getMaxPageFromDocument(doc, maxPage);
button.setAttribute('data-current', String(nextPage));
button.setAttribute('data-max', String(nextMaxPage));
if(!followingUrl||nextPage >=nextMaxPage){
removeButton();
return;
}
button.setAttribute('data-next-url', followingUrl);
button.disabled=false;
button.textContent=loadText;
button.classList.remove('is-loading');
isLoading=false;
})
.catch(function (){
button.disabled=false;
button.textContent=errorText;
button.classList.remove('is-loading');
button.setAttribute('title', 'Yükleme sırasında hata oluştu.');
isLoading=false;
});
});
});
})();
(function (){
'use strict';
function gahCommentRefreshIconState(field){
if(!field){
return;
}
var wrap=field.closest('.gah-cmt-input-wrap');
if(!wrap){
return;
}
if((field.value||'').trim()!==''||document.activeElement===field){
wrap.classList.add('gah-cmt-has-value');
}else{
wrap.classList.remove('gah-cmt-has-value');
}}
document.addEventListener('DOMContentLoaded', function (){
var fields=document.querySelectorAll('.gah-cmt-input-wrap input, .gah-cmt-input-wrap textarea'
);
if(!fields.length){
return;
}
fields.forEach(function (field){
gahCommentRefreshIconState(field);
field.addEventListener('focus', function (){
gahCommentRefreshIconState(field);
});
field.addEventListener('input', function (){
gahCommentRefreshIconState(field);
});
field.addEventListener('blur', function (){
gahCommentRefreshIconState(field);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var scrollTopBtn=document.getElementById('gahxScrollTop');
if(scrollTopBtn){
var toggleScrollButton=function (){
if(window.scrollY > 300){
scrollTopBtn.classList.add('is-visible');
}else{
scrollTopBtn.classList.remove('is-visible');
}};
toggleScrollButton();
window.addEventListener('scroll', toggleScrollButton, { passive: true });
scrollTopBtn.addEventListener('click', function (event){
event.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
var popupInner=document.querySelector('.splash-popup .popup-inner');
if(popupInner){
var centerPopup=function (){
var height=popupInner.offsetHeight||0;
if(height > 0){
popupInner.style.marginTop='-' + (height / 2) + 'px';
}};
centerPopup();
window.setTimeout(centerPopup, 1000);
var closeButton=popupInner.querySelector('.close-popup');
if(closeButton){
closeButton.addEventListener('click', function (event){
event.preventDefault();
var popup=closeButton.closest('.splash-popup');
if(popup){
popup.style.opacity='0';
popup.style.pointerEvents='none';
window.setTimeout(function (){
popup.remove();
}, 250);
}});
}}
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-imggal-page="1"]');
if(!page){
return;
}
var adGate=page.querySelector('[data-gah-imggal-adgate="1"]');
var viewer=page.querySelector('[data-gah-imggal-viewer="1"]');
var skipButton=page.querySelector('[data-gah-imggal-skip="1"]');
function showGalleryImage(){
if(adGate){
adGate.remove();
}
if(viewer){
viewer.classList.remove('is-hidden');
}}
if(adGate&&viewer){
var timeout=parseInt(adGate.getAttribute('data-timeout')||'30000', 10);
if(!Number.isFinite(timeout)||timeout < 1000){
timeout=30000;
}
var adTimer=window.setTimeout(showGalleryImage, timeout);
if(skipButton){
skipButton.addEventListener('click', function (){
window.clearTimeout(adTimer);
showGalleryImage();
});
}}
document.addEventListener('keydown', function (event){
if(event.defaultPrevented){
return;
}
var active=document.activeElement;
var activeTag=active&&active.tagName ? active.tagName.toLowerCase():'';
if(activeTag==='input'||activeTag==='textarea'||activeTag==='select'){
return;
}
var prevUrl=page.getAttribute('data-prev-url')||'';
var nextUrl=page.getAttribute('data-next-url')||'';
if(event.key==='ArrowLeft'&&prevUrl!==''){
window.location.href=prevUrl;
}
if(event.key==='ArrowRight'&&nextUrl!==''){
window.location.href=nextUrl;
}});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var indexPage=document.querySelector('[data-gah-index-page="1"]');
if(!indexPage){
return;
}
var root=document.documentElement;
function updateStickyTop(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(20, Math.min(190, Math.round(height + 16)));
root.style.setProperty('--gah-index-sticky-top', offset + 'px');
}
updateStickyTop();
window.addEventListener('load', updateStickyTop);
window.addEventListener('resize', updateStickyTop, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var pageTemplate=document.querySelector('[data-gah-page-template="1"]');
if(!pageTemplate){
return;
}
var root=document.documentElement;
function updatePageStickyTop(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(90, Math.min(190, Math.round(height + 18)));
root.style.setProperty('--gah-page-sticky-top', offset + 'px');
}
updatePageStickyTop();
window.addEventListener('load', updatePageStickyTop);
window.addEventListener('resize', updatePageStickyTop, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var button=document.getElementById('gahSrcLoadMore');
var results=document.getElementById('gahSrcResults');
if(!button||!results){
return;
}
var isLoading=false;
function getText(name, fallback){
var value=button.getAttribute(name);
return value&&value.trim()!=='' ? value:fallback;
}
function removeButton(){
var wrapper=document.getElementById('gahSrcMore');
if(wrapper){
wrapper.remove();
return;
}
button.remove();
}
function getNextUrlFromDocument(doc){
var nextButton=doc.querySelector('#gahSrcLoadMore');
if(!nextButton){
return '';
}
return nextButton.getAttribute('data-next-url')||'';
}
function appendNewItems(doc){
var newItems=doc.querySelectorAll('[data-gah-src-result="1"], [data-gah-src-ad="1"]');
if(!newItems.length){
return false;
}
newItems.forEach(function (item){
results.appendChild(item.cloneNode(true));
});
return true;
}
button.addEventListener('click', function (){
if(isLoading){
return;
}
var nextUrl=button.getAttribute('data-next-url')||'';
var currentPage=parseInt(button.getAttribute('data-current')||'1', 10);
var maxPage=parseInt(button.getAttribute('data-max')||'1', 10);
var loadText=getText('data-load-text', 'DAHA FAZLA YÜKLE');
var loadingText=getText('data-loading-text', 'YÜKLENİYOR...');
var errorText=getText('data-error-text', 'TEKRAR DENE');
if(!Number.isFinite(currentPage)||currentPage < 1){
currentPage=1;
}
if(!Number.isFinite(maxPage)||maxPage < 1){
maxPage=1;
}
if(!nextUrl||currentPage >=maxPage){
removeButton();
return;
}
isLoading=true;
button.disabled=true;
button.textContent=loadingText;
button.classList.add('is-loading');
fetch(nextUrl, {
method: 'GET',
credentials: 'same-origin',
cache: 'no-store'
})
.then(function (response){
if(!response.ok){
throw new Error('HTTP ' + response.status);
}
return response.text();
})
.then(function (html){
var doc=new DOMParser().parseFromString(html, 'text/html');
var hasItems=appendNewItems(doc);
if(!hasItems){
removeButton();
return;
}
var nextPage=currentPage + 1;
var followingUrl=getNextUrlFromDocument(doc);
button.setAttribute('data-current', String(nextPage));
if(!followingUrl||nextPage >=maxPage){
removeButton();
return;
}
button.setAttribute('data-next-url', followingUrl);
button.disabled=false;
button.textContent=loadText;
button.classList.remove('is-loading');
isLoading=false;
})
.catch(function (){
button.disabled=false;
button.textContent=errorText;
button.classList.remove('is-loading');
button.setAttribute('title', 'Yükleme sırasında hata oluştu.');
isLoading=false;
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-hg-page="1"]');
if(!page){
return;
}
var form=page.querySelector('[data-gah-hg-form="1"]');
var fileInput=page.querySelector('#gah_hg_file');
var fileHelp=page.querySelector('#gahHgFileName');
var captchaImg=page.querySelector('#gahHgCaptchaImg');
var captchaRefresh=page.querySelector('#gahHgCaptchaRefresh');
var submitButton=page.querySelector('.gah-hg-submit');
if(fileInput&&fileHelp){
var defaultFileText=fileHelp.textContent;
fileInput.addEventListener('change', function (){
if(fileInput.files&&fileInput.files.length > 0){
fileHelp.textContent='Seçilen dosya: ' + fileInput.files[0].name;
}else{
fileHelp.textContent=defaultFileText;
}});
}
if(captchaImg&&captchaRefresh){
captchaRefresh.addEventListener('click', function (){
var baseSrc=captchaImg.getAttribute('data-src')||captchaImg.getAttribute('src')||'';
if(!baseSrc){
return;
}
var separator=baseSrc.indexOf('?')===-1 ? '?':'&';
captchaImg.setAttribute('src', baseSrc + separator + 'v=' + Date.now());
});
}
if(form&&submitButton){
form.addEventListener('submit', function (){
var loadingText=submitButton.getAttribute('data-loading-text')||'Gönderiliyor...';
submitButton.disabled=true;
submitButton.textContent=loadingText;
});
}});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var weatherPage=document.querySelector('[data-gah-hwp-page="1"]');
if(!weatherPage){
return;
}
var root=document.documentElement;
function updateWeatherStickyTop(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(90, Math.min(190, Math.round(height + 18)));
root.style.setProperty('--gah-hwp-sticky-top', offset + 'px');
}
updateWeatherStickyTop();
window.addEventListener('load', updateWeatherStickyTop);
window.addEventListener('resize', updateWeatherStickyTop, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-contact-page="1"]');
if(!page){
return;
}
var form=page.querySelector('[data-gah-contact-form="1"]');
var captchaImg=page.querySelector('#gahContactCaptchaImg');
var captchaRefresh=page.querySelector('#gahContactCaptchaRefresh');
var submitButton=page.querySelector('.gah-contact-submit');
if(captchaImg&&captchaRefresh){
captchaRefresh.addEventListener('click', function (){
var baseSrc=captchaImg.getAttribute('data-src')||captchaImg.getAttribute('src')||'';
if(!baseSrc){
return;
}
var separator=baseSrc.indexOf('?')===-1 ? '?':'&';
captchaImg.setAttribute('src', baseSrc + separator + 'v=' + Date.now());
});
}
if(form&&submitButton){
form.addEventListener('submit', function (){
var loadingText=submitButton.getAttribute('data-loading-text')||'Gönderiliyor...';
submitButton.disabled=true;
submitButton.textContent=loadingText;
});
}
var root=document.documentElement;
function updateContactStickyTop(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(90, Math.min(190, Math.round(height + 18)));
root.style.setProperty('--gah-contact-sticky-top', offset + 'px');
}
updateContactStickyTop();
window.addEventListener('load', updateContactStickyTop);
window.addEventListener('resize', updateContactStickyTop, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-hero-slider="1"]');
if(!sliders.length){
return;
}
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-hero-slide]');
var navButtons=root.querySelectorAll('[data-gah-hero-nav]');
var prevBtn=root.querySelector('.gah-hero-slider__arrow--prev');
var nextBtn=root.querySelector('.gah-hero-slider__arrow--next');
var current=0;
var timer=null;
var delay=5000;
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-hero-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
if(slides.length < 2){
return;
}
stopAuto();
timer=window.setInterval(nextSlide, delay);
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-hero-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(button.classList.contains('gah-hero-slider__num')){
button.addEventListener('mouseenter', function (){
var index=parseInt(button.getAttribute('data-gah-hero-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
button.addEventListener('focus', function (){
var index=parseInt(button.getAttribute('data-gah-hero-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-big-manset="1"]');
if(!sliders.length){
return;
}
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-bm-slide]');
var navButtons=root.querySelectorAll('[data-gah-bm-nav]');
var prevBtn=root.querySelector('.gah-bm__arrow--prev');
var nextBtn=root.querySelector('.gah-bm__arrow--next');
var current=0;
var timer=null;
var delay=5000;
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-bm-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
if(slides.length < 2){
return;
}
stopAuto();
timer=window.setInterval(nextSlide, delay);
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-bm-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(button.classList.contains('gah-bm__num')){
button.addEventListener('mouseenter', function (){
var index=parseInt(button.getAttribute('data-gah-bm-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
button.addEventListener('focus', function (){
var index=parseInt(button.getAttribute('data-gah-bm-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-sur2-slider="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var track=root.querySelector('.gah-sur2__track');
var prevBtn=root.querySelector('.gah-sur2__arrow--prev');
var nextBtn=root.querySelector('.gah-sur2__arrow--next');
var slides=root.querySelectorAll('.gah-sur2__slide');
if(!track||slides.length < 1){
return;
}
var timer=null;
var isPaused=false;
var autoplay=root.getAttribute('data-gah-sur2-autoplay')==='1';
var interval=parseInt(root.getAttribute('data-gah-sur2-interval')||'4500', 10);
if(!Number.isFinite(interval)||interval < 1500){
interval=4500;
}
function getGap(){
var style=window.getComputedStyle(track);
var gap=parseFloat(style.columnGap||style.gap||'0');
return Number.isFinite(gap) ? gap:0;
}
function getStep(){
var firstSlide=slides[0];
if(!firstSlide){
return track.clientWidth;
}
return firstSlide.getBoundingClientRect().width + getGap();
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function isAtStart(){
return track.scrollLeft <=2;
}
function isAtEnd(){
return Math.ceil(track.scrollLeft) >=getMaxScroll() - 2;
}
function updateButtons(){
var maxScroll=getMaxScroll();
if(maxScroll <=2){
if(prevBtn){
prevBtn.classList.add('is-disabled');
}
if(nextBtn){
nextBtn.classList.add('is-disabled');
}
return;
}
if(prevBtn){
prevBtn.classList.toggle('is-disabled', isAtStart());
}
if(nextBtn){
nextBtn.classList.toggle('is-disabled', isAtEnd());
}}
function scrollToStart(){
track.scrollTo({
left: 0,
behavior: reduceMotion ? 'auto':'smooth'
});
}
function scrollNext(){
if(isAtEnd()){
scrollToStart();
return;
}
track.scrollBy({
left: getStep(),
behavior: reduceMotion ? 'auto':'smooth'
});
}
function scrollPrev(){
if(isAtStart()){
track.scrollTo({
left: getMaxScroll(),
behavior: reduceMotion ? 'auto':'smooth'
});
return;
}
track.scrollBy({
left: -getStep(),
behavior: reduceMotion ? 'auto':'smooth'
});
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(!autoplay||reduceMotion||slides.length < 2||getMaxScroll() <=2||isPaused){
return;
}
timer=window.setInterval(function (){
if(!isPaused){
scrollNext();
}}, interval);
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
scrollPrev();
updateButtons();
startAuto();
});
}
if(nextBtn){
nextBtn.addEventListener('click', function (){
scrollNext();
updateButtons();
startAuto();
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
root.addEventListener('mouseenter', function (){
isPaused=true;
stopAuto();
});
root.addEventListener('mouseleave', function (){
isPaused=false;
startAuto();
});
root.addEventListener('focusin', function (){
isPaused=true;
stopAuto();
});
root.addEventListener('focusout', function (){
isPaused=false;
startAuto();
});
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
window.addEventListener('resize', function (){
updateButtons();
startAuto();
}, { passive: true });
updateButtons();
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-ym-slider="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-ym-slide]');
var navButtons=root.querySelectorAll('[data-gah-ym-nav]');
var prevBtn=root.querySelector('.gah-ym__arrow--prev');
var nextBtn=root.querySelector('.gah-ym__arrow--next');
var current=0;
var timer=null;
var delay=5000;
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-ym-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length < 2){
return;
}
timer=window.setInterval(nextSlide, delay);
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-ym-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(button.classList.contains('gah-ym__num')){
button.addEventListener('mouseenter', function (){
var index=parseInt(button.getAttribute('data-gah-ym-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
button.addEventListener('focus', function (){
var index=parseInt(button.getAttribute('data-gah-ym-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-pg-page="1"]');
if(!page){
return;
}
var cards=page.querySelectorAll('.gah-pg-card');
if(!cards.length){
return;
}
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var galleries=document.querySelectorAll('[data-gah-mm="1"]');
if(!galleries.length){
return;
}
galleries.forEach(function (root){
var tabs=root.querySelectorAll('[data-gah-mm-tab]');
var panels=root.querySelectorAll('[data-gah-mm-panel]');
tabs.forEach(function (tab){
tab.addEventListener('click', function (){
var target=tab.getAttribute('data-gah-mm-tab')||'';
if(!target){
return;
}
tabs.forEach(function (item){
var active=item===tab;
item.classList.toggle('is-active', active);
item.setAttribute('aria-selected', active ? 'true':'false');
});
panels.forEach(function (panel){
var active=panel.getAttribute('data-gah-mm-panel')===target;
panel.classList.toggle('is-active', active);
if(active){
panel.removeAttribute('hidden');
}else{
panel.setAttribute('hidden', 'hidden');
}});
});
});
var heroLink=root.querySelector('[data-gah-mm-hero-link="1"]');
var heroTitle=root.querySelector('[data-gah-mm-hero-title="1"]');
var heroImg=root.querySelector('[data-gah-mm-hero-img="1"]');
var videoItems=root.querySelectorAll('[data-gah-mm-video-item="1"]');
if(!heroLink||!heroTitle||!videoItems.length){
return;
}
videoItems.forEach(function (button){
button.addEventListener('click', function (){
var title=button.getAttribute('data-title')||'';
var url=button.getAttribute('data-url')||'';
var image=button.getAttribute('data-image')||'';
if(!title||!url){
return;
}
videoItems.forEach(function (item){
item.classList.remove('is-active');
});
button.classList.add('is-active');
heroLink.setAttribute('href', url);
heroLink.setAttribute('title', title);
heroTitle.textContent=title;
if(heroImg&&image){
heroImg.setAttribute('src', image);
heroImg.setAttribute('alt', title);
heroImg.removeAttribute('srcset');
heroImg.removeAttribute('sizes');
}});
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-okm="1"]');
if(!modules.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function initAdsense(root){
var ads=root.querySelectorAll('ins.adsbygoogle');
if(!ads.length||typeof window.adsbygoogle==='undefined'){
return;
}
ads.forEach(function (ad){
if(ad.getAttribute('data-adsbygoogle-status')){
return;
}
try {
(window.adsbygoogle=window.adsbygoogle||[]).push({});
} catch (error){
}});
}
modules.forEach(function (root){
initAdsense(root);
var track=root.querySelector('.gah-okm__track');
var prevBtn=root.querySelector('.gah-okm__arrow--prev');
var nextBtn=root.querySelector('.gah-okm__arrow--next');
var slides=root.querySelectorAll('.gah-okm__slide');
if(!track||!slides.length){
return;
}
var timer=null;
var isPaused=false;
var autoplay=root.getAttribute('data-gah-okm-autoplay')==='1';
var interval=parseInt(root.getAttribute('data-gah-okm-interval')||'4500', 10);
if(!Number.isFinite(interval)||interval < 1500){
interval=4500;
}
function getGap(){
var style=window.getComputedStyle(track);
var gap=parseFloat(style.columnGap||style.gap||'0');
return Number.isFinite(gap) ? gap:0;
}
function getStep(){
var firstSlide=slides[0];
if(!firstSlide){
return track.clientWidth;
}
return firstSlide.getBoundingClientRect().width + getGap();
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function isAtStart(){
return track.scrollLeft <=2;
}
function isAtEnd(){
return Math.ceil(track.scrollLeft) >=getMaxScroll() - 2;
}
function updateButtons(){
var maxScroll=getMaxScroll();
if(maxScroll <=2){
if(prevBtn){
prevBtn.classList.add('is-disabled');
}
if(nextBtn){
nextBtn.classList.add('is-disabled');
}
return;
}
if(prevBtn){
prevBtn.classList.toggle('is-disabled', isAtStart());
}
if(nextBtn){
nextBtn.classList.toggle('is-disabled', isAtEnd());
}}
function scrollToStart(){
track.scrollTo({
left: 0,
behavior: reduceMotion ? 'auto':'smooth'
});
}
function scrollNext(){
if(isAtEnd()){
scrollToStart();
return;
}
track.scrollBy({
left: getStep(),
behavior: reduceMotion ? 'auto':'smooth'
});
}
function scrollPrev(){
if(isAtStart()){
track.scrollTo({
left: getMaxScroll(),
behavior: reduceMotion ? 'auto':'smooth'
});
return;
}
track.scrollBy({
left: -getStep(),
behavior: reduceMotion ? 'auto':'smooth'
});
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(!autoplay||reduceMotion||slides.length < 2||getMaxScroll() <=2||isPaused){
return;
}
timer=window.setInterval(function (){
if(!isPaused){
scrollNext();
}}, interval);
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
scrollPrev();
updateButtons();
startAuto();
});
}
if(nextBtn){
nextBtn.addEventListener('click', function (){
scrollNext();
updateButtons();
startAuto();
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
root.addEventListener('mouseenter', function (){
isPaused=true;
stopAuto();
});
root.addEventListener('mouseleave', function (){
isPaused=false;
startAuto();
});
root.addEventListener('focusin', function (){
isPaused=true;
stopAuto();
});
root.addEventListener('focusout', function (){
isPaused=false;
startAuto();
});
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
window.addEventListener('resize', function (){
updateButtons();
startAuto();
}, { passive: true });
updateButtons();
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-os2="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-os2-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-os3="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-os3-slide]');
var navItems=root.querySelectorAll('[data-gah-os3-nav]');
var prevBtn=root.querySelector('.gah-os3__arrow--prev');
var nextBtn=root.querySelector('.gah-os3__arrow--next');
var heroBlock=root.querySelector('.gah-os3__hero');
var current=0;
var timer=null;
var delay=parseInt(root.getAttribute('data-gah-os3-interval')||'5000', 10);
if(!Number.isFinite(delay)||delay < 1500){
delay=5000;
}
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navItems.forEach(function (nav){
var target=parseInt(nav.getAttribute('data-gah-os3-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
nav.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length < 2){
return;
}
timer=window.setInterval(nextSlide, delay);
}
navItems.forEach(function (nav){
nav.addEventListener('click', function (){
var index=parseInt(nav.getAttribute('data-gah-os3-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(nav.classList.contains('gah-os3__nav-item')){
nav.addEventListener('mouseenter', function (){
var index=parseInt(nav.getAttribute('data-gah-os3-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
nav.addEventListener('mouseleave', startAuto);
nav.addEventListener('focus', function (){
var index=parseInt(nav.getAttribute('data-gah-os3-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
nav.addEventListener('blur', startAuto);
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
if(heroBlock){
heroBlock.addEventListener('mouseenter', stopAuto);
heroBlock.addEventListener('mouseleave', startAuto);
}
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cg6="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cg6-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-syw="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var track=root.querySelector('.gah-syw__track');
var slides=Array.prototype.slice.call(root.querySelectorAll('.gah-syw__slide'));
var prevButton=root.querySelector('.gah-syw__arrow--prev');
var nextButton=root.querySelector('.gah-syw__arrow--next');
var dotsWrap=root.querySelector('.gah-syw__dots');
if(!track||!prevButton||!nextButton||!slides.length){
return;
}
var autoTimer=null;
var isPaused=false;
var interval=parseInt(root.getAttribute('data-gah-syw-interval')||'4500', 10);
if(!Number.isFinite(interval)||interval < 1500){
interval=4500;
}
function getPerView(){
if(window.matchMedia('(max-width: 640px)').matches){
return 1;
}
if(window.matchMedia('(max-width: 991px)').matches){
return 2;
}
return 3;
}
function getStep(){
var firstSlide=slides[0];
if(!firstSlide){
return track.clientWidth;
}
return firstSlide.getBoundingClientRect().width;
}
function getMaxPage(){
return Math.max(0, Math.ceil(slides.length / getPerView()) - 1);
}
function getCurrentPage(){
var step=getStep() * getPerView();
if(step <=0){
return 0;
}
return Math.round(track.scrollLeft / step);
}
function goToPage(page){
var maxPage=getMaxPage();
var safePage=Math.max(0, Math.min(maxPage, page));
track.scrollTo({
left: safePage * getStep() * getPerView(),
behavior: reduceMotion ? 'auto':'smooth'
});
}
function refreshDots(){
var maxPage;
var i;
var dot;
if(!dotsWrap){
return;
}
maxPage=getMaxPage();
dotsWrap.innerHTML='';
if(maxPage <=0){
return;
}
for (i=0; i <=maxPage; i +=1){
dot=document.createElement('button');
dot.type='button';
dot.className='gah-syw__dot';
dot.setAttribute('aria-label', (i + 1) + '. yazar grubu');
(function (pageIndex){
dot.addEventListener('click', function (){
goToPage(pageIndex);
startAuto();
});
}(i));
dotsWrap.appendChild(dot);
}}
function updateState(){
var page=getCurrentPage();
var maxPage=getMaxPage();
prevButton.classList.toggle('is-disabled', page <=0);
nextButton.classList.toggle('is-disabled', page >=maxPage);
if(dotsWrap){
Array.prototype.slice.call(dotsWrap.children).forEach(function (dot, index){
dot.classList.toggle('is-active', index===page);
});
}}
function next(){
var page=getCurrentPage();
var maxPage=getMaxPage();
if(page >=maxPage){
goToPage(0);
return;
}
goToPage(page + 1);
}
function prev(){
var page=getCurrentPage();
var maxPage=getMaxPage();
if(page <=0){
goToPage(maxPage);
return;
}
goToPage(page - 1);
}
function stopAuto(){
if(autoTimer){
window.clearInterval(autoTimer);
autoTimer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length <=getPerView()){
return;
}
autoTimer=window.setInterval(function (){
if(!isPaused){
next();
}}, interval);
}
prevButton.addEventListener('click', function (){
prev();
startAuto();
});
nextButton.addEventListener('click', function (){
next();
startAuto();
});
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateState);
}, { passive: true });
root.addEventListener('mouseenter', function (){
isPaused=true;
});
root.addEventListener('mouseleave', function (){
isPaused=false;
});
root.addEventListener('focusin', function (){
isPaused=true;
});
root.addEventListener('focusout', function (){
isPaused=false;
});
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
window.addEventListener('resize', function (){
refreshDots();
updateState();
startAuto();
}, { passive: true });
refreshDots();
updateState();
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-tmhx-page="1"]');
if(!page){
return;
}
var results=page.querySelector('[data-gah-tmhx-results="1"]');
var button=page.querySelector('[data-gah-tmhx-load-more="1"]');
function animateCards(scope){
var cards=scope.querySelectorAll('[data-gah-tmhx-card="1"]:not(.is-loaded)');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 30);
});
}
function updateStickyTop(){
var root=document.documentElement;
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(90, Math.min(190, Math.round(height + 18)));
root.style.setProperty('--gah-tmhx-sticky-top', offset + 'px');
}
animateCards(page);
updateStickyTop();
window.addEventListener('load', updateStickyTop);
window.addEventListener('resize', updateStickyTop, { passive: true });
if(!results||!button){
return;
}
button.addEventListener('click', function (){
var ajaxUrl=button.getAttribute('data-ajax-url')||'';
var nonce=button.getAttribute('data-nonce')||'';
var currentPage=parseInt(button.getAttribute('data-page')||'1', 10);
var maxPage=parseInt(button.getAttribute('data-max')||'1', 10);
var perPage=parseInt(button.getAttribute('data-per-page')||'12', 10);
var loadingText=button.getAttribute('data-loading-text')||'Yükleniyor...';
var loadText=button.getAttribute('data-load-text')||'Daha Fazla Yükle';
var errorText=button.getAttribute('data-error-text')||'Tekrar Dene';
if(!ajaxUrl||!nonce){
button.remove();
return;
}
if(!Number.isFinite(currentPage)){
currentPage=1;
}
if(!Number.isFinite(maxPage)){
maxPage=1;
}
if(!Number.isFinite(perPage)){
perPage=12;
}
if(currentPage >=maxPage){
button.remove();
return;
}
var nextPage=currentPage + 1;
var formData=new FormData();
formData.append('action', 'gah_tmhx_load_more');
formData.append('nonce', nonce);
formData.append('page', String(nextPage));
formData.append('per_page', String(perPage));
button.disabled=true;
button.textContent=loadingText;
fetch(ajaxUrl, {
method: 'POST',
credentials: 'same-origin',
body: formData
})
.then(function (response){
if(!response.ok){
throw new Error('HTTP ' + response.status);
}
return response.json();
})
.then(function (payload){
if(!payload||!payload.success||!payload.data||!payload.data.html){
throw new Error('Invalid response');
}
var temp=document.createElement('div');
temp.innerHTML=payload.data.html;
var newItems=Array.prototype.slice.call(temp.children);
newItems.forEach(function (item){
results.appendChild(item);
});
button.setAttribute('data-page', String(payload.data.page||nextPage));
animateCards(results);
if(!payload.data.has_more||(payload.data.page||nextPage) >=maxPage){
button.remove();
return;
}
button.disabled=false;
button.textContent=loadText;
})
.catch(function (){
button.disabled=false;
button.textContent=errorText;
button.setAttribute('title', 'Yükleme sırasında hata oluştu.');
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-trfx-page="1"]');
if(!page){
return;
}
var mapElement=page.querySelector('[data-gah-trfx-map="1"]');
var loadingElement=page.querySelector('[data-gah-trfx-loading="1"]');
if(!mapElement){
return;
}
var centerLat=parseFloat(mapElement.getAttribute('data-lat')||'40.9128');
var centerLng=parseFloat(mapElement.getAttribute('data-lng')||'38.3895');
var zoomLevel=parseInt(mapElement.getAttribute('data-zoom')||'12', 10);
var cityName=mapElement.getAttribute('data-city')||'Giresun';
var apiUrl=mapElement.getAttribute('data-api-url')||'';
if(!Number.isFinite(centerLat)){
centerLat=40.9128;
}
if(!Number.isFinite(centerLng)){
centerLng=38.3895;
}
if(!Number.isFinite(zoomLevel)||zoomLevel < 4||zoomLevel > 18){
zoomLevel=12;
}
function hideLoading(){
if(loadingElement){
loadingElement.style.display='none';
}}
function showError(message){
if(!loadingElement){
return;
}
loadingElement.textContent=message||'Harita yüklenemedi';
loadingElement.classList.add('is-error');
loadingElement.style.display='inline-flex';
}
function loadYandexApi(callback){
var existingScript;
if(typeof window.ymaps!=='undefined'){
callback();
return;
}
if(!apiUrl){
showError('Harita API adresi bulunamadı');
return;
}
existingScript=document.getElementById('gah-trfx-yandex-api');
if(existingScript){
existingScript.addEventListener('load', callback);
existingScript.addEventListener('error', function (){
showError('Harita servisi yüklenemedi');
});
return;
}
existingScript=document.createElement('script');
existingScript.id='gah-trfx-yandex-api';
existingScript.src=apiUrl;
existingScript.async=true;
existingScript.addEventListener('load', callback);
existingScript.addEventListener('error', function (){
showError('Harita servisi yüklenemedi');
});
document.head.appendChild(existingScript);
}
function initTrafficMap(){
if(typeof window.ymaps==='undefined'){
showError('Harita servisi başlatılamadı');
return;
}
window.ymaps.ready(function (){
try {
var map=new window.ymaps.Map(mapElement, {
center: [centerLat, centerLng],
zoom: zoomLevel,
controls: ['zoomControl', 'fullscreenControl']
}, {
suppressMapOpenBlock: true
});
var trafficControl=new window.ymaps.control.TrafficControl({
state: {
providerKey: 'traffic#actual',
trafficShown: true,
infoLayerShown: true
}});
map.controls.add(trafficControl);
try {
trafficControl.getProvider('traffic#actual').state.set('infoLayerShown', true);
} catch (providerError){
}
var placemark=new window.ymaps.Placemark([centerLat, centerLng], {
balloonContent: cityName + ' trafik durumu'
}, {
preset: 'islands#redDotIcon'
});
map.geoObjects.add(placemark);
if(window.matchMedia&&window.matchMedia('(max-width: 768px)').matches){
map.behaviors.disable('scrollZoom');
}
hideLoading();
} catch (error){
showError('Harita yüklenemedi');
}});
}
loadYandexApi(initTrafficMap);
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var page=document.querySelector('[data-gah-yzpg-page="1"]');
if(!page){
return;
}
var cards=page.querySelectorAll('[data-gah-yzpg-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
var root=document.documentElement;
function updateYzpgStickyTop(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=8){
height +=rect.height;
counted.push(el);
}}
});
var offset=Math.max(90, Math.min(190, Math.round(height + 18)));
root.style.setProperty('--gah-yzpg-sticky-top', offset + 'px');
}
updateYzpgStickyTop();
window.addEventListener('load', updateYzpgStickyTop);
window.addEventListener('resize', updateYzpgStickyTop, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt1="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt1-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt2="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt2-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt3="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt3-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-cnt4="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-cnt4-slide]');
var navButtons=root.querySelectorAll('[data-gah-cnt4-nav]');
var prevBtn=root.querySelector('.gah-cnt4__arrow--prev');
var nextBtn=root.querySelector('.gah-cnt4__arrow--next');
var current=0;
var timer=null;
var delay=parseInt(root.getAttribute('data-gah-cnt4-interval')||'5000', 10);
if(!Number.isFinite(delay)||delay < 1500){
delay=5000;
}
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-cnt4-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length < 2){
return;
}
timer=window.setInterval(nextSlide, delay);
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-cnt4-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(button.classList.contains('gah-cnt4__thumb')){
button.addEventListener('mouseenter', function (){
var index=parseInt(button.getAttribute('data-gah-cnt4-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
button.addEventListener('mouseleave', startAuto);
button.addEventListener('focus', function (){
var index=parseInt(button.getAttribute('data-gah-cnt4-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
button.addEventListener('blur', startAuto);
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt5="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt5-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt6="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt6-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-cnt7="1"]');
if(!modules.length){
return;
}
modules.forEach(function (root){
var cards=root.querySelectorAll('[data-gah-cnt7-card="1"]');
cards.forEach(function (card, index){
window.setTimeout(function (){
card.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sliders=document.querySelectorAll('[data-gah-spsl="1"]');
if(!sliders.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
sliders.forEach(function (root){
var slides=root.querySelectorAll('[data-gah-spsl-slide]');
var navButtons=root.querySelectorAll('[data-gah-spsl-nav]');
var prevBtn=root.querySelector('.gah-spsl__arrow--prev');
var nextBtn=root.querySelector('.gah-spsl__arrow--next');
var current=0;
var timer=null;
var delay=parseInt(root.getAttribute('data-gah-spsl-interval')||'5000', 10);
if(!Number.isFinite(delay)||delay < 1500){
delay=5000;
}
if(!slides.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function showSlide(index){
index=normalizeIndex(index);
slides.forEach(function (slide, slideIndex){
slide.classList.toggle('is-active', slideIndex===index);
});
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-spsl-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function nextSlide(){
showSlide(current + 1);
}
function prevSlide(){
showSlide(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length < 2){
return;
}
timer=window.setInterval(nextSlide, delay);
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-spsl-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
startAuto();
});
if(button.classList.contains('gah-spsl__nav-item')){
button.addEventListener('mouseenter', function (){
var index=parseInt(button.getAttribute('data-gah-spsl-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
button.addEventListener('mouseleave', startAuto);
button.addEventListener('focus', function (){
var index=parseInt(button.getAttribute('data-gah-spsl-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
showSlide(index);
stopAuto();
});
button.addEventListener('blur', startAuto);
}});
if(nextBtn){
nextBtn.addEventListener('click', function (){
nextSlide();
startAuto();
});
}
if(prevBtn){
prevBtn.addEventListener('click', function (){
prevSlide();
startAuto();
});
}
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
showSlide(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var modules=document.querySelectorAll('[data-gah-pmbx="1"]');
if(!modules.length){
return;
}
modules.forEach(function (module){
var track=module.querySelector('[data-gah-pmbx-track="1"]');
var prev=module.querySelector('.gah-pmbx__nav--prev');
var next=module.querySelector('.gah-pmbx__nav--next');
var cards=module.querySelectorAll('.gah-pmbx__card');
if(!track){
return;
}
function getStep(){
if(!cards.length){
return 180;
}
return cards[0].getBoundingClientRect().width;
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function updateButtons(){
var max=getMaxScroll();
if(!prev||!next){
return;
}
if(max <=5){
prev.classList.add('is-disabled');
next.classList.add('is-disabled');
return;
}
prev.classList.toggle('is-disabled', track.scrollLeft <=2);
next.classList.toggle('is-disabled', Math.ceil(track.scrollLeft) >=max - 2);
}
if(prev){
prev.addEventListener('click', function (){
track.scrollBy({
left: -getStep(),
behavior: 'smooth'
});
window.setTimeout(updateButtons, 260);
});
}
if(next){
next.addEventListener('click', function (){
track.scrollBy({
left: getStep(),
behavior: 'smooth'
});
window.setTimeout(updateButtons, 260);
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
window.addEventListener('resize', updateButtons, { passive: true });
window.addEventListener('load', updateButtons);
updateButtons();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-vzbx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var track=root.querySelector('[data-gah-vzbx-track="1"]');
var prevButton=root.querySelector('.gah-vzbx__arrow--prev');
var nextButton=root.querySelector('.gah-vzbx__arrow--next');
var slides=root.querySelectorAll('[data-gah-vzbx-slide="1"]');
if(!track){
return;
}
function getGap(){
var styles=window.getComputedStyle(track);
var gap=parseFloat(styles.columnGap||styles.gap||'0');
return Number.isFinite(gap) ? gap:0;
}
function getStep(){
if(!slides.length){
return track.clientWidth;
}
return slides[0].getBoundingClientRect().width + getGap();
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function updateButtons(){
var maxScroll=getMaxScroll();
if(!prevButton||!nextButton){
return;
}
if(maxScroll <=2){
prevButton.classList.add('is-disabled');
nextButton.classList.add('is-disabled');
return;
}
prevButton.classList.toggle('is-disabled', track.scrollLeft <=2);
nextButton.classList.toggle('is-disabled', Math.ceil(track.scrollLeft) >=maxScroll - 2);
}
function scrollNext(){
track.scrollBy({
left: getStep(),
behavior: 'smooth'
});
}
function scrollPrev(){
track.scrollBy({
left: -getStep(),
behavior: 'smooth'
});
}
slides.forEach(function (slide, index){
window.setTimeout(function (){
slide.classList.add('is-loaded');
}, index * 35);
});
if(nextButton){
nextButton.addEventListener('click', function (){
scrollNext();
window.setTimeout(updateButtons, 260);
});
}
if(prevButton){
prevButton.addEventListener('click', function (){
scrollPrev();
window.setTimeout(updateButtons, 260);
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
window.addEventListener('resize', updateButtons, { passive: true });
window.addEventListener('load', updateButtons);
updateButtons();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var sidebars=document.querySelectorAll('[data-gah-sgbx="1"]');
if(!sidebars.length){
return;
}
var root=document.documentElement;
function markHosts(){
sidebars.forEach(function (sidebar){
var parent=sidebar.parentElement;
if(parent){
parent.classList.add('gah-sgbx-host');
}});
}
function getStickyHeaderHeight(){
var selectors=[
'#wpadminbar',
'.ghh-topbar',
'.ghh-header',
'.ghh-main-header',
'.site-header',
'.main-header',
'header#masthead',
'#header',
'.header',
'.ustMenu'
];
var height=0;
var counted=[];
selectors.forEach(function (selector){
var el=document.querySelector(selector);
if(!el||counted.indexOf(el)!==-1){
return;
}
var style=window.getComputedStyle(el);
var rect=el.getBoundingClientRect();
if(selector==='#wpadminbar' ||
style.position==='fixed' ||
style.position==='sticky'
){
if(rect.height > 0&&rect.top <=12){
height +=rect.height;
counted.push(el);
}}
});
return Math.max(80, Math.min(190, Math.round(height + 18)));
}
function updateStickyTop(){
root.style.setProperty('--gah-sgbx-sticky-top', getStickyHeaderHeight() + 'px');
}
function updateScrollableState(){
sidebars.forEach(function (sidebar){
var needsScroll=sidebar.scrollHeight > sidebar.clientHeight + 8;
sidebar.classList.toggle('is-not-scrollable', !needsScroll);
});
}
function updateAll(){
updateStickyTop();
window.requestAnimationFrame(function (){
updateScrollableState();
});
}
markHosts();
updateAll();
window.addEventListener('load', updateAll);
window.addEventListener('resize', updateAll, { passive: true });
sidebars.forEach(function (sidebar){
if('ResizeObserver' in window){
var observer=new ResizeObserver(updateScrollableState);
observer.observe(sidebar);
}});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-pollx="1"]');
if(!widgets.length){
return;
}
function refreshPollWidget(widget){
var options=widget.querySelectorAll('.wp-polls-ul li');
options.forEach(function (item){
var input=item.querySelector('input[type="radio"], input[type="checkbox"]');
if(!input){
return;
}
item.classList.toggle('is-checked', input.checked);
input.addEventListener('change', function (){
options.forEach(function (otherItem){
var otherInput=otherItem.querySelector('input[type="radio"], input[type="checkbox"]');
otherItem.classList.toggle('is-checked', !!otherInput&&otherInput.checked);
});
}, { once: false });
});
widget.classList.add('is-ready');
}
widgets.forEach(function (widget){
refreshPollWidget(widget);
if('MutationObserver' in window){
var observer=new MutationObserver(function (){
refreshPollWidget(widget);
});
observer.observe(widget, {
childList: true,
subtree: true
});
}});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-gakx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var track=root.querySelector('[data-gah-gakx-track="1"]');
var prevButton=root.querySelector('.gah-gakx__arrow--prev');
var nextButton=root.querySelector('.gah-gakx__arrow--next');
var slides=root.querySelectorAll('[data-gah-gakx-slide="1"]');
if(!track){
return;
}
function getGap(){
var styles=window.getComputedStyle(track);
var gap=parseFloat(styles.columnGap||styles.gap||'0');
return Number.isFinite(gap) ? gap:0;
}
function getStep(){
if(!slides.length){
return track.clientWidth;
}
return slides[0].getBoundingClientRect().width + getGap();
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function updateButtons(){
var maxScroll=getMaxScroll();
if(!prevButton||!nextButton){
return;
}
if(maxScroll <=2){
prevButton.classList.add('is-disabled');
nextButton.classList.add('is-disabled');
return;
}
prevButton.classList.toggle('is-disabled', track.scrollLeft <=2);
nextButton.classList.toggle('is-disabled', Math.ceil(track.scrollLeft) >=maxScroll - 2);
}
function scrollNext(){
track.scrollBy({
left: getStep(),
behavior: 'smooth'
});
}
function scrollPrev(){
track.scrollBy({
left: -getStep(),
behavior: 'smooth'
});
}
slides.forEach(function (slide, index){
window.setTimeout(function (){
slide.classList.add('is-loaded');
}, index * 35);
});
if(nextButton){
nextButton.addEventListener('click', function (){
scrollNext();
window.setTimeout(updateButtons, 260);
});
}
if(prevButton){
prevButton.addEventListener('click', function (){
scrollPrev();
window.setTimeout(updateButtons, 260);
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
window.addEventListener('resize', updateButtons, { passive: true });
window.addEventListener('load', updateButtons);
updateButtons();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-wthx="1"]');
if(!widgets.length){
return;
}
function text(value){
return String(value===null||value===undefined ? '':value);
}
function formatTemp(value){
var number=Number(value);
if(!Number.isFinite(number)){
return '-';
}
return number.toLocaleString('tr-TR', {
minimumFractionDigits: 1,
maximumFractionDigits: 1
}) + '°C';
}
function formatPercent(value){
var number=Number(value);
if(!Number.isFinite(number)){
return '-';
}
return number.toLocaleString('tr-TR', {
maximumFractionDigits: 0
}) + '%';
}
function formatSpeed(value){
var number=Number(value);
if(!Number.isFinite(number)){
return '-';
}
return number.toLocaleString('tr-TR', {
minimumFractionDigits: 1,
maximumFractionDigits: 1
}) + ' km/sa';
}
function formatMm(value){
var number=Number(value);
if(!Number.isFinite(number)){
return '-';
}
return number.toLocaleString('tr-TR', {
minimumFractionDigits: 1,
maximumFractionDigits: 1
}) + ' mm';
}
function formatDate(dateString){
var date=new Date(text(dateString) + 'T00:00:00');
if(Number.isNaN(date.getTime())){
return '-';
}
return date.toLocaleDateString('tr-TR', {
day: '2-digit',
month: 'short'
});
}
function setTarget(root, target, value){
var element=root.querySelector('[data-gah-wthx-target="' + target + '"]');
if(element){
element.textContent=value;
}}
function renderForecast(root, days){
var list=root.querySelector('[data-gah-wthx-forecast="1"]');
if(!list||!Array.isArray(days)){
return;
}
list.innerHTML='';
days.slice(0, 5).forEach(function (day){
var item=document.createElement('div');
item.className='gah-wthx__forecast-item';
var date=document.createElement('span');
date.className='gah-wthx__forecast-date';
date.textContent=formatDate(day.date);
var icon=document.createElement('span');
icon.className='gah-wthx__forecast-icon';
icon.textContent=text(day.icon||'🌡️');
var desc=document.createElement('span');
desc.className='gah-wthx__forecast-desc';
desc.textContent=text(day.description||'-');
var temp=document.createElement('span');
temp.className='gah-wthx__forecast-temp';
temp.textContent=formatTemp(day.temperature_min) + ' / ' + formatTemp(day.temperature_max);
item.appendChild(date);
item.appendChild(icon);
item.appendChild(desc);
item.appendChild(temp);
list.appendChild(item);
});
}
function updateWeather(root, select){
var endpoint=root.getAttribute('data-gah-wthx-endpoint')||'';
var body=root.querySelector('[data-gah-wthx-body="1"]');
var option=select.options[select.selectedIndex];
if(!endpoint||!option){
return;
}
var lat=option.getAttribute('data-lat')||'';
var lon=option.getAttribute('data-lon')||'';
var city=option.getAttribute('data-label')||option.textContent||'';
var url;
try {
url=new URL(endpoint);
} catch (error){
return;
}
url.searchParams.set('lat', lat);
url.searchParams.set('lon', lon);
url.searchParams.set('city', city);
url.searchParams.set('days', '5');
if(body){
body.classList.add('is-loading');
}
fetch(url.toString(), {
credentials: 'same-origin'
})
.then(function (response){
if(!response.ok){
throw new Error('Hava durumu alınamadı.');
}
return response.json();
})
.then(function (data){
if(!data||!data.ok||!data.current){
throw new Error('Hava durumu verisi okunamadı.');
}
var current=data.current||{};
var daily=Array.isArray(data.daily) ? data.daily:[];
setTarget(root, 'header-icon', text(current.icon||'🌡️'));
setTarget(root, 'big-icon', text(current.icon||'🌡️'));
setTarget(root, 'temperature', formatTemp(current.temperature));
setTarget(root, 'description', text(current.description||'-'));
setTarget(root, 'city', text(data.city||city));
setTarget(root, 'feels', formatTemp(current.apparent_temperature));
setTarget(root, 'humidity', formatPercent(current.relative_humidity));
setTarget(root, 'wind', formatSpeed(current.wind_speed));
setTarget(root, 'cloud', formatPercent(current.cloud_cover));
setTarget(root, 'rain', formatMm(current.precipitation));
if(daily[0]){
setTarget(root, 'today-min', formatTemp(daily[0].temperature_min));
}
renderForecast(root, daily);
})
.catch(function (){
setTarget(root, 'description', 'Veri alınamadı');
})
.finally(function (){
if(body){
body.classList.remove('is-loading');
}});
}
widgets.forEach(function (root){
var select=root.querySelector('[data-gah-wthx-select="1"]');
if(!select){
return;
}
select.addEventListener('change', function (){
updateWeather(root, select);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-scatx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-scatx-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var adBoxes=document.querySelectorAll('[data-gah-adx="adsense"]');
if(!adBoxes.length){
return;
}
var adsenseScriptLoading=false;
var adsenseScriptLoaded=typeof window.adsbygoogle!=='undefined';
function getClient(){
var client='';
adBoxes.forEach(function (box){
if(client){
return;
}
client=box.getAttribute('data-gah-adx-client')||'';
if(!client){
var ins=box.querySelector('ins.adsbygoogle[data-ad-client]');
client=ins ? (ins.getAttribute('data-ad-client')||''):'';
}});
return client;
}
function loadAdsenseScript(callback){
var client=getClient();
if(typeof window.adsbygoogle!=='undefined'){
adsenseScriptLoaded=true;
callback();
return;
}
if(adsenseScriptLoading){
window.setTimeout(function (){
loadAdsenseScript(callback);
}, 300);
return;
}
if(!client||!/^ca-pub-[0-9]+$/.test(client)){
return;
}
var existing=document.querySelector('script[src*="pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"]');
if(existing){
adsenseScriptLoading=true;
existing.addEventListener('load', function (){
adsenseScriptLoaded=true;
adsenseScriptLoading=false;
callback();
});
existing.addEventListener('error', function (){
adsenseScriptLoading=false;
});
return;
}
adsenseScriptLoading=true;
var script=document.createElement('script');
script.async=true;
script.crossOrigin='anonymous';
script.src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=' + encodeURIComponent(client);
script.addEventListener('load', function (){
adsenseScriptLoaded=true;
adsenseScriptLoading=false;
callback();
});
script.addEventListener('error', function (){
adsenseScriptLoading=false;
});
document.head.appendChild(script);
}
function isVisible(element){
if(!element){
return false;
}
var rect=element.getBoundingClientRect();
return rect.width > 0&&rect.height >=0;
}
function pushAd(ins, attempt){
attempt=attempt||0;
if(!ins||ins.getAttribute('data-gah-adx-pushed')==='1'){
return;
}
var box=ins.closest('.gah-adx');
if(!isVisible(ins)||ins.offsetWidth < 120){
if(attempt < 10){
window.setTimeout(function (){
pushAd(ins, attempt + 1);
}, 400);
}
return;
}
try {
window.adsbygoogle=window.adsbygoogle||[];
window.adsbygoogle.push({});
ins.setAttribute('data-gah-adx-pushed', '1');
if(box){
box.classList.remove('is-waiting');
box.classList.add('is-pushed');
}} catch (error){
if(box){
box.classList.add('is-error');
}}
}
function initAds(){
var insItems=document.querySelectorAll('[data-gah-adx="adsense"] ins.adsbygoogle');
insItems.forEach(function (ins){
pushAd(ins, 0);
});
}
adBoxes.forEach(function (box){
box.classList.add('is-waiting');
});
loadAdsenseScript(initAds);
window.addEventListener('load', function (){
if(adsenseScriptLoaded){
initAds();
}});
window.addEventListener('resize', function (){
if(adsenseScriptLoaded){
window.setTimeout(initAds, 250);
}}, { passive: true });
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-kat2x="1"]');
if(!widgets.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
widgets.forEach(function (root){
var track=root.querySelector('[data-gah-kat2x-track="1"]');
var slides=root.querySelectorAll('[data-gah-kat2x-slide]');
var navButtons=root.querySelectorAll('[data-gah-kat2x-nav]');
var prevButton=root.querySelector('.gah-kat2x__arrow--prev');
var nextButton=root.querySelector('.gah-kat2x__arrow--next');
var interval=parseInt(root.getAttribute('data-gah-kat2x-interval')||'5000', 10);
var timer=null;
var current=0;
if(!track||!slides.length){
return;
}
if(!Number.isFinite(interval)||interval < 1500){
interval=5000;
}
function normalizeIndex(index){
if(index < 0){
return slides.length - 1;
}
if(index >=slides.length){
return 0;
}
return index;
}
function setActive(index){
index=normalizeIndex(index);
navButtons.forEach(function (button){
var target=parseInt(button.getAttribute('data-gah-kat2x-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
button.classList.toggle('is-active', target===index);
});
current=index;
}
function goTo(index){
index=normalizeIndex(index);
track.scrollTo({
left: index * track.clientWidth,
behavior: reduceMotion ? 'auto':'smooth'
});
setActive(index);
}
function updateFromScroll(){
var index=Math.round(track.scrollLeft / Math.max(1, track.clientWidth));
setActive(index);
}
function next(){
goTo(current + 1);
}
function prev(){
goTo(current - 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||slides.length < 2){
return;
}
timer=window.setInterval(next, interval);
}
if(prevButton){
prevButton.addEventListener('click', function (){
prev();
startAuto();
});
}
if(nextButton){
nextButton.addEventListener('click', function (){
next();
startAuto();
});
}
navButtons.forEach(function (button){
button.addEventListener('click', function (){
var index=parseInt(button.getAttribute('data-gah-kat2x-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
goTo(index);
startAuto();
});
});
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateFromScroll);
}, { passive: true });
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
root.addEventListener('focusin', stopAuto);
root.addEventListener('focusout', startAuto);
window.addEventListener('resize', function (){
goTo(current);
}, { passive: true });
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
setActive(0);
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-kat3x="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-kat3x-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-kat4x="1"]');
if(!widgets.length){
return;
}
var reduceMotion=window.matchMedia &&
window.matchMedia('(prefers-reduced-motion: reduce)').matches;
widgets.forEach(function (root){
var panels=root.querySelectorAll('[data-gah-kat4x-panel]');
var navItems=root.querySelectorAll('[data-gah-kat4x-nav]');
var current=0;
var timer=null;
var delay=parseInt(root.getAttribute('data-gah-kat4x-interval')||'5000', 10);
if(!Number.isFinite(delay)||delay < 1500){
delay=5000;
}
if(!panels.length||!navItems.length){
return;
}
function normalizeIndex(index){
if(index < 0){
return panels.length - 1;
}
if(index >=panels.length){
return 0;
}
return index;
}
function show(index){
index=normalizeIndex(index);
panels.forEach(function (panel, panelIndex){
panel.classList.toggle('is-active', panelIndex===index);
});
navItems.forEach(function (nav){
var target=parseInt(nav.getAttribute('data-gah-kat4x-nav')||'0', 10);
if(!Number.isFinite(target)){
target=0;
}
nav.classList.toggle('is-active', target===index);
});
current=index;
}
function next(){
show(current + 1);
}
function stopAuto(){
if(timer){
window.clearInterval(timer);
timer=null;
}}
function startAuto(){
stopAuto();
if(reduceMotion||panels.length < 2){
return;
}
timer=window.setInterval(next, delay);
}
navItems.forEach(function (item){
item.addEventListener('mouseenter', function (){
var index=parseInt(item.getAttribute('data-gah-kat4x-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
show(index);
stopAuto();
});
item.addEventListener('focus', function (){
var index=parseInt(item.getAttribute('data-gah-kat4x-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
show(index);
stopAuto();
});
item.addEventListener('click', function (){
var index=parseInt(item.getAttribute('data-gah-kat4x-nav')||'0', 10);
if(!Number.isFinite(index)){
index=0;
}
show(index);
});
});
root.addEventListener('mouseenter', stopAuto);
root.addEventListener('mouseleave', startAuto);
root.addEventListener('focusin', stopAuto);
root.addEventListener('focusout', startAuto);
document.addEventListener('visibilitychange', function (){
if(document.hidden){
stopAuto();
return;
}
startAuto();
});
show(0);
root.classList.add('is-ready');
startAuto();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-kat5x="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-kat5x-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-kat6x="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-kat6x-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 30);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-pfgx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var track=root.querySelector('[data-gah-pfgx-track="1"]');
var prevButton=root.querySelector('.gah-pfgx__arrow--prev');
var nextButton=root.querySelector('.gah-pfgx__arrow--next');
var slides=root.querySelectorAll('[data-gah-pfgx-slide="1"]');
if(!track){
return;
}
function getGap(){
var styles=window.getComputedStyle(track);
var gap=parseFloat(styles.columnGap||styles.gap||'0');
return Number.isFinite(gap) ? gap:0;
}
function getStep(){
if(!slides.length){
return track.clientWidth;
}
return slides[0].getBoundingClientRect().width + getGap();
}
function getMaxScroll(){
return Math.max(0, track.scrollWidth - track.clientWidth);
}
function updateButtons(){
var maxScroll=getMaxScroll();
if(!prevButton||!nextButton){
return;
}
if(maxScroll <=2){
prevButton.classList.add('is-disabled');
nextButton.classList.add('is-disabled');
return;
}
prevButton.classList.toggle('is-disabled', track.scrollLeft <=2);
nextButton.classList.toggle('is-disabled', Math.ceil(track.scrollLeft) >=maxScroll - 2);
}
function scrollNext(){
track.scrollBy({
left: getStep(),
behavior: 'smooth'
});
}
function scrollPrev(){
track.scrollBy({
left: -getStep(),
behavior: 'smooth'
});
}
slides.forEach(function (slide, index){
window.setTimeout(function (){
slide.classList.add('is-loaded');
}, index * 35);
});
if(nextButton){
nextButton.addEventListener('click', function (){
scrollNext();
window.setTimeout(updateButtons, 260);
});
}
if(prevButton){
prevButton.addEventListener('click', function (){
scrollPrev();
window.setTimeout(updateButtons, 260);
});
}
track.addEventListener('scroll', function (){
window.requestAnimationFrame(updateButtons);
}, { passive: true });
window.addEventListener('resize', updateButtons, { passive: true });
window.addEventListener('load', updateButtons);
updateButtons();
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-pvgx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-pvgx-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-pdsx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var select=root.querySelector('[data-gah-pdsx-select="1"]');
var panels=root.querySelectorAll('[data-gah-pdsx-panel]');
if(!select||!panels.length){
root.classList.add('is-ready');
return;
}
function showPanel(value){
panels.forEach(function (panel){
panel.classList.toggle('is-active',
panel.getAttribute('data-gah-pdsx-panel')===value
);
});
}
select.addEventListener('change', function (){
showPanel(select.value);
});
showPanel(select.value);
root.classList.add('is-ready');
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-sndx="1"]');
if(!widgets.length){
return;
}
widgets.forEach(function (root){
var items=root.querySelectorAll('[data-gah-sndx-item="1"]');
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();
(function (){
'use strict';
document.addEventListener('DOMContentLoaded', function (){
var widgets=document.querySelectorAll('[data-gah-ywrx="1"]');
if(!widgets.length){
return;
}
function escapeSelector(value){
value=String(value||'');
if(window.CSS&&typeof window.CSS.escape==='function'){
return window.CSS.escape(value);
}
return value.replace(/[^a-zA-Z0-9_-]/g, '');
}
widgets.forEach(function (root){
var popover=root.querySelector('.gah-ywrx__popover');
var content=root.querySelector('[data-gah-ywrx-content="1"]');
var closeButton=root.querySelector('[data-gah-ywrx-close="1"]');
var openButtons=root.querySelectorAll('[data-gah-ywrx-modal]');
var items=root.querySelectorAll('[data-gah-ywrx-item="1"]');
var lastFocused=null;
if(!popover||!content||!closeButton){
return;
}
function openPopover(templateId, trigger){
var safeId=escapeSelector(templateId);
var template=root.querySelector('#' + safeId);
if(!template){
return;
}
if(template.tagName&&template.tagName.toLowerCase()==='template'){
content.innerHTML=template.innerHTML;
}else{
content.innerHTML=template.innerHTML||'';
}
lastFocused=trigger||null;
popover.classList.add('is-open');
popover.setAttribute('aria-hidden', 'false');
closeButton.focus();
}
function closePopover(){
popover.classList.remove('is-open');
popover.setAttribute('aria-hidden', 'true');
content.innerHTML='';
if(lastFocused&&typeof lastFocused.focus==='function'){
lastFocused.focus();
}}
openButtons.forEach(function (button){
button.addEventListener('click', function (){
openPopover(button.getAttribute('data-gah-ywrx-modal'), button);
});
});
closeButton.addEventListener('click', closePopover);
root.addEventListener('keydown', function (event){
if(event.key==='Escape'&&popover.classList.contains('is-open')){
closePopover();
}});
items.forEach(function (item, index){
window.setTimeout(function (){
item.classList.add('is-loaded');
}, index * 35);
});
});
});
})();