-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
051a301
commit 12e18cb
Showing
5 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"files": { | ||
"views/post.ejs": [ | ||
{ | ||
"id": "728f013b-b0b8-42e7-afa4-46729eb5cb5d", | ||
"line": 12, | ||
"version": 1, | ||
"index": 190 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//Input Search Bar | ||
const input = document.querySelector("input"); | ||
input.addEventListener("keyup", (event) => { | ||
if (event.key === "Enter") { | ||
//Searching mechanism. No real algorithm involved. Just searches through all of it. | ||
search = true; | ||
var searchData = []; | ||
if (input.value.length > 2) { | ||
for (var i = 0; i < jsonData.length; i++) { | ||
if (jsonData[i].title.toLowerCase().includes(input.value)) { | ||
searchData.push(jsonData[i]); | ||
} | ||
} | ||
if (searchData != "") { | ||
error.innerHTML = searchData.length + " matches for " + input.value + "</br>"; | ||
content.innerHTML = ""; | ||
for (var i = 0; i < searchData.length; i++) { | ||
content.innerHTML += "<div class='box'><span class='floatright'>" + searchData[i].id + "</span><a href='post?id=" + searchData[i].id + "'>" + searchData[i].title + "</a></div>"; | ||
} | ||
} else { | ||
//These two lines were the only two lines that worked first try throughout this whole thing. | ||
//Epic Programming. | ||
error.innerHTML = "No matches"; | ||
content.innerHTML = ""; | ||
} | ||
|
||
} | ||
} | ||
}); | ||
console.log("Hello") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body{ | ||
background: blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters