Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cookieInfo = {
- createDiv: function () {
- var banner = $(
- '<aside id="cookieConsent"><div class="container-fluid"><div class="row sep-top-xxs sep-bottom-xxs"><div class="col-xs-9 col-sm-10"><p class="no-margin">W ramach naszej witryny stosujemy pliki cookies w celu świadczenia usług na najwyższym poziomie.</p></div><div class="col-xs-3 col-sm-2"><button type="button" class="btn btn-primary btn-xs btn-block" onclick="cookieInfo.createCookie(cookieConsent, 1, 365)">OK</button></div></div></div></aside>'
- )
- $('body').append(banner)
- $('#cookieConsent').hide().fadeIn()
- },
- createCookie: function (name, value, days) {
- var expires = ''
- if (days) {
- var date = new Date()
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
- expires = '; expires=' + date.toGMTString()
- }
- document.cookie = name + '=' + value + expires + '; path=/'
- $('#cookieConsent').fadeOut()
- },
- checkCookie: function (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
- },
- init: function () {
- if (this.checkCookie(cookieConsent) != 1)
- this.createDiv()
- }
- }
- $(document).ready(function () {
- cookieInfo.init()
- })
Add Comment
Please, Sign In to add comment