From 43c633d977b06af2120b456956f24da84d4e3d97 Mon Sep 17 00:00:00 2001
From: LAKSHAY BANSAL <119696323+LAKSHAYBANSAL879@users.noreply.github.com>
Date: Mon, 23 Oct 2023 23:45:20 +0530
Subject: [PATCH 1/2] Add files via upload
---
CHATBOT/index.css | 264 ++++++++++++++++++++++++++++++++++++++
CHATBOT/index.html | 42 ++++++
CHATBOT/index.js | 70 ++++++++++
DICTIONARY APP/index.css | 150 ++++++++++++++++++++++
DICTIONARY APP/index.html | 42 ++++++
DICTIONARY APP/index.js | 46 +++++++
DICTIONARY APP/search.png | Bin 0 -> 1559 bytes
7 files changed, 614 insertions(+)
create mode 100644 CHATBOT/index.css
create mode 100644 CHATBOT/index.html
create mode 100644 CHATBOT/index.js
create mode 100644 DICTIONARY APP/index.css
create mode 100644 DICTIONARY APP/index.html
create mode 100644 DICTIONARY APP/index.js
create mode 100644 DICTIONARY APP/search.png
diff --git a/CHATBOT/index.css b/CHATBOT/index.css
new file mode 100644
index 0000000..7de5c41
--- /dev/null
+++ b/CHATBOT/index.css
@@ -0,0 +1,264 @@
+@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@600&display=swap');
+*{
+ margin: 0;
+ padding: 0;
+ font-family: 'Roboto Slab', serif;
+ box-sizing: border-box;
+}
+body{
+ background-color: rgb(240, 237, 235);
+
+}
+.chatbot{
+ background-color: rgb(249, 209, 195);
+ right:3vw;
+ position: fixed;
+ bottom: 9vh;
+ transform: scale(0.5);
+ opacity: 0;
+ pointer-events: none;
+ width: 40vw;
+ border-radius: 20px;
+ box-shadow: 0 0 128px 0 rgba(0,0,0,0.1),
+ 0 32px 64px -48px rgba(0,0,0,0.5);
+ padding-left: 3px;
+ height: fit-content;
+ padding-bottom: 20px;
+ transform: all 1s ease-in;
+}
+.show-chatbot .chatbot{
+ transform: scale(1);
+ opacity: 1;
+ pointer-events: auto;
+}
+.show-chatbot .chatbot-toggler span:last-child{
+ opacity: 1;
+}
+.chatbot ul{
+ list-style: none;
+}
+h2{
+ background-color: rgba(185, 39, 238, 0.692);
+ width: 100%;
+ text-align: center;
+ /* padding: 16px 0px; */
+ height: 8vh;
+ padding-top: 5px;
+ font-size: 30px;
+
+}
+.chatbot .chatbox{
+ height: 30vw;
+overflow-y: auto;
+padding: 15px 20px 70px;
+}
+.chatbox .chat{
+ display: flex;
+}
+.chatbot .outgoing{
+ justify-content: flex-end;
+ gap:2vh;
+ margin-top: 2vh;
+ margin-bottom: 2vh;
+}
+.chatbox .chat p{
+ padding: 12px 16px;
+ font-size: 20px;
+ white-space: pre-wrap;
+ color: white;
+ border-radius: 10px 10px 0 10px;
+ background: rgba(185, 39, 238, 0.692);
+}
+.chatbox .incoming p{
+ color: black;
+ background: ghostwhite;
+ border-radius: 10px 10px 10px 0;
+}
+.chatbox .incoming span{
+ height: 32px;
+ width: 32px;
+ color: white;
+ background: rgba(185, 39, 238, 0.692);
+ align-self: flex-end;
+ text-align: center;
+ line-height: 32px;
+ border-radius: 4px;
+ margin-top:1vh ;
+ margin-right: 1vw;
+
+}
+.chatbot .chat-input{
+ position: absolute;
+ height: 7vh;
+ bottom: 0;
+ width: 100%;
+ background: white;
+ padding: 5px 15px;
+ border-top: 2px solid #ccc;
+ display: flex;
+ gap: 1.5vw;
+ /* justify-content: center; */
+ align-items: center;
+ margin-bottom: 0.5vh;
+}
+.chat-input textarea{
+ font-size: 20px;
+ border: none;
+ outline: none;
+ width: 2vw;
+
+}
+.chat-input span{
+ visibility: hidden;
+ cursor: pointer;
+}
+.chat-input textarea:valid ~span{
+ visibility: visible;
+}
+.chatbox .chat p.error{
+ color: #fff;
+ background-color: rgb(234, 125, 125);
+}
+.chatbot-toggler{
+
+ position: fixed;
+right: 3vw;
+bottom: 3vh;
+ color: #fff;
+ border: none;
+ outline: none;
+ background: rgba(185, 39, 238, 0.692);
+ cursor: pointer;
+ border-radius: 50%;
+ width: 3vw;
+ height: 5vh;
+
+display: flex;
+justify-content: center;
+align-items: center;
+
+}
+.chatbot-toggler span{
+ position: absolute;
+}
+.show-chatbot .chatbot-toggler span:first-child, .chatbot-toggler span:last-child{
+ opacity: 0;
+}
+@media (max-width:969px){
+.chatbot{
+ position: fixed;
+ right: 30vw;
+ /* bottom: 40vh; */
+ height: fit-content;
+ top:10vh;
+
+ padding-bottom: 40px;
+}
+.chatbot-toggler{
+ position: fixed;
+ right: 20vw;
+ bottom: 25vh;
+ width: 5vw;
+ height: 5vh;
+
+}
+.chatbox{
+ padding-top: 20px;
+ padding-bottom: 20px;
+
+}
+}
+@media(max-width:650px){
+ .chatbot{
+ width: 50vw;
+ }
+ h2{
+ font-size: 20px;
+ height: fit-content;
+ padding: 5px;
+width: 100%;
+text-align: center;
+ }
+ .chatbot .outgoing{
+ justify-content: flex-end;
+ gap:1vh;
+ margin-top: 2vh;
+ margin-left: 2vh;
+ font-size: 15px;
+
+ }
+ .chatbox .chat p{
+ padding: 8px 12px;
+ font-size: 12px;
+ color: white;
+ border-radius: 10px 10px 0 10px;
+ background: rgba(185, 39, 238, 0.692);
+ }
+ .chatbox .incoming p{
+ color: black;
+ background: ghostwhite;
+ border-radius: 10px 10px 10px 0;
+ }
+ .chatbox .incoming span{
+ height: 22px;
+ width: 22px;
+ color: white;
+ background: rgba(185, 39, 238, 0.692);
+ align-self: flex-end;
+ text-align: center;
+ line-height: 22px;
+ border-radius: 4px;
+ margin-top:1vh ;
+ margin-right: 1vw;
+ font-size: 15px;
+margin-left: -2vw;
+ }
+ .chatbot .chat-input{
+ position: absolute;
+ height: 5vh;
+ bottom: 2px;
+ width: 95%;
+ margin-left: 1vw;
+ padding: 5px 15px;
+
+ display: flex;
+ gap: 1.5vw;
+ /* justify-content: center; */
+ align-items: center;
+ margin-bottom: 0.5vh;
+
+ }
+ .chat-input textarea{
+ font-size: 15px;
+ border: none;
+ outline: none;
+ width: fit-content;
+ /* text-align: center; */
+
+ }
+}
+#apiId{
+ display: flex;
+ justify-content: center;
+ align-items: flex-start;
+ flex-direction: column;
+ margin-left: 10px;
+ margin-top: 10px;
+ gap: 2vh;
+ font-size: 16px;
+}
+#apiId input{
+ height: 4vh;
+ border-radius: 10px;
+}
+#apiId a{
+ text-decoration: none;
+ color: blue;
+}
+#apiId button{
+ border-radius: 10px;
+ background-color: rgba(185, 39, 238, 0.692);
+ color: #fff;
+ padding: 10px;
+
+}
\ No newline at end of file
diff --git a/CHATBOT/index.html b/CHATBOT/index.html
new file mode 100644
index 0000000..566f775
--- /dev/null
+++ b/CHATBOT/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+ Welcome To My Chatbot
+
+
+
+
+
+
+
+
+
+
+
+
Generate your own API KEY BY
clicking here
+
+
+
+
+
+
+
+ send
+
+
+
+
\ No newline at end of file
diff --git a/CHATBOT/index.js b/CHATBOT/index.js
new file mode 100644
index 0000000..9a7aa61
--- /dev/null
+++ b/CHATBOT/index.js
@@ -0,0 +1,70 @@
+const sendChatBtn = document.querySelector(".chat-input span");
+const chatbox = document.querySelector(".chatbox");
+const chatInput = document.querySelector(".chat-input textarea");
+const chatbottoggler = document.querySelector(".chatbot-toggler");
+const closeChatBtn = document.getElementById("close-chat-btn");
+
+let userMessage;
+const apiBox = document.querySelector("#apiId")
+const apiInput = document.querySelector("#apiId input")
+const apiButton = document.querySelector("#apiId button")
+
+
+apiButton.addEventListener("click",()=>{
+ apikey=apiInput.value;
+ apiBox.style.display="none";
+})
+const createChatLi = (message, className) => {
+ const chatLi = document.createElement("li");
+ chatLi.classList.add("chat", className);
+ let chatContent = className === "outgoing" ? `
${message}
` : `
smart_toy${message}
`;
+ chatLi.innerHTML = chatContent;
+ return chatLi;
+};
+
+const generateResponse = (incomingChatLi) => {
+ const apiurl = "https://api.openai.com/v1/chat/completions";
+ const messageElement = incomingChatLi.querySelector("p");
+ const requestOptions = {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${apikey}`
+ },
+ body: JSON.stringify({
+ model: "gpt-3.5-turbo",
+ messages: [{ role: "user", content: userMessage }]
+ })
+ };
+ fetch(apiurl, requestOptions)
+ .then((res) => res.json())
+ .then((data) => {
+ console.log(data);
+ messageElement.textContent = data.choices[0].message.content.trim();
+ })
+ .catch((error) => {
+ messageElement.classList.add("error");
+ messageElement.textContent = "Oops, something went wrong";
+ console.log(error);
+ })
+ .finally(() => chatbox.scrollTo(0, chatbox.scrollHeight));
+};
+
+const handleChat = () => {
+ userMessage = chatInput.value.trim();
+ if (!userMessage) return;
+ chatbox.appendChild(createChatLi(userMessage, "outgoing"));
+ chatbox.scrollTo(0, chatbox.scrollHeight);
+ console.log(userMessage);
+ chatInput.value = "";
+ setTimeout(() => {
+ const incomingChatLi = createChatLi("Thinking ... Please Wait!", "incoming");
+ chatbox.appendChild(incomingChatLi);
+ chatbox.scrollTo(0, chatbox.scrollHeight);
+ generateResponse(incomingChatLi);
+ }, 600);
+};
+
+chatbottoggler.addEventListener("click", () => document.body.classList.toggle("show-chatbot"));
+sendChatBtn.addEventListener("click", handleChat);
+
diff --git a/DICTIONARY APP/index.css b/DICTIONARY APP/index.css
new file mode 100644
index 0000000..768db83
--- /dev/null
+++ b/DICTIONARY APP/index.css
@@ -0,0 +1,150 @@
+@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@700&family=Lobster&display=swap');
+*{margin: 0;
+padding: 0;
+box-sizing: border-box;
+font-family: 'Josefin Sans', sans-serif;
+}
+body{
+ background-color: #444141;
+}
+.card{
+ width:90%;
+ max-width: 70vw;
+ background: linear-gradient(135deg,#00feba,#5b548a);
+ color:#ffffff;
+ margin: 100px auto 0px;
+ border-radius: 20px;
+ padding: 40px 35px;
+ /* text-align: center; */
+
+}
+.search{
+ /* border-radius: 20px; */
+ width: 100%;
+ align-items: center;
+ display: flex;
+ justify-content: space-between;
+
+}
+.search input{
+ border: 0;
+ outline: 0;
+ background: #ebfffc;
+color: #555;
+padding: 10px 25px;
+height: 60px;
+border-radius: 30px;
+
+flex:1;
+margin-right: 16px;
+font-size: 20px;
+}
+.search button img{
+ width: 16px;
+
+
+}
+.search button{
+ border-radius: 50%;
+ border: 0;
+ outline: 0;
+ background: #ebfffc;
+ cursor: pointer;
+ width: 60px;
+ height: 60px;
+}
+.search button:hover{
+ background-color: #fff;
+
+}
+.result{
+
+ position: relative;
+ display: none;
+}
+
+.word{
+ /* display: none;
+ */
+ display: flex;
+ margin-top: 4vh;
+ /* flex-direction: column; */
+ /* align-items: flex-start; */
+ justify-content: space-between;
+ /* gap: 1vh; */
+}
+.word h3{
+ font-size: 35px;
+ color: black;
+}
+.word button{
+ background: transparent;
+ border: 0px;
+ cursor: pointer;
+ outline: none;
+ font-size: 20px;
+ color: antiquewhite;
+}
+.result .details{
+display: flex;
+flex-direction: row;
+gap: 2vw;
+color: rgb(255, 249, 249);
+margin: 5px 0 20px 0;
+
+font-size: 20px;
+/* justify-content: center; */
+align-items: flex-start;
+
+}
+.word-meaning {
+ color: #f4f5fb;
+ /* text-align: left; */
+ font-size: 25px;
+
+}
+.word-example{
+ color: #f4f5fb;
+ font-style: italic;
+ border-left: 5px solid grey;
+ padding-left: 20px;
+ margin-top: 1vh;
+ font-size: 20px;
+}
+@media(max-width:716px){
+ .card{
+ width: fit-content;
+ padding: 10px;
+ }
+ .col img{
+ width: 5vw;
+ }
+ .humidity,.wind{
+ font-size: 15px;
+ }
+ .search button{
+ width: 20px;
+ height: 30px;
+ }
+ #searchinput{
+ width:45vw;
+ }
+ .col div{
+ font-size: 10px;
+ margin-left: 1vw;
+ }
+ .col{
+ padding: 5px;
+ }
+ .errormessage{
+ font-size: 10px;
+ }
+}
+.errormessage{
+ margin-top: 2vh;
+ text-align: left;
+ margin-left: 2vw;
+ font-size: 15px;
+display: none;
+color: red;
+}
\ No newline at end of file
diff --git a/DICTIONARY APP/index.html b/DICTIONARY APP/index.html
new file mode 100644
index 0000000..3b1837b
--- /dev/null
+++ b/DICTIONARY APP/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+
DICTIONARY
+
+
+
+
+
+
+
+
+
+
+
COULD NOT FIND THE WORD
+
+
+
+
+
Sample
+
+
+
+
+
+ Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, iste?
+
+
Lorem ipsum dolor sit amet.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DICTIONARY APP/index.js b/DICTIONARY APP/index.js
new file mode 100644
index 0000000..c7c613c
--- /dev/null
+++ b/DICTIONARY APP/index.js
@@ -0,0 +1,46 @@
+const url = "https://api.dictionaryapi.dev/api/v2/entries/en/";
+const result = document.getElementById("result");
+const sound = document.getElementById("sound");
+const btn = document.getElementById("searchbutton");
+const errormsg = document.getElementById("errormsg");
+
+btn.addEventListener("click", () => {
+ let inpword = document.getElementById("searchinput").value;
+ console.log(inpword);
+
+ fetch(`${url}${inpword}`)
+ .then((response) => response.json())
+ .then((data) => {
+ if (data.title && data.title === "No Definitions Found") {
+ // Word not found
+ errormsg.style.display = "block";
+ result.style.display = "none";
+ } else {
+ console.log(data);
+ result.innerHTML = `
+
+
${inpword}
+
+
+
+
${data[0].meanings[0].partOfSpeech}
+
${data[0].phonetic}
+
+
${data[0].meanings[0].definitions[0].definition}
+
${data[0].meanings[0].definitions[0].example || " "}
`;
+ sound.setAttribute("src", data[0].phonetics[1].audio || data[0].phonetics[0].audio);
+ let playButton = result.querySelector(".play-button");
+ playButton.addEventListener("click", playSound);
+ result.style.display = "block";
+ errormsg.style.display = "none";
+ }
+ })
+ .catch(() => {
+ errormsg.style.display = "block";
+ result.style.display = "none";
+ });
+});
+
+function playSound() {
+ sound.play();
+}
diff --git a/DICTIONARY APP/search.png b/DICTIONARY APP/search.png
new file mode 100644
index 0000000000000000000000000000000000000000..95ec64e78190532d5d209c01b10fa767dda2192d
GIT binary patch
literal 1559
zcmV+y2I%>TP)
Px)(Md!>RA>d&nZIx3L=?wa=SPtOHZ&(u1k)g0wMIt^c%aVQ4A0m
zu$zFZ1IiuN2JQ=S-w`JB)i@Iw3SL1!0&H_w;GFS3Ch>TbNel!J=qe)(fOZbV$X!e?
ztVBnx1XFFG@=|z$!|*d)-ar<|7=%d#xb9*V2AY7A=L_K6cz+B4-h-Woh}>OuE${B`
zR?uG7I`-q@xXeO7^hdv$gN%;M$gi!fH4%j`VXSJ5H=Cyr+JHl#28$GL=1L+3o4gm-
zYq(NHrO`tKz)y7=3M;&dI8((2PH5(5XBcS1XVg@aXhGnWngl1HQYeu3YB>c@qg=Wy
za6qpDI@6#wJZQ~8VI{g4pEZHEvVxSzc?F&o@gBh4NrH2Nv`4#WruG8^i0c`-I98Sf
zJR;D-U{4N$+(Z6(aMZW-jjf_xt|(h$3^p`aOurYm7d=Wfnh0caF2AL;HV9`%arTlfI1Mkhu5m2Jpax6)@ZxFn
zv(XVXanq{Q6(oDoFL>irDs|)~xReRsPbu;COX`Y{@j$Y1gqnq?O;-!L#?sinVe0Og
z)iw_B{+Bj*5FAMw4B&T&s?^U?rhjrspC+$^<0!;{6FCS=)|9$g${GIooh#HF(T2tH
zq@oYqqoSfuzx1ymbq!rtw^?iWj;UlDOU9Q&EvcV{OuzImeE~kf8NqWY(6MhB%pbm<
z)K62UKd@{{ALKJrhW!yd8|ZAKil1K8arU?}-d_Rwh%axh{bll*41>HuIr+_sw948B*p=$uRZ9>CVG!#14JUCh-y`PV);3IDZ
z^cdD~9N_ZdI8bu*_JN?#)s&9u(ZuCZ&MTLfm!BLQ9Bk)}VP9tC^^F8jDHK6y{UmBe
z84Z64*4W&^^YLcn+B3MrjjVr;E7%*5cyg(~XUd
z1))!fa|tO!2!i16^eBQ(suN$6wIx@K{2
zMgytj!WmDAI)=QNF)UBrL&UqdqKD7=`uc5v{sMd4%!z_k{|Kx9G@(?&Nbsg1P6T_R
z4iIicmwkX>o2L{X>j8BrA@uwU=Lj%iq%l5V=R?@}(NINA+~0@Z+u7MUk$q#sOM~Oc
zIG(@2{hwKEJfEMRe}8Lh>xJ3((hX}4o_2d>W#w~3x@+-s=i=hx8>uf<g002ov
JPDHLkV1mkf_tgLZ
literal 0
HcmV?d00001
From ba1ac287b876707b76ece81012bdbe9f51d39e1d Mon Sep 17 00:00:00 2001
From: LAKSHAY BANSAL <119696323+LAKSHAYBANSAL879@users.noreply.github.com>
Date: Mon, 23 Oct 2023 23:48:05 +0530
Subject: [PATCH 2/2] Add files via upload
---
TRANSLATOR APP/index.css | 183 +++++++++++++++++++++++++++++++++++++
TRANSLATOR APP/index.html | 123 +++++++++++++++++++++++++
TRANSLATOR APP/js/index.js | 170 ++++++++++++++++++++++++++++++++++
3 files changed, 476 insertions(+)
create mode 100644 TRANSLATOR APP/index.css
create mode 100644 TRANSLATOR APP/index.html
create mode 100644 TRANSLATOR APP/js/index.js
diff --git a/TRANSLATOR APP/index.css b/TRANSLATOR APP/index.css
new file mode 100644
index 0000000..3b932e4
--- /dev/null
+++ b/TRANSLATOR APP/index.css
@@ -0,0 +1,183 @@
+@import url('https://fonts.googleapis.com/css2?family=Inclusive+Sans&display=swap');
+*{
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ font-family: 'Inclusive Sans', sans-serif;
+}
+.container{
+ display: flex;
+ justify-content: center;
+ flex-direction: column;
+ align-items: center;
+ margin-top: 4vh;
+}
+body{
+ background: linear-gradient(135deg,rgb(255, 169, 183),rgb(111, 111, 235));
+ width: 100%;
+ height: 100vh;
+}
+.mainContent{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: row;
+ margin-top: -4vh;
+ border-radius: 10px;
+ max-height: 80%;
+ min-width: 50%;
+ gap:1vw;
+ background: linear-gradient(135deg,rgb(246, 220, 220),rgb(255, 199, 208));
+}
+textarea::placeholder{
+ /* pointer-events: none; */
+ margin: auto;
+ padding: 6px;
+ font-weight: bold;
+
+/* font-size: 18px; */
+}
+textarea{
+ background-color: rgb(245, 244, 242);
+ width: 100%;
+ height: 100%;
+ border-radius: 10px;
+ border: 3px solid black;
+ resize: none;
+padding: 20px;
+font-size: 15px;
+font-weight: bold;
+}
+.text-input{
+ /* border: 3px solid black; */
+ border-radius: 10px;
+}
+
+.textToTranslate,.translatedText{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+padding: 20px;
+}
+.controls ul{
+ list-style: none;
+margin-top: 2vh;
+
+}
+.control li{
+display: flex;
+align-items: center;
+justify-content: space-between;
+padding-left:15px;
+padding-right:15px;
+padding-bottom: 12px;
+
+}
+.control .icons i{
+ width: 60px;
+ cursor: pointer;
+
+
+}
+.exchange{
+ list-style: none;
+ cursor: pointer;
+}
+select{
+ width: 8vw;
+ height: 4vh;
+ border-radius: 10px;
+ font-size: 19px;
+ background: NONE;
+ border: none;
+ outline: none;
+cursor: pointer;
+}
+.tbtn{
+ width: 85%;
+ background: linear-gradient(135deg,rgb(255, 169, 183),rgb(111, 111, 235));
+
+ /* background-color: rgb(20, 88, 223); */
+height: 6vh;
+font-size: 20px;
+font-weight: bold;
+padding: 5px;
+border: none;
+border-radius: 10px;
+margin-bottom: 2vh;
+margin-top: 3vh;
+color: white;
+cursor: pointer;
+}
+.col{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ height: 85vh;
+ background: linear-gradient(135deg,rgb(246, 220, 220),rgb(255, 199, 208));
+margin-bottom: 1vh;
+}
+h1{
+ margin-bottom: 2vh;
+}
+@media (max-width:539px) {
+ select{
+ width: fit-content;
+ padding: 1px;
+ height: 4vh;
+ border-radius: 10px;
+ font-size: 11px;
+
+ }
+ .control .icons i{
+ width: 30px;
+ }
+ .control li{
+ /* display: flex; */
+ /* align-items: center; */
+ /* justify-content: space-between; */
+ padding-left:10px;
+ padding-right:12px;
+ padding-bottom: 11px;
+ padding-top: 5px;
+
+ }
+ .fa-volume-high{
+ padding-bottom: 20px;
+ }
+}
+@media (max-width:363px){
+ .mainContent{
+
+ width: fit-content;
+ padding: 6px;
+ margin-top: -1vh;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: row;
+
+ }
+ textarea{
+ width: 80%;
+ height: 80%;
+ margin-left: 5vw;
+ }
+ .textToTranslate{
+ margin-right: -3vh;
+ }
+ .translatedText{
+ margin-left: -4vh;
+ }
+ .col{
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ flex-direction: column;
+ height: 75vh;
+ background: linear-gradient(135deg,rgb(246, 220, 220),rgb(255, 199, 208));
+ margin-bottom: 1vh;
+ }
+}
\ No newline at end of file
diff --git a/TRANSLATOR APP/index.html b/TRANSLATOR APP/index.html
new file mode 100644
index 0000000..b1f89b0
--- /dev/null
+++ b/TRANSLATOR APP/index.html
@@ -0,0 +1,123 @@
+
+
+
+
+
+ MY-TRANSLATOR
+
+
+
+
+
+
+
WELCOME TO MY TRANSLATOR
+
+
+
+
+
+
+
+
+
diff --git a/TRANSLATOR APP/js/index.js b/TRANSLATOR APP/js/index.js
new file mode 100644
index 0000000..30d8892
--- /dev/null
+++ b/TRANSLATOR APP/js/index.js
@@ -0,0 +1,170 @@
+const countries = {
+ "am-ET": "Amharic",
+ "ar-SA": "Arabic",
+ "be-BY": "Bielarus",
+ "bem-ZM": "Bemba",
+ "bi-VU": "Bislama",
+ "bjs-BB": "Bajan",
+ "bn-IN": "Bengali",
+ "bo-CN": "Tibetan",
+ "br-FR": "Breton",
+ "bs-BA": "Bosnian",
+ "ca-ES": "Catalan",
+ "cop-EG": "Coptic",
+ "cs-CZ": "Czech",
+ "cy-GB": "Welsh",
+ "da-DK": "Danish",
+ "dz-BT": "Dzongkha",
+ "de-DE": "German",
+ "dv-MV": "Maldivian",
+ "el-GR": "Greek",
+ "en-GB": "English",
+ "es-ES": "Spanish",
+ "et-EE": "Estonian",
+ "eu-ES": "Basque",
+ "fa-IR": "Persian",
+ "fi-FI": "Finnish",
+ "fn-FNG": "Fanagalo",
+ "fo-FO": "Faroese",
+ "fr-FR": "French",
+ "gl-ES": "Galician",
+ "gu-IN": "Gujarati",
+ "ha-NE": "Hausa",
+ "he-IL": "Hebrew",
+ "hi-IN": "Hindi",
+ "hr-HR": "Croatian",
+ "hu-HU": "Hungarian",
+ "id-ID": "Indonesian",
+ "is-IS": "Icelandic",
+ "it-IT": "Italian",
+ "ja-JP": "Japanese",
+ "kk-KZ": "Kazakh",
+ "km-KM": "Khmer",
+ "kn-IN": "Kannada",
+ "ko-KR": "Korean",
+ "ku-TR": "Kurdish",
+ "ky-KG": "Kyrgyz",
+ "la-VA": "Latin",
+ "lo-LA": "Lao",
+ "lv-LV": "Latvian",
+ "men-SL": "Mende",
+ "mg-MG": "Malagasy",
+ "mi-NZ": "Maori",
+ "ms-MY": "Malay",
+ "mt-MT": "Maltese",
+ "my-MM": "Burmese",
+ "ne-NP": "Nepali",
+ "niu-NU": "Niuean",
+ "nl-NL": "Dutch",
+ "no-NO": "Norwegian",
+ "ny-MW": "Nyanja",
+ "ur-PK": "Pakistani",
+ "pau-PW": "Palauan",
+ "pa-IN": "Panjabi",
+ "ps-PK": "Pashto",
+ "pis-SB": "Pijin",
+ "pl-PL": "Polish",
+ "pt-PT": "Portuguese",
+ "rn-BI": "Kirundi",
+ "ro-RO": "Romanian",
+ "ru-RU": "Russian",
+ "sg-CF": "Sango",
+ "si-LK": "Sinhala",
+ "sk-SK": "Slovak",
+ "sm-WS": "Samoan",
+ "sn-ZW": "Shona",
+ "so-SO": "Somali",
+ "sq-AL": "Albanian",
+ "sr-RS": "Serbian",
+ "sv-SE": "Swedish",
+ "sw-SZ": "Swahili",
+ "ta-LK": "Tamil",
+ "te-IN": "Telugu",
+ "tet-TL": "Tetum",
+ "tg-TJ": "Tajik",
+ "th-TH": "Thai",
+ "ti-TI": "Tigrinya",
+ "tk-TM": "Turkmen",
+ "tl-PH": "Tagalog",
+ "tn-BW": "Tswana",
+ "to-TO": "Tongan",
+ "tr-TR": "Turkish",
+ "uk-UA": "Ukrainian",
+ "uz-UZ": "Uzbek",
+ "vi-VN": "Vietnamese",
+ "wo-SN": "Wolof",
+ "xh-ZA": "Xhosa",
+ "yi-YD": "Yiddish",
+ "zu-ZA": "Zulu"
+}
+
+const selectTag=document.querySelectorAll("select");
+const body=document.getElementById("body")
+const translateBtn=document.getElementById("btn");
+const inputText=document.getElementById("translate");
+const outputText=document.getElementById("translated");
+const exchange=document.getElementById("exchange");
+const icons=document.querySelectorAll(".row i")
+selectTag.forEach((tag,id) => {
+ for(const country_code in countries) {
+ let selected;
+ if(id==0 && country_code=="en-GB"){
+ selected="selected";
+ }
+ else if(id==1 && country_code=="hi-IN"){
+ selected="selected";
+ }
+ console.log(countries[country_code]);
+ let option=``;
+ tag.insertAdjacentHTML("beforeend",option);
+ }
+});
+translateBtn.addEventListener("click",()=>{
+ let text=body.value;
+ let translateFrom=selectTag[0].value;
+ let translateTo=selectTag[1].value;
+ console.log(text,translateFrom,translateTo);
+ let apiUrl=`https://api.mymemory.translated.net/get?q=${text}&langpair=${translateFrom}|${translateTo}`;
+ fetch(apiUrl).then(res => res.json()).then(data=>{
+ console.log(data);
+// outputText.value=data.responseData.translatedText;
+body.value=data.responseData.translatedText;
+
+ })
+
+
+})
+
+exchange.addEventListener("click",()=>{
+ let tempText=body.value;
+ body.value=body.value;
+ body.value=tempText;
+ let tempLang=selectTag[0].value;
+ selectTag[0].value=selectTag[1].value;
+ selectTag[1].value=tempLang;
+})
+icons.forEach(icon=>{
+icon.addEventListener("click",({target})=>{
+ if(target.classList.contains("fa-copy")){
+ if(target.id=="from"){
+ navigator.clipboard.writeText(body.value);
+ }
+ else{
+ navigator.clipboard.writeText(body.value);
+ }
+ }
+ else{
+ let utterance;
+ if(target.id=="from"){
+ utterance=new SpeechSynthesisUtterance(inputText.value);
+ utterance.lang=selectTag[0].value;
+ }
+ else{
+ utterance=new SpeechSynthesisUtterance(outputText.value);
+ utterance.lang=selectTag[1].value;
+ }
+ speechSynthesis.speak(utterance);
+ }
+
+});
+})
\ No newline at end of file