* Bağımlılık yok. Ayarlar aşağıdaki CONFIG içinde.
*/
(function () {
'use strict';
var CONFIG = {
domain: 'bolutakip.com',
sourceUrl: 'https://www.google.com/preferences/source?q=bolutakip.com',
logoUrl: '', // Boş bırakılırsa yazı logo kullanılır. Örn: '/images/logo.png'
delayMs: 3500, // Sayfa açıldıktan kaç ms sonra çıksın
remindLaterDays: 3, // "Sonra hatırlat" -> kaç gün sonra tekrar
closeDays: 7, // X ile kapatınca kaç gün sonra tekrar
doneDays: 365, // Butona tıklayınca kaç gün gösterilmesin
excludePaths: [/^\/admin/, /^\/panel/, /^\/amp\//], // Gösterilmeyecek yollar
storageKey: 'bt_kaynak_popup'
};
// --- Gösterim koşulları ------------------------------------------------
if (window.__btKaynakPopup) return;
window.__btKaynakPopup = true;
var ua = navigator.userAgent || '';
if (/bot|crawl|spider|slurp|lighthouse|pagespeed|headless|preview/i.test(ua)) return;
for (var i = 0; i < CONFIG.excludePaths.length; i++) {
if (CONFIG.excludePaths[i].test(location.pathname)) return;
}
if (/[?&]kaynak_popup=0/.test(location.search)) return;
var force = /[?&]kaynak_popup=1/.test(location.search); // Test için: ?kaynak_popup=1
function getState() {
try { return JSON.parse(localStorage.getItem(CONFIG.storageKey) || '{}'); } catch (e) { return {}; }
}
function setUntil(days) {
try {
localStorage.setItem(CONFIG.storageKey, JSON.stringify({ until: Date.now() + days * 864e5 }));
} catch (e) {}
}
var st = getState();
if (!force && st.until && Date.now() < st.until) return;
// --- Stil --------------------------------------------------------------
var css = '' +
'.btkp-ov{position:fixed;inset:0;z-index:2147483000;background:rgba(10,22,40,.55);' +
'backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);display:flex;align-items:center;' +
'justify-content:center;padding:16px;opacity:0;transition:opacity .25s ease}' +
'.btkp-ov.btkp-in{opacity:1}' +
'.btkp,.btkp *{box-sizing:border-box}.btkp:focus{outline:none}' +
'.btkp{font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;width:100%;max-width:420px;' +
'background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 24px 60px rgba(0,0,0,.35);' +
'transform:translateY(16px) scale(.98);transition:transform .3s cubic-bezier(.2,.8,.2,1);color:#1b2433}' +
'.btkp-in .btkp{transform:none}' +
'.btkp-hd{background:#13294b;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;' +
'border-bottom:3px solid #d0021b}' +
'.btkp-logo{background:#fff;border-radius:8px;padding:4px 10px;display:inline-flex;align-items:center;height:36px}' +
'.btkp-logo img{max-height:28px;width:auto;display:block}' +
'.btkp-word{font:italic 900 22px/1 Georgia,"Times New Roman",serif;color:#d0021b;letter-spacing:-.5px}' +
'.btkp-hr{display:flex;align-items:center;gap:10px}' +
'.btkp-g{width:30px;height:30px;border-radius:8px;background:#fff;display:grid;' +
'grid-template-columns:repeat(2,7px);gap:3px;place-content:center}' +
'.btkp-g i{width:7px;height:7px;border-radius:50%;display:block}' +
'.btkp-x{background:none;border:0;color:#fff;font-size:24px;line-height:1;cursor:pointer;padding:4px 6px;opacity:.85}' +
'.btkp-x:hover{opacity:1}' +
'.btkp-bd{padding:20px 22px 18px}' +
'.btkp-tag{display:inline-flex;align-items:center;gap:7px;background:#eef2f8;color:#13294b;font-weight:800;' +
'font-size:11.5px;letter-spacing:.6px;padding:6px 11px;border-radius:999px}' +
'.btkp-tag:before{content:"";width:7px;height:7px;border-radius:50%;background:#d0021b}' +
'.btkp h2{font:800 23px/1.2 Georgia,"Times New Roman",serif;margin:14px 0 8px;color:#13294b}' +
'.btkp p{font-size:14.5px;line-height:1.55;margin:0 0 16px;color:#4a5568}' +
'.btkp-serp{border:1px solid #e3e8ef;background:#f7f9fc;border-radius:12px;padding:12px}' +
'.btkp-serp small{display:block;font-size:10.5px;font-weight:800;letter-spacing:1px;color:#8a94a6;margin-bottom:9px}' +
'.btkp-row{display:flex;align-items:center;gap:10px;background:#fff;border:1px solid #e3e8ef;border-radius:9px;' +
'padding:9px 11px;box-shadow:0 2px 6px rgba(19,41,75,.06)}' +
'.btkp-fav{width:24px;height:24px;border-radius:6px;background:#d0021b;color:#fff;font:italic 900 13px/24px Georgia,serif;text-align:center}' +
'.btkp-row b{font-size:14.5px;flex:1;color:#1b2433}' +
'.btkp-star{font-size:11px;font-weight:800;color:#13294b;white-space:nowrap}' +
'.btkp-sk{display:flex;align-items:center;gap:10px;padding:8px 11px 0}' +
'.btkp-sk span{width:24px;height:16px;border-radius:5px;background:#e3e8ef}' +
'.btkp-sk em{height:7px;border-radius:4px;background:#e3e8ef;display:block}' +
'.btkp-cta{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin-top:18px;' +
'background:#d0021b;color:#fff !important;text-decoration:none !important;font-weight:800;font-size:15.5px;' +
'padding:15px;border-radius:12px;box-shadow:0 8px 20px rgba(208,2,27,.3);transition:background .15s,transform .15s}' +
'.btkp-cta:hover{background:#a80016;transform:translateY(-1px)}' +
'.btkp-later{display:block;margin:12px auto 0;background:none;border:0;color:#7b8597;font-size:13.5px;' +
'cursor:pointer;padding:4px 8px}' +
'.btkp-later:hover{color:#13294b;text-decoration:underline}' +
'.btkp :focus-visible{outline:3px solid #f5b800;outline-offset:2px}' +
/* Mobil: alttan açılan kart (Google'ın araya giren reklam/pop-up kurallarına daha uyumlu) */
'@media (max-width:600px){' +
'.btkp-ov{align-items:flex-end;padding:0;background:rgba(10,22,40,.35);backdrop-filter:none;-webkit-backdrop-filter:none}' +
'.btkp{max-width:none;border-radius:18px 18px 0 0;transform:translateY(100%)}' +
'.btkp h2{font-size:20px;margin-top:10px}.btkp p{font-size:14px;margin-bottom:12px}' +
'.btkp-bd{padding:16px 18px calc(14px + env(safe-area-inset-bottom))}' +
'.btkp-serp{display:none}.btkp-cta{margin-top:6px}' +
'}' +
'@media (prefers-reduced-motion:reduce){.btkp-ov,.btkp{transition:none}}';
// --- HTML --------------------------------------------------------------
function el(html) { var d = document.createElement('div'); d.innerHTML = html; return d.firstChild; }
var logoHtml = CONFIG.logoUrl
? '
'
: '
Bolu Takip ';
var html = '' +
'
' +
'
' +
'
' +
'' + logoHtml + ' ' +
'' +
' ' +
' ' +
'× ' +
' ' +
'
' +
'
' +
'
GOOGLE KAYNAK TERCİHİ ' +
'
Bolu haberlerinde Bolu Takip\'i öne çıkarın. ' +
'
Bolu Takip\'i Google\'da tercih ettiğiniz kaynaklara ekleyin; Bolu ve ilçelerinden ' +
'son dakika haberlerinde bizi Google\'da daha sık görün.
' +
'
' +
'
GOOGLE · ÖNE ÇIKAN HABERLER ' +
'
B ' + CONFIG.domain + ' ' +
'★ TERCİH EDİLEN
' +
'
' +
'
' +
'
' +
'
' +
'Google\'da kaynak olarak seç → ' +
'
Sonra hatırlat ' +
'
' +
'
' +
'
';
// --- Davranış ----------------------------------------------------------
var ov, lastFocus, prevOverflow;
function track(action) {
try {
if (window.gtag) window.gtag('event', 'kaynak_popup', { action: action });
if (window.dataLayer) window.dataLayer.push({ event: 'kaynak_popup', kaynak_action: action });
} catch (e) {}
}
function close(days, action) {
if (!ov) return;
setUntil(days);
track(action);
ov.classList.remove('btkp-in');
document.removeEventListener('keydown', onKey);
document.documentElement.style.overflow = prevOverflow;
setTimeout(function () { if (ov && ov.parentNode) ov.parentNode.removeChild(ov); ov = null; }, 300);
if (lastFocus && lastFocus.focus) try { lastFocus.focus(); } catch (e) {}
}
function onKey(e) {
if (e.key === 'Escape') return close(CONFIG.closeDays, 'esc');
if (e.key === 'Tab') { // odak döngüsü
var f = ov.querySelectorAll('a,button');
var first = f[0], last = f[f.length - 1];
if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
}
}
function show() {
if (document.hidden) { // sekme arka plandaysa görünür olunca göster
document.addEventListener('visibilitychange', function h() {
if (!document.hidden) { document.removeEventListener('visibilitychange', h); show(); }
});
return;
}
var style = document.createElement('style');
style.textContent = css;
document.head.appendChild(style);
ov = el(html);
document.body.appendChild(ov);
lastFocus = document.activeElement;
prevOverflow = document.documentElement.style.overflow;
if (window.innerWidth > 600) document.documentElement.style.overflow = 'hidden';
ov.addEventListener('click', function (e) {
if (e.target === ov) return close(CONFIG.closeDays, 'backdrop');
var a = e.target.closest('[data-act]');
if (!a) return;
var act = a.getAttribute('data-act');
if (act === 'go') close(CONFIG.doneDays, 'click_google'); // link yeni sekmede açılır
else if (act === 'later') close(CONFIG.remindLaterDays, 'later');
else if (act === 'close') close(CONFIG.closeDays, 'close');
});
document.addEventListener('keydown', onKey);
requestAnimationFrame(function () {
ov.classList.add('btkp-in');
ov.querySelector('.btkp').focus({ preventScroll: true });
});
track('view');
}
function init() { setTimeout(show, force ? 300 : CONFIG.delayMs); }
if (document.readyState === 'complete') init();
else window.addEventListener('load', init);
})();