PageSourceSearch

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

js helso.lt collected 2026-10-04 11:32:44 UTC 7,501 bytes, 276 lines download raw bytes

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

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.