-
+
-
+ + + +++ ++
+
+
-
+
-
+ + + +++ ++
+
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 @@ + + +
+ + +Hi there 👋
Welcome to my chatbot
How can I help you today
${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 @@ + + + + + +pos
+/sample/
+ ++ Lorem ipsum dolor, sit amet consectetur adipisicing elit. Accusamus, iste? +
+Lorem ipsum dolor sit amet.
+${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 0000000..95ec64e Binary files /dev/null and b/DICTIONARY APP/search.png differ 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 @@ + + + + + +