MAPG-188 get rid of inline js
This commit is contained in:
parent
d03a3934c6
commit
3555be9b63
@ -244,4 +244,23 @@ var MapGuesser = {
|
|||||||
document.getElementById('cover').onclick = function () {
|
document.getElementById('cover').onclick = function () {
|
||||||
MapGuesser.hideModal();
|
MapGuesser.hideModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (COOKIES_CONSENT) {
|
||||||
|
MapGuesser.initGoogleAnalitics();
|
||||||
|
} else {
|
||||||
|
// we don't want user to agree cookies when clicking on the notice itself
|
||||||
|
document.getElementById('cookiesNotice').onclick = function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
};
|
||||||
|
|
||||||
|
document.getElementById('agreeCookiesButton').onclick = function () {
|
||||||
|
MapGuesser.agreeCookies();
|
||||||
|
|
||||||
|
document.getElementById('cookiesNotice').style.display = 'none';
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onclick = function () {
|
||||||
|
MapGuesser.agreeCookies();
|
||||||
|
};
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -42,38 +42,11 @@
|
|||||||
<?php if (!empty($_ENV['GOOGLE_ANALITICS_ID'])): ?>
|
<?php if (!empty($_ENV['GOOGLE_ANALITICS_ID'])): ?>
|
||||||
const GOOGLE_ANALITICS_ID = '<?= $_ENV['GOOGLE_ANALITICS_ID'] ?>';
|
const GOOGLE_ANALITICS_ID = '<?= $_ENV['GOOGLE_ANALITICS_ID'] ?>';
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
const COOKIES_CONSENT = <?= isset($_COOKIE['COOKIES_CONSENT']) ? 'true' : 'false' ?>;
|
||||||
</script>
|
</script>
|
||||||
@yields('pageScript')
|
@yields('pageScript')
|
||||||
<script src="<?= $_ENV['STATIC_ROOT'] ?>/js/mapguesser.js?rev=<?= REVISION ?>"></script>
|
<script src="<?= $_ENV['STATIC_ROOT'] ?>/js/mapguesser.js?rev=<?= REVISION ?>"></script>
|
||||||
@yields('externalJs')
|
@yields('externalJs')
|
||||||
@yields('inlineJs')
|
@yields('inlineJs')
|
||||||
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
// we don't want user to agree cookies when clicking on the notice itself
|
|
||||||
document.getElementById('cookiesNotice').onclick = function (e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
};
|
|
||||||
|
|
||||||
document.getElementById('agreeCookiesButton').onclick = function () {
|
|
||||||
MapGuesser.agreeCookies();
|
|
||||||
|
|
||||||
document.getElementById('cookiesNotice').style.display = 'none';
|
|
||||||
};
|
|
||||||
|
|
||||||
window.onclick = function () {
|
|
||||||
MapGuesser.agreeCookies();
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php if (!empty($_ENV['GOOGLE_ANALITICS_ID'])): ?>
|
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
MapGuesser.initGoogleAnalitics();
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user