Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- addLoadEvent();
- });
- function addLoadEvent() {
- var oldonload = window.onload;
- console.log(typeof window.onload != 'function');
- if (typeof window.onload != 'function') {
- window.onload = cookiesAccept;
- } else {
- window.onload = function() {
- if (oldonload) { oldonload(); }
- cookiesAccept();
- }
- }
- }
- function cookiesAccept() {
- checkCookie();
- function getCookie(c_name) {
- var i, x, y, ARRcookies = document.cookie.split(";");
- for (i = 0; i < ARRcookies.length; i++) {
- x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
- y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
- x = x.replace(/^\s+|\s+$/g,"");
- if (x == c_name) { return unescape(y); }
- }
- }
- function setCookie() {
- var exdate = new Date();
- exdate.setDate(exdate.getDate() + 365);
- var c_value = escape('1') + ((365==null) ? "" : "; expires=" + exdate.toUTCString());
- document.cookie = 'cookies_info' + "=" + c_value;
- document.getElementById('cookie_info').style.display = 'none';
- }
- function checkCookie() {
- var cookies_info = getCookie("cookies_info");
- if (cookies_info == null || cookies_info == "") {
- var cookiesContainer = document.createElement("div");
- cookiesContainer.setAttribute("class", "container-fluid");
- cookiesContainer.setAttribute("id", "cookie_info");
- cookiesContainer.innerHTML = '<div class="user_information container"><div class="row"><div class="col-md-8 col-xs-12">Ta strona używa ciasteczek.......</div><div class="pull-right col-md-2 col-xs-6 button-cookies"><button class="btn btn-default"><a id="close_info_cookie">zgadzam się</a></butotn></div><div class="pull-right col-md-2 col-xs-6 button-cookies"><button class="btn btn-default"><a href="/privacy_policy" title="polityka prywatności">polityka prywatności</a></butotn></div>';
- document.getElementsByTagName("body").item(0).appendChild(cookiesContainer);
- var element = document.getElementById('close_info_cookie');
- if (element.addEventListener) { element.addEventListener('click', function() { setCookie() } , false); }
- else if (element.attachEvent) { element.attachEvent('onclick', function() { setCookie() }); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement