-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
186 lines (169 loc) · 9.78 KB
/
script.js
File metadata and controls
186 lines (169 loc) · 9.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// Sayfa tamamen yüklendikten sonra çalışacak kodlar (DOMContentLoaded)
document.addEventListener('DOMContentLoaded', () => {
// Çok dilli destek için çeviri objesi (i18n = internationalization)
// Her dil için anahtar-değer çiftleri tutuluyor
const i18n = {
tr: {
"btn-contact": "Bana Ulaş",
"nav-about": "Neler Yapıyorum?",
"nav-projects": "Projelerim",
"nav-career": "Kariyer & Eğitim",
"nav-skills": "Yetenekler",
"hero-badge": "YAZILIM GELİŞTİRME // ÜNİVERSİTE 1",
"hero-title": "Tasarımı Kodla Buluşturuyorum.",
"hero-desc": "Liseden gelen 4 yıllık teknik temelimi ve tam dönem staj tecrübemi harmanlıyorum.",
"stat-1-val": "Sertifikalı",
"stat-1-lbl": "Usta Geliştirici",
"stat-2-lbl": "Arayüz Vizyonu",
"stat-3-val": "Aktif",
"stat-3-lbl": "Öğrenme Süreci",
"feat-1-title": "Modern Arayüz",
"feat-1-desc": "Tailwind ve Bootstrap kullanarak şık, hızlı ve kullanıcı odaklı tasarımlar geliştiriyorum.",
"feat-2-title": "Teknik Analiz",
"feat-2-desc": "Bölümümün getirdiği analiz yeteneğiyle, karmaşık sorunlara temiz kodlu çözümler üretiyorum.",
"feat-3-title": "Ustalık Belgeli",
"feat-3-desc": "Lise eğitimimden gelen resmi ustalık ve işyeri açma belgeleriyle teknik yetkinlik.",
"proj-main-title": "Seçkin Projelerim",
"proj-1-desc": "Karmaşık görev yönetimi süreçlerini optimize eden saf JavaScript tabanlı mantık projesi.",
"proj-2-desc": "İnternetin tarihsel gelişimini modern bir arayüzle sunan görsel çalışma.",
"proj-3-desc": "Veri odaklı yönetim panelleri için tasarlanmış, tam responsive arayüz bileşenleri.",
"career-main-title": "Kariyer & Eğitim",
"edu-1-title": "M. Rüştü Uzel MTAL",
"edu-1-desc": "Bilişim Teknolojileri ve Yazılım eğitimi. 12. sınıfta tam dönem staj ile saha tecrübesi.",
"edu-2-title": "Yazılım Geliştirme",
"edu-2-desc": "Yazılım Geliştirme ve Çözümleme bölümü. Frontend üzerine aktif akademik uzmanlaşma.",
"footer-role": "Usta Geliştirici"
},
en: {
"btn-contact": "Contact Me",
"nav-about": "What I Do",
"nav-projects": "Projects",
"nav-career": "Career",
"nav-skills": "Skills",
"hero-badge": "SOFTWARE DEVELOPMENT // FRESHMAN",
"hero-title": "Merging Design with Code.",
"hero-desc": "Blending 4 years of technical foundation with professional internship experience.",
"stat-1-val": "Certified",
"stat-1-lbl": "Master Developer",
"stat-2-lbl": "UI Vision",
"stat-3-val": "Active",
"stat-3-lbl": "Learning Process",
"feat-1-title": "Modern UI",
"feat-1-desc": "Developing sleek, fast and user-centric designs with modern tools.",
"feat-2-title": "Technical Analysis",
"feat-2-desc": "Creating clean-coded solutions with strong analytical skills.",
"feat-3-title": "Mastery Certified",
"feat-3-desc": "Technical competence with official mastery certificates.",
"proj-main-title": "Featured Projects",
"proj-1-desc": "Pure JS logic project for complex task management.",
"proj-2-desc": "Visual study presenting the history of the web.",
"proj-3-desc": "Responsive UI components for data-driven dashboards.",
"career-main-title": "Career & Education",
"edu-1-title": "M. Rüştü Uzel MTAL",
"edu-1-desc": "IT and Software education with field experience.",
"edu-2-title": "Software Development",
"edu-2-desc": "Academic specialization in Frontend development.",
"footer-role": "Master Developer"
},
ar: {
"btn-contact": "اتصل بي",
"nav-about": "ماذا أفعل؟",
"nav-projects": "مشاريعي",
"nav-career": "المسيرة والتعليم",
"nav-skills": "المهارات",
"hero-badge": "تطوير البرمجيات // السنة الجامعية الأولى",
"hero-title": "أجمع بين التصميم والكود.",
"hero-desc": "أمزج بين أساسي التقني لمدة 4 سنوات وخبرتي العملية في التدريب الميداني.",
"stat-1-val": "معتمد",
"stat-1-lbl": "مطور محترف",
"stat-2-lbl": "رؤية الواجهة",
"stat-3-val": "نشط",
"stat-3-lbl": "عملية التعلم",
"feat-1-title": "واجهة عصرية",
"feat-1-desc": "تطوير تصميمات أنيقة وسريعة باستخدام Tailwind و Bootstrap.",
"feat-2-title": "التحليل التقني",
"feat-2-desc": "تقديم حلول برمجية نظيفة للمشاكل المعقدة بمهارات تحليلية.",
"feat-3-title": "شهادة إتقان",
"feat-3-desc": "كفاءة تقنية مع شهادات إتقان رسمية لفتح المشاريع.",
"proj-main-title": "مشاريع مختارة",
"proj-1-desc": "مشروع منطق JavaScript خالص لتحسين إدارة المهام.",
"proj-2-desc": "دراسة بصرية تعرض التطور التاريخي للإنترنت بواجهة حديثة.",
"proj-3-desc": "مكونات واجهة مستخدم سريعة الاستجابة للوحات التحكم.",
"career-main-title": "المسيرة والتعليم",
"edu-1-title": "M. Rüştü Uzel MTAL",
"edu-1-desc": "تعليم تكنولوجيا المعلومات والبرمجيات مع خبرة ميدانية.",
"edu-2-title": "تطوير البرمجيات",
"edu-2-desc": "تخصص أكاديمي في تطوير الواجهات الأمامية.",
"footer-role": "مطور محترف"
}
};
// Dil değiştirme fonksiyonu
// Tüm data-i18n attribute'lu elementlerin metnini günceller
// HTML lang ve dir attribute'larını da ayarlar (özellikle Arapça için RTL)
const updateLang = (lang) => {
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (i18n[lang] && i18n[lang][key]) {
el.innerText = i18n[lang][key];
}
});
// <html> etiketine lang ve direction (ltr/rtl) ekle
document.documentElement.setAttribute('lang', lang);
document.documentElement.setAttribute('dir', lang === 'ar' ? 'rtl' : 'ltr');
// Seçilen dili tarayıcıda sakla (sayfa yenilense bile kalır)
localStorage.setItem('lang', lang);
};
// Tüm dil değiştirme linklerine tıklama olayı ekle
document.querySelectorAll('.lang-switch').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault(); // Link'in normal davranışını engelle
updateLang(link.dataset.lang); // Tıklanan dil kodunu al ve uygula
});
});
// Tema değiştirme butonu (light ↔ dark)
const themeBtn = document.getElementById('theme-toggle');
themeBtn.addEventListener('click', () => {
// Mevcut temanın tersini al (light → dark, dark → light)
const current = document.documentElement.getAttribute('data-theme');
const nextTheme = current === 'light' ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', nextTheme);
localStorage.setItem('theme', nextTheme); // Tercihi sakla
});
// Scroll ile görünme efekti (reveal animation)
const reveal = () => {
// .reveal class'lı tüm elementleri kontrol et
document.querySelectorAll('.reveal').forEach(el => {
// Element ekranın üst kısmına (window yüksekliğinin -50px kadar) geldiyse
if (el.getBoundingClientRect().top < window.innerHeight - 50) {
el.classList.add('active'); // active class'ı ekle → CSS animasyonu başlar
}
});
};
// Sayfa yüklendiğinde kaydedilmiş tema ve dili uygula
const savedTheme = localStorage.getItem('theme') || 'light'; // Varsayılan: light
const savedLang = localStorage.getItem('lang') || 'tr'; // Varsayılan: Türkçe
document.documentElement.setAttribute('data-theme', savedTheme);
updateLang(savedLang);
// Scroll olayında reveal fonksiyonunu çalıştır
window.addEventListener('scroll', reveal);
// Sayfa ilk açıldığında da reveal uygula (bazı elementler hemen görünür)
reveal();
});
// ========================
// Mobil menü davranışı
// ========================
// Navbar'daki tüm linkleri seç
const navLinks = document.querySelectorAll('.nav-link');
// Collapse menü elementini seç
const menuToggle = document.querySelector('.navbar-collapse');
// Bootstrap Collapse instance'ı oluştur (toggle: false → manuel kontrol)
const bsCollapse = new bootstrap.Collapse(menuToggle, { toggle: false });
// Her menü linkine tıklandığında
navLinks.forEach((link) => {
link.addEventListener('click', () => {
// Eğer menü şu an açıksa (mobil modda)
if (menuToggle.classList.contains('show')) {
bsCollapse.hide(); // Menüyü kapat
}
});
});