Use inline for cookieconsent again (needs to be parsed by twig)

This commit is contained in:
Varakh 2018-05-24 01:59:49 +02:00
parent b32adde2bd
commit 3e34d22cae
5 changed files with 54 additions and 27 deletions

View file

@ -26,8 +26,10 @@ legalmodal.open: I've read the agreement and I agree to it.
legalmodal.title: Agreement legalmodal.title: Agreement
# Cookie modal # Cookie modal
cookiemodal.dismiss: "OK" cookie.message: "Cookies are required for this website in order to check the login status. Those will be deleted once you end your browser session. Other cookies are not set. OK?"
cookiemodal.message: "This website uses cookies to ensure you get the best experience." cookie.more: "Learn more in the privacy policy!"
cookie.dismiss: "Yes!"
cookie.deny: "No."
# Verification # Verification
verification.mail.subject: "%server%: jabber account verification" verification.mail.subject: "%server%: jabber account verification"

View file

@ -1,21 +0,0 @@
$(".alert-danger").delay(30000).fadeOut(300);
$(".alert-success").delay(10000).fadeOut(300);
$(".alert-info").delay(10000).fadeOut(300);
window.addEventListener("load", function () {
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#252e39"
},
"button": {
"background": "#14a7d0"
}
},
"content": {
"message": "{{ 'cookiemodal.message'|trans }}",
"dismiss": "{{ 'cookiemodal.dismiss'|trans }}",
"href": "/signup"
}
})
});

View file

@ -9,7 +9,7 @@
<!-- CSS & fonts --> <!-- CSS & fonts -->
<link rel="stylesheet" href="{{ base_url() }}/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ base_url() }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ base_url() }}/css/font-awesome.css"> <link rel="stylesheet" href="{{ base_url() }}/css/font-awesome.css">
<link rel="stylesheet" href="{{ base_url() }}/css/cookieconsent.min.css"/> <link rel="stylesheet" href="{{ base_url() }}/css/cookie.min.css"/>
<!-- Custom styles for this template --> <!-- Custom styles for this template -->
<link rel="stylesheet" href="{{ base_url() }}/css/custom.css"/> <link rel="stylesheet" href="{{ base_url() }}/css/custom.css"/>
@ -117,10 +117,56 @@
<!-- Script --> <!-- Script -->
<script src="{{ base_url() }}/js/jquery.min.js"></script> <script src="{{ base_url() }}/js/jquery.min.js"></script>
<script src="{{ base_url() }}/js/bootstrap.bundle.min.js"></script> <script src="{{ base_url() }}/js/bootstrap.bundle.min.js"></script>
<script src="{{ base_url() }}/js/cookieconsent.min.js"></script> <script>
$(".alert-danger").delay(30000).fadeOut(300);
$(".alert-success").delay(10000).fadeOut(300);
$(".alert-info").delay(10000).fadeOut(300);
</script>
<!-- Custom Script --> <!-- Cookie -->
<script src="{{ base_url() }}/js/custom.js"></script> <script src="{{ base_url() }}/js/cookie.min.js"></script>
<script>
window.addEventListener("load", function () {
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#252e39"
},
"button": {
"background": "#14a7d0"
}
},
"content": {
"message": "{{ 'cookie.message'|trans }}",
"dismiss": "{{ 'cookie.dismiss'|trans }}",
"deny": "{{ 'cookie.deny'|trans }}",
"link": "{{ 'cookie.more'|trans }}",
"href": "/signup"
},
"type": "opt-out",
onStatusChange: function(status, chosenBefore) {
var type = this.options.type;
var didConsent = this.hasConsented();
if (type === 'opt-out' && !didConsent) {
console.log('Opting out of cookies, at least for non HttpOnly');
// deleting cookies
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
window.location.replace("about:blank");
}
}
})
});
</script>
</body> </body>
</html> </html>