Skip to content

Commit

Permalink
Merge pull request #23 from facn6/css/list
Browse files Browse the repository at this point in the history
search field updated
  • Loading branch information
samjam48 authored Jul 31, 2019
2 parents 4bbf5ff + 6828601 commit 402e593
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
32 changes: 16 additions & 16 deletions public/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
let searchBar = document.getElementById('myInput');

fetch(`${window.location.href}api/assets`)
.then(data => data.json()).then(({ files }) => {
Expand All @@ -6,40 +7,39 @@ fetch(`${window.location.href}api/assets`)
const textnode = document.createTextNode(file);
node.className = 'file_li';
node.appendChild(textnode);
node.addEventListener('click', (e) => {
searchBar.value = file;
})
document.getElementById('list').appendChild(node);
});
});

const transcribe = (filename) => {
fetch(`${window.location.href}api/transcribe?file=${filename}`)
.then(data => data.json()).then(({ files }) => {
console.log('front end transcription result = ', files);

});
};
// transcribe('ameer-test.wav');

function search_audio() {
console.log('here1');
let input = document.getElementById('myInput').value;
input = input.toLowerCase();
let input = searchBar.value.toLowerCase();
const x = document.getElementsByClassName('file_li');
for (i = 0; i < x.length; i++) {
if (!x[i].innerHTML.toLowerCase().includes(input)) {
x[i].style.display = 'none';
console.log('here2');
} else {
x[i].style.display = 'list-item';
console.log('here3');
}
}
}
document.getElementById('submit').addEventListener('click', (e) => {
if (document.getElementById('myInput').value === '') {
inputError = 'Please select some value!';
document.getElementById('input_error').style.color = 'red';
document.getElementById('input_error').innerHTML = inputError;
} else {
document.getElementById('input_error').innerHTML = '';
console.log(document.getElementById('myInput').value);
}
});
// document.getElementById('submit').addEventListener('click', (e) => {
// if (document.getElementById('myInput').value === '') {
// inputError = 'Please select some value!';
// document.getElementById('input_error').style.color = 'red';
// document.getElementById('input_error').innerHTML = inputError;
// } else {
// document.getElementById('input_error').innerHTML = '';
// console.log(document.getElementById('myInput').value);
// }
// });
3 changes: 1 addition & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
</head>
<body>

<div class="ui-result">
<div class="autocomplete">
<h1 class="title-design">Make Note</h1>
<h2 class="mini-title">* convert from voice to note* </h2>
<input id="myInput" onkeyup="search_audio()" type="text" placeholder="audio name" required>
<input type="button" id="submit" value="submit"></button>
</div>

<span class="error"><p id="input_error"></p></span>
Expand Down
19 changes: 19 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@

* { box-sizing: border-box; }
body {
background: rgb(179, 245, 196);

font: 16px Arial;
justify-content: center;
}
.title-design{
text-align: center;
font-family: Impact;
color: rgb(33, 65, 41)
}
.mini-title
{

text-align: center;
font-family: Impact;
color: rgb(11, 66, 18)
}
#list{
font-size: 1.5em;
margin-left: 90px;
Expand Down

0 comments on commit 402e593

Please sign in to comment.