mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-11-10 05:34:44 +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:
parent
8924540757
commit
82aba63baf
@ -102,7 +102,7 @@ function setupUpdate(){
|
||||
|
||||
let tagSetVal;
|
||||
for (let i = 0; i < currReview["tags"].length; i++) {
|
||||
tagSetVal = currReview["tags"][i].toLowerCase()
|
||||
tagSetVal = currReview["tags"][i].toLowerCase();
|
||||
tagSet.add(tagSetVal);
|
||||
let newTag = document.createElement("label");
|
||||
newTag.setAttribute("class","tag");
|
||||
|
@ -89,7 +89,7 @@ export function updateReviewToStorage(ID, review){
|
||||
//stars update recency if unchanged
|
||||
for (let i in starArr){
|
||||
if(starArr[i] == ID) {
|
||||
starArr.splice(i,1)
|
||||
starArr.splice(i,1);
|
||||
starArr.push(ID);
|
||||
break;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ function initFormHandler() {
|
||||
searchTag = null;
|
||||
searchField.value = "";
|
||||
sortAndFilter(searchTag);
|
||||
})
|
||||
});
|
||||
|
||||
//sort by selected method
|
||||
let sortMethod = document.getElementById("sort");
|
||||
@ -142,7 +142,7 @@ function loadReviews(index, reviewIDs){
|
||||
moreBtn.setAttribute("id", "more-btn");
|
||||
moreBtn.innerText = "Load 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);
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ function loadReviews(index, reviewIDs){
|
||||
const registerServiceWorker = async () => {
|
||||
if ("serviceWorker" in navigator) {
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.register("./sw.js", {scope: "./"});
|
||||
await navigator.serviceWorker.register("./sw.js", {scope: "./"});
|
||||
} catch (error) {
|
||||
console.error(`Registration failed with ${error}`);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
const CACHE_NAME = "food-journal-v1";
|
||||
const ASSETS = [
|
||||
"/",
|
||||
"index.html",
|
||||
"ReviewDetails.html",
|
||||
"CreatePage.html",
|
||||
@ -57,7 +58,7 @@ self.addEventListener("fetch", (event) => {
|
||||
// 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
|
||||
// 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});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user