Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3856ccb576 | ||
|
|
9f839d3f5d | ||
|
|
721b611cdb | ||
|
|
70fb30f673 | ||
|
|
e200dab2a4 | ||
|
|
e8c246f002 | ||
|
|
251bf1be3d | ||
|
|
0be20a6097 |
No files matched your search
@@ -84,7 +84,7 @@ hr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.small, span.small {
|
p.small, span.small {
|
||||||
font-size: 12px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.justify {
|
.justify {
|
||||||
@@ -148,6 +148,13 @@ button, a.button {
|
|||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button.small {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0 12px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
button:enabled:hover, button:enabled:focus, a.button:hover, a.button:focus {
|
button:enabled:hover, button:enabled:focus, a.button:hover, a.button:focus {
|
||||||
background-color: #29457f;
|
background-color: #29457f;
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -336,6 +343,12 @@ div.buttonContainer>button {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#cookiesNotice {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#loading {
|
#loading {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ div.mapItem>div.inner>div.info {
|
|||||||
grid-template-columns: auto auto;
|
grid-template-columns: auto auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.mapItem>div.inner>div.description {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
div.mapItem>div.inner>div.info>p:nth-child(1) {
|
div.mapItem>div.inner>div.info>p:nth-child(1) {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-21
@@ -30,7 +30,9 @@ $cssFiles = [
|
|||||||
-->~ <?= $map['area'][0] ?> <?= $map['area'][1] ?><sup>2</sup>
|
-->~ <?= $map['area'][0] ?> <?= $map['area'][1] ?><sup>2</sup>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="small justify marginTop"><?= $map['description'] ?></p>
|
<div class="description marginTop">
|
||||||
|
<p class="small center"><?= $map['description'] ?></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($isAdmin): ?>
|
<?php if ($isAdmin): ?>
|
||||||
<div class="buttonContainer">
|
<div class="buttonContainer">
|
||||||
@@ -64,7 +66,7 @@ $cssFiles = [
|
|||||||
const GOOGLE_MAPS_JS_API_KEY = '<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>';
|
const GOOGLE_MAPS_JS_API_KEY = '<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>';
|
||||||
|
|
||||||
var Maps = {
|
var Maps = {
|
||||||
innerDivs: null,
|
descriptionDivs: null,
|
||||||
|
|
||||||
addStaticMaps: function () {
|
addStaticMaps: function () {
|
||||||
var imgContainers = document.getElementById('mapContainer').getElementsByClassName('imgContainer');
|
var imgContainers = document.getElementById('mapContainer').getElementsByClassName('imgContainer');
|
||||||
@@ -81,29 +83,29 @@ $cssFiles = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initializeInnerDivs: function () {
|
initializeDescriptionDivs: function () {
|
||||||
Maps.innerDivs = document.getElementById('mapContainer').getElementsByClassName('inner');
|
Maps.descriptionDivs = document.getElementById('mapContainer').getElementsByClassName('description');
|
||||||
|
|
||||||
for (var i = 0; i < Maps.innerDivs.length; i++) {
|
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
|
||||||
var inner = Maps.innerDivs[i];
|
var description = Maps.descriptionDivs[i];
|
||||||
var boundingClientRect = inner.getBoundingClientRect();
|
var boundingClientRect = description.getBoundingClientRect();
|
||||||
|
|
||||||
inner.defaultHeight = boundingClientRect.height;
|
description.defaultHeight = boundingClientRect.height;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateInnerDivHeights: function () {
|
calculateDescriptionDivHeights: function () {
|
||||||
var currentY;
|
var currentY;
|
||||||
var rows = [];
|
var rows = [];
|
||||||
for (var i = 0; i < Maps.innerDivs.length; i++) {
|
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
|
||||||
var inner = Maps.innerDivs[i];
|
var description = Maps.descriptionDivs[i];
|
||||||
var boundingClientRect = inner.getBoundingClientRect();
|
var boundingClientRect = description.getBoundingClientRect();
|
||||||
|
|
||||||
if (currentY !== boundingClientRect.y) {
|
if (currentY !== boundingClientRect.y) {
|
||||||
rows.push([]);
|
rows.push([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rows[rows.length - 1].push(inner);
|
rows[rows.length - 1].push(description);
|
||||||
|
|
||||||
currentY = boundingClientRect.y;
|
currentY = boundingClientRect.y;
|
||||||
}
|
}
|
||||||
@@ -113,17 +115,17 @@ $cssFiles = [
|
|||||||
|
|
||||||
var maxHeight = 0;
|
var maxHeight = 0;
|
||||||
for (var j = 0; j < row.length; j++) {
|
for (var j = 0; j < row.length; j++) {
|
||||||
var inner = row[j];
|
var description = row[j];
|
||||||
|
|
||||||
if (inner.defaultHeight > maxHeight) {
|
if (description.defaultHeight > maxHeight) {
|
||||||
maxHeight = inner.defaultHeight;
|
maxHeight = description.defaultHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < row.length; j++) {
|
for (var j = 0; j < row.length; j++) {
|
||||||
var inner = row[j];
|
var description = row[j];
|
||||||
|
|
||||||
inner.style.height = maxHeight + 'px';
|
description.style.height = maxHeight + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,11 +133,11 @@ $cssFiles = [
|
|||||||
|
|
||||||
Maps.addStaticMaps();
|
Maps.addStaticMaps();
|
||||||
|
|
||||||
Maps.initializeInnerDivs();
|
Maps.initializeDescriptionDivs();
|
||||||
Maps.calculateInnerDivHeights();
|
Maps.calculateDescriptionDivHeights();
|
||||||
|
|
||||||
window.onresize = function () {
|
window.onresize = function () {
|
||||||
Maps.calculateInnerDivHeights();
|
Maps.calculateDescriptionDivHeights();
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,5 +14,30 @@
|
|||||||
<script src="<?= $jsFile ?>"></script>
|
<script src="<?= $jsFile ?>"></script>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
MapGuesser = {
|
||||||
|
cookiesAgreed: false,
|
||||||
|
|
||||||
|
agreeCookies: function () {
|
||||||
|
if (MapGuesser.cookiesAgreed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expirationDate = new Date(new Date().getTime() + 20 * 365 * 24 * 60 * 60 * 1000).toUTCString();
|
||||||
|
document.cookie = 'COOKIES_CONSENT=1; expires=' + expirationDate + '; path=/';
|
||||||
|
|
||||||
|
MapGuesser.cookiesAgreed = true;
|
||||||
|
document.getElementById('cookiesNotice').style.display = 'none';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onclick = function () {
|
||||||
|
MapGuesser.agreeCookies();
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -22,6 +22,14 @@
|
|||||||
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
|
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
||||||
|
<div id="cookiesNotice">
|
||||||
|
<p class="small">
|
||||||
|
<?= $_ENV['APP_NAME'] ?> uses cookies to improve user experience. By using the app or clicking I agree, you consent to our use of cookies.
|
||||||
|
</p>
|
||||||
|
<button id="agreeCookies" class="small marginTop">I agree</button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<div id="loading">
|
<div id="loading">
|
||||||
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>" width="64" height="64">
|
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>" width="64" height="64">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCo
|
|||||||
$routeCollection->post('admin.deleteMap', 'deleteMap/{mapId}', [MapGuesser\Controller\MapAdminController::class, 'deleteMap']);
|
$routeCollection->post('admin.deleteMap', 'deleteMap/{mapId}', [MapGuesser\Controller\MapAdminController::class, 'deleteMap']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isset($_COOKIE['COOKIES_CONSENT'])) {
|
||||||
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
|
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
|
||||||
|
|
||||||
session_set_save_handler(Container::$sessionHandler, true);
|
session_set_save_handler(Container::$sessionHandler, true);
|
||||||
@@ -58,6 +59,9 @@ session_start([
|
|||||||
'cookie_httponly' => true,
|
'cookie_httponly' => true,
|
||||||
'cookie_samesite' => 'Lax'
|
'cookie_samesite' => 'Lax'
|
||||||
]);
|
]);
|
||||||
|
} else {
|
||||||
|
$_SESSION = [];
|
||||||
|
}
|
||||||
|
|
||||||
Container::$request = new MapGuesser\Request\Request($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, $_SESSION);
|
Container::$request = new MapGuesser\Request\Request($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, $_SESSION);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user