aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKumar Priyansh <[email protected]>2020-08-31 00:57:08 +0530
committerKumar Priyansh <[email protected]>2020-08-31 00:57:08 +0530
commitde938483ac3299685e798139a622a07d34778022 (patch)
tree1ebc81eca9297b0d34f86569e39af653f99cb52e /app
parente99a01c645b8faf88bc92bf63a0aec88a7d5b2d3 (diff)
downloaddictionary-de938483ac3299685e798139a622a07d34778022.tar.xz
dictionary-de938483ac3299685e798139a622a07d34778022.zip
update results
Diffstat (limited to 'app')
-rw-r--r--app/css/style.css3
-rw-r--r--app/scripts/search.js7
2 files changed, 9 insertions, 1 deletions
diff --git a/app/css/style.css b/app/css/style.css
index f8c53d9..8070c1c 100644
--- a/app/css/style.css
+++ b/app/css/style.css
@@ -43,7 +43,8 @@ body {
}
.results {
- margin-top: 50px;
height: 50%;
overflow-y: scroll;
+ width: 80%;
+ margin: 50px auto 0px auto;
}
diff --git a/app/scripts/search.js b/app/scripts/search.js
index d9fdc71..e7146fb 100644
--- a/app/scripts/search.js
+++ b/app/scripts/search.js
@@ -1,4 +1,5 @@
const searchBox = document.getElementById('searchBox');
+const results = document.getElementById('results');
const natural = require('natural');
const wordnet = new natural.WordNet();
@@ -7,6 +8,12 @@ searchBox.addEventListener('keypress', (e) => {
const word = searchBox.value;
wordnet.lookup(word, details => {
console.log(details);
+ details.forEach(detail => {
+ const definition = document.createElement('p');
+ definition.innerHTML = detail.def;
+ definition.className = 'definition';
+ results.appendChild(definition);
+ });
});
}
});