1(function (window, document) { 2 'use strict'; 3 4 var config = window.SwiftyConsentConfig || {}; 5 var bootstrap = window.SwiftyConsentBootstrap || {}; 6 var optionalCategories = ['functional', 'analytics', 'media', 'advertising']; 7 var gpcEnabled = bootstrap.gpc === true; 8 var hasSavedChoice = bootstrap.hasSavedChoice === true; 9 var state = normalizeChoices(bootstrap.choices || {}); 10 var loadedCategories = {}; 11 var servicePromises = {}; 12 var deferredScriptPromises = {}; 13 var lastFocusedElement = null; 14 var resourceQueue = Promise.resolve(); 15 var resourceLoadTimeout = 15000; 16 17 function normalizeChoices(choices) { 18 var normalized = { necessary: true }; 19 20 optionalCategories.forEach(function (category) { 21 normalized[category] = choices[category] === true; 22 }); 23 24 if (gpcEnabled) { 25 normalized.advertising = false; 26 } 27 28 return normalized; 29 } 30 31 function copyChoices(choices) { 32 return normalizeChoices(choices || {}); 33 } 34 35 function generateReceiptId() { 36 if (window.crypto && typeof window.crypto.randomUUID === 'function') { 37 return window.crypto.randomUUID(); 38 } 39 40 var values = new Uint8Array(16); 41 if (window.crypto && typeof window.crypto.getRandomValues === 'function') { 42 window.crypto.getRandomValues(values); 43 } else { 44 for (var index = 0; index < values.length; index += 1) { 45 values[index] = Math.floor(Math.random() * 256); 46 } 47 } 48 49 values[6] = (values[6] & 15) | 64; 50 values[8] = (values[8] & 63) | 128; 51 52 return Array.prototype.map.call(values, function (value) { 53 return value.toString(16).padStart(2, '0'); 54 }).join('').replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '$1-$2-$3-$4-$5'); 55 } 56 57 function writePreferenceCookie(payload) { 58 var maxAge = Math.max(1, Number(config.cookieLifetimeDays) || 180) * 86400; 59 var cookie = String(config.cookieName) + '=' + encodeURIComponent(JSON.stringify(payload)); 60 61 cookie += '; Max-Age=' + maxAge + '; Path=/; SameSite=Lax'; 62 if (window.location.protocol === 'https:') { 63 cookie += '; Secure'; 64 } 65 66 document.cookie = cookie; 67 } 68 69 function postReceipt(payload) { 70 if (!config.receiptLogging || !config.receiptEndpoint || typeof window.fetch !== 'function') { 71 return; 72 } 73 74 var receipt = {}; 75 Object.keys(payload).forEach(function (key) { 76 receipt[key] = payload[key]; 77 }); 78 receipt.token = config.receiptToken || ''; 79 80 window.fetch(config.receiptEndpoint, { 81 method: 'POST', 82 credentials: 'same-origin', 83 keepalive: true, 84 headers: { 'Content-Type': 'application/json' }, 85 body: JSON.stringify(receipt) 86 }).catch(function () { 87 // Receipt logging must never prevent the visitor's choice from taking effect. 88 }); 89 } 90 91 function updateGoogleConsent(choices) { 92 if (config.googleConsentMode === 'off' || typeof window.gtag !== 'function') { 93 return; 94 } 95 96 window.gtag('consent', 'update', { 97 ad_storage: choices.advertising ? 'granted' : 'denied', 98 ad_user_data: choices.advertising ? 'granted' : 'denied', 99 ad_personalization: choices.advertising ? 'granted' : 'denied', 100 analytics_storage: choices.analytics ? 'granted' : 'denied', 101 functionality_storage: choices.functional ? 'granted' : 'denied', 102 personalization_storage: choices.functional ? 'granted' : 'denied', 103 security_storage: 'granted' 104 }); 105 } 106 107 function dispatchConsentEvent(name, detail) { 108 var event; 109 110 if (typeof window.CustomEvent === 'function') { 111 event = new CustomEvent(name, { detail: detail }); 112 } else { 113 event = document.createEvent('CustomEvent'); 114 event.initCustomEvent(name, false, false, detail); 115 } 116 117 document.dispatchEvent(event); 118 } 119 120 function hasConsent(category) { 121 return category === 'necessary' || state[category] === true; 122 } 123 124 function decodeBase64Utf8(value) { 125 var binary = window.atob(value); 126 var bytes = new Uint8Array(binary.length); 127 128 for (var index = 0; index < binary.length; index += 1) {
129 bytes[index] = binary.charCodeAt(index); 130 } 131 132 if (typeof window.TextDecoder === 'function') { 133 return new TextDecoder('utf-8').decode(bytes); 134 } 135 136 var encoded = Array.prototype.map.call(bytes, function (byte) { 137 return '%' + byte.toString(16).padStart(2, '0'); 138 }).join(''); 139 140 return decodeURIComponent(encoded); 141 } 142 143 function executeScript(definition) { 144 return new Promise(function (resolve) { 145 var script = document.createElement('script'); 146 var source = ''; 147 var timeout = null; 148 var settled = false; 149 150 function finish() { 151 if (settled) { 152 return; 153 } 154 settled = true; 155 if (timeout) { 156 window.clearTimeout(timeout); 157 } 158 resolve(); 159 } 160 161 definition.attributes.forEach(function (attribute) { 162 if (attribute.name === 'src') { 163 source = attribute.value; 164 } 165 script.setAttribute(attribute.name, attribute.value); 166 }); 167 168 if (definition.text) { 169 script.text = definition.text; 170 } 171 172 if (source) { 173 script.addEventListener('load', finish, { once: true }); 174 script.addEventListener('error', finish, { once: true }); 175 timeout = window.setTimeout(finish, resourceLoadTimeout); 176 } 177 178 if (definition.placeholder.parentNode) { 179 definition.placeholder.parentNode.insertBefore(script, definition.placeholder); 180 definition.placeholder.remove(); 181 } else { 182 finish(); 183 return; 184 } 185 186 if (!source) { 187 finish(); 188 } 189 }); 190 } 191 192 function activateResourceMarker(marker) { 193 if (!marker || marker.getAttribute('data-swifty-consent-state')) { 194 return Promise.resolve(); 195 } 196 197 marker.setAttribute('data-swifty-consent-state', 'activating'); 198 199 try { 200 var payload = JSON.parse(marker.textContent || '{}'); 201 var content = payload.content || payload.markup || ''; 202 var markup = payload.encoding === 'base64' ? decodeBase64Utf8(content) : String(content); 203 var template = document.createElement('template'); 204 var scripts = []; 205 206 template.innerHTML = markup; 207 Array.prototype.slice.call(template.content.querySelectorAll('script')).forEach(function (sourceScript) { 208 var placeholder = document.createComment('swifty-consent-script'); 209 var attributes = Array.prototype.map.call(sourceScript.attributes, function (attribute) { 210 return { name: attribute.name, value: attribute.value }; 211 }); 212 213 scripts.push({ 214 attributes: attributes, 215 text: sourceScript.textContent || '', 216 placeholder: placeholder 217 }); 218 sourceScript.parentNode.replaceChild(placeholder, sourceScript); 219 }); 220 221 marker.parentNode.insertBefore(template.content, marker); 222 marker.remove(); 223 224 return scripts.reduce(function (promise, definition) { 225 return promise.then(function () { 226 return executeScript(definition); 227 }); 228 }, Promise.resolve()); 229 } catch (error) { 230 marker.setAttribute('data-swifty-consent-state', 'error'); 231 if (window.console && typeof window.console.error === 'function') { 232 window.console.error('Swifty Cookie Consent could not activate a configured resource.', error); 233 } 234 return Promise.resolve(); 235 } 236 } 237 238 function activateDeferredElement(element) { 239 var source = element.getAttribute('data-swifty-consent-src'); 240 var category = element.getAttribute('data-swifty-consent-category') || 'media'; 241 242 if (!source || !hasConsent(category) || element.getAttribute('data-swifty-consent-loaded') === 'true') { 243 return Promise.resolve(); 244 } 245 246 loadedCategories[category] = true; 247 element.setAttribute('data-swifty-consent-loaded', 'true'); 248 249 if (element.tagName.toLowerCase() === 'script') { 250 if (deferredScriptPromises[source]) { 251 element.remove(); 252 return deferredScriptPromises[source]; 253 } 254 255 deferredScriptPromises[source] = new Promise(function (resolve) { 256 var replacement = document.createElement('script'); 257 var timeout = null; 258 var settled = false;
259 260 function finish() { 261 if (settled) { 262 return; 263 } 264 settled = true; 265 if (timeout) { 266 window.clearTimeout(timeout); 267 } 268 resolve(); 269 } 270 271 Array.prototype.forEach.call(element.attributes, function (attribute) { 272 if (attribute.name !== 'data-swifty-consent-src' && attribute.name !== 'data-swifty-consent-category' && attribute.name !== 'data-swifty-consent-loaded' && attribute.name !== 'data-swifty-cache-placeholder' && attribute.name !== 'data-swifty-cache-resolver' && attribute.name !== 'type') { 273 replacement.setAttribute(attribute.name, attribute.value); 274 } 275 }); 276 replacement.src = source; 277 replacement.text = element.textContent || ''; 278 replacement.addEventListener('load', finish, { once: true }); 279 replacement.addEventListener('error', finish, { once: true }); 280 timeout = window.setTimeout(finish, resourceLoadTimeout); 281 element.parentNode.replaceChild(replacement, element); 282 }); 283 284 return deferredScriptPromises[source]; 285 } 286 287 element.src = source; 288 element.removeAttribute('data-swifty-cache-placeholder'); 289 element.removeAttribute('data-swifty-cache-resolver'); 290 element.classList.remove('swifty-consent-blocked-frame'); 291 var placeholder = document.querySelector('[data-swifty-consent-placeholder-for="' + element.getAttribute('data-swifty-consent-id') + '"]'); 292 if (placeholder) { 293 placeholder.remove(); 294 } 295 296 return Promise.resolve(); 297 } 298 299 function addBlockedFramePlaceholder(frame, index, category) { 300 if (!frame || frame.getAttribute('data-swifty-consent-placeholder') === 'true') { 301 return; 302 } 303 304 var identifier = frame.getAttribute('data-swifty-consent-id') || ('media-' + index + '-' + Math.random().toString(36).slice(2)); 305 var placeholder = document.createElement('div'); 306 var button = document.createElement('button'); 307 308 frame.setAttribute('data-swifty-consent-id', identifier); 309 frame.setAttribute('data-swifty-consent-placeholder', 'true'); 310 placeholder.className = 'swifty-consent-media-placeholder'; 311 placeholder.setAttribute('data-swifty-consent-placeholder-for', identifier); 312 placeholder.setAttribute('role', 'group'); 313 placeholder.setAttribute('aria-label', category === 'media' ? 'External media is blocked' : 'Optional website feature is blocked'); 314 placeholder.innerHTML = category === 'media' 315 ? '<strong>External media is blocked</strong><p>Allow External Media to load this content.</p>' 316 : '<strong>This optional feature is blocked</strong><p>Allow Functional technologies to use this feature.</p>'; 317 button.type = 'button'; 318 button.setAttribute('data-swifty-consent-action', category === 'media' ? 'allow_media' : 'manage'); 319 button.textContent = category === 'media' ? 'Load external media' : 'Manage preferences'; 320 placeholder.appendChild(button); 321 frame.parentNode.insertBefore(placeholder, frame); 322 } 323 324 function activateAllowedResources() { 325 resourceQueue = resourceQueue.then(function () { 326 var resources = Array.prototype.slice.call(document.querySelectorAll('.swifty-consent-resource[data-swifty-consent-category], [data-swifty-consent-src][data-swifty-consent-category]')); 327 328 return resources.reduce(function (promise, resource) { 329 var category = resource.getAttribute('data-swifty-consent-category'); 330 if (!hasConsent(category)) { 331 return promise; 332 } 333 334 loadedCategories[category] = true; 335 return promise.then(function () { 336 if (resource.classList.contains('swifty-consent-resource')) { 337 return activateResourceMarker(resource); 338 } 339 340 return activateDeferredElement(resource); 341 }); 342 }, Promise.resolve()); 343 }); 344 345 return resourceQueue; 346 } 347 348 function renderBlockedFramePlaceholders() { 349 Array.prototype.forEach.call(document.querySelectorAll('iframe[data-swifty-consent-src][data-swifty-consent-category]'), function (frame, index) { 350 var category = frame.getAttribute('data-swifty-consent-category') || 'media'; 351 if (hasConsent(category) || (category === 'media' && config.blockExternalMedia === false)) { 352 return; 353 } 354 addBlockedFramePlaceholder(frame, index, category); 355 }); 356 } 357 358 function getCookieDomains() { 359 var host = window.location.hostname; 360 var parts = host.split('.'); 361 var domains = ['', host, '.' + host]; 362 363 if (parts.length > 2) { 364 domains.push('.' + parts.slice(-2).join('.')); 365 } 366 367 return domains.filter(function (domain, index, values) { 368 return values.indexOf(domain) === index; 369 }); 370 } 371 372 function clearOptionalCookies(categories) { 373 var exactNames = []; 374 var prefixes = []; 375 376 if (categories.indexOf('functional') !== -1) { 377 exactNames.push('googtrans'); 378 } 379 380 if (categories.indexOf('analytics') !== -1) { 381 exactNames = exactNames.concat(['_ga', '_gid', '_gat']); 382 prefixes = prefixes.concat(['_ga_', '_gat_', '_pk_id', '_pk_ses', '_hj', 'AMP_TOKEN']); 383 } 384 385 if (categories.indexOf('advertising') !== -1) { 386 exactNames = exactNames.concat(['_gcl_au', '_fbp', '_fbc', 'IDE', 'ANONCHK', 'MUID']); 387 prefixes = prefixes.concat(['_gcl_']); 388 } 389 390 if (categories.indexOf('media') !== -1) { 391 try { 392 Object.keys(window.localStorage).forEach(function (key) { 393 if (key.indexOf('instagramFeed_') === 0) { 394 window.localStorage.removeItem(key); 395 } 396 }); 397 } catch (error) {
398 // Storage can be unavailable in privacy-restricted browsing modes. 399 } 400 } 401 402 if (!exactNames.length && !prefixes.length) { 403 return; 404 } 405 406 var currentNames = document.cookie.split(';').map(function (cookie) { 407 return cookie.split('=')[0].trim(); 408 }); 409 var names = exactNames.concat(currentNames.filter(function (name) { 410 return prefixes.some(function (prefix) { 411 return name.indexOf(prefix) === 0; 412 }); 413 })); 414 415 if (categories.indexOf('analytics') !== -1 && window._paq && typeof window._paq.push === 'function') { 416 window._paq.push(['forgetConsentGiven']); 417 window._paq.push(['disableCookies']); 418 } 419 420 getCookieDomains().forEach(function (domain) { 421 names.forEach(function (name) { 422 var removal = name + '=; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/; SameSite=Lax'; 423 if (domain) { 424 removal += '; Domain=' + domain; 425 } 426 if (window.location.protocol === 'https:') { 427 removal += '; Secure'; 428 } 429 document.cookie = removal; 430 }); 431 }); 432 } 433 434 function closePreferences() { 435 var modal = document.getElementById('swifty-consent-modal'); 436 if (!modal) { 437 return; 438 } 439 440 modal.hidden = true; 441 document.body.classList.remove('swifty-consent-modal-open'); 442 document.removeEventListener('keydown', trapModalFocus); 443 444 if (lastFocusedElement && typeof lastFocusedElement.focus === 'function') { 445 lastFocusedElement.focus(); 446 } 447 } 448 449 function syncPreferenceInputs() { 450 Array.prototype.forEach.call(document.querySelectorAll('[data-swifty-consent-category]'), function (input) { 451 if (input.tagName.toLowerCase() !== 'input') { 452 return; 453 } 454 455 var category = input.getAttribute('data-swifty-consent-category'); 456 input.checked = hasConsent(category); 457 input.disabled = category === 'necessary' || (category === 'advertising' && gpcEnabled); 458 }); 459 460 Array.prototype.forEach.call(document.querySelectorAll('[data-swifty-gpc-notice]'), function (notice) { 461 notice.hidden = !gpcEnabled; 462 }); 463 } 464 465 function openPreferences() { 466 var modal = document.getElementById('swifty-consent-modal'); 467 if (!modal) { 468 return; 469 } 470 471 lastFocusedElement = document.activeElement; 472 syncPreferenceInputs(); 473 modal.hidden = false; 474 document.body.classList.add('swifty-consent-modal-open'); 475 document.addEventListener('keydown', trapModalFocus); 476 477 var dialog = modal.querySelector('[role="dialog"]'); 478 if (dialog) { 479 dialog.focus(); 480 } 481 } 482 483 function trapModalFocus(event) { 484 var modal = document.getElementById('swifty-consent-modal'); 485 if (!modal || modal.hidden) { 486 return; 487 } 488 489 if (event.key === 'Escape') { 490 event.preventDefault(); 491 closePreferences(); 492 return; 493 } 494 495 if (event.key !== 'Tab') { 496 return; 497 } 498 499 var focusable = Array.prototype.slice.call(modal.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')); 500 if (!focusable.length) { 501 return; 502 } 503 504 var first = focusable[0]; 505 var last = focusable[focusable.length - 1]; 506 if (event.shiftKey && document.activeElement === first) { 507 event.preventDefault(); 508 last.focus(); 509 } else if (!event.shiftKey && document.activeElement === last) { 510 event.preventDefault(); 511 first.focus(); 512 } 513 } 514 515 function hideInitialNotice() { 516 var banner = document.getElementById('swifty-consent-banner'); 517 if (banner) { 518 banner.hidden = true; 519 } 520 closePreferences(); 521 } 522 523 function commitChoices(action, choices) { 524 var previous = copyChoices(state); 525 var revoked = []; 526 var existingReceiptId = bootstrap.saved && bootstrap.saved.receiptId ? bootstrap.saved.receiptId : ''; 527 var payload; 528 529 state = normalizeChoices(choices);
530 optionalCategories.forEach(function (category) { 531 if (previous[category] && !state[category]) { 532 revoked.push(category); 533 } 534 }); 535 536 payload = { 537 receiptId: existingReceiptId || generateReceiptId(), 538 policyVersion: config.policyVersion, 539 noticeHash: config.noticeHash, 540 choices: copyChoices(state), 541 action: action, 542 gpc: gpcEnabled, 543 updatedAt: new Date().toISOString() 544 }; 545 546 bootstrap.saved = payload; 547 bootstrap.hasSavedChoice = true; 548 hasSavedChoice = true; 549 writePreferenceCookie(payload); 550 postReceipt(payload); 551 updateGoogleConsent(state); 552 syncPreferenceInputs(); 553 hideInitialNotice(); 554 showPersistentControl(); 555 556 if (revoked.length) { 557 clearOptionalCookies(revoked); 558 } 559 560 activateAllowedResources().then(function () { 561 dispatchConsentEvent('swifty:consent-change', { 562 action: action, 563 choices: copyChoices(state), 564 gpc: gpcEnabled 565 }); 566 567 var needsReload = revoked.some(function (category) { 568 return loadedCategories[category] === true; 569 }); 570 if (needsReload) { 571 window.setTimeout(function () { 572 window.location.reload(); 573 }, 100); 574 } 575 }); 576 } 577 578 function showPersistentControl() { 579 var button = document.getElementById('swifty-consent-manage-button'); 580 if (button) { 581 button.hidden = false; 582 } 583 } 584 585 function choicesFromInputs() { 586 var choices = { necessary: true }; 587 588 optionalCategories.forEach(function (category) { 589 var input = document.querySelector('input[data-swifty-consent-category="' + category + '"]'); 590 choices[category] = !!(input && input.checked); 591 }); 592 593 return normalizeChoices(choices); 594 } 595 596 function handleAction(action) { 597 var choices; 598 599 if (action === 'manage') { 600 openPreferences(); 601 return; 602 } 603 604 if (action === 'close_preferences') { 605 closePreferences(); 606 return; 607 } 608 609 if (action === 'accept_all') { 610 choices = { necessary: true, functional: true, analytics: true, media: true, advertising: !gpcEnabled }; 611 commitChoices('accept_all', choices); 612 return; 613 } 614 615 if (action === 'acknowledge') { 616 commitChoices('acknowledge', copyChoices(state)); 617 return; 618 } 619 620 if (action === 'reject_all') { 621 commitChoices('reject_all', { necessary: true }); 622 return; 623 } 624 625 if (action === 'save_preferences') { 626 commitChoices('save_preferences', choicesFromInputs()); 627 return; 628 } 629 630 if (action === 'allow_media') { 631 choices = copyChoices(state); 632 choices.media = true; 633 commitChoices('save_preferences', choices); 634 } 635 } 636 637 function loadService(name) { 638 var service = config.services && config.services[name]; 639 640 if (!service || !service.src) { 641 return Promise.reject(new Error('This service is not configured.')); 642 } 643 644 if (name === 'recaptcha' && window.grecaptcha && window.grecaptcha.enterprise) { 645 return Promise.resolve(window.grecaptcha); 646 } 647 648 if (servicePromises[name]) { 649 return servicePromises[name]; 650 } 651 652 loadedCategories[service.category] = true; 653 servicePromises[name] = new Promise(function (resolve, reject) { 654 var script = document.createElement('script'); 655 var timeout; 656 657 script.src = service.src; 658 script.async = true; 659 script.setAttribute('data-swifty-consent-service', name); 660 script.addEventListener('load', function () { 661 if (name !== 'recaptcha') { 662 resolve(window[name]); 663 return; 664 } 665 666 var attempts = 0; 667 timeout = window.setInterval(function () { 668 attempts += 1; 669 if (window.grecaptcha && window.grecaptcha.enterprise) { 670 window.clearInterval(timeout); 671 resolve(window.grecaptcha); 672 } else if (attempts >= 100) { 673 window.clearInterval(timeout); 674 reject(new Error('The security service did not finish loading. Please try again.')); 675 } 676 }, 50); 677 }, { once: true }); 678 script.addEventListener('error', function () { 679 reject(new Error('The security service could not be loaded. Please try again.')); 680 }, { once: true }); 681 document.head.appendChild(script); 682 }).catch(function (error) { 683 delete servicePromises[name]; 684 throw error; 685 }); 686 687 return servicePromises[name]; 688 } 689 690 function ensureService(name) { 691 var service = config.services && config.services[name]; 692 var category = service && service.category ? service.category : 'functional'; 693 694 if (!hasConsent(category)) { 695 openPreferences(); 696 return Promise.reject(new Error('Please allow Functional technologies to use the form security service.')); 697 } 698 699 return loadService(name); 700 } 701 702 function gateKnownIntegrationClick(event) { 703 var target = event.target && event.target.closest ? event.target : null; 704 if (!target) { 705 return; 706 } 707 708 var translateLink = target.closest('ul.lang-flags li a'); 709 var mediaTrigger = target.closest('a.youtube, a.popup-vimeo, a.popup-gmaps, a.vr-tour, a.link-type-vt-url, .single-gallery-video >
709 a, span.vr-tour, [data_vt_type][data_url]'); 710 711 if (translateLink && !hasConsent('functional')) { 712 event.preventDefault(); 713 event.stopImmediatePropagation(); 714 openPreferences(); 715 return; 716 } 717 718 if (config.blockExternalMedia !== false && mediaTrigger && !hasConsent('media')) { 719 event.preventDefault(); 720 event.stopImmediatePropagation(); 721 openPreferences(); 722 } 723 } 724 725 function initializeInterface() { 726 var banner = document.getElementById('swifty-consent-banner'); 727 var savedAdvertising = bootstrap.saved && bootstrap.saved.choices && bootstrap.saved.choices.advertising === true; 728 729 optionalCategories.forEach(function (category) { 730 if (hasConsent(category)) { 731 loadedCategories[category] = true; 732 } 733 }); 734 735 document.addEventListener('click', gateKnownIntegrationClick, true); 736 document.addEventListener('click', function (event) { 737 var control = event.target.closest ? event.target.closest('[data-swifty-consent-action]') : null; 738 739 if (!control) { 740 return; 741 } 742 743 event.preventDefault(); 744 handleAction(control.getAttribute('data-swifty-consent-action')); 745 }); 746 747 syncPreferenceInputs(); 748 renderBlockedFramePlaceholders(); 749 clearOptionalCookies(optionalCategories.filter(function (category) { 750 if (category === 'media' && config.blockExternalMedia === false) { 751 return false; 752 } 753 return !hasConsent(category); 754 })); 755 756 if (!hasSavedChoice && banner) { 757 banner.hidden = false; 758 } else { 759 showPersistentControl(); 760 } 761 762 if (gpcEnabled && hasSavedChoice && savedAdvertising) { 763 clearOptionalCookies(['advertising']); 764 commitChoices('gpc_override', state); 765 } else { 766 updateGoogleConsent(state); 767 activateAllowedResources(); 768 } 769 770 var recaptcha = config.services && config.services.recaptcha; 771 if (recaptcha && recaptcha.category === 'necessary' && document.querySelector('form .formmangr-button, form .new-formmangr-button')) { 772 loadService('recaptcha').catch(function () { 773 // The form will display an actionable error if loading also fails on submit. 774 }); 775 } 776 777 dispatchConsentEvent('swifty:consent-ready', { 778 hasSavedChoice: hasSavedChoice, 779 choices: copyChoices(state), 780 gpc: gpcEnabled 781 }); 782 } 783 784 window.SwiftyConsent = { 785 has: hasConsent, 786 getChoices: function () { 787 return copyChoices(state); 788 }, 789 openPreferences: openPreferences, 790 ensureService: ensureService, 791 loadService: ensureService 792 }; 793 794 if (document.readyState === 'loading') { 795 document.addEventListener('DOMContentLoaded', initializeInterface, { once: true }); 796 } else { 797 initializeInterface(); 798 } 799})(window, document);
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.