From fad971ce65e6567ad9456720d34686883ca92d90 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 22 Sep 2019 15:36:15 -0400
Subject: [PATCH 01/10] Add files via upload
---
chatbot.js | 26 ++++++++++++
chatbot_style.css | 102 ++++++++++++++++++++++------------------------
index.html | 1 -
3 files changed, 75 insertions(+), 54 deletions(-)
create mode 100644 chatbot.js
diff --git a/chatbot.js b/chatbot.js
new file mode 100644
index 0000000..2f227c7
--- /dev/null
+++ b/chatbot.js
@@ -0,0 +1,26 @@
+const chatbot = [
+ {
+ input: 'Hello',
+ output: ['Hola', 'Hi, 'Hey']},
+
+ {
+ input: 'how are you?',
+ output: ['Fine', 'Good', 'Not Bad']},
+
+ {
+ input: 'what is your favourite colour?',
+ output: ['I like Blue', 'I like Purple', 'I like all colors']},
+
+];
+
+//console.log();
+
+function reply ()
+let question = document.getElementById('input').value.toLowerCase();
+document.getElementById("demo").innerHTML = question;
+let randomNumber = Math.floor((Math.random() * 3) + 0);
+let filterType = null;
+const output = chatbot.filter(item => item.input === question);
+if(question === ''){ return false; }
+appendQ (question)
+if(output.length > 0){
diff --git a/chatbot_style.css b/chatbot_style.css
index a915556..a1b6e5a 100755
--- a/chatbot_style.css
+++ b/chatbot_style.css
@@ -1,53 +1,49 @@
-button {
- font-family: Helvetica;
- font-size: 10pt;
- /*width: 92px;*/
-}
-
-textarea {
- font-family: arial;
- font-size: 10pt;
-}
-
-body {
- color: #333;
- background-color: #efefef;
- font: 13px helvetica, arial, freesans, clean, sans-serif;
-}
-
-#demo {
- width: 80%;
- max-width: 1000px;
- margin-left: auto;
- margin-right: auto;
- padding: 20px;
-
- background-color: #F8F8F8;
- border: 1px solid #ccc;
- box-shadow: 0 0 10px #999;
- line-height: 1.4em;
- font: 13px helvetica, arial, freesans, clean, sans-serif;
- color: black;
-}
-
-#demo #input {
- padding: 8px;
- font-size: 14px;
- border: 1px solid #ddd;
- width: 400px;
-}
-
-#demo textarea {
- padding: 8px;
- font-size: 14px;
- border: 1px solid #ddd;
- width: 800px;
-}
-
-input:focus {
- outline: none;
-}
-
-textarea:focus {
- outline: none;
-}
\ No newline at end of file
+
diff --git a/index.html b/index.html
index c516c16..e6a4068 100755
--- a/index.html
+++ b/index.html
@@ -1,7 +1,6 @@
My First Chatbot
-
From bb420bd85d24106f1aad07a687f8f979310bbd59 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 29 Sep 2019 21:19:38 -0400
Subject: [PATCH 02/10] Add files via upload
---
README.md | 5 +++
chatbot3.js | 55 +++++++++++++++++++++++++
chatbot_style.css | 102 ++++++++++++++++++++++++----------------------
index.html | 1 +
4 files changed, 114 insertions(+), 49 deletions(-)
create mode 100644 chatbot3.js
diff --git a/README.md b/README.md
index 5e9e1fd..4f0080f 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,8 @@
# Chatbot
Please see the instructions [here](https://docs.google.com/document/d/1BP27Tjgit66o6kLpzu8RMnPr7M5GWpC_2N05DvMMTUE/).
+
+
+# Chatbot - week 10
+
+Please see the instructions [here](https://docs.google.com/document/d/1qrdVIXy7D10M3AkQUIKV0z7kkIOoCsofMD3ZJexyy2s/edit?usp=sharing)
diff --git a/chatbot3.js b/chatbot3.js
new file mode 100644
index 0000000..7b01dea
--- /dev/null
+++ b/chatbot3.js
@@ -0,0 +1,55 @@
+const chatbot = [
+
+{
+input: ['Hola', 'Hi', 'Oi'],
+output: ['Hello', 'Hey', 'Greetings']
+},
+{
+ input: ['What is your favourite cusine?', 'Who is your Hero?', 'Who is your role model?'],
+output: ['I am not sure.', 'There are too many to choose from.', 'I like everyone.'],
+},
+{
+ input: ['How are you?', 'How is the weather today?', 'How is Canada doing in the Olympics?'],
+output: ['Fine', 'Great', 'Not so good'],
+},
+];
+
+/*
+It should now look like this:
+
+{
+ input: ['Hello', 'Hi', 'Greetings'],
+ output: ['Hello', 'Hey', 'Greetings']
+},
+{
+*/
+
+function reply() {
+
+ let randomNumber = Math.floor((Math.random() * 3));
+ let question = document.getElementById('input').value;
+ let filterType = null;
+
+ let answer = chatbot.filter(function(item){
+ if(item.input.includes(question)){
+ return true
+ }
+ });
+
+if (answer.length > 0){
+ if(document.getElementById('longest').checked){
+ let long = answer[0].output.sort((a,b) => b.length - a.length);
+};
+
+else if (document.getElementById('shortest').checked){
+ let short = answer[0].output.sort((a,b) => b.lenght - a.length);
+};
+
+else if (document.getElementById('random').checked){
+ let random = answer[0].output.sort((a,b) => b.lenght - a.length);
+};
+
+else {
+ document.getElementById('output').textContent = "I don't understand that command. Please enter another"
+};
+
diff --git a/chatbot_style.css b/chatbot_style.css
index a1b6e5a..a915556 100755
--- a/chatbot_style.css
+++ b/chatbot_style.css
@@ -1,49 +1,53 @@
-
+button {
+ font-family: Helvetica;
+ font-size: 10pt;
+ /*width: 92px;*/
+}
+
+textarea {
+ font-family: arial;
+ font-size: 10pt;
+}
+
+body {
+ color: #333;
+ background-color: #efefef;
+ font: 13px helvetica, arial, freesans, clean, sans-serif;
+}
+
+#demo {
+ width: 80%;
+ max-width: 1000px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 20px;
+
+ background-color: #F8F8F8;
+ border: 1px solid #ccc;
+ box-shadow: 0 0 10px #999;
+ line-height: 1.4em;
+ font: 13px helvetica, arial, freesans, clean, sans-serif;
+ color: black;
+}
+
+#demo #input {
+ padding: 8px;
+ font-size: 14px;
+ border: 1px solid #ddd;
+ width: 400px;
+}
+
+#demo textarea {
+ padding: 8px;
+ font-size: 14px;
+ border: 1px solid #ddd;
+ width: 800px;
+}
+
+input:focus {
+ outline: none;
+}
+
+textarea:focus {
+ outline: none;
+}
\ No newline at end of file
diff --git a/index.html b/index.html
index e6a4068..c516c16 100755
--- a/index.html
+++ b/index.html
@@ -1,6 +1,7 @@
My First Chatbot
+
From d2622fe9a0d39e9bddf51afbeaad7d6b18986002 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 6 Oct 2019 22:00:45 -0400
Subject: [PATCH 03/10] Add files via upload
---
script.js | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
create mode 100644 script.js
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..b74de1e
--- /dev/null
+++ b/script.js
@@ -0,0 +1,92 @@
+const chatbot = [
+ {
+ input: ['hello', 'hi', 'greetings'],
+ output: ['hello', 'hey', 'greetings']
+ },
+ {
+ input: ['how are you?', 'how is the weather today?', 'how is Canada doing in the Olympics?'],
+ output: ['fine', 'great', 'not so good']
+ },
+ {
+ input: ['what is your favourite colour?', 'who is your favourite HYF instructor?', 'who is your role model?'],
+ output: ['i am not sure', 'i have so many favorites it\'s hard to choose one.', 'i like every one']
+ },
+ {
+ input: ['show me a dog'],
+ output: [showMeADog]
+ },
+ {
+ input: ['set an alarm'],
+ output: [delayedAlert]
+ }
+
+];
+
+
+
+function reply() {
+ let randomNumber = Math.floor((Math.random() * 3));
+ let question = document.getElementById('input').value();
+ let filterType = null;
+ const output = chatbot.filter(item => item.input.includes(question));
+
+ if(question === ''){ return false; }
+ appendToOutput(question);
+
+ if(output.length > 0){
+ if(document.getElementById('longest').checked){
+ long = output[0].output.sort((a, b) => b.length - a.length);
+ appendToOutput(long[0], 1);
+ }else if(document.getElementById('shortest').checked){
+ short = output[0].output.sort((a, b) => a.length - b.length );
+ appendToOutput(sOutput[0], 1);
+ }else{
+ (output[0]['output'].length > 1)? appendToOutput(output[0].output[randomNumber], 1):appendToOutput(output[0].output[0], 1);
+ }
+ }else{
+ //if the question not found in out dataDase show this msg to the user
+ appendToOutput("I don't understand that command. Please enter another.",1);
+ }
+}
+
+function appendToOutput(msg, sender) {
+ if (typeof msg == 'function') {
+ msg();
+
+ appendToOutput("With pleasure", 1)
+ return false;
+ }
+ sender = (sender) ? 'ChatBot':'You';
+ let newLine = (sender === 'ChatBot')? '\n':'\n\n';
+ document.getElementById('output').textContent = sender + ' : ' + msg + newLine + document.getElementById('output').textContent;
+}
+
+
+
+document.querySelector('.close').addEventListener('click', function(e) {
+ document.getElementById('show-content').classList.add('hide');
+});
+
+document.getElementById('chatbot-form').addEventListener('submit', function(e) {
+ e.preventDefault();
+ reply();
+ document.getElementById('chatbot-form').reset();
+});
+
+
+let image = new XMLHttpRequest();
+image.onreadystatechange = function() {
+ if (image.readyState == 4) {
+ //alert(http.responseText);
+ let url = JSON.parse(image.responseText).message;
+ }
+}
+
+variable1.open('GET', 'https://dog.ceo/api/breeds/image/random', true);
+variable1.send(null);
+
+
+//set timout for 2 seconds
+function delayAlert(){
+ setTimeout(function(){alert("Did you forget about me? it's your friend, the Alarm!")}, 2000);
+}
From 0f5bfc65cd5fed337102eb90173b555e0a0ca2eb Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 6 Oct 2019 22:03:57 -0400
Subject: [PATCH 04/10] Add files via upload
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 4f0080f..0cad391 100644
--- a/README.md
+++ b/README.md
@@ -6,3 +6,7 @@ Please see the instructions [here](https://docs.google.com/document/d/1BP27Tjgit
# Chatbot - week 10
Please see the instructions [here](https://docs.google.com/document/d/1qrdVIXy7D10M3AkQUIKV0z7kkIOoCsofMD3ZJexyy2s/edit?usp=sharing)
+
+# Chatbot - week 11
+
+Please see the instructions [here](https://docs.google.com/document/d/1sWx_g90eLzSyfLRNfeZzCYUGqR5ArW4LT10D2dWctCU/edit?usp=sharing)
From a73ef8ff3b52874acecbbb2802266cf8cef8ff8f Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:06:43 -0400
Subject: [PATCH 05/10] Add files via upload
---
README.md | 37 ++++++----
index.html | 70 +++++++++---------
script.js | 206 +++++++++++++++++++++++++++++------------------------
style.css | 101 ++++++++++++++++++++++++++
4 files changed, 277 insertions(+), 137 deletions(-)
create mode 100644 style.css
diff --git a/README.md b/README.md
index 0cad391..7ae9af6 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,25 @@
-# Chatbot
-
-Please see the instructions [here](https://docs.google.com/document/d/1BP27Tjgit66o6kLpzu8RMnPr7M5GWpC_2N05DvMMTUE/).
-
-
-# Chatbot - week 10
-
-Please see the instructions [here](https://docs.google.com/document/d/1qrdVIXy7D10M3AkQUIKV0z7kkIOoCsofMD3ZJexyy2s/edit?usp=sharing)
-
-# Chatbot - week 11
-
-Please see the instructions [here](https://docs.google.com/document/d/1sWx_g90eLzSyfLRNfeZzCYUGqR5ArW4LT10D2dWctCU/edit?usp=sharing)
+Welcome to Glitch
+Click Show in the header to see your app live. Updates to your code will instantly deploy and update live.
+
+Glitch is the friendly community where you'll build the app of your dreams. Glitch lets you instantly create, remix, edit, and host an app, bot or site, and you can invite collaborators or helpers to simultaneously edit code with you.
+
+Find out more about Glitch.
+
+Your Project
+← README.md
+That's this file, where you can tell people what your cool website does and how you built it.
+
+← index.html
+Where you'll write the content of your website.
+
+← style.css
+CSS files add styling rules to your content.
+
+← script.js
+If you're feeling fancy you can add interactivity to your site with JavaScript.
+
+← assets
+Drag in assets, like images or music, to add them to your project
+
+Made by Glitch
+\ ゜o゜)ノ
diff --git a/index.html b/index.html
index c516c16..caa5076 100755
--- a/index.html
+++ b/index.html
@@ -1,33 +1,37 @@
-
-
- My First Chatbot
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+ My First Chatbot
+
+
+
+
+
+
+
+
+

+
+
+
My first chatbot!
+
Talk to your bot!
+
+
+
+
+
+
Chat history
+
+
+
+
+
+
+
+
diff --git a/script.js b/script.js
index b74de1e..bbaa7bf 100644
--- a/script.js
+++ b/script.js
@@ -1,92 +1,114 @@
-const chatbot = [
- {
- input: ['hello', 'hi', 'greetings'],
- output: ['hello', 'hey', 'greetings']
- },
- {
- input: ['how are you?', 'how is the weather today?', 'how is Canada doing in the Olympics?'],
- output: ['fine', 'great', 'not so good']
- },
- {
- input: ['what is your favourite colour?', 'who is your favourite HYF instructor?', 'who is your role model?'],
- output: ['i am not sure', 'i have so many favorites it\'s hard to choose one.', 'i like every one']
- },
- {
- input: ['show me a dog'],
- output: [showMeADog]
- },
- {
- input: ['set an alarm'],
- output: [delayedAlert]
- }
-
-];
-
-
-
-function reply() {
- let randomNumber = Math.floor((Math.random() * 3));
- let question = document.getElementById('input').value();
- let filterType = null;
- const output = chatbot.filter(item => item.input.includes(question));
-
- if(question === ''){ return false; }
- appendToOutput(question);
-
- if(output.length > 0){
- if(document.getElementById('longest').checked){
- long = output[0].output.sort((a, b) => b.length - a.length);
- appendToOutput(long[0], 1);
- }else if(document.getElementById('shortest').checked){
- short = output[0].output.sort((a, b) => a.length - b.length );
- appendToOutput(sOutput[0], 1);
- }else{
- (output[0]['output'].length > 1)? appendToOutput(output[0].output[randomNumber], 1):appendToOutput(output[0].output[0], 1);
- }
- }else{
- //if the question not found in out dataDase show this msg to the user
- appendToOutput("I don't understand that command. Please enter another.",1);
- }
-}
-
-function appendToOutput(msg, sender) {
- if (typeof msg == 'function') {
- msg();
-
- appendToOutput("With pleasure", 1)
- return false;
- }
- sender = (sender) ? 'ChatBot':'You';
- let newLine = (sender === 'ChatBot')? '\n':'\n\n';
- document.getElementById('output').textContent = sender + ' : ' + msg + newLine + document.getElementById('output').textContent;
-}
-
-
-
-document.querySelector('.close').addEventListener('click', function(e) {
- document.getElementById('show-content').classList.add('hide');
-});
-
-document.getElementById('chatbot-form').addEventListener('submit', function(e) {
- e.preventDefault();
- reply();
- document.getElementById('chatbot-form').reset();
-});
-
-
-let image = new XMLHttpRequest();
-image.onreadystatechange = function() {
- if (image.readyState == 4) {
- //alert(http.responseText);
- let url = JSON.parse(image.responseText).message;
- }
-}
-
-variable1.open('GET', 'https://dog.ceo/api/breeds/image/random', true);
-variable1.send(null);
-
-
-//set timout for 2 seconds
-function delayAlert(){
- setTimeout(function(){alert("Did you forget about me? it's your friend, the Alarm!")}, 2000);
-}
+function showMeADog(){
+ //get a dog image from API
+ let dataRequest = new XMLHttpRequest();
+ dataRequest.onreadystatechange = function(){
+ if(dataRequest.readyState == 4){
+ //change the returned data from API to Object, and get the url from .message
+ let imageUrl = JSON.parse(dataRequest.responseText).message;
+ //change img attr -src- to the url from API
+ document.querySelector('#show-content img').setAttribute('src', imageUrl);
+ //remove the class hide from the element to show the image
+ document.getElementById('show-content').classList.remove('hide');
+ }
+ }
+ //the url for API ,, and then send the request
+ dataRequest.open('GET', 'https://dog.ceo/api/breeds/image/random', true);
+ dataRequest.send();
+}
+
+function delayedAlert(){
+ setTimeout(function(){
+ alert("Did you forget about me? it's your friend, the Alarm!")
+ }, 2000);
+}
+
+const chatbot = [
+ {
+ input: ['Hello', 'Hi', 'Greetings'],
+ output: ['Hello', 'Hi', 'Greetings']
+ },
+ {
+ input: ['how is class', 'how are you enjoying class', 'how do you like class'],
+ output: ['Fantastic', 'Amazing', 'Bad']
+ },
+ {
+ input: ['do you like to code?', 'do you like to code', 'do you like css'],
+ output: ['I am not sure', 'Not at all', 'I love it']
+ },
+ {
+ input: ['show me a dog'],
+ output: [showMeADog]
+ },
+ {
+ input: ['set an alarm'],
+ output: [delayedAlert]
+ }
+
+ {
+ input: ['Show Me The Weather'],
+ output: [ShowMeTheWeather]
+ }
+];
+
+const sendResponse = () => {
+ let randomNumber = Math.floor((Math.random() * 3));
+ let question = document.getElementById('user-input').value.toLowerCase();
+
+ if(question === ''){ return false; }
+ appendToOutput(question, false);
+
+ const output = chatbot.filter(item => item.input.map(item => item.toLowerCase()).includes(question));
+
+ if (output.length > 0){
+ if (document.getElementById('longest').checked) {
+ const longestOutput = output[0].output.sort((a, b) => b.length - a.length);
+ appendToOutput(longestOutput[0], true);
+ } else if(document.getElementById('shortest').checked) {
+ const shortestOutput = output[0].output.sort((a, b) => a.length - b.length );
+ appendToOutput(shortestOutput[0], 1);
+ } else{
+ //check if the output array has more than value,, if yes get a random one else get the first one
+ (output[0]['output'].length > 1)
+ ? appendToOutput(output[0].output[randomNumber], 1)
+ :appendToOutput(output[0].output[0], 1);
+ }
+ } else {
+ appendToOutput("I don't understand that command. Please enter another.", true);
+ }
+}
+
+const appendToOutput = (msg, sender) => {
+ if (msg instanceof Function) {
+ msg();//call the function ,, which got from the output
+
+ //add an answer on the chat history
+ appendToOutput("With pleasure", 1)
+ return false;
+ }
+ sender = (sender) ? 'Bot':'You';
+ document.getElementById('output').textContent = sender + ' : ' + msg +'\n'+ document.getElementById('output').textContent;
+}
+
+document.getElementById('chatbot-form').addEventListener('submit', function(e) {
+ e.preventDefault();
+ sendResponse();
+ document.getElementById('chatbot-form').reset();
+
+})
+
+// async function
+async function ShowMeTheWeather() {
+ // await response of fetch call
+ let response = await fetch('http://api.openweathermap.org/data/2.5/forecast?q=TORONTO,CA&APPID={65fb059755e7e579db81a98b5956bba7
+}');
+// only proceed once promise is resolved
+let data = await response.json();
+// only proceed once second promise is resolved
+return data;
+}
+// trigger async function
+// log response or catch error of fetch promise
+
+fetchAsync()
+ .then(data => console.log(data))
+ .catch(reason => console.log(reason.message))
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..25e9d67
--- /dev/null
+++ b/style.css
@@ -0,0 +1,101 @@
+button {
+ font-family: Helvetica;
+ font-size: 10pt;
+ /*width: 92px;*/
+}
+
+textarea {
+ font-family: arial;
+ font-size: 10pt;
+}
+
+body {
+ color: #333;
+ background-color: #efefef;
+ font: 13px helvetica, arial, freesans, clean, sans-serif;
+ margin: 0px;
+}
+
+#demo {
+ width: 80%;
+ max-width: 1000px;
+ margin-left: auto;
+ margin-right: auto;
+ padding: 20px;
+
+ background-color: #F8F8F8;
+ border: 1px solid #ccc;
+ box-shadow: 0 0 10px #999;
+ line-height: 1.4em;
+ font: 13px helvetica, arial, freesans, clean, sans-serif;
+ color: black;
+ margin-top: 80px;
+}
+
+#demo #input {
+ padding: 8px;
+ font-size: 14px;
+ border: 1px solid #ddd;
+ width: 400px;
+}
+
+#demo textarea {
+ padding: 8px;
+ font-size: 14px;
+ border: 1px solid #ddd;
+ width: 800px;
+}
+
+input:focus {
+ outline: none;
+}
+
+textarea:focus {
+ outline: none;
+}
+
+#show-content{
+ position: absolute;
+ width: 80%;
+ max-width: 80%;
+ height: auto;
+ z-index: 1;
+ color: white;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: flex-start;
+ margin: 0 10%;
+ padding-bottom: 100px;
+
+}
+
+#show-content:before {
+ content: " ";
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.7);
+ z-index: -1;
+ border-radius: 15px;
+ box-shadow: 0 0 10px black;
+
+}
+
+#show-content .close{
+ text-align: right;
+ cursor: pointer;
+ position: relative;
+ align-self: flex-end;
+ right: 10px;
+ top: 10px;
+
+}
+
+#show-content img{
+ max-width: 70%;
+ max-height: 70%;
+}
+.hide{
+ display: none !important;
+}
From 3c99c0b8396a130c80a81b607e0e17392cbf2303 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:07:15 -0400
Subject: [PATCH 06/10] Delete chatbot.js
---
chatbot.js | 26 --------------------------
1 file changed, 26 deletions(-)
delete mode 100644 chatbot.js
diff --git a/chatbot.js b/chatbot.js
deleted file mode 100644
index 2f227c7..0000000
--- a/chatbot.js
+++ /dev/null
@@ -1,26 +0,0 @@
-const chatbot = [
- {
- input: 'Hello',
- output: ['Hola', 'Hi, 'Hey']},
-
- {
- input: 'how are you?',
- output: ['Fine', 'Good', 'Not Bad']},
-
- {
- input: 'what is your favourite colour?',
- output: ['I like Blue', 'I like Purple', 'I like all colors']},
-
-];
-
-//console.log();
-
-function reply ()
-let question = document.getElementById('input').value.toLowerCase();
-document.getElementById("demo").innerHTML = question;
-let randomNumber = Math.floor((Math.random() * 3) + 0);
-let filterType = null;
-const output = chatbot.filter(item => item.input === question);
-if(question === ''){ return false; }
-appendQ (question)
-if(output.length > 0){
From 02fc518b8df0fc0368ecf4799f271a4d36eee836 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:07:29 -0400
Subject: [PATCH 07/10] Delete chatbot3.js
---
chatbot3.js | 55 -----------------------------------------------------
1 file changed, 55 deletions(-)
delete mode 100644 chatbot3.js
diff --git a/chatbot3.js b/chatbot3.js
deleted file mode 100644
index 7b01dea..0000000
--- a/chatbot3.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const chatbot = [
-
-{
-input: ['Hola', 'Hi', 'Oi'],
-output: ['Hello', 'Hey', 'Greetings']
-},
-{
- input: ['What is your favourite cusine?', 'Who is your Hero?', 'Who is your role model?'],
-output: ['I am not sure.', 'There are too many to choose from.', 'I like everyone.'],
-},
-{
- input: ['How are you?', 'How is the weather today?', 'How is Canada doing in the Olympics?'],
-output: ['Fine', 'Great', 'Not so good'],
-},
-];
-
-/*
-It should now look like this:
-
-{
- input: ['Hello', 'Hi', 'Greetings'],
- output: ['Hello', 'Hey', 'Greetings']
-},
-{
-*/
-
-function reply() {
-
- let randomNumber = Math.floor((Math.random() * 3));
- let question = document.getElementById('input').value;
- let filterType = null;
-
- let answer = chatbot.filter(function(item){
- if(item.input.includes(question)){
- return true
- }
- });
-
-if (answer.length > 0){
- if(document.getElementById('longest').checked){
- let long = answer[0].output.sort((a,b) => b.length - a.length);
-};
-
-else if (document.getElementById('shortest').checked){
- let short = answer[0].output.sort((a,b) => b.lenght - a.length);
-};
-
-else if (document.getElementById('random').checked){
- let random = answer[0].output.sort((a,b) => b.lenght - a.length);
-};
-
-else {
- document.getElementById('output').textContent = "I don't understand that command. Please enter another"
-};
-
From 35bef5918f2ee45a91ca021564ff0808d23c2e91 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:07:42 -0400
Subject: [PATCH 08/10] Delete chatbot_style.css
---
chatbot_style.css | 53 -----------------------------------------------
1 file changed, 53 deletions(-)
delete mode 100755 chatbot_style.css
diff --git a/chatbot_style.css b/chatbot_style.css
deleted file mode 100755
index a915556..0000000
--- a/chatbot_style.css
+++ /dev/null
@@ -1,53 +0,0 @@
-button {
- font-family: Helvetica;
- font-size: 10pt;
- /*width: 92px;*/
-}
-
-textarea {
- font-family: arial;
- font-size: 10pt;
-}
-
-body {
- color: #333;
- background-color: #efefef;
- font: 13px helvetica, arial, freesans, clean, sans-serif;
-}
-
-#demo {
- width: 80%;
- max-width: 1000px;
- margin-left: auto;
- margin-right: auto;
- padding: 20px;
-
- background-color: #F8F8F8;
- border: 1px solid #ccc;
- box-shadow: 0 0 10px #999;
- line-height: 1.4em;
- font: 13px helvetica, arial, freesans, clean, sans-serif;
- color: black;
-}
-
-#demo #input {
- padding: 8px;
- font-size: 14px;
- border: 1px solid #ddd;
- width: 400px;
-}
-
-#demo textarea {
- padding: 8px;
- font-size: 14px;
- border: 1px solid #ddd;
- width: 800px;
-}
-
-input:focus {
- outline: none;
-}
-
-textarea:focus {
- outline: none;
-}
\ No newline at end of file
From 904b6448cf1bac1b865033696110117cd7a5a32c Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:11:12 -0400
Subject: [PATCH 09/10] Add files via upload
From 262f5cd244659857c9db9209a04a407c29fed221 Mon Sep 17 00:00:00 2001
From: iwaseem <52173678+iwaseem@users.noreply.github.com>
Date: Sun, 13 Oct 2019 11:13:51 -0400
Subject: [PATCH 10/10] Done
---
script.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/script.js b/script.js
index bbaa7bf..9534d4b 100644
--- a/script.js
+++ b/script.js
@@ -112,3 +112,5 @@ return data;
fetchAsync()
.then(data => console.log(data))
.catch(reason => console.log(reason.message))
+
+ //