-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
208 lines (184 loc) Β· 12.6 KB
/
script.js
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
var audio = new Audio('assets/sentmessage.mp3');
var contactString = "<div class='social'> <a target='_blank' href='tel:+919361477185'> <div class='socialItem' id='call'><img class='socialItemI' src='images/phone.svg'/><label class='number'>9361477185</label></div> </a> <a href='mailto:[email protected]'> <div class='socialItem'><img class='socialItemI' src='images/gmail.svg' alt=''></div> </a> <a target='_blank' href='https://github.com/Vinay-vicky'> <div class='socialItem'><img class='socialItemI' src='images/github.svg' alt=''></div> </a> <a target='_blank' href='https://wa.link/f81hp0'> <div class='socialItem'><img class='socialItemI' src='images/whatsapp.svg' alt=''></div> </a> <a target='_blank' href='https://t.me/Vinay_Vicky'> <div class='socialItem'><img class='socialItemI' src='images/telegram.svg' alt=''></div> </a> <a target='_blank' href='https://instagram.com/vinay_vicky.2000'> <div class='socialItem'><img class='socialItemI' src='images/instagram.svg' alt=''> </div> </a> <a href='https://www.linkedin.com/in/vignesh200009' target='_blank' rel='noopener noreferrer'> <div class='socialItem'><img class='socialItemI' src='images/linkedin.svg' alt=''></div> </a> </div>";
var resumeString = "<img src='images/resumeThumbnail.png' class='resumeThumbnail'><div class='downloadSpace'><div class='pdfname'><img src='images/pdf.png'><label>Vignesh RV Resume.pdf</label></div><a href='assets/Vignesh RV Resume.pdf' download='Vignesh_RV_Resume.pdf'><img class='download' src='images/downloadIcon.svg'></a></div>";
var addressString = "<div class='mapview'><iframe src='https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3890.918774657286!2d79.67440357377181!3d12.783784187514572!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3a52dda41e7594ad%3A0x221aa1eb2271988a!2sAyyangarkulam%20Koot%20Road%20Bus%20Stop!5e0!3m2!1sen!2sin!4v1708748038454!5m2!1sen!2sin' class='map'></iframe></div><label class='add'><address>No 162 'Nattar Street'<br>Ayyangarkulam<br>Kanchipuram, Tamilnadu, INDIA 631502</address>";
var repliesForHowAreYou = ["I'm fine.", "I'm good. And yourself?", "Not bad. How are you?", "I'm doing well, and you?", "Good, how about you?", "I'm great!", "Everything is fine when you are around.", "The best I can be. I hope you are at your best too.", "I'm still learning and eagerly waiting to grasp new things."];
var repliesForHello = ["Hello there!", "Hey!", "Hola!", "Nice to meet you!", "I'm here!", "Hey! How's it going?", "What's up?", "Hey! What a pleasant surprise!"];
var repliesForBye = ["Catch you on the flip side!", "Bye-bye, butterfly.", "See you soon!", "Catch you later!", "Bye for now", "See you on the internet!"];
var repliesForLove = ["I get that a lot!", "You are day-dreaming again!", "I love You........Tube! LOL!", "Are you sure you aren't sick or something?", "I love you too!", "You are not my type!", "β€οΈΒ"]
var repliesForCommandUnknown = ["Hey I couldn't catch you....<br>Send 'help' to know more about usage.", "I didn't get it.", "Please can you repeat it?", "I'm still learning...please use approriate keywords in your phrase.", "I'm still working on it.<br>"];
var repliesForVoiceAssistants = ["Yes! I know her.", "Of-cource! Who don't know her?", "I'm teching lessions from her!", "She is my BFF!", "My childhood friend!"];
function getRandom(arrayOfReplies) {
var sizeOfArray = arrayOfReplies.length;
return arrayOfReplies[Math.floor(Math.random() * sizeOfArray)];
}
function startFunction() {
setLastSeen();
waitAndResponse("intro");
}
function setLastSeen() {
var date = new Date();
var lastSeen = document.getElementById("lastseen");
lastSeen.innerText = "last seen today at " + date.getHours() + ":" + date.getMinutes()
}
function closeFullDP() {
var x = document.getElementById("fullScreenDP");
if (x.style.display === 'flex') {
x.style.display = 'none';
} else {
x.style.display = 'flex';
}
}
function openFullScreenDP() {
var x = document.getElementById("fullScreenDP");
if (x.style.display === 'flex') {
x.style.display = 'none';
} else {
x.style.display = 'flex';
}
}
function isEnter(event) {
if (event.keyCode == 13) {
sendMsg();
}
}
function sendMsg() {
var input = document.getElementById("inputMSG");
var ti = input.value;
if (input.value == "") {
return;
}
var date = new Date();
var myLI = document.createElement("li");
var myDiv = document.createElement("div");
var greendiv = document.createElement("div");
var dateLabel = document.createElement("label");
dateLabel.innerText = date.getHours() + ":" + date.getMinutes();
myDiv.setAttribute("class", "sent");
greendiv.setAttribute("class", "green");
dateLabel.setAttribute("class", "dateLabel");
greendiv.innerText = input.value;
myDiv.appendChild(greendiv);
myLI.appendChild(myDiv);
greendiv.appendChild(dateLabel);
document.getElementById("listUL").appendChild(myLI);
var s = document.getElementById("chatting");
s.scrollTop = s.scrollHeight;
setTimeout(function () { waitAndResponse(ti) }, 1500);
input.value = "";
playSound();
}
function waitAndResponse(inputText) {
var lastSeen = document.getElementById("lastseen");
lastSeen.innerText = "typing...";
switch (inputText.toLowerCase().trim()) {
case "intro":
setTimeout(() => {
sendTextMessage("Hello there ππ»,<br><br>My name is <span class='bold'><a class='alink'>Vignesh RV</a>.</span><br><br>I am a MCA student at <span class='bold'>SCSVMV University π¨π»βπ»π</span><br><br>I am eager to hear about potential career opportunities, so I would be pleased to chat about job openings in the Web development sphere.<br><br>Send <span class='bold'>'help'</span> to know more about me.<br>");
}, 2000);
break;
case "help":
sendTextMessage("<span class='sk'>Send Keyword to get what you want to know about me...<br>e.g<br><span class='bold'>'skills'</span> - to know my skills<br><span class='bold'>'resume'</span> - to get my resume<br><span class='bold'>'education'</span> - to get my education details<br><span class='bold'>'address'</span> - to get my address<br><span class='bold'>'contact'</span> - to get ways to connect with me<br><span class='bold'>'projects'</span> - to get details of my projects<br><span class='bold'>'clear'</span> - to clear conversation<br><span class='bold'>'about'</span> - to know about this site</span>");
break;
case "resume":
sendTextMessage(resumeString);
break;
case "skills":
sendTextMessage("<span class='sk'>I am currently pursuing MCA degree in Computer Application Field.<br><br>I can comfortably write code in following languages :<br><span class='bold'>Python<br>PHP<br>MySQL<br>Javascript<br>CSS<br>HTML</span><br><br>I've experiance with following frameworks :<span class='bold'><br>Bootstrap<br>ReactJs</span><br><br>I use <span class='bold'>Intel Core i3</span> as daily driver on my ASUS EeeBook 14<br>OS:Windows 11<br>Favourite IDE:VSCode, Spyder</span>");
break;
case "education":
sendTextMessage("I am currently pursuing MCA degree in Computer Application Department from SCSVMV University, Enathur<br>Passing Year: 2024<br><br>I have completed my BCA Degree from University of Madras(Autonomous)<br>Passing Year:2022<br>CGPA:7.90<br><br>I have completed my HSC from local school known as SVM<br>Passing Year:2019");
break;
case "address":
sendTextMessage(addressString);
break;
case "clear":
clearChat();
break;
case "about":
sendTextMessage("π οΈπ» This portfolio website is built using HTML, CSS and JavaScript from SCRATCH!<br><br>π¨π»βπ» Designed and Developed by <a class='alink' target='_blank' href='https:\/\/instagram.com/vinay_vicky.2000/'><span class='bold'>VIGNESH RV</a> with β€οΈ</span>");
break;
case "contact":
sendTextMessage(contactString);
break;
case "projects":
sendTextMessage("You want to check my projects? Then just jump into my Github Account.<br><br><div class='social'><a target='_blank' href='https://github.com/Vinay-vicky'> <div class='socialItem'><img class='socialItemI' src='images/github.svg' alt=''></div> </a></div>");
break;
case "new":
sendTextMessage(addressString);
break;
default:
ifElseThenAndExecute(inputText.toLowerCase().trim());
break;
}
}
function ifElseThenAndExecute(textString) {
if (textString.includes("hii Vignesh") || textString.includes("hi Vignesh") || textString.includes("hello Vignesh") || textString.includes("hola Vignesh") || textString.includes("hey Vignesh") || textString.includes("hii") || textString.includes("hi") || textString.includes("hello") || textString.includes("hola") || textString.includes("hey")) {
// reply for hi message
sendTextMessage(getRandom(repliesForHello));
} else if (textString.includes("i need break") || textString.includes("leave me") || textString.includes("bye") || textString.includes("see you soon") || textString.includes("bye bye") || textString.includes("goodbye") || textString.includes("I'll catch you later") || textString.includes("See you later")) {
// reply for bye message
sendTextMessage(getRandom(repliesForBye));
} else if (textString.includes("i love you") || textString.includes("love you") || textString.includes("you are hot") || textString.includes("i like you")) {
// reply for i love you
sendTextMessage(getRandom(repliesForLove));
} else if (textString.includes("how are you") || (textString.includes("hows going") || textString.includes("how its going") || textString.includes("how it's going") || textString.includes("what are you doing"))) {
// reply for 'how are you' request
sendTextMessage(getRandom(repliesForHowAreYou));
} else if (textString.includes("you know") && (textString.includes("bixby") || textString.includes("siri") || textString.includes("alexa") || textString.includes("cortana"))) {
// reply for 'you know other chattingBots' request
sendTextMessage(getRandom(repliesForVoiceAssistants));
} else {
setTimeout(() => {
sendTextMessage(getRandom(repliesForCommandUnknown));
}, 2000);
}
}
function clearChat() {
document.getElementById("listUL").innerHTML = "";
waitAndResponse('intro');
}
function sendTextMessage(textToSend) {
setTimeout(setLastSeen, 1000);
var date = new Date();
var myLI = document.createElement("li");
var myDiv = document.createElement("div");
var greendiv = document.createElement("div");
var dateLabel = document.createElement("label");
dateLabel.setAttribute("id", "sentlabel");
dateLabel.id = "sentlabel";
dateLabel.innerText = date.getHours() + ":" + date.getMinutes();
myDiv.setAttribute("class", "received");
greendiv.setAttribute("class", "grey");
greendiv.innerHTML = textToSend;
myDiv.appendChild(greendiv);
myLI.appendChild(myDiv);
greendiv.appendChild(dateLabel);
document.getElementById("listUL").appendChild(myLI);
var s = document.getElementById("chatting");
s.scrollTop = s.scrollHeight;
playSound();
}
function sendResponse() {
setTimeout(setLastSeen, 1000);
var date = new Date();
var myLI = document.createElement("li");
var myDiv = document.createElement("div");
var greendiv = document.createElement("div");
var dateLabel = document.createElement("label");
dateLabel.innerText = date.getHours() + ":" + date.getMinutes();
myDiv.setAttribute("class", "received");
greendiv.setAttribute("class", "grey");
dateLabel.setAttribute("class", "dateLabel");
greendiv.innerText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. ";
myDiv.appendChild(greendiv);
myLI.appendChild(myDiv);
greendiv.appendChild(dateLabel);
document.getElementById("listUL").appendChild(myLI);
var s = document.getElementById("chatting");
s.scrollTop = s.scrollHeight;
playSound();
}
function playSound() {
audio.play();
}