restart on no hash
This commit is contained in:
parent
c47cd498c0
commit
60b5f74e94
@ -80,14 +80,14 @@ window.onload = function() {
|
||||
else if (node.label) node.label.title += shortcut
|
||||
}
|
||||
|
||||
onhashchange()
|
||||
loadSavedGame()
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register(`service-worker.php?location=${location.pathname}`)
|
||||
}
|
||||
}
|
||||
|
||||
onhashchange = function(event) {
|
||||
function loadSavedGame() {
|
||||
const savedGame = location.hash.slice(1)
|
||||
if (savedGame.match(/[1-9.]{81}/)) {
|
||||
boxes.forEach((box, i) => {
|
||||
@ -103,6 +103,11 @@ onhashchange = function(event) {
|
||||
refreshUI()
|
||||
}
|
||||
|
||||
onhashchange = function(event) {
|
||||
if (location.hash.slice(1)) loadSavedGame()
|
||||
else restart()
|
||||
}
|
||||
|
||||
function searchCandidatesOf(box) {
|
||||
box.candidates = new Set(VALUES)
|
||||
box.neighbourhood.forEach(neighbour => box.candidates.delete(neighbour.value))
|
||||
|
Loading…
x
Reference in New Issue
Block a user