diff --git a/Final_year_Project_Priyesh/customer chat/chatbot.js b/Final_year_Project_Priyesh/customer chat/chatbot.js
index 0a0eaa4..25e3587 100644
--- a/Final_year_Project_Priyesh/customer chat/chatbot.js
+++ b/Final_year_Project_Priyesh/customer chat/chatbot.js
@@ -1,217 +1,217 @@
-var data = {
- chatinit: {
- title: ["Hello 👋", "I am Mr. Chatbot", "How can I help you?"],
- options: ["Services 📠", "Check new 📝", "Buying 👜", "Contact us 📞", "LCD 📺", "Laptop 💻", "Smartphone 📱"]
-
- },
- services: {
- title: ["Please select category"],
- options: ['New & Trending', 'LCD', 'Laptop', 'Smartphone', 'Others'],
- url: {
- more: "https://www.amazon.in/",
- link: ["http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
- "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
- "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
- "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html", "https://www.amazon.in/"]
- }
- },
- check: {
- title: ["Select your category"],
- options: ["Large Screen LCD", "Gamming Laptop", "Foldable Smartphone", "Future item"],
- url: {
- more: "https://www.startus-insights.com/innovators-guide/display-technology-trends/",
- link: ["https://www.sony.co.in/microsite/LargeScreenTVs/",
- "https://www.tomshardware.com/laptops/gaming-laptops/best-gaming-laptops",
- "https://www.techradar.com/best/best-foldable-phones",
- "https://www.weforum.org/agenda/2021/10/technology-trends-top-10-mckinsey/"]
- }
- },
- buying: {
- title: ["Please choose shopping category 👜"],
- options: ['LCD', 'Laptop', 'Smartphone'],
- url: {
- more: "https://www.flipkart.com/",
- link: ["http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
- "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
- "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html"]
- }
- },
- contact: {
- title: ["Pick the phone number 📞"],
- options: ["Linkdin", "Facebook", "Instagram", "priyeshm845@gmail.com", "shivamsingh163248@gmail.com"],
- url: {
- more: "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/contact.html",
- link: ["https://www.linkedin.com/in/priyesh-mishra-932793253/", "https://www.facebook.com/priyeshmishra.mishra.33", "https://www.instagram.com/mishrapriyeshmishra/?hl=en", "https://www.instagram.com/shivamsingh163248/?hl=en", "https://www.facebook.com/priyeshmishra.mishra.33"]
- }
- },
- lcd: {
- title: ["Select your brand"],
- options: ["Samsung LCD", "Zebronic LCD", "Acer LCD", "LG LCD"],
- url: {
- more: "https://www.flipkart.com/televisions/lcd~type/pr?sid=ckf%2Cczl",
- link: ["https://www.samsung.com/in/multistore/corporate/tvs/?cid=in_pd_search_bing_b2b_none_samsung-q1-24-epp-spp_text_17jan2024-na_1ur-454037l-keyword-cpc_na-82120149186875-520267879-1313918742618609-kwd-82120898627555:loc-90-samsung%20tvs-e--o--&msclkid=1e271f67e15019c8b173796dbfbab8f1",
- "https://zebronics.com/collections/monitors",
- "https://store.acer.com/en-in/monitors",
- "ttps://www.ebay.com/sch/i.html?_nkw=lg%20flat%20screen%20lcd%20tv&norover=1&mkevt=1&mkrid=711-34002-13078-0&mkcid=2&mkscid=102&keyword=lg%20flat%20screen%20lcd%20tv&crlp=_&MT_ID=&geo_id=&rlsatarget=kwd-76897271030125:loc-90&adpos=&device=c&mktype=&loc=148595&poi=&abcId=&cmpgn=395411080&sitelnk=&adgroupid=1230353719025973&network=o&matchtype=e&msclkid=1a1026e1cacc195b99a840eb956e8124"]
-
- }
- },
- laptop: {
- title: ["Select your brand"],
- options: ["Dell", "Samsung", "Asus", "Hp"],
- url: {
- more: "https://www.amazon.in/Laptops/b?node=1375424031",
- link: ["https://www.dell.com/en-in/shop/deals/customize-n-buy?gacd=10415953-9029-5763017-320277763-0&dgc=ST&gclid=cd9810016271146f444a760b3f270f0a&gclsrc=3p.ds&",
- "https://store.acer.com/en-in/monitors",
- "https://www.asus.com/in/laptops/for-home/all-series/",
- "https://www.hp.com/in-en/shop/?optly_qa_cookie=optly_hp_test&gclid=SEM&gclsrc=3p.ds&msclkid=3fb96e85483c12c4adac088f161cb444&utm_source=bing&utm_medium=cpc&utm_campaign=IN%20-%20HPCOM%7CHPStore%7CHHO%7CHome%26HomeOffice%7CIN%7CBrand%7CExact%7CEN%7C%20(Always-On)&utm_term=hp%20pc%20laptop&utm_content=Online%20EM"]
- }
- },
- smartphone: {
- title: ["Select your brand"],
- options: ["Apple", "Samsung", "Oneplus", "Realme"],
- url: {
- more: "https://www.flipkart.com/mobile-phones-store",
- link: ["https://www.apple.com/in/iphone/",
- "https://www.samsung.com/in/multistore/corporate/smartphones/?cid=in_pd_search_bing_b2b_none_samsung-q1-24-epp-spp_text_17jan2024-na_1ur-454037l-keyword-cpc_na-82601184313848-520267876-1321615323914872-kwd-82601939453448:loc-90-samsung%20phone-e--o--&msclkid=fa73882ac026151855daee27cc39aaff",
- "https://www.oneplus.in/phone",
- "https://www.realme.com/in/realme-phones"]
- }
- },
-
- others: {
- title: ["Here are some more options for you"],
- options: ["coming soon", "coming soon", "coming soon", "coming soon"],
- url: {
- more: "https://www.youtube.com/",
- link: ["https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos"]
- }
- },
-
-}
-
-
-
-
-document.getElementById("init").addEventListener("click", showChatBot);
-var cbot = document.getElementById("chat-box");
-
-
-
-var len1 = data.chatinit.title.length;
-
-function showChatBot() {
- console.log(this.innerText);
- if (this.innerText == 'START CHAT') {
- document.getElementById('test').style.display = 'block';
- document.getElementById('init').innerText = 'CLOSE CHAT';
- initChat();
- }
- else {
- location.reload();
- }
-}
-
-function initChat() {
- j = 0;
- cbot.innerHTML = '';
- for (var i = 0; i < len1; i++) {
- setTimeout(handleChat, (i * 500));
- }
- setTimeout(function () {
- showOptions(data.chatinit.options)
- }, ((len1 + 1) * 500))
-
-}
-
-var j = 0;
-function handleChat() {
- console.log(j);
- var elm = document.createElement("p");
- elm.innerHTML = data.chatinit.title[j];
- elm.setAttribute("class", "msg");
- cbot.appendChild(elm);
- j++;
- handleScroll();
-
-}
-
-function showOptions(options) {
- for (var i = 0; i < options.length; i++) {
- var opt = document.createElement("span");
- var inp = '
' + options[i] + '
';
- opt.innerHTML = inp;
- opt.setAttribute("class", "opt");
- opt.addEventListener("click", handleOpt);
- cbot.appendChild(opt);
- handleScroll();
- }
-}
-
-function handleOpt() {
- console.log(this);
- var str = this.innerText;
- var textArr = str.split(" ");
- var findText = textArr[0];
- document.querySelectorAll(".opt").forEach(el => { el.remove(); })
-
- var elm = document.createElement("p");
- elm.setAttribute("class", "test");
- var sp = '' + findText + '';
- elm.innerHTML = sp;
- cbot.appendChild(elm);
-
- console.log(findText.toLowerCase());
- var tempObj = data[findText.toLowerCase()];
- handleResults(tempObj.title, tempObj.options, tempObj.url);
-}
-
-
-function handleResults(title, options, url) {
- for (let i = 0; i < title.length; i++) {
- var elm = document.createElement("p");
- elm.innerHTML = title[i];
- elm.setAttribute("class", "msg");
- cbot.appendChild(elm);
- }
- const isObjectEmpty = (url) => {
- return JSON.stringify(url) === "{}";
-
- }
- if (isObjectEmpty(url) == true) {
- console.log("having more options");
- showOptions(options);
-
- }
- else {
- console.log("end result");
- handleOptions(options, url);
-
- }
-}
-
-function handleOptions(options, url) {
- for (var i = 0; i < options.length; i++) {
- var opt = document.createElement("span");
- var link = url.link && url.link[i] ? url.link[i] : '#'; // Check if url.link is defined
- var inp = '' + options[i] + '';
- opt.innerHTML = inp;
- opt.setAttribute("class", "opt");
- cbot.appendChild(opt);
- }
-
- var opt = document.createElement("span");
- var moreLink = url.more ? url.more : '#'; // Check if url.more is defined
- var inp = '' + ' See more';
-
- opt.innerHTML = inp;
- opt.setAttribute("class", "opt chat_link");
- cbot.appendChild(opt);
- handleScroll();
-}
-
-
-function handleScroll() {
- var elem = document.getElementById('chat-box');
- elem.scrollTop = elem.scrollHeight;
+var data = {
+ chatinit: {
+ title: ["Hello 👋", "I am Mr. Chatbot", "How can I help you?"],
+ options: ["Services 📠", "Check new 📝", "Buying 👜", "Contact us 📞", "LCD 📺", "Laptop 💻", "Smartphone 📱"]
+
+ },
+ services: {
+ title: ["Please select category"],
+ options: ['New & Trending', 'LCD', 'Laptop', 'Smartphone', 'Others'],
+ url: {
+ more: "https://www.amazon.in/",
+ link: ["https://lovelymobilecenter.store/fina_year_project_ravi/home_page_ui/listing.html",
+ "https://lovelymobilecenter.store/fina_year_project_ravi/home_page_ui/listing.html",
+ "https://lovelymobilecenter.store/fina_year_project_ravi/home_page_ui/listing.htmll",
+ "https://lovelymobilecenter.store/fina_year_project_ravi/home_page_ui/listing.html", "https://www.amazon.in/"]
+ }
+ },
+ check: {
+ title: ["Select your category"],
+ options: ["Large Screen LCD", "Gamming Laptop", "Foldable Smartphone", "Future item"],
+ url: {
+ more: "https://www.startus-insights.com/innovators-guide/display-technology-trends/",
+ link: ["https://www.sony.co.in/microsite/LargeScreenTVs/",
+ "https://www.tomshardware.com/laptops/gaming-laptops/best-gaming-laptops",
+ "https://www.techradar.com/best/best-foldable-phones",
+ "https://www.weforum.org/agenda/2021/10/technology-trends-top-10-mckinsey/"]
+ }
+ },
+ buying: {
+ title: ["Please choose shopping category 👜"],
+ options: ['LCD', 'Laptop', 'Smartphone'],
+ url: {
+ more: "https://www.flipkart.com/",
+ link: ["http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
+ "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html",
+ "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/listing.html"]
+ }
+ },
+ contact: {
+ title: ["Pick the phone number 📞"],
+ options: ["Linkdin", "Facebook", "Instagram", "priyeshm845@gmail.com", "shivamsingh163248@gmail.com"],
+ url: {
+ more: "http://127.0.0.1:5501/fina_year_project_ravi/home_page_ui/contact.html",
+ link: ["https://www.linkedin.com/in/priyesh-mishra-932793253/", "https://www.facebook.com/priyeshmishra.mishra.33", "https://www.instagram.com/mishrapriyeshmishra/?hl=en", "https://www.instagram.com/shivamsingh163248/?hl=en", "https://www.facebook.com/priyeshmishra.mishra.33"]
+ }
+ },
+ lcd: {
+ title: ["Select your brand"],
+ options: ["Samsung LCD", "Zebronic LCD", "Acer LCD", "LG LCD"],
+ url: {
+ more: "https://www.flipkart.com/televisions/lcd~type/pr?sid=ckf%2Cczl",
+ link: ["https://www.samsung.com/in/multistore/corporate/tvs/?cid=in_pd_search_bing_b2b_none_samsung-q1-24-epp-spp_text_17jan2024-na_1ur-454037l-keyword-cpc_na-82120149186875-520267879-1313918742618609-kwd-82120898627555:loc-90-samsung%20tvs-e--o--&msclkid=1e271f67e15019c8b173796dbfbab8f1",
+ "https://zebronics.com/collections/monitors",
+ "https://store.acer.com/en-in/monitors",
+ "ttps://www.ebay.com/sch/i.html?_nkw=lg%20flat%20screen%20lcd%20tv&norover=1&mkevt=1&mkrid=711-34002-13078-0&mkcid=2&mkscid=102&keyword=lg%20flat%20screen%20lcd%20tv&crlp=_&MT_ID=&geo_id=&rlsatarget=kwd-76897271030125:loc-90&adpos=&device=c&mktype=&loc=148595&poi=&abcId=&cmpgn=395411080&sitelnk=&adgroupid=1230353719025973&network=o&matchtype=e&msclkid=1a1026e1cacc195b99a840eb956e8124"]
+
+ }
+ },
+ laptop: {
+ title: ["Select your brand"],
+ options: ["Dell", "Samsung", "Asus", "Hp"],
+ url: {
+ more: "https://www.amazon.in/Laptops/b?node=1375424031",
+ link: ["https://www.dell.com/en-in/shop/deals/customize-n-buy?gacd=10415953-9029-5763017-320277763-0&dgc=ST&gclid=cd9810016271146f444a760b3f270f0a&gclsrc=3p.ds&",
+ "https://store.acer.com/en-in/monitors",
+ "https://www.asus.com/in/laptops/for-home/all-series/",
+ "https://www.hp.com/in-en/shop/?optly_qa_cookie=optly_hp_test&gclid=SEM&gclsrc=3p.ds&msclkid=3fb96e85483c12c4adac088f161cb444&utm_source=bing&utm_medium=cpc&utm_campaign=IN%20-%20HPCOM%7CHPStore%7CHHO%7CHome%26HomeOffice%7CIN%7CBrand%7CExact%7CEN%7C%20(Always-On)&utm_term=hp%20pc%20laptop&utm_content=Online%20EM"]
+ }
+ },
+ smartphone: {
+ title: ["Select your brand"],
+ options: ["Apple", "Samsung", "Oneplus", "Realme"],
+ url: {
+ more: "https://www.flipkart.com/mobile-phones-store",
+ link: ["https://www.apple.com/in/iphone/",
+ "https://www.samsung.com/in/multistore/corporate/smartphones/?cid=in_pd_search_bing_b2b_none_samsung-q1-24-epp-spp_text_17jan2024-na_1ur-454037l-keyword-cpc_na-82601184313848-520267876-1321615323914872-kwd-82601939453448:loc-90-samsung%20phone-e--o--&msclkid=fa73882ac026151855daee27cc39aaff",
+ "https://www.oneplus.in/phone",
+ "https://www.realme.com/in/realme-phones"]
+ }
+ },
+
+ others: {
+ title: ["Here are some more options for you"],
+ options: ["coming soon", "coming soon", "coming soon", "coming soon"],
+ url: {
+ more: "https://www.youtube.com/",
+ link: ["https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos", "https://www.youtube.com/@webhub/videos"]
+ }
+ },
+
+}
+
+
+
+
+document.getElementById("init").addEventListener("click", showChatBot);
+var cbot = document.getElementById("chat-box");
+
+
+
+var len1 = data.chatinit.title.length;
+
+function showChatBot() {
+ console.log(this.innerText);
+ if (this.innerText == 'START CHAT') {
+ document.getElementById('test').style.display = 'block';
+ document.getElementById('init').innerText = 'CLOSE CHAT';
+ initChat();
+ }
+ else {
+ location.reload();
+ }
+}
+
+function initChat() {
+ j = 0;
+ cbot.innerHTML = '';
+ for (var i = 0; i < len1; i++) {
+ setTimeout(handleChat, (i * 500));
+ }
+ setTimeout(function () {
+ showOptions(data.chatinit.options)
+ }, ((len1 + 1) * 500))
+
+}
+
+var j = 0;
+function handleChat() {
+ console.log(j);
+ var elm = document.createElement("p");
+ elm.innerHTML = data.chatinit.title[j];
+ elm.setAttribute("class", "msg");
+ cbot.appendChild(elm);
+ j++;
+ handleScroll();
+
+}
+
+function showOptions(options) {
+ for (var i = 0; i < options.length; i++) {
+ var opt = document.createElement("span");
+ var inp = '' + options[i] + '
';
+ opt.innerHTML = inp;
+ opt.setAttribute("class", "opt");
+ opt.addEventListener("click", handleOpt);
+ cbot.appendChild(opt);
+ handleScroll();
+ }
+}
+
+function handleOpt() {
+ console.log(this);
+ var str = this.innerText;
+ var textArr = str.split(" ");
+ var findText = textArr[0];
+ document.querySelectorAll(".opt").forEach(el => { el.remove(); })
+
+ var elm = document.createElement("p");
+ elm.setAttribute("class", "test");
+ var sp = '' + findText + '';
+ elm.innerHTML = sp;
+ cbot.appendChild(elm);
+
+ console.log(findText.toLowerCase());
+ var tempObj = data[findText.toLowerCase()];
+ handleResults(tempObj.title, tempObj.options, tempObj.url);
+}
+
+
+function handleResults(title, options, url) {
+ for (let i = 0; i < title.length; i++) {
+ var elm = document.createElement("p");
+ elm.innerHTML = title[i];
+ elm.setAttribute("class", "msg");
+ cbot.appendChild(elm);
+ }
+ const isObjectEmpty = (url) => {
+ return JSON.stringify(url) === "{}";
+
+ }
+ if (isObjectEmpty(url) == true) {
+ console.log("having more options");
+ showOptions(options);
+
+ }
+ else {
+ console.log("end result");
+ handleOptions(options, url);
+
+ }
+}
+
+function handleOptions(options, url) {
+ for (var i = 0; i < options.length; i++) {
+ var opt = document.createElement("span");
+ var link = url.link && url.link[i] ? url.link[i] : '#'; // Check if url.link is defined
+ var inp = '' + options[i] + '';
+ opt.innerHTML = inp;
+ opt.setAttribute("class", "opt");
+ cbot.appendChild(opt);
+ }
+
+ var opt = document.createElement("span");
+ var moreLink = url.more ? url.more : '#'; // Check if url.more is defined
+ var inp = '' + ' See more';
+
+ opt.innerHTML = inp;
+ opt.setAttribute("class", "opt chat_link");
+ cbot.appendChild(opt);
+ handleScroll();
+}
+
+
+function handleScroll() {
+ var elem = document.getElementById('chat-box');
+ elem.scrollTop = elem.scrollHeight;
}
\ No newline at end of file