document.addEventListener("DOMContentLoaded", function() {
const styleId = 'eltek-custom-style';
let themeInterval;
function applyTheme() {
const isAuthPage = window.location.pathname === '/' ||
window.location.pathname.includes('sign-in') ||
window.location.pathname.includes('sign-up');
if (isAuthPage) {
if (!document.getElementById(styleId)) {
const style = document.createElement('style');
style.id = styleId;
style.innerHTML = `
/* 1. ARKA PLAN: Sadece body'ye veriyoruz, böylece z-index sorunu yaratmıyor */
body {
background-image: url('/eltek-assets/Login_Screen_Background.png') !important;
background-size: cover !important;
background-position: center !important;
background-repeat: no-repeat !important;
background-attachment: fixed !important;
background-color: #0f172a !important;
}
/* 2. BEYAZ KATMANLARI ŞEFFAFLAŞTIR: Arka planın önünü kapatan tüm perdeleri kaldırıyoruz */
#__next, #__next > div, main, [class*="layout_auth"], [class*="bg-"] {
background: transparent !important;
background-color: transparent !important;
}
/* 3. Form Dışı Yazıları Beyaz Yap */
main, [class*="layout_auth"] {
color: #ffffff !important;
}
/* Linkleri ELTEK Yeşili Yap */
main a, [class*="layout_auth"] a {
color: #95bd22 !important;
text-decoration: none !important;
font-weight: bold !important;
}
main a:hover, [class*="layout_auth"] a:hover {
text-decoration: underline !important;
}
/* 4. GİRİŞ KUTUSU */
form {
background: rgba(20, 30, 45, 0.85) !important;
backdrop-filter: blur(12px) !important;
border-radius: 12px !important;
padding: 2.5rem !important;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
border: 1px solid rgba(255, 255, 255, 0.1) !important;
width: 100% !important;
box-sizing: border-box !important;
}
form h1, form h2, form h3, form p, form span, form label, form div {
color: #ffffff !important;
}
/* 5. EMAIL VE ŞİFRE INPUTLARI */
form input {
background-color: rgba(0, 0, 0, 0.4) !important;
color: #ffffff !important;
border: 1px solid rgba(255, 255, 255, 0.3) !important;
padding: 12px !important;
border-radius: 6px !important;
}
form input:focus {
border-color: #95bd22 !important;
background-color: rgba(0, 0, 0, 0.6) !important;
outline: none !important;
}
`;
document.head.appendChild(style);
}
if (!themeInterval) {
themeInterval = setInterval(() => {
// Sayfa açıldıktan sonra beyaz renk gelirse ez
document.querySelectorAll('#__next, #__next > div, main, [class*="layout_auth"]').forEach(el => {
if (el.style.backgroundColor && el.style.backgroundColor !== 'transparent') {
el.style.setProperty('background-color', 'transparent', 'important');
}
});
// LOGO DEĞİŞİMİ
const logoLinks = document.querySelectorAll('a[href="/"]');
logoLinks.forEach(link => {
const svgLogo = link.querySelector('svg');
if (svgLogo) svgLogo.style.display = 'none';
if (!link.querySelector('.eltek-logo')) {
const img = document.createElement('img');
img.src = '/eltek-assets/ELTEK_Logo.png';
img.className = 'eltek-logo';
img.style.height = '80px';
img.style.width = 'auto';
img.style.display = 'block';
img.style.margin = '0 auto';
link.appendChild(img);
}
});
// METİNLER VE GÜVENLİ GİZLEME (Sorunu çözen kısım burası!)
document.querySelectorAll('h1, h2, h3, p, span, div').forEach(el => {
if (el.childNodes.length === 1 && el.childNodes[0].nodeType === 3) {
let text = el.innerText.trim();
// ELTEK Rengi
if (text === 'Work in all dimensions.') {
el.innerText = 'ELTEK';
el.style.textAlign = 'center';
el.style.display = 'block';
el.style.width = '100%';
el.style.setProperty('color', '#95bd22', 'important');
}
// PLANE'i İki Satıra Bölme
if (text === 'Welcome back to Plane.') {
el.innerHTML = 'PLANE
Project Management Tool';
el.style.textAlign = 'center';
el.style.display = 'block';
el.style.width = '100%';
}
// KUTUYU YOK ETMEK YERİNE SADECE İÇİNDEKİ YAZIYI SİL (Çökmeyi önler)
if (text.includes('Join 10,000+ teams')) {
el.innerHTML = '';
}
}
});
// Marka logolarını güvenle gizle
document.querySelectorAll('img').forEach(img => {
let src = (img.src || '').toLowerCase();
let alt = (img.alt || '').toLowerCase();
if(src.includes('sony') || src.includes('dolby') || src.includes('zerodha') || src.includes('accenture') ||
alt.includes('sony') || alt.includes('dolby') || alt.includes('zerodha') || alt.includes('accenture')) {
img.style.opacity = '0'; // Kutuyu silmek yerine sadece görünmez yapıyoruz (Güvenli)
}
});
}, 200);
}
} else {
// SİSTEMİN İÇİNDEYİZ -> TÜM TEMAYI SİL
const customStyle = document.getElementById(styleId);
if (customStyle) customStyle.remove();
if (themeInterval) {
clearInterval(themeInterval);
themeInterval = null;
}
document.body.style.backgroundImage = '';
document.body.style.backgroundColor = '';
document.querySelectorAll('#__next, #__next > div').forEach(el => {
el.style.backgroundColor = '';
});
}
}
applyTheme();
const originalPushState = history.pushState;
const originalReplaceState = history.replaceState;
history.pushState = function() {
originalPushState.apply(this, arguments);
setTimeout(applyTheme, 50);
};
history.replaceState = function() {
originalReplaceState.apply(this, arguments);
setTimeout(applyTheme, 50);
};
window.addEventListener('popstate', applyTheme);
});