PageSourceSearch

https://xn--80abjd4ah2c.xn--p1ai/local/templates/belduma/js/cookies.js

js xn--80abjd4ah2c.xn--p1ai collected 2026-09-30 03:09:38 UTC 7,283 bytes, 177 lines download raw bytes

1(function (window, undefined){
2	"use strict";
3	var document = window.document;
4	function log() {
5		if (window.console && window.console.log) {
6			for (var x in arguments) {
7				if (arguments.hasOwnProperty(x)) {
8					window.console.log(arguments[x]);
9				}
10			}
11		}
12	}
13	function AcceptCookie() {
14		if (!(this instanceof AcceptCookie)) {
15			return new AcceptCookie();
16		}
17		this.init.call(this);
18		return this;
19	}
20	AcceptCookie.prototype = {
21		init: function () {
22			var self = this;
23			if(self.readCookie('pjAcceptCookie') == null)
24			{
25				// self.appendCss();
26				self.addCookieBar();
27			}
28			var clear_cookie_arr = self.getElementsByClass("pjClearCookie", null, "a");
29			if(clear_cookie_arr.length > 0)
30			{
31				self.addEvent(clear_cookie_arr[0], "click", function (e) {
32					if (e.preventDefault) {
33						e.preventDefault();
34					}
35					self.eraseCookie('pjAcceptCookie');
36					document.location.reload();
37					return false;
38				});
39			}
40		},
41		getElementsByClass: function (searchClass, node, tag) {
42			var classElements = new Array();
43			if (node == null) {
44				node = document;
45			}
46			if (tag == null) {
47				tag = '*';
48			}
49			var els = node.getElementsByTagName(tag);
50			var elsLen = els.length;
51			var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
52			for (var i = 0, j = 0; i < elsLen; i++) {
53				if (pattern.test(els[i].className)) {
54					classElements[j] = els[i];
55					j++;
56				}
57			}
58			return classElements;
59		},
60		addEvent: function (obj, type, fn) {
61			if (obj.addEventListener) {
62				obj.addEventListener(type, fn, false);
63			} else if (obj.attachEvent) {
64				obj["e" + type + fn] = fn;
65				obj[type + fn] = function() { obj["e" + type + fn](window.event); };
66				obj.attachEvent("on" + type, obj[type + fn]);
67			} else {
68				obj["on" + type] = obj["e" + type + fn];
69			}
70		},
71		createCookie: function (name, value, days){
72			var expires;
73		    if (days) {
74		        var date = new Date();
75		        date.setTime(date.getTime()+(days*24*60*60*1000));
76		        expires = "; expires="+date.toGMTString();
77		    } else {
78		        expires = "";
79		    }
80		    document.cookie = name+"="+value+expires+"; path=/";
81		},
82		readCookie: function (name) {
83		    var nameEQ = name + "=";
84		    var ca = document.cookie.split(';');
85		    for(var i=0;i < ca.length;i++) {
86		        var c = ca[i];
87		        while (c.charAt(0) === ' ') {
88		            c = c.substring(1,c.length);
89		        }
90		        if (c.indexOf(nameEQ) === 0) {
91		            return c.substring(nameEQ.length,c.length);
92		        }
93		    }
94		    return null;
95		},
96		eraseCookie: function (name) {
97			var self = this;
98			self.createCookie(name,"",-1);
99		},
100		// appendCss: function()
101		// {
102		// 	var self = this;
103		// 	var cssId = 'pjAcceptCookieCss';
104		// 	if (!document.getElementById(cssId))
105		// 	{
106		// 	    var head  = document.getElementsByTagName('head')[0];
107		// 	    var link  = document.createElement('link');
108		// 	    link.id   = cssId;
109		// 	    link.rel  = 'stylesheet';
110		// 	    link.type = 'text/css';
111		// 	    link.href = 'https://fonts.googleapis.com/css?family=Open+Sans';
112		// 	    link.media = 'all';
113		// 	    head.appendChild(link);
114		// 	}
115		// 	var cssCode = "";
116		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn,";
117		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:after { -webkit-transition: all .5s ease-in-out; -moz-transition: all .5s ease-in-out; -ms-transition: all .5s ease-in-out; -o-transition: all .5s ease-in-out; transition: all .5s ease-in-out; }";
118		// 	cssCode += "#pjAcceptCookieBar { position: fixed; bottom: 0; left: 0; z-index: 9999; overflow-x: hidden; overflow-y: auto; width: 100%; max-height: 100%; padding: 10px 0; font-family: 'Open Sans', sans-serif; text-align: center;color: #fff; background-color: #308584;}";
119		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarShell { width: 90%; margin: 0 auto; }";
120		// 	cssCode += "#pjAcceptCookieBar a[href^=tel] { color: inherit; }";
121		// 	cssCode += "#pjAcceptCookieBar a:focus,";
122		// 	cssCode += "#pjAcceptCookieBar button:focus { outline: unset; outline: none; }";
123		// 	cssCode += "#pjAcceptCookieBar p { font-size: 14px; line-height: 1.4; color: #333333; font-weight: 400; }";
124		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarActions { padding-top: 10px; }";
125		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn { position: relative; display: inline-block; height: 20px;
125 padding: 0 30px; border: 0; background: #6f2d20; font-size: 14px; line-height: 14px; color: #fff; text-decoration: none; vertical-align: middle; cursor: pointer; border-radius: 0; -webkit-appearance: none; -webkit-border-radius: 0; -webkit-transform: translateZ(0); transform: translateZ(0); -webkit-backface-visibility: hidden; backface-visibility: hidden; -moz-osx-font-smoothing: grayscale; }";
126		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:hover,";
127		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:focus { text-decoration: none; }";
128		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:after { position: absolute; top: 0; right: 52%; bottom: 0; left: 52%; z-index: -1; border-bottom: 4px solid #14428d; background: rgba(20, 66, 141, .3); content: ''; }";
129		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:hover:after,";
130		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarBtn:focus:after { right: 0; left: 0; }";
131		// 	cssCode += "@media only screen and (max-width: 767px) {";
132		// 	cssCode += "#pjAcceptCookieBar { padding: 15px 0; }";
133		// 	cssCode += "#pjAcceptCookieBar .pjAcceptCookieBarShell { width: 96%; }";
134		// 	cssCode += "#pjAcceptCookieBar p { font-size: 14px; }";
135		// 	cssCode += "}";
136		// 	var styleElement = document.createElement("style");
137		// 	styleElement.type = "text/css";
138		// 	if (styleElement.styleSheet) {
139		// 	    styleElement.styleSheet.cssText = cssCode;
140		// 	} else {
141		// 		styleElement.appendChild(document.createTextNode(cssCode));
142		// 	}
143		// 	document.getElementsByTagName("head")[0].appendChild(styleElement);
144		// },
145		addCookieBar: function(){
146			var self = this;
147			var htmlBar = '';
148			htmlBar += '<div class="modal" style="display: block"><div class="modal-dialog"><div class="modal-content"><div class="modal-body"><form class="container" action="#" method="post">';
149			htmlBar += '<p>Мы используем файлы cookie. Они помогают улучшить ваше взаимодействие с сайтом.</p>';
150			htmlBar += '<button type="button" class="pjAcceptCookieBarBtn btn btn-outline-primary">Прекрасно</button></form></div></div></div></div>';
151			var barDiv = document.createElement('div');
152			barDiv.id = "cookie-modal";
153			document.body.appendChild(barDiv);
154			barDiv.innerHTML = htmlBar;
155			self.bindCookieBar();
156		},
157		bindCookieBar: function(){
158			var self = this;
159			var btn_arr = self.getElementsByClass("pjAcceptCookieBarBtn", null, "button");
160			if(btn_arr.length > 0)
161			{
162				self.addEvent(btn_arr[0], "click", function (e) {
163					if (e.preventDefault) {
164						e.preventDefault();
165					}
166					self.createCookie('pjAcceptCookie', 'YES', 365);
167					document.getElementById("cookie-modal").remove();
168					return false;
169				});
170			}
171		}
172	};
173	window.AcceptCookie = AcceptCookie;
174})(window);
175window.onload = function() {
176	AcceptCookie = AcceptCookie();
177}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.