mirror of
				https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
				synced 2025-10-30 19:46:49 +00:00 
			
		
		
		
	fix styling issue,
fix bug in service worker and search URI Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
		| @@ -102,7 +102,7 @@ function setupUpdate(){ | |||||||
|        |        | ||||||
| 			let tagSetVal; | 			let tagSetVal; | ||||||
| 			for (let i = 0; i < currReview["tags"].length; i++) { | 			for (let i = 0; i < currReview["tags"].length; i++) { | ||||||
| 				tagSetVal = currReview["tags"][i].toLowerCase() | 				tagSetVal = currReview["tags"][i].toLowerCase(); | ||||||
| 				tagSet.add(tagSetVal); | 				tagSet.add(tagSetVal); | ||||||
| 				let newTag = document.createElement("label"); | 				let newTag = document.createElement("label"); | ||||||
| 				newTag.setAttribute("class","tag"); | 				newTag.setAttribute("class","tag"); | ||||||
|   | |||||||
| @@ -89,7 +89,7 @@ export function updateReviewToStorage(ID, review){ | |||||||
| 		//stars update recency if unchanged | 		//stars update recency if unchanged | ||||||
| 		for (let i in starArr){ | 		for (let i in starArr){ | ||||||
| 			if(starArr[i] == ID) { | 			if(starArr[i] == ID) { | ||||||
| 				starArr.splice(i,1) | 				starArr.splice(i,1); | ||||||
| 				starArr.push(ID); | 				starArr.push(ID); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ function initFormHandler() { | |||||||
| 		searchTag = null; | 		searchTag = null; | ||||||
| 		searchField.value = ""; | 		searchField.value = ""; | ||||||
| 		sortAndFilter(searchTag); | 		sortAndFilter(searchTag); | ||||||
| 	}) | 	}); | ||||||
|  |  | ||||||
| 	//sort by selected method | 	//sort by selected method | ||||||
| 	let sortMethod = document.getElementById("sort"); | 	let sortMethod = document.getElementById("sort"); | ||||||
| @@ -142,7 +142,7 @@ function loadReviews(index, reviewIDs){ | |||||||
| 		moreBtn.setAttribute("id", "more-btn"); | 		moreBtn.setAttribute("id", "more-btn"); | ||||||
| 		moreBtn.innerText = "Load More"; | 		moreBtn.innerText = "Load More"; | ||||||
| 		//if load more clicked, load 9 more | 		//if load more clicked, load 9 more | ||||||
| 		moreBtn.addEventListener("click", function(){loadReviews(index + 9, reviewIDs)}); | 		moreBtn.addEventListener("click", function(){loadReviews(index + 9, reviewIDs);}); | ||||||
| 		reviewBox.append(moreBtn); | 		reviewBox.append(moreBtn); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -151,7 +151,7 @@ function loadReviews(index, reviewIDs){ | |||||||
| const registerServiceWorker = async () => { | const registerServiceWorker = async () => { | ||||||
| 	if ("serviceWorker" in navigator) { | 	if ("serviceWorker" in navigator) { | ||||||
| 		try { | 		try { | ||||||
| 			const registration = await navigator.serviceWorker.register("./sw.js", {scope: "./"}); | 			await navigator.serviceWorker.register("./sw.js", {scope: "./"}); | ||||||
| 		} catch (error) { | 		} catch (error) { | ||||||
| 			console.error(`Registration failed with ${error}`); | 			console.error(`Registration failed with ${error}`); | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| const CACHE_NAME = "food-journal-v1"; | const CACHE_NAME = "food-journal-v1"; | ||||||
| const ASSETS = [ | const ASSETS = [ | ||||||
|  | 	"/", | ||||||
| 	"index.html", | 	"index.html", | ||||||
| 	"ReviewDetails.html", | 	"ReviewDetails.html", | ||||||
| 	"CreatePage.html", | 	"CreatePage.html", | ||||||
| @@ -57,7 +58,7 @@ self.addEventListener("fetch", (event) => { | |||||||
| 			// If there is not a network response, return the cached response | 			// If there is not a network response, return the cached response | ||||||
| 			// The ignoreVary option is used here to fix an issue where the service worker  | 			// The ignoreVary option is used here to fix an issue where the service worker  | ||||||
| 			// would not serve certain requests unless the page was refreshed at least once | 			// would not serve certain requests unless the page was refreshed at least once | ||||||
| 			return cache.match(event.request, {ignoreVary: true});  | 			return cache.match(event.request, {ignoreVary: true, ignoreSearch: true});  | ||||||
| 		}); | 		}); | ||||||
| 	})); | 	})); | ||||||
| }); | }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user