-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
281 lines (262 loc) · 15.4 KB
/
script.js
File metadata and controls
281 lines (262 loc) · 15.4 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
// Dark Mode Toggle
const darkModeBtn = document.getElementById("dark-mode-btn");
darkModeBtn.addEventListener("click", () => {
document.body.classList.toggle("dark-mode");
darkModeBtn.textContent = document.body.classList.contains("dark-mode") ? "☀️" : "🌙";
});
// Chatbot Toggle Button
const chatbotToggleBtn = document.getElementById("chatbot-toggle-btn");
const chatbotContainer = document.getElementById("chatbot");
const chatbotCloseBtn = document.getElementById("chatbot-close-btn");
chatbotToggleBtn.addEventListener("click", () => {
chatbotContainer.style.display = chatbotContainer.style.display === "none" ? "block" : "none";
});
chatbotCloseBtn.addEventListener("click", () => {
chatbotContainer.style.display = "none";
});
// Chatbot Logic
function sendMessage() {
const userInput = document.getElementById("user-input").value.trim(); // Trim whitespace
const chatbotBody = document.getElementById("chatbot-body");
if (userInput === "") return; // Don't send empty messages
// Display user message
chatbotBody.innerHTML += `<p><strong>You:</strong> ${userInput}</p>`;
// Bot response logic
let botResponse = '';
if (userInput.toLowerCase() === "hi" || userInput.toLowerCase() === "hello") {
botResponse = "Hello! 👋I'm a Backend Developer at IBM, an Open Source Contributor, a passionate Blog Writer, and a Tech Speaker who loves sharing knowledge through sessions and workshops. What would you like to know about me?<br>" +
"<button onclick=\"selectOption('Education')\">Education 🎓</button>" +
"<button onclick=\"selectOption('Experience')\">Experience 🎓</button>" +
"<button onclick=\"selectOption('Blogs')\">Blogs ✍️</button>" +
"<button onclick=\"selectOption('Presentations')\">Presentations 📊</button>" +
"<button onclick=\"selectOption('Projects')\">Projects 🧑💻</button>" +
"<button onclick=\"selectOption('Contact')\">Contact 📞</button>";
} else {
// Handle typed input
const input = userInput.toLowerCase();
if (input.includes("education") || input.includes("edu")) {
selectOption("Education");
return;
} else if (input.includes("experience") || input.includes("exp")) {
selectOption("Experience");
return;
} else if (input.includes("blog") || input.includes("write")) {
selectOption("Blogs");
return;
} else if (input.includes("presentation") || input.includes("talk")) {
selectOption("Presentations");
return;
} else if (input.includes("project") || input.includes("work")) {
selectOption("Projects");
return;
} else if (input.includes("contact") || input.includes("reach")) {
selectOption("Contact");
return;
} else if (input.includes("matriculation") || input.includes("school")) {
selectOption("Matriculation");
return;
} else if (input.includes("higher secondary") || input.includes("12th")) {
selectOption("Higher Secondary");
return;
} else if (input.includes("undergraduate") || input.includes("btech")) {
selectOption("Undergraduate");
return;
} else if (input.includes("intern") || input.includes("internship")) {
selectOption("Intern");
return;
} else if (input.includes("developer") || input.includes("job")) {
selectOption("Developer");
return;
} else if (input.includes("virtual threads") || input.includes("threads")) {
selectOption("Virtual Threads");
return;
} else if (input.includes("low-code") || input.includes("no-code")) {
selectOption("Low-Code Platforms");
return;
} else if (input.includes("websocket") || input.includes("jakarta")) {
selectOption("Jakarta WebSocket");
return;
} else if (input.includes("java migration") || input.includes("java 8")) {
selectOption("Java Migration");
return;
} else if (input.includes("containerization") || input.includes("openshift")) {
selectOption("Containerization");
return;
} else if (input.includes("low-code") || input.includes("no-code")) {
selectOption("Low-Code");
return;
} else if (input.includes("bmi") || input.includes("calculator")) {
selectOption("BMI Calculator");
return;
} else if (input.includes("chat") || input.includes("websocket")) {
selectOption("WebSocket Chat Application");
return;
} else {
botResponse = "I’m still learning. Can you please send <strong>Hi</strong> or <strong>Hello</strong> to start?";
}
}
// Display bot message
chatbotBody.innerHTML += `<p><strong>Sweetty:</strong> ${botResponse}</p>`;
// Clear input
document.getElementById("user-input").value = "";
// Scroll to the bottom of the chatbot body
chatbotBody.scrollTop = chatbotBody.scrollHeight;
}
// Add Enter key functionality
document.getElementById("user-input").addEventListener("keydown", (event) => {
if (event.key === "Enter") {
sendMessage();
}
});
function selectOption(option) {
const chatbotBody = document.getElementById("chatbot-body");
let botResponse = '';
switch (option) {
case "Education":
botResponse = "Great! Here are the levels of education I have completed:<br>" +
"<button onclick=\"selectOption('Matriculation')\">Matriculation 🏫</button>" +
"<button onclick=\"selectOption('Higher Secondary')\">Higher Secondary</button>" +
"<button onclick=\"selectOption('Undergraduate')\">Undergraduate 🎓</button>";
break;
case "Matriculation":
botResponse = "I completed my Matriculation from Sobhana Public School with CGPA 10.";
break;
case "Higher Secondary":
botResponse = "I completed my Higher Secondary education in Computer Science from St George HSS, Kothamangalam with 97.25%";
break;
case "Undergraduate":
botResponse = "I completed my B.Tech in Electronics and Communication Engineering from Mar Athanasius College of Engineering, Kothamangalam with CPGA 9.48. I also have minor degree in Computer Science Engineering and Honours degree in Electronics and Communication Engineering.";
break;
case "Blogs":
botResponse = "Here are some of my featured blogs. Click to explore!<br>" +
"<button onclick=\"selectOption('Virtual Threads')\">Virtual Threads: A Game-Changer for Concurrency 💻</button>" +
"<button onclick=\"selectOption('Low-Code Platforms')\">Unleashing Creativity: The Rise of Low-Code/No-Code 🎨</button>" +
"<button onclick=\"selectOption('Jakarta WebSocket')\">Jakarta WebSocket Essentials 🌐</button>";
break;
case "Experience":
botResponse = "Here’s an overview of my professional experience:<br>" +
"<button onclick=\"selectOption('Intern')\">Software Developer Intern 💼</button>" +
"<button onclick=\"selectOption('Developer')\">Software Developer 👨💻</button>";
break;
case "Intern":
botResponse = "<h3>Software Developer Intern</h3>" +
"<p><strong>Company:</strong> IBM India Private Limited, Kochi</p>" +
"<p><strong>Duration:</strong> 30/01/2023 - 31/07/2023</p>" +
"<p><strong>Project:</strong> WebSphere Application Server</p>" +
"<p>Engaged in L3 support cases and development activities for JCA and JDBC components of traditional WebSphere and Open Liberty, as well as the Bean Validation component of Open Liberty.</p>";
break;
case "Developer":
botResponse = "<h3>Software Developer</h3>" +
"<p><strong>Company:</strong> IBM India Private Limited, Kochi</p>" +
"<p><strong>Duration:</strong> 01/08/2023 - Present</p>" +
"<p><strong>Project:</strong> WebSphere Application Server</p>" +
"<p>Engaged in L3 support cases and development activities for JCA and JDBC components of traditional WebSphere and Open Liberty, as well as the Bean Validation component of Open Liberty.</p>";
break;
case "Virtual Threads":
botResponse = "<h3>Virtual Threads: A Game-Changer for Concurrency</h3>" +
"<p>Published on DZone, this blog explores Java Virtual Threads, comparing them to traditional platform threads and providing example code.</p>" +
"<a href='https://dzone.com/articles/deep-dive-into-java-virtual-threads-a-game-changer' target='_blank'>Read Full Blog</a>";
break;
case "Low-Code Platforms":
botResponse = "<h3>Unleashing Creativity: The Rise of Low-Code and No-Code Platforms</h3>" +
"<p>This blog likens low-code and no-code platforms to an artist's canvas, emphasizing how these platforms empower users to transform ideas into software solutions without extensive technical skills.</p>" +
"<a href='https://medium.com/@sweettypdevassy2001/unleashing-creativity-the-rise-of-low-code-and-no-code-platforms-8c09bd10261b' target='_blank'>Read Full Blog</a>";
break;
case "Jakarta WebSocket":
botResponse = "<h3>Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java</h3>" +
"<p>Published on DZone, this blog demonstrates how to build a real-time chat app using Jakarta WebSocket and Open Liberty.</p>" +
"<a href='https://dzone.com/articles/jakarta-websocket-essentials' target='_blank'>Read Full Blog</a>";
break;
case "Presentations":
botResponse = "I’ve delivered several presentations. Click on a topic to learn more!<br>" +
"<button onclick=\"selectOption('Java Migration')\">Java 8 to 17 Migration ☕</button>" +
"<button onclick=\"selectOption('Containerization')\">Enterprise App Containerization 📦</button>" +
"<button onclick=\"selectOption('Low-Code')\">The Rise of Low-Code/No-Code 🚀</button>";
break;
case "Java Migration":
botResponse = "<h3>Java 8 to 17 Migration</h3>" +
"<p><strong>Event:</strong> Java User Group</p>" +
"<p>Discussed major changes from Java 8 to 17, including JPMS, var, garbage collectors, pattern matching, and best migration practices.</p>";
break;
case "Containerization":
botResponse = "<h3>Enterprise App Containerization</h3>" +
"<p><strong>Event:</strong> WebSphere User Group</p>" +
"<p>Presented how Open Liberty and OpenShift simplify enterprise application deployment, focusing on scalability and cloud-native best practices.</p>" +
"<a href='https://drive.google.com/file/d/1W0UCDC9BBQ7YDIIuHImIP9wP6dcdKa_Z/view?usp=sharing' target='_blank'>Watch Presentation</a>";
break;
case "Low-Code":
botResponse = "<h3>The Rise of Low-Code/No-Code Platforms</h3>" +
"<p><strong>Event:</strong> Think Friday Session</p>" +
"<p>Explored how low-code and no-code platforms empower users to develop software with minimal coding, accelerating digital transformation.</p>" +
"<a href='https://drive.google.com/file/d/1WPZutUhxL7Ex-ucdeeiF8MmH-Uvf_i6o/view?usp=sharing' target='_blank'>Watch Presentation</a>";
break;
case "Projects":
botResponse = "Here are some of my projects:<br>" +
"<button onclick=\"selectOption('WebSocket Chat Application')\">WebSocket Chat Application</button>" +
"<button onclick=\"selectOption('BMI Calculator')\">BMI Calculator</button>";
break;
case "WebSocket Chat Application":
botResponse = "A simple chat server using Jakarta WebSocket API. Check out the <a href='https://github.com/sweettypdevassy/ws-blog-backend' target='_blank'>Backend Repo</a> and <a href='https://github.com/sweettypdevassy/ws-blog-frontend' target='_blank'>Frontend Repo</a>.";
break;
case "BMI Calculator":
botResponse = "A BMI calculator web application using Open Liberty, HttpServlet, and Tailwind CSS. Check out the <a href='https://github.com/sweetty01/bmi-calculator' target='_blank'>GitHub Repo</a>.";
break;
case "Contact":
botResponse = "You can reach out to me via:<br>" +
"<strong>Email:</strong> sweettypdevassy91@gmail.com<br>" +
"<strong>GitHub:</strong> <a href='https://github.com/sweettypdevassy' target='_blank'>sweettypdevassy</a><br>" +
"<strong>LinkedIn:</strong> <a href='https://www.linkedin.com/in/sweetty-p-devassy/' target='_blank'>Sweetty P Devassy</a>";
break;
default:
botResponse = "I’m still learning. Can you please choose an option?";
}
chatbotBody.innerHTML += `<p><strong>Sweetty:</strong> ${botResponse}</p>`;
// Scroll to the bottom of the chatbot body
chatbotBody.scrollTop = chatbotBody.scrollHeight;
document.getElementById("user-input").value = "";
}
// Your existing JavaScript code for animations and toggling details
document.addEventListener("DOMContentLoaded", function () {
console.log("Website Loaded Successfully!");
let talkCards = document.querySelectorAll(".talk-card");
talkCards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("visible");
}, index * 200);
});
let experienceCards = document.querySelectorAll(".experience-card");
experienceCards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("visible");
}, index * 200);
});
let educationCards = document.querySelectorAll(".education-card");
educationCards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("visible");
}, index * 200);
});
let blogCards = document.querySelectorAll(".blog-card");
blogCards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("visible");
}, index * 200);
});
let projectCards = document.querySelectorAll(".project-card");
projectCards.forEach((card, index) => {
setTimeout(() => {
card.classList.add("visible");
}, index * 200);
});
});
// Toggle visibility of details inside each card
function toggleDetails(card) {
let details = card.querySelectorAll("p");
details.forEach(detail => {
if (detail.style.display === "none" || detail.style.display === "") {
detail.style.display = "block";
} else {
detail.style.display = "none";
}
});
}