MAPG-86 adapt URLs in HTML and JS

This commit is contained in:
Bence Pőcze 2020-05-31 20:45:57 +02:00
parent 28464fc4ac
commit 665eb7e4d1
4 changed files with 18 additions and 24 deletions

View File

@ -53,7 +53,7 @@
Core.startNewRound(); Core.startNewRound();
}; };
xhr.open('GET', 'position.json?map=' + mapId, true); xhr.open('GET', '/game/' + mapId + '/position.json', true);
xhr.send(); xhr.send();
}, },
@ -135,7 +135,7 @@
Core.resetGame(); Core.resetGame();
}; };
xhr.open('GET', 'game.json?map=' + mapId, true); xhr.open('GET', '/game/' + mapId + '/position.json', true);
xhr.send(); xhr.send();
}, },
@ -160,7 +160,6 @@
document.getElementById('cover').style.visibility = 'visible'; document.getElementById('cover').style.visibility = 'visible';
var data = new FormData(); var data = new FormData();
data.append('guess', '1');
data.append('lat', String(guessPosition.lat)); data.append('lat', String(guessPosition.lat));
data.append('lng', String(guessPosition.lng)); data.append('lng', String(guessPosition.lng));
@ -209,7 +208,7 @@
Core.panoId = this.response.panoId; Core.panoId = this.response.panoId;
}; };
xhr.open('POST', 'position.json?map=' + mapId, true); xhr.open('POST', '/game/' + mapId + '/guess.json', true);
xhr.send(data); xhr.send(data);
}, },

View File

@ -1,9 +1,9 @@
<?php require 'templates/main_header.php'; ?> <?php require ROOT . '/views/templates/main_header.php'; ?>
<div class="header small"> <div class="header small">
<div class="grid"> <div class="grid">
<h1> <h1>
<a href="maps" title="Back to playable maps"> <a href="/maps" title="Back to playable maps">
<?php require 'templates/icon.php'; ?> <?php require ROOT . '/views/templates/icon.php'; ?>
<span>MapGuesser</span> <span>MapGuesser</span>
</a> </a>
</h1> </h1>
@ -49,5 +49,5 @@
var mapBounds = <?= json_encode($bounds) ?>; var mapBounds = <?= json_encode($bounds) ?>;
</script> </script>
<script src="https://maps.googleapis.com/maps/api/js?key=<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>"></script> <script src="https://maps.googleapis.com/maps/api/js?key=<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>"></script>
<script src="static/js/game.js"></script> <script src="/static/js/game.js"></script>
<?php require 'templates/main_footer.php'; ?> <?php require ROOT . '/views/templates/main_footer.php'; ?>

View File

@ -1,10 +1,5 @@
<?php require 'templates/main_header.php'; ?> <?php require ROOT . '/views/templates/main_header.php'; ?>
<div class="header"> <?php require ROOT . '/views/templates/header.php'; ?>
<h1>
<?php require 'templates/icon.php'; ?>
MapGuesser
</h1>
</div>
<div class="main"> <div class="main">
<h2>Playable maps</h2> <h2>Playable maps</h2>
<div class="mapContainer"> <div class="mapContainer">
@ -34,7 +29,7 @@
</div> </div>
<p class="small justify marginTop"><?= $map['description'] ?></p> <p class="small justify marginTop"><?= $map['description'] ?></p>
</div> </div>
<a class="button fullWidth" href="game?map=<?= $map['id']; ?>" title="Play map '<?= $map['name'] ?>'">Play this map</a> <a class="button fullWidth" href="game/<?= $map['id']; ?>" title="Play map '<?= $map['name'] ?>'">Play this map</a>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if (count($maps) < 4): ?> <?php if (count($maps) < 4): ?>
@ -44,4 +39,4 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<?php require 'templates/main_footer.php'; ?> <?php require ROOT . '/views/templates/main_footer.php'; ?>

View File

@ -4,14 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>MapGuesser</title> <title>MapGuesser</title>
<link href="static/css/mapguesser.css" rel="stylesheet"> <link href="/static/css/mapguesser.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&family=Roboto+Mono:wght@300;500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;500&family=Roboto+Mono:wght@300;500&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" sizes="192x192" href="static/img/favicon/192x192.png"> <link rel="icon" type="image/png" sizes="192x192" href="/static/img/favicon/192x192.png">
<link rel="icon" type="image/png" sizes="96x96" href="static/img/favicon/96x96.png"> <link rel="icon" type="image/png" sizes="96x96" href="/static/img/favicon/96x96.png">
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon/32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="/static/img/favicon/32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon/16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="/static/img/favicon/16x16.png">
</head> </head>
<body> <body>
<div id="loading"> <div id="loading">
<img src="static/img/loading.svg"> <img src="/static/img/loading.svg">
</div> </div>