added info about cookies
This commit is contained in:
parent
d8994de79f
commit
5d72dd7304
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Skrypt wyświetlający okienko z informacją o wykorzystaniu ciasteczek (cookies)
|
||||
*
|
||||
* Więcej informacji: http://webhelp.pl/artykuly/okienko-z-informacja-o-ciasteczkach-cookies/
|
||||
*
|
||||
*/
|
||||
|
||||
function WHCreateCookie(name, value, days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
||||
var expires = "; expires=" + date.toGMTString();
|
||||
document.cookie = name+"="+value+expires+"; path=/";
|
||||
}
|
||||
function WHReadCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
window.onload = WHCheckCookies;
|
||||
|
||||
function WHCheckCookies() {
|
||||
if(WHReadCookie('cookies_accepted') != 'T') {
|
||||
var message_container = document.createElement('div');
|
||||
message_container.id = 'cookies-message-container';
|
||||
var html_code = '<div id="cookies-message" style="margin-top:56px; padding: 10px 0px; font-size: 14px; line-height: 22px; border-bottom: 1px solid rgb(211, 208, 208); text-align: center; position: fixed; top: 0px; background-color: #efefef; width: 100%; z-index: 999;">Ta strona używa ciasteczek (cookies), dzięki którym nasz serwis może działać lepiej. <a href="http://wszystkoociasteczkach.pl" target="_blank">Dowiedz się więcej</a><a href="javascript:WHCloseCookiesWindow();" id="accept-cookies-checkbox" name="accept-cookies" style="background-color: #00AFBF; padding: 5px 10px; color: #FFF; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; display: inline-block; margin-left: 10px; text-decoration: none; cursor: pointer;">Rozumiem</a></div>';
|
||||
message_container.innerHTML = html_code;
|
||||
document.body.appendChild(message_container);
|
||||
}
|
||||
}
|
||||
|
||||
function WHCloseCookiesWindow() {
|
||||
WHCreateCookie('cookies_accepted', 'T', 365);
|
||||
document.getElementById('cookies-message-container').removeChild(document.getElementById('cookies-message'));
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'font_awesomeall', 'tempusdominus-bootstrap-4.min', 'select2.min', 'adminlte.min', 'main' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'whcookies', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body class="layout-top-nav" style="height: auto;">
|
||||
|
|
|
|||
Loading…
Reference in New Issue