PageSourceSearch

https://www.concellodemesia.gal/sites/default/files/js/js_4MRGjqSerJEQxet46pdKTifSYprPwyhoaSNKNoRsFw4.js

js concellodemesia.gal collected 2026-10-02 12:48:13 UTC 20,007 bytes, 483 lines download raw bytes

1(function ($) {
2  'use strict';
3
4  Drupal.behaviors.eu_cookie_compliance_popup = {
5    attach: function (context, settings) {
6      $('body', context).once('eu-cookie-compliance', function () {
7        // If configured, check JSON callback to determine if in EU.
8        if (Drupal.settings.eu_cookie_compliance.popup_eu_only_js) {
9          if (Drupal.eu_cookie_compliance.showBanner()) {
10            var url = Drupal.settings.basePath + Drupal.settings.pathPrefix + 'eu-cookie-compliance-check';
11            var data = {};
12            $.getJSON(url, data, function (data) {
13              // If in the EU, show the compliance banner.
14              if (data.in_eu) {
15                Drupal.eu_cookie_compliance.execute();
16              }
17
18              // If not in EU, set an agreed cookie automatically.
19              else {
20                Drupal.eu_cookie_compliance.setStatus(2);
21              }
22            });
23          }
24        }
25
26        // Otherwise, fallback to standard behavior which is to render the banner.
27        else {
28          Drupal.eu_cookie_compliance.execute();
29        }
30      });
31    }
32  };
33
34  Drupal.eu_cookie_compliance = {};
35
36  Drupal.eu_cookie_compliance.execute = function () {
37    try {
38      if (!Drupal.settings.eu_cookie_compliance.popup_enabled) {
39        return;
40      }
41
42      if (!Drupal.eu_cookie_compliance.cookiesEnabled()) {
43        return;
44      }
45
46      Drupal.eu_cookie_compliance.updateCheck();
47      var status = Drupal.eu_cookie_compliance.getCurrentStatus();
48      if ((status === 0 && Drupal.settings.eu_cookie_compliance.method === 'default') || status === null) {
49        if (!Drupal.settings.eu_cookie_compliance.disagree_do_not_show_popup || status === null) {
50          // Detect mobile here and use mobile_popup_html_info, if we have a mobile device.
51          if (window.matchMedia('(max-width: ' + Drupal.settings.eu_cookie_compliance.mobile_breakpoint + 'px)').matches && Drupal.settings.eu_cookie_compliance.use_mobile_message) {
52            Drupal.eu_cookie_compliance.createPopup(Drupal.settings.eu_cookie_compliance.mobile_popup_html_info);
53          } else {
54            Drupal.eu_cookie_compliance.createPopup(Drupal.settings.eu_cookie_compliance.popup_html_info);
55          }
56
57          Drupal.eu_cookie_compliance.attachAgreeEvents();
58        }
59      } else if (status === 1 && Drupal.settings.eu_cookie_compliance.popup_agreed_enabled) {
60        Drupal.eu_cookie_compliance.createPopup(Drupal.settings.eu_cookie_compliance.popup_html_agreed);
61        Drupal.eu_cookie_compliance.attachHideEvents();
62      } else if (status === 2 && Drupal.settings.eu_cookie_compliance.withdraw_enabled) {
63        Drupal.eu_cookie_compliance.createWithdrawBanner(Drupal.settings.eu_cookie_compliance.withdraw_markup);
64        Drupal.eu_cookie_compliance.attachWithdrawEvents();
65      }
66    }
67    catch (e) {
68    }
69  };
70
71  Drupal.eu_cookie_compliance.createWithdrawBanner = function (html) {
72    var $html = $('<div></div>').html(html);
73    var $banner = $('.eu-cookie-withdraw-banner', $html);
74    $html.attr('id', 'sliding-popup');
75    $html.addClass('eu-cookie-withdraw-wrapper');
76
77    if (!Drupal.settings.eu_cookie_compliance.popup_use_bare_css) {
78      $banner.height(Drupal.settings.eu_cookie_compliance.popup_height)
79          .width(Drupal.settings.eu_cookie_compliance.popup_width);
80    }
81    $html.hide();
82    var height = 0;
83    if (Drupal.settings.eu_cookie_compliance.popup_position) {
84      $html.prependTo('body');
85      height = $html.outerHeight();
86
87      $html.show()
88          .addClass('sliding-popup-top')
89          .addClass('clearfix')
90          .css({ top: -1 * height });
91      // For some reason, the tab outerHeight is -10 if we don't use a timeout
92      // function to reveal the tab.
93      setTimeout(function () {
94        $html.animate({ top: -1 * height }, Drupal.settings.eu_cookie_compliance.popup_delay, null, function () {
95          $html.trigger('eu_cookie_compliance_popup_open');
96        });
97      }.bind($html, height), 0);
98    } else {
99      if (Drupal.settings.eu_cookie_compliance.better_support_for_screen_readers) {
100        $html.prependTo('body');
101      } else {
102        $html.appendTo('body');
103      }
104      height = $html.outerHeight();
105      $html.show()
106          .addClass('sliding-popup-bottom')
107          .css({ bottom: -1 * height });
108      // For some reason, the tab outerHeight is -10 if we don't use a timeout
109      // function to reveal the tab.
110      setTimeout(function () {
111        $html.animate({ bottom: -1 * height }, Drupal.settings.eu_cookie_compliance.popup_delay, null, function () {
112          $html.trigger('eu_cookie_compliance_popup_open');
113        });
114      }.bind($html, height), 0);
115    }
116  };
117
118  Drupal.eu_cookie_compliance.toggleWithdrawBanner = function () {
119    var $wrapper = $('#sliding-popup');
120    var $tab = $('.eu-cookie-withdraw-tab');
121    var $bannerIsShowing = Drupal.settings.eu_cookie_compliance.popup_position ? parseInt($wrapper.css('top')) === 0 : parseInt($wrapper.css('bottom')) === 0;
122    var topBottom = (Drupal.settings.eu_cookie_compliance.popup_position ? 'top' : 'bottom');
123    var height = $wrapper.outerHeight();
124    if (Drupal.settings.eu_cookie_compliance.popup_position) {
125      if ($bannerIsShowing) {
126        $wrapper.animate({'top' : -1 * height}, Drupal.settings.eu_cookie_compliance.popup_delay);
127      }
128      else {
129        $wrapper.animate({'top' : 0}, Drupal.settings.eu_cookie_compliance.popup_delay);
130      }
131    }
132    else {
133      if ($bannerIsShowing) {
134        $wrapper.animate({'bottom' : -1 * height}, Drupal.settings.eu_cookie_compliance.popup_delay);
135      }
136      else {
137        $wrapper.animate({'bottom' : 0}, Drupal.settings.eu_cookie_compliance.popup_delay);
138      }
139    }
140  };
141
142  Drupal.eu_cookie_compliance.createPopup = function (html) {
143    // This fixes a problem with jQuery 1.9.
144    var $popup = $('<div></div>').html(html);
145    $popup.attr('id', 'sliding-popup');
146    if (!Drupal.settings.eu_cookie_compliance.popup_use_bare_css) {
147      $popup.height(Drupal.settings.eu_cookie_compliance.popup_height)
148          .width(Drupal.settings.eu_cookie_compliance.popup_width);
149    }
150
151    $popup.hide();
152    var height = 0;
153    if (Drupal.settings.eu_cookie_compliance.popup_position) {
154      $popup.prependTo('body');
155      height = $popup.outerHeight();
156      $popup.show()
157        .attr({ class: 'sliding-popup-top clearfix' })
158        .css({ top: -1 * height })
159        .animate({ top: 0 }, Drupal.settings.eu_cookie_compliance.popup_delay, null, function () {
160          $popup.trigger('eu_cookie_compliance_popup_open');
161        });
162    } else {
163      if (Drupal.settings.eu_cookie_compliance.better_support_for_screen_readers) {
164        $popup.prependTo('body');
165      } else {
166        $popup.appendTo('body');
167      }
168
169      height = $popup.outerHeight();
170      $popup.show()
171        .attr({ class: 'sliding-popup-bottom' })
172        .css({ bottom: -1 * height })
173        .animate({ bottom: 0 }, Drupal.settings.eu_cookie_compliance.popup_delay, null, function () {
174          $popup.trigger('eu_cookie_compliance_popup_open');
175        });
176    }
177  };
178
179  Drupal.eu_cookie_compliance.attachAgreeEvents = function () {
180    var clickingConfirms = Drupal.settings.eu_cookie_compliance.popup_clicking_confirmation;
181    var scrollConfirms = Drupal.settings.eu_cookie_compliance.popup_scrolling_confirmation;
182
183    $('.agree-button').click(Drupal.eu_cookie_compliance.acceptAction);
184    $('.decline-button').click(Drupal.eu_cookie_compliance.declineAction);
185
186    if (clickingConfirms) {
187      $('a, input[type=submit], button[type=submit]').bind('click.euCookieCompliance', Drupal.eu_cookie_compliance.acceptAction);
188    }
189
190    if (scrollConfirms) {
191      var alreadyScrolled = false;
192      var scrollHandler = function () {
193        if (alreadyScrolled) {
194          Drupal.eu_cookie_compliance.acceptAction();
195          $(window).off('scroll', scrollHandler);
196        } else {
197          alreadyScrolled = true;
198        }
199      };
200
201      $(window).bind('scroll', scrollHandler);
202    }
203
204    $('.find-more-button').not('.find-more-button-processed').addClass('find-more-button-processed').click(Drupal.eu_cookie_compliance.moreInfoAction);
205  };
206
207  Drupal.eu_cookie_compliance.attachHideEvents = function () {
208    var popupHideAgreed = Drupal.settings.eu_cookie_compliance.popup_hide_agreed;
209    var clickingConfirms = Drupal.settings.eu_cookie_compliance.popup_clicking_confirmation;
210    $('.hide-popup-button').click(function () {
211      Drupal.eu_cookie_compliance.changeStatus(2);
212    }
213    );
214    if (clickingConfirms) {
215      $('a, input[type=submit], button[type=submit]').unbind('click.euCookieCompliance');
216    }
217
218    if (popupHideAgreed) {
219      $('a, input[type=submit], button[type=submit]').bind('click.euCookieComplianceHideAgreed', function () {
220        Drupal.eu_cookie_compliance.changeStatus(2);
221      });
222    }
223
224    $('.find-more-button').not('.find-more-button-processed').addClass('find-more-button-processed').click(Drupal.eu_cookie_compliance.moreInfoAction);
225  };
226
227  Drupal.eu_cookie_compliance.attachWithdrawEvents = function () {
228    $('.eu-cookie-withdraw-button').click(Drupal.eu_cookie_compliance.withdrawAction);
229    $('.eu-cookie-withdraw-tab').click(Drupal.eu_cookie_compliance.toggleWithdrawBanner);
230  };
231
232  Drupal.eu_cookie_compliance.acceptAction = function () {
233    var agreedEnabled = Drupal.settings.eu_cookie_compliance.popup_agreed_enabled;
234    var nextStatus = 1;
235    if (!agreedEnabled) {
236      Drupal.eu_cookie_compliance.setStatus(1);
237      nextStatus = 2;
238    }
239
240    if (!euCookieComplianceHasLoadedScripts) {
241      euCookieComplianceLoadScripts();
242    }
243
244    if (typeof euCookieComplianceBlockCookies !== 'undefined') {
245      clearInterval(euCookieComplianceBlockCookies);
246    }
247
248    Drupal.eu_cookie_compliance.changeStatus(nextStatus);
249  };
250
251  Drupal.eu_cookie_compliance.declineAction = function () {
252    Drupal.eu_cookie_compliance.setStatus(0);
253    let popup = $('#sliding-popup');
254    if (popup.hasClass('sliding-popup-top')) {
255      popup.animate({ top: popup.outerHeight() * -1 }).trigger('eu_cookie_compliance_popup_close');
256    }
257    else {
258      popup.animate({ bottom: popup.outerHeight() * -1 }).trigger('eu_cookie_compliance_popup_close');
259    }
260  };
261
262  Drupal.eu_cookie_compliance.withdrawAction = function () {
263    Drupal.eu_cookie_compliance.setStatus(null);
264    location.reload();
265  };
266
267  Drupal.eu_cookie_compliance.moreInfoAction = function () {
268    if (Drupal.settings.eu_cookie_compliance.disagree_do_not_show_popup) {
269      Drupal.eu_cookie_compliance.setStatus(0);
270      $('#sliding-popup').trigger('eu_cookie_compliance_popup_close').remove();
271    } else {
272      if (Drupal.settings.eu_cookie_compliance.popup_link_new_window) {
273        window.open(Drupal.settings.eu_cookie_compliance.popup_link);
274      } else {
275        window.location.href = Drupal.settings.eu_cookie_compliance.popup_link;
276      }
277    }
278  };
279
280  Drupal.eu_cookie_compliance.getCurrentStatus = function () {
281    var cookieName = (typeof eu_cookie_compliance_cookie_name === 'undefined' || eu_cookie_compliance_cookie_name === '') ? 'cookie-agreed' : eu_cookie_compliance_cookie_name;
282    var value = $.cookie(cookieName);
283    value = parseInt(value);
284    if (isNaN(value)) {
285      value = null;
286    }
287
288    return value;
289  };
290
291  Drupal.eu_cookie_compliance.changeStatus = function (value) {
292    var status = Drupal.eu_cookie_compliance.getCurrentStatus();
293    var reloadPage = Drupal.settings.eu_cookie_compliance.reload_page;
294    if (status === value) {
295      return;
296    }
297
298    if (Drupal.settings.eu_cookie_compliance.popup_position) {
299      $('.sliding-popup-top').animate({ top: $('#sliding-popup').outerHeight() * -1 }, Drupal.settings.eu_cookie_compliance.popup_delay, function () {
300        if (status === null && !reloadPage) {
301          $('#sliding-popup').html(Drupal.settings.eu_cookie_compliance.popup_html_agreed).animate({ top: 0 }, Drupal.settings.eu_cookie_compliance.popup_delay);
302          Drupal.eu_cookie_compliance.attachHideEvents();
303        } else if (status === 1) {
304          $('#sliding-popup').trigger('eu_cookie_compliance_popup_close').remove();
305        }
306      });
307    } else {
308      $('.sliding-popup-bottom').animate({ bottom: $('#sliding-popup').outerHeight() * -1 }, Drupal.settings.eu_cookie_compliance.popup_delay, function () {
309        if (status === null && !reloadPage) {
310          $('#sliding-popup').html(Drupal.settings.eu_cookie_compliance.popup_html_agreed).animate({ bottom: 0 }, Drupal.settings.eu_cookie_compliance.popup_delay);
311          Drupal.eu_cookie_compliance.attachHideEvents();
312        } else if (status === 1) {
313          $('#sliding-popup').trigger('eu_cookie_compliance_popup_close').remove();
314        }
315      });
316    }
317
318    if (reloadPage) {
319      location.reload();
320    }
321
322    if (value === 2 && Drupal.settings.eu_cookie_compliance.withdraw_enabled) {
323      Drupal.eu_cookie_compliance.createWithdrawBanner(Drupal.settings.eu_cookie_compliance.withdraw_markup);
324      Drupal.eu_cookie_compliance.attachWithdrawEvents();
325    }
326
327    Drupal.eu_cookie_compliance.setStatus(value);
328  };
329
330  Drupal.eu_cookie_compliance.setStatus = function (status) {
331    var date = new Date();
332    var domain = Drupal.settings.eu_cookie_compliance.domain ? Drupal.settings.eu_cookie_compliance.domain : '';
333    var path = Drupal.settings.basePath;
334    var cookieName = (typeof eu_cookie_compliance_cookie_name === 'undefined' || eu_cookie_compliance_cookie_name === '') ? 'cookie-agreed' : eu_cookie_compliance_cookie_name;
335    if (path.length > 1) {
336      var pathEnd = path.length - 1;
337      if (path.lastIndexOf('/') === pathEnd) {
338        path = path.substring(0, pathEnd);
339      }
340    }
341
342
343    var cookieSession = parseInt(Drupal.settings.eu_cookie_compliance.cookie_session);
344    if (cookieSession) {
345      $.cookie(cookieName, status, { path: path, domain: domain });
346    } else {
347      var lifetime = parseInt(Drupal.settings.eu_cookie_compliance.cookie_lifetime);
348      date.setDate(date.getDate() + lifetime);
349      $.cookie(cookieName, status, { expires: date, path: path, domain: domain });
350    }
351    $(document).trigger('eu_cookie_compliance.changeStatus', [status]);
352
353    // Store consent if applicable.
354    if (Drupal.settings.eu_cookie_compliance.store_consent && ((status === 1 && Drupal.settings.eu_cookie_compliance.popup_agreed_enabled) || (status === 2  && !Drupal.settings.eu_cookie_compliance.popup_agreed_enabled))) {
355      var url = Drupal.settings.basePath + Drupal.settings.pathPrefix + 'eu-cookie-compliance/store_consent/banner';
356      $.post(url, {}, function (data) { });
357    }
358  };
359
360  Drupal.eu_cookie_compliance.hasAgreed = function () {
361    var status = Drupal.eu_cookie_compliance.getCurrentStatus();
362    return (status === 1 || status === 2);
363  };
364
365  Drupal.eu_cookie_compliance.showBanner = function () {
366    var showBanner = false;
367    var status = Drupal.eu_cookie_compliance.getCurrentStatus();
368    if ((status === 0 && Drupal.settings.eu_cookie_compliance.method === 'default') || status === null) {
369      if (!Drupal.settings.eu_cookie_compliance.disagree_do_not_show_popup || status === null) {
370        showBanner = true;
371      }
372    } else if (status === 1 && Drupal.settings.eu_cookie_compliance.popup_agreed_enabled) {
373      showBanner = true;
374    }
375
376    return showBanner;
377  };
378
379  Drupal.eu_cookie_compliance.cookiesEnabled = function () {
380    var cookieEnabled = navigator.cookieEnabled;
381    if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) {
382      document.cookie = 'testCookie';
383      cookieEnabled = (document.cookie.indexOf('testCookie') !== -1);
384    }
385
386    return cookieEnabled;
387  };
388
389  // This code upgrades the cookie agreed status when upgrading for an old version.
390  Drupal.eu_cookie_compliance.updateCheck = function () {
391    var legacyCookie = 'cookie-agreed-' + Drupal.settings.eu_cookie_compliance.popup_language;
392    var domain = Drupal.settings.eu_cookie_compliance.domain ? Drupal.settings.eu_cookie_compliance.domain : '';
393    var path = Drupal.settings.basePath;
394    var cookie = $.cookie(legacyCookie);
395    var date = new Date();
396    var cookieName = (typeof eu_cookie_compliance_cookie_name === 'undefined' || eu_cookie_compliance_cookie_name === '') ? 'cookie-agreed' : eu_cookie_compliance_cookie_name;
397
398    // jQuery.cookie 1.0 (bundled with Drupal) returns null,
399    // jQuery.cookie 1.4.1 (bundled with some themes) returns undefined.
400    // We had a 1.4.1 related bug where the value was set to 'null' (string).
401    if (cookie !== undefined && cookie !== null && cookie !== 'null') {
402      date.setDate(date.getDate() + parseInt(Drupal.settings.eu_cookie_compliance.cookie_lifetime));
403      $.cookie(cookieName, cookie, { expires: date, path:  path, domain: domain });
404
405      // Use removeCookie if the function exists.
406      if (typeof $.removeCookie !== 'undefined') {
407        $.removeCookie(legacyCookie);
408      } else {
409        $.cookie(legacyCookie, null, { path: path, domain: domain });
410      }
411    }
412  };
413
414  // Load blocked scripts if the user has agreed to being tracked.
415  var euCookieComplianceHasLoadedScripts = false;
416  $(function () {
417    if (Drupal.eu_cookie_compliance.hasAgreed()
418        || (Drupal.eu_cookie_compliance.getCurrentStatus() === null && Drupal.settings.eu_cookie_compliance.method !== 'opt_in')
419    ) {
420      euCookieComplianceLoadScripts();
421      euCookieComplianceHasLoadedScripts = true;
422    }
423  });
424
425  // Block cookies when the user hasn't agreed.
426  Drupal.behaviors.eu_cookie_compliance_popup_block_cookies = {
427    attach: function (context, settings) {
428      $(document).ready(function() {
429        if ((settings.eu_cookie_compliance.method === 'opt_in' && (Drupal.eu_cookie_compliance.getCurrentStatus() === null || !Drupal.eu_cookie_compliance.hasAgreed()))
430          || (settings.eu_cookie_compliance.method === 'opt_out' && !Drupal.eu_cookie_compliance.hasAgreed() && Drupal.eu_cookie_compliance.getCurrentStatus() !== null)
431        ) {
432          // Split the white-listed cookies.
433          var euCookieComplianceWhitelist = settings.eu_cookie_compliance.whitelisted_cookies.split(/\r\n|\n|\r/g);
434
435          // Add the EU Cookie Compliance cookie.
436          euCookieComplianceWhitelist.push((settings.eu_cookie_compliance.cookie_name === '') ? 'cookie-agreed' : settings.eu_cookie_compliance.cookie_name);
437          var euCookieComplianceBlockCookies = setInterval(function () {
438            // Load all cookies from jQuery.
439            var cookies = $.cookie();
440
441            // Check each cookie and try to remove it if it's not white-listed.
442            for (var i in cookies) {
443              var remove = true;
444              var hostname = window.location.hostname;
445              var cookieRemoved = false;
446              var index = 0;
447
448              // Skip the PHP session cookie.
449              if (i.indexOf('SESS') === 0 || i.indexOf('SSESS') === 0) {
450                remove = false;
451              }
452
453              // Check if the cookie is white-listed.
454              for (var item in euCookieComplianceWhitelist) {
455                if (i === euCookieComplianceWhitelist[item]) {
456                  remove = false;
457                }
458              }
459
460              // Remove the cookie if it's not white-listed.
461              if (remove) {
462                while (!cookieRemoved && hostname !== '') {
463                  // Attempt to remove.
464                  cookieRemoved = $.removeCookie(i, { domain: '.' + hostname, path: '/' });
465                  if (!cookieRemoved) {
466                    cookieRemoved = $.removeCookie(i, { domain: hostname, path: '/' });
467                  }
468
469                  index = hostname.indexOf('.');
470
471                  // We can be on a sub-domain, so keep checking the main domain as well.
472                  hostname = (index === -1) ? '' : hostname.substring(index + 1);
473                }
474              }
475            }
476          }, 5000);
477        }
478      });
479    }
480  }
481
482})(jQuery);
483;

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.