66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
|
|
const addButton = document.getElementById("add-btn");
|
|
addButton.addEventListener("click", () => {
|
|
navigateToAdd();
|
|
});
|
|
|
|
const filterButton = document.getElementById("filter-btn");
|
|
filterButton.addEventListener("change", () => {
|
|
const filterString = filterButton.value;
|
|
filter(filterString);
|
|
});
|
|
|
|
const searchButton = document.getElementById("search-btn");
|
|
searchButton.addEventListener("click", () => {
|
|
const searchString = searchBar.value;
|
|
search(searchString);
|
|
});
|
|
const searchBar = document.getElementById("search-entry");
|
|
searchBar.addEventListener("input", () => {
|
|
const searchString = searchBar.value;
|
|
search(searchString);
|
|
});
|
|
|
|
const sortButton = document.getElementById("sort-btn");
|
|
sortButton.addEventListener("change", () => {
|
|
const sortString = sortButton.value;
|
|
sort(sortString);
|
|
});
|
|
|
|
const upvoteButtons = document.getElementsByClassName("upvote-btn");
|
|
const upvoteButtonClickListener = () => {
|
|
const entryID = upvoteButton.parent.dataset.id;
|
|
vote(entryID, true);
|
|
};
|
|
for (const upvoteButton of upvoteButtons) {
|
|
upvoteButton.addEventListener("click", upvoteButtonClickListener);
|
|
}
|
|
|
|
const downvoteButtons = document.getElementsByClassName("downvote-btn");
|
|
const downvoteButtonClickListener = () => {
|
|
const entryID = downvoteButton.parent.dataset.id;
|
|
vote(entryID, false);
|
|
};
|
|
for (const downvoteButton of downvoteButtons) {
|
|
downvoteButton.addEventListener("click", downvoteButtonClickListener);
|
|
}
|
|
|
|
function navigateToAdd() {
|
|
|
|
}
|
|
|
|
function filter(filterString) {
|
|
|
|
}
|
|
|
|
function search(searchString) {
|
|
console.log(searchString);
|
|
}
|
|
|
|
function sort(sortString) {
|
|
|
|
}
|
|
|
|
function vote(entryID, up) {
|
|
fetch()
|
|
} |