mirror of https://github.com/dirtbags/moth.git
Merge branch '81-support-downloading-open-content' of https://github.com/dirtbags/moth into 81-support-downloading-open-content
This commit is contained in:
commit
9b047e7821
|
@ -1,7 +1,8 @@
|
||||||
function pwa_init() {
|
function pwa_init() {
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
navigator.serviceWorker.register("./sw.js").then(function(reg) {
|
navigator.serviceWorker.register("./sw.js").then(function(reg) {
|
||||||
}).catch(function(err) {
|
})
|
||||||
|
.catch(err => {
|
||||||
console.warn("Error while registering service worker", err)
|
console.warn("Error while registering service worker", err)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -137,7 +137,8 @@ function drawCacheButton(teamId) {
|
||||||
} else {
|
} else {
|
||||||
cacher.style.display = "none"
|
cacher.style.display = "none"
|
||||||
}
|
}
|
||||||
}).catch( ex => {
|
})
|
||||||
|
.catch(ex => {
|
||||||
cacher.style.display = "none"
|
cacher.style.display = "none"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -158,14 +159,14 @@ async function fetchAll(teamId) {
|
||||||
.then( resp => {
|
.then( resp => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.json()
|
resp.json()
|
||||||
.then( contents => {
|
.then(contents => {
|
||||||
console.log("Processing manifest")
|
console.log("Processing manifest")
|
||||||
for (let resource of contents) {
|
for (let resource of contents) {
|
||||||
if (resource == "puzzles.json") {
|
if (resource == "puzzles.json") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fetch(resource)
|
fetch(resource)
|
||||||
.then( e => {
|
.then(e => {
|
||||||
console.log("Fetched " + resource)
|
console.log("Fetched " + resource)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -191,7 +192,7 @@ async function fetchAll(teamId) {
|
||||||
url.searchParams.set("points", puzzle[0])
|
url.searchParams.set("points", puzzle[0])
|
||||||
url.searchParams.set("pid", puzzle[1])
|
url.searchParams.set("pid", puzzle[1])
|
||||||
requests.push( fetch(url)
|
requests.push( fetch(url)
|
||||||
.then( e => {
|
.then(e => {
|
||||||
console.log("Fetched " + url)
|
console.log("Fetched " + url)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue