manage url args

This commit is contained in:
Adrien MALINGREY 2020-11-14 12:45:49 +01:00
parent 9b2f1f9d78
commit 5836f53a24
2 changed files with 4 additions and 4 deletions

View File

@ -25,5 +25,5 @@ location /sudoku/ {
}
location ~ "^/sudoku/([1-9.]{81})$" {
rewrite "^/sudoku/([1-9.]{81})$" /sudoku/sudoku.php?grid=$1 last;
rewrite "^/sudoku/([1-9.]{81})\??(.*)?(#.*)?$" /sudoku/sudoku.php?grid=$1&$2$3 last;
}

View File

@ -52,7 +52,7 @@ window.onload = function () {
rowId++
}
const savedGame = localStorage[location.href]
const savedGame = localStorage[location.pathname]
if (savedGame) {
boxes.forEach((box, i) => {
if (!box.disabled && savedGame[i] != UNKNOWN) {
@ -79,7 +79,7 @@ window.onload = function () {
refreshUI()
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register(`service-worker.php?location=${location.href}`)
navigator.serviceWorker.register(`service-worker.php?location=${location.pathname}`)
}
}
@ -150,7 +150,7 @@ function oninput() {
function refreshBox(box) {
let saveGame = boxes.map(box => box.value || UNKNOWN).join("")
localStorage[location.href] = saveGame
localStorage[location.pathname] = saveGame
fixGridLink.href = saveGame
box.neighbourhood.concat([box]).forEach(neighbour => {