mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-11-10 05:34:44 +00:00
cleanup unused html and js code
This commit is contained in:
parent
5e83338668
commit
89b7319dd8
@ -1,13 +0,0 @@
|
|||||||
// Run the init() function when the page has loaded
|
|
||||||
window.addEventListener("DOMContentLoaded", init);
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
let result = sessionStorage.getItem("currReview");
|
|
||||||
|
|
||||||
let main = document.querySelector("main");
|
|
||||||
|
|
||||||
main.innerHTML = result;
|
|
||||||
let p = document.createElement("p");
|
|
||||||
p.innerHTML = JSON.parse(result)["comments"];
|
|
||||||
main.append(p);
|
|
||||||
}
|
|
@ -39,85 +39,4 @@ function initFormHandler() {
|
|||||||
createBtn.addEventListener("click", function(){
|
createBtn.addEventListener("click", function(){
|
||||||
window.location.assign("./CreatePage.html");
|
window.location.assign("./CreatePage.html");
|
||||||
});
|
});
|
||||||
|
|
||||||
//accessing form components
|
|
||||||
/*
|
|
||||||
let tagContainer = document.getElementById("tag-container-form");
|
|
||||||
let form = document.querySelector("form");
|
|
||||||
|
|
||||||
form.addEventListener("submit", function(){
|
|
||||||
/*
|
|
||||||
* User submits the form for their review.
|
|
||||||
* We create reviewCard and put in storage
|
|
||||||
let formData = new FormData(form);
|
|
||||||
let reviewObject = {};
|
|
||||||
for (let [key, value] of formData) {
|
|
||||||
console.log(`${key}`);
|
|
||||||
console.log(`${value}`);
|
|
||||||
if (`${key}` !== "tag-form") {
|
|
||||||
reviewObject[`${key}`] = `${value}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reviewObject["tags"] = [];
|
|
||||||
|
|
||||||
let tags = document.querySelectorAll(".tag");
|
|
||||||
for(let i = 0; i < tags.length; i ++) {
|
|
||||||
reviewObject["tags"].push(tags[i].innerHTML);
|
|
||||||
tagContainer.removeChild(tags[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let newReview = document.createElement("review-card");
|
|
||||||
newReview.data = reviewObject;
|
|
||||||
|
|
||||||
//TODO: want to append it to whatever the box is in layout
|
|
||||||
let mainEl = document.querySelector("main");
|
|
||||||
mainEl.append(newReview);
|
|
||||||
|
|
||||||
// TODO: assign an ID to be used for referencing this object form the activeIDs array and the tag arrays
|
|
||||||
let ID = localStorage.nextID;
|
|
||||||
|
|
||||||
let storedReviews = getReviewsFromStorage();
|
|
||||||
storedReviews.push(reviewObject);
|
|
||||||
saveReviewsToStorage(storedReviews);
|
|
||||||
document.getElementById("new-food-entry").reset();
|
|
||||||
});
|
|
||||||
|
|
||||||
// DEV-MODE: for testing purposes
|
|
||||||
let clearBtn = document.querySelector(".danger");
|
|
||||||
clearBtn.addEventListener("click", function() {
|
|
||||||
localStorage.clear();
|
|
||||||
let mainEl = document.querySelector("main");
|
|
||||||
while (mainEl.firstChild) {
|
|
||||||
mainEl.removeChild(mainEl.firstChild);
|
|
||||||
}
|
|
||||||
let deleteTags = document.querySelectorAll(".tag");
|
|
||||||
for(let i = 0; i < deleteTags.length; i ++) {
|
|
||||||
tagContainer.removeChild(deleteTags[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//clears reviews AS WELL as resets form
|
|
||||||
document.getElementById("new-food-entry").reset();
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
let tagAddBtn = document.getElementById("tagAdd");
|
|
||||||
tagAddBtn.addEventListener("click", ()=> {
|
|
||||||
let tagField = document.getElementById("tag-form");
|
|
||||||
if (tagField.value.length > 0) {
|
|
||||||
let tagLabel = document.createElement("label");
|
|
||||||
tagLabel.innerHTML = tagField.value;
|
|
||||||
tagLabel.setAttribute("class","tag");
|
|
||||||
tagLabel.addEventListener("click",()=> {
|
|
||||||
tagContainer.removeChild(tagLabel);
|
|
||||||
});
|
|
||||||
|
|
||||||
tagContainer.append(tagLabel);
|
|
||||||
tagField.value = "";
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Food Journal</title>
|
|
||||||
|
|
||||||
<script src="assets/scripts/reviewpage.js" type="module"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Current Review:</h1>
|
|
||||||
<main>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user