This repository was archived by the owner on Oct 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
396 lines (335 loc) · 14.8 KB
/
Copy pathscript.js
File metadata and controls
396 lines (335 loc) · 14.8 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
document.addEventListener('DOMContentLoaded', function() {
// Mobile Navigation
const hamburger = document.querySelector('.hamburger');
const navLinks = document.querySelector('.nav-links');
hamburger.addEventListener('click', function() {
this.classList.toggle('active');
navLinks.classList.toggle('active');
});
// Close mobile menu when clicking a link
document.querySelectorAll('.nav-links a').forEach(link => {
link.addEventListener('click', () => {
hamburger.classList.remove('active');
navLinks.classList.remove('active');
});
});
// Back to Top Button
const backToTopBtn = document.getElementById('backToTop');
window.addEventListener('scroll', function() {
if (window.pageYOffset > 300) {
backToTopBtn.classList.add('active');
} else {
backToTopBtn.classList.remove('active');
}
});
backToTopBtn.addEventListener('click', function(e) {
e.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
// Current Year in Footer
document.getElementById('current-year').textContent = new Date().getFullYear();
// Email Obfuscation
const emailUser = 'mail';
const emailDomain = 'janphilippkleinschmidt.com';
const emailLink = document.getElementById('email-link');
if (emailLink) {
emailLink.href = 'mailto:' + emailUser + '@' + emailDomain;
emailLink.textContent = emailUser + '@' + emailDomain;
}
// Projects Filter
const filterBtns = document.querySelectorAll('.filter-btn');
const projectCards = document.querySelectorAll('.project-card');
filterBtns.forEach(btn => {
btn.addEventListener('click', function() {
// Remove active class from all buttons
filterBtns.forEach(btn => btn.classList.remove('active'));
// Add active class to clicked button
this.classList.add('active');
const filter = this.getAttribute('data-filter');
projectCards.forEach(card => {
if (filter === 'all' || card.getAttribute('data-categories').includes(filter)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
// Reset skill filtering when changing category
resetSkillFilter();
});
});
// Skill Filtering
const skillItems = document.querySelectorAll('.skill-item');
const skillBadges = document.querySelectorAll('.skill-badge');
function highlightProjectsBySkill(skill) {
// First scroll to the projects section
const projectsSection = document.getElementById('projects');
if (projectsSection) {
window.scrollTo({
top: projectsSection.offsetTop - 80,
behavior: 'smooth'
});
}
// Then highlight projects that use this skill (after a small delay to account for scrolling)
setTimeout(() => {
const relevantProjects = document.querySelectorAll(`.project-card[data-skills*="${skill}"]`);
relevantProjects.forEach(project => {
project.classList.add('highlight');
// Remove highlight after 1 second
setTimeout(() => {
project.classList.remove('highlight');
}, 1000);
});
// Highlight the skill badge in projects
const relevantBadges = document.querySelectorAll(`.skill-badge[data-skill="${skill}"]`);
relevantBadges.forEach(badge => {
badge.classList.add('active');
// Remove highlight after 1 second
setTimeout(() => {
badge.classList.remove('active');
}, 1000);
});
}, 500);
}
skillItems.forEach(item => {
item.addEventListener('click', function() {
const skill = this.getAttribute('data-skill');
highlightProjectsBySkill(skill);
});
});
skillBadges.forEach(badge => {
badge.addEventListener('click', function(e) {
e.stopPropagation();
const skill = this.getAttribute('data-skill');
highlightProjectsBySkill(skill);
});
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
window.scrollTo({
top: targetElement.offsetTop - 80,
behavior: 'smooth'
});
}
});
});
// Scroll animations
const animateOnScroll = function() {
const elements = document.querySelectorAll('.section, .project-card, .timeline-item, .skill-item');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const windowHeight = window.innerHeight;
if (elementPosition < windowHeight - 100) {
element.style.opacity = '1';
element.style.transform = 'translateY(0)';
}
});
};
// Set initial state for animated elements
document.querySelectorAll('.section, .project-card, .timeline-item, .skill-item').forEach(element => {
element.style.opacity = '0';
element.style.transform = 'translateY(30px)';
element.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
});
animateOnScroll();
window.addEventListener('scroll', animateOnScroll);
});
//#region console
// Console Easter Egg
const consoleContainer = document.getElementById('console-container');
const consoleOutput = document.getElementById('console-output');
const consoleInput = document.getElementById('console-input');
const consoleClose = document.getElementById('console-close');
let consoleVisible = false;
// Toggle console with backtick key (`)
document.addEventListener('keydown', function(e) {
if (e.shiftKey && e.key === 'C') {
e.preventDefault();
toggleConsole();
}
// If console is visible and Enter is pressed
if (consoleVisible && e.key === 'Enter' && document.activeElement === consoleInput) {
e.preventDefault();
processCommand(consoleInput.value);
consoleInput.value = '';
}
});
// Close button
consoleClose.addEventListener('click', toggleConsole);
function toggleConsole() {
consoleVisible = !consoleVisible;
if (consoleVisible) {
consoleContainer.classList.remove('console-hidden');
consoleInput.focus();
printToConsole('Welcome to JPK Console! Type "help" for available commands.', 'info');
} else {
consoleContainer.classList.add('console-hidden');
}
}
function printToConsole(text, type = 'normal') {
const line = document.createElement('div');
line.className = `response ${type}`;
line.textContent = text;
consoleOutput.appendChild(line);
consoleOutput.scrollTop = consoleOutput.scrollHeight;
}
function processCommand(cmd) {
if (!cmd.trim()) return;
// Echo the command
printToConsole(`$ ${cmd}`, 'command');
const args = cmd.split(' ');
const command = args[0].toLowerCase();
const params = args.slice(1).join(' ');
switch(command) {
case 'help':
printToConsole('Available commands:', 'info');
printToConsole('info - Shows information about this website');
printToConsole(' goto <section> - Jump to section (about, skills, projects, etc)');
printToConsole('echo <text> - Repeats the provided text');
printToConsole('contact - Shows contact information');
printToConsole('projects - Lists all projects');
printToConsole('skills - Lists all skills');
printToConsole('clear - Clears the console');
printToConsole('play <game>- Launch one of my games (beaver-runner, move-on, etc)');
printToConsole('open <site>- Open a website (github, linkedin, lieblings-wunschliste, etc)');
printToConsole('quit - Close the console');
break;
case 'info':
printToConsole('Jan Philipp Kleinschmidt Portfolio', 'info');
printToConsole('Version: 0.2.9');
printToConsole('Description: Professional portfolio showcasing skills in Wirtschaftsinformatik, programming, and Game design.');
printToConsole('Technologies: HTML5, CSS3, JavaScript');
break;
case 'echo':
if (!params) {
printToConsole('Usage: echo <text>', 'error');
break;
}
printToConsole(params);
break;
case 'contact':
printToConsole('Contact Information:', 'info');
printToConsole('Email: ' + 'mail' + '@' + 'janphilippkleinschmidt.com');
printToConsole('LinkedIn: https://linkedin.com/in/Jan-Philipp-Kleinschmidt');
printToConsole('GitHub: https://github.com/J20a05n');
break;
case 'projects':
printToConsole('My Projects:', 'info');
printToConsole('1. Lieblings Wunschliste - Free online wishlist creator');
printToConsole('2. Move On - 2D Platformer game');
printToConsole('3. Beaver Runner - 2D jump and run game');
printToConsole('4. Side.Games - Game development project');
printToConsole('5. Choros - 2D action space shooter');
printToConsole('6. S.A.C. - Secret agent game');
printToConsole('7. Cat Adventure - Run-and-gun platformer');
printToConsole('Visit the projects section for more details!');
break;
case 'skills':
printToConsole('My Skills:', 'info');
printToConsole('Programming: C#, Java, Python, JavaScript, HTML, CSS');
printToConsole('Tools: Unity, Godot, Git, Docker, Node.js, Linux, VS Code');
printToConsole('Other: Office, Adobe Suite, 3D Printing, Arduino');
break;
case 'clear':
consoleOutput.innerHTML = '';
break;
case 'play':
if (!params) {
printToConsole('Usage: play <game>', 'error');
printToConsole('Available games: beaver-runner, move-on, choros, sac, cat-adventure', 'info');
break;
}
const gameMap = {
'beaver-runner': 'https://j20a05n.github.io/Beaver-Runner_WebGL-Build/',
'move-on': 'https://j20a05n.itch.io/move-on',
'choros': 'https://j20a05n.itch.io/choros',
'sac': 'https://j20a05n.itch.io/sac',
'cat-adventure': 'https://j20a05n.itch.io/cat-adventure'
};
const gameKey = params.toLowerCase().replace(/\s+/g, '-');
if (gameMap[gameKey]) {
printToConsole(`Launching ${params}...`, 'success');
setTimeout(() => window.open(gameMap[gameKey], '_blank'), 500);
} else {
printToConsole(`Game "${params}" not found. Type "play" for available games.`, 'error');
}
break;
case 'open':
if (!params) {
printToConsole('Usage: open <site>', 'error');
printToConsole('Available sites: github, linkedin, lieblings-wunschliste, sidegames', 'info');
break;
}
const siteMap = {
'github': 'https://github.com/J20a05n',
'linkedin': 'https://linkedin.com/in/Jan-Philipp-Kleinschmidt',
'lieblings': 'https://www.lieblings-wunschliste.de',
'sidegames': 'https://sidegames.janphilippkleinschmidt.com'
};
const siteKey = params.toLowerCase();
if (siteMap[siteKey]) {
printToConsole(`Opening ${params}...`, 'success');
setTimeout(() => window.open(siteMap[siteKey], '_blank'), 500);
} else {
printToConsole(`Site "${params}" not found. Type "open" for available sites.`, 'error');
}
break;
case 'goto':
if (!params) {
printToConsole('Usage: goto <section>', 'error');
printToConsole('Available sections: about, skills, projects, experience, contact', 'info');
break;
}
const sectionMap = {
'about': '#about',
'skills': '#skills',
'projects': '#projects',
'experience': '#experience',
'contact': '#contact'
};
const sectionKey = params.toLowerCase();
if (sectionMap[sectionKey]) {
const section = document.querySelector(sectionMap[sectionKey]);
if (section) {
printToConsole(`Scrolling to ${params} section...`, 'success');
window.scrollTo({
top: section.offsetTop - 80,
behavior: 'smooth'
});
} else {
printToConsole(`Section "${params}" not found in DOM`, 'error');
}
} else {
printToConsole(`Section "${params}" not available. Type "goto" for available sections.`, 'error');
}
break;
case 'sudo':
if (params === 'rm -rf /') {
printToConsole('', 'error');
printToConsole('ERROR: PERMISSION DENIED.', 'error');
printToConsole('', 'error');
printToConsole('(╯°□°)╯︵ ┻━┻', 'error');
printToConsole('', 'error');
printToConsole('System integrity maintained. *phew*', 'success');
} else {
printToConsole(`sudo: ${params}: command not found`, 'error');
}
break;
case 'quit':
printToConsole('Closing console...', 'info');
toggleConsole();
break;
default:
printToConsole(`Command not found: ${command}`, 'error');
printToConsole('Type "help" for available commands', 'info');
}
}
//#endregion console