main.js further implemented
This commit is contained in:
parent
cddfdf546a
commit
d5fd98a066
@ -16,7 +16,7 @@ searchButton.addEventListener("click", () => {
|
|||||||
search(searchString);
|
search(searchString);
|
||||||
});
|
});
|
||||||
const searchBar = document.getElementById("search-entry");
|
const searchBar = document.getElementById("search-entry");
|
||||||
searchBar.addEventListener("change", () => {
|
searchBar.addEventListener("input", () => {
|
||||||
const searchString = searchBar.value;
|
const searchString = searchBar.value;
|
||||||
search(searchString);
|
search(searchString);
|
||||||
});
|
});
|
||||||
@ -27,17 +27,23 @@ sortButton.addEventListener("change", () => {
|
|||||||
sort(sortString);
|
sort(sortString);
|
||||||
});
|
});
|
||||||
|
|
||||||
const upvoteButton = document.getElementsByClassName("upvote-btn");
|
const upvoteButtons = document.getElementsByClassName("upvote-btn");
|
||||||
upvoteButton.addEventListener("click", () => {
|
const upvoteButtonClickListener = () => {
|
||||||
//const entryID = ;
|
const entryID = upvoteButton.parent.dataset.id;
|
||||||
vote(entryID, true);
|
vote(entryID, true);
|
||||||
});
|
};
|
||||||
|
for (const upvoteButton of upvoteButtons) {
|
||||||
|
upvoteButton.addEventListener("click", upvoteButtonClickListener);
|
||||||
|
}
|
||||||
|
|
||||||
const downvoteButton = document.getElementsByClassName("downvote-btn");
|
const downvoteButtons = document.getElementsByClassName("downvote-btn");
|
||||||
downvoteButton.addEventListener("click", () => {
|
const downvoteButtonClickListener = () => {
|
||||||
//const entryID;
|
const entryID = downvoteButton.parent.dataset.id;
|
||||||
vote(entryID, false);
|
vote(entryID, false);
|
||||||
});
|
};
|
||||||
|
for (const downvoteButton of downvoteButtons) {
|
||||||
|
downvoteButton.addEventListener("click", downvoteButtonClickListener);
|
||||||
|
}
|
||||||
|
|
||||||
function navigateToAdd() {
|
function navigateToAdd() {
|
||||||
|
|
||||||
@ -48,7 +54,7 @@ function filter(filterString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search(searchString) {
|
function search(searchString) {
|
||||||
|
console.log(searchString);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sort(sortString) {
|
function sort(sortString) {
|
||||||
@ -57,5 +63,4 @@ function sort(sortString) {
|
|||||||
|
|
||||||
function vote(entryID, up) {
|
function vote(entryID, up) {
|
||||||
fetch()
|
fetch()
|
||||||
|
|
||||||
}
|
}
|
@ -4,8 +4,8 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>DataDash</title>
|
<title>DataDash</title>
|
||||||
<link rel="stylesheet" href="../static/main.css">
|
<link rel="stylesheet" href="main.css">
|
||||||
<script type="text/javascript" src="../static/main.js"></script>
|
<script type="text/javascript" src="main.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div onclick="console.log('add')" id="add-btn" title="Add a new API entry"></div>
|
<div onclick="console.log('add')" id="add-btn" title="Add a new API entry"></div>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
<h2>Recently added:</h2>
|
<h2>Recently added:</h2>
|
||||||
<ul class="datasets">
|
<ul class="datasets">
|
||||||
<!-- Preliminary content to be replaced by data from our server: -->
|
<!-- Preliminary content to be replaced by data from our server: -->
|
||||||
<li class="dataset">
|
<li class="dataset" data-id="">
|
||||||
<div class="dataset-info">
|
<div class="dataset-info">
|
||||||
<div class="icon standup"></div>
|
<div class="icon standup"></div>
|
||||||
<div class="details">
|
<div class="details">
|
||||||
|
Loading…
Reference in New Issue
Block a user