js skeleton implemented
This commit is contained in:
		
							
								
								
									
										61
									
								
								src/main/resources/static/main.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/main/resources/static/main.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					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("change", () => {
 | 
				
			||||||
 | 
					    const searchString = searchBar.value;
 | 
				
			||||||
 | 
					    search(searchString);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const sortButton = document.getElementById("sort-btn");
 | 
				
			||||||
 | 
					sortButton.addEventListener("change", () => {
 | 
				
			||||||
 | 
					    const sortString = sortButton.value;
 | 
				
			||||||
 | 
					    sort(sortString);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const upvoteButton = document.getElementsByClassName("upvote-btn");
 | 
				
			||||||
 | 
					upvoteButton.addEventListener("click", () => {
 | 
				
			||||||
 | 
					    //const entryID = ;
 | 
				
			||||||
 | 
					    vote(entryID, true);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const downvoteButton = document.getElementsByClassName("downvote-btn");
 | 
				
			||||||
 | 
					downvoteButton.addEventListener("click", () => {
 | 
				
			||||||
 | 
					    //const entryID;
 | 
				
			||||||
 | 
					    vote(entryID, false);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function navigateToAdd() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function filter(filterString) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function search(searchString) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function sort(sortString) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function vote(entryID, up) {
 | 
				
			||||||
 | 
					    fetch()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -4,7 +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="main.css">
 | 
					    <link rel="stylesheet" href="../static/main.css">
 | 
				
			||||||
 | 
					    <script type="text/javascript" src="../static/main.js"></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>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user