PageSourceSearch

https://www.gabija.lt/js/cookie.js

js gabija.lt collected 2026-10-08 04:30:16 UTC 6,411 bytes, 231 lines download raw bytes

1function cookiesAgree() {
2
3	function savelog(value){
4
5	 $.ajax( {type: 'POST', url:'/cookie-save/', async:false,  data:{val: value},dataType: 'json', success:function (data) {
6        		
7        		
8    	}});
9	}
10
11    function createCookie(name, value, days) {
12
13        var expires = "";
14        if (days) {
15            var date = new Date();
16            date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
17            expires = "; expires=" + date.toUTCString();
18        }
19        
20       
21        
22        document.cookie = name + "=" + value + expires + "; path=/ ";
23    }
24
25    function eraseCookie(name) {
26        createCookie(name, "", -1);
27    }
28
29    function eraseCookies() {
30        //var nameEQ = name + "=";
31        var ca = document.cookie.split(';');
32        for (var i = 0; i < ca.length; i++) {
33
34            var n = ca[i].split('=');
35
36            var name = $.trim(n[0]);
37
38            var subname = name.substring(0,9);
39
40            if (name != 'uniq_param' && subname != 'CMSSESSID') {
41                eraseCookie($.trim(n[0]));
42            }
43
44        }
45
46
47        return null;
48    }
49
50    var html = $('html');
51
52    html.on('click', '.submit-cookie', function (event) {
53
54        event.preventDefault();
55        $('.cookie-section').removeClass('visible');
56
57        localStorage.setItem('cookiesAgree', 'true');
58        localStorage.setItem('cookiesLevel1', 1);
59        localStorage.setItem('cookiesLevel2', 1);
60        localStorage.setItem('cookiesLevel3', 1);
61        createCookie('cookiesAgree', 'true', 99999);
62        createCookie('cookiesLevel1', 1, 99999);
63        createCookie('cookiesLevel2', 1, 99999);
64        createCookie('cookiesLevel3', 1, 99999);
65gtag('consent', 'update', {
66            'ad_storage': 'granted',
67            'ad_user_data': 'granted',
68            'ad_personalization': 'granted',
69            'analytics_storage': 'granted',
70            'functionality_storage': 'granted',
71            'personalization_storage': 'granted',
72            'security_storage': 'granted',
73        });
74
75        savelog('cookiesLevel1,cookiesLevel2,cookiesLevel3');
76
77        window.location.reload(true);
78        //$('body').append('
vendor: 85 bytes, line 78
78<script src="https://www.google.com/recaptcha/api.js?onload=the_call_back2"></script>
78');
79    });
80
81    $('.submit-none-cookie').on('click', function (event) {
82
83        event.preventDefault();
84        $('.cookie-section').removeClass('visible');
85
86        eraseCookies();
87        savelog('no-cookies');
88        localStorage.setItem('cookiesDisAgree', 'true');
89        
90    });
91
92
93
94    html.on('click', '.submit-part-cookie', function (event) {
95        event.preventDefault();
96
97        var cookie_policy_1 = $(this).parents('.descr2').find('input[name="cookie_policy_1"]:checked').val();
98        var cookie_policy_2 = $(this).parents('.descr2').find('input[name="cookie_policy_2"]:checked').val();
99        var cookie_policy_3 = $(this).parents('.descr2').find('input[name="cookie_policy_3"]:checked').val();
100
101        console.log(cookie_policy_1);
102        console.log(cookie_policy_2);
103        console.log(cookie_policy_3);
104
105
106        eraseCookies();
107
108        localStorage.setItem('cookiesAgree', 'true');
109        createCookie('cookiesAgree', 'true', 99999);
110
111        //cookie_policy_1
112        localStorage.setItem('cookiesLevel1', 1);
113        createCookie('cookiesLevel1', 1, 99999);
114        var cs = 'cookiesLevel1';
115
116        if (typeof cookie_policy_2 != 'undefined') {
117gtag('consent', 'update', {
118            'ad_storage': 'granted',
119            'ad_user_data': 'granted',
120            'ad_personalization': 'granted',
121            'analytics_storage': 'granted',
122            'functionality_storage': 'granted',
123            'personalization_storage': 'granted',
124            'security_storage': 'granted',
125        });
126
127            localStorage.setItem('cookiesLevel2', 1);
128            createCookie('cookiesLevel2', 1, 99999);
129             cs = cs+',cookiesLevel2';
130        }
131        if (typeof cookie_policy_3 != 'undefined') {
132            localStorage.setItem('cookiesLevel3', 1);
133            createCookie('cookiesLevel3', 1, 99999);
134             cs = cs+',cookiesLevel3';
135        }
136        
137        savelog(cs);
138
139        $('.cookie-section').removeClass('visible');
140        $.fancybox.close();
141
142        window.location.reload(true);
143        //$('body').append('
vendor: 85 bytes, line 143
143<script src="https://www.google.com/recaptcha/api.js?onload=the_call_back2"></script>
143');
144    });
145
146    html.on('click', '.cookie-cancel', function(e) {
147        e.preventDefault();
148
149        $.fancybox.close();
150
151    });
152
153    html.on('click', '.cookie-table tr', function(e) {
154        if (!$(e.target).is('input') && $(this).find('input[type="checkbox"]:not(input:disabled)').length > 0) {
155
156            var ckb = $(this).find('input[type="checkbox"]');
157            if (ckb.prop('checked')) {
158                $(this).find('input[type="checkbox"]').prop('checked', false);
159            } else {
160                $(this).find('input[type="checkbox"]').prop('checked', true);
161            }
162        }
163
164
165
166    });
167
168
169    if (localStorage.getItem('cookiesAgree')) {
170
171
172    } else {
173
174        eraseCookies();
175    }
176
177    if (!localStorage.getItem('cookiesAgree') && !localStorage.getItem('cookiesDisAgree')) {
178
179
180
181        var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
182        if (!fs) {
183            $('.cookie-section').addClass('visible');
184        } else {
185            fs(window.TEMPORARY,
186                100,
187                function() {
188                    $('.cookie-section').addClass('visible');
189                },
190                function() {
191
192                }
193            );
194        }
195    }
196
197}
198
199function focus() {
200
201
202
203    $('.cookie_no a').click(function(e) {
204        e.preventDefault();
205        $('.fancy2').trigger('click');
206    });
207
208    $('.fancy2').fancybox({helpers: {media: {}, overlay: {locked: false}}});
209
210
211}
212
213function the_call_back2() {
214    $('.g-c-elem').each(function (index, el) {
215        grecaptcha.render(el, {
216            'sitekey': '6LcM61AUAAAAAPSBkGBS28l1xtADfGaLbD1RR6kY',
217            'callback': function (token) {
218                if (typeof current_form !== 'undefined') {
219                    current_form.find(".g-recaptcha-response").val(token);
220                    current_form.submit();
221                }
222            },
223            'size': 'invisible'
224        });
225    });
226}
227
228$(document).ready(function() {
229    cookiesAgree();
230    focus();
231});

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.