1/*! 2* MyAgilePrivacy (https://www.myagileprivacy.com/) 3* plain version 4*/ 5 6var MAP_SYS = { 7 'plugin_version' : null, 8 'internal_version' : "2.0013", 9 'cookie_shield_version' : null, 10 'technology' : "plain", 11 'maplog' : "\x1b[40m\x1b[37m[MyAgilePrivacy]\x1b[0m ", 12 'map_initted' : false, 13 'map_document_load' : false, 14 'map_debug' : false, 15 'map_cookie_expire' : 180, 16 'map_skip_regexp' : [/.*oxygen_iframe=true.*$/, /.*ct_builder=true.*$/], 17 'map_missing_cookie_shield' : null, 18 'map_detectableKeys' : null, 19 'map_detectedKeys' : null, 20 'in_iab_context' : false, 21 'dependencies' : [], 22 'cmode_v2' : null, 23 'cmode_v2_implementation_type' : null, 24 'cmode_v2_forced_off_ga4_advanced' : null, 25 'cmode_v2_js_on_error' : null, 26 'starting_gconsent' : [], 27 'current_gconsent' : [], 28}; 29 30if( !( typeof MAP_JSCOOKIE_SHIELD !== 'undefined' && MAP_JSCOOKIE_SHIELD ) ) 31{ 32 MAP_POSTFIX = ''; 33 MAP_ACCEPTED_ALL_COOKIE_NAME = 'map_accepted_all_cookie_policy'; 34 MAP_ACCEPTED_SOMETHING_COOKIE_NAME = 'map_accepted_something_cookie_policy'; 35 MAP_CONSENT_STATUS = 'map_consent_status'; 36 37 console.debug( MAP_SYS.maplog + 'MAP_POSTFIX=' + MAP_POSTFIX ); 38} 39 40if( typeof MAP_Cookie === 'undefined' ) 41{ 42 if( typeof MAP_UA_NO_COOKIE_SET === 'undefined' ) 43 { 44 var MAP_UA_NO_COOKIE_SET = ["Cookiebot", "cookiebot.com", "CookieHubVerify", "TermlyBot"]; 45 } 46 47 var MAP_Cookie = { 48 _isUserAgentNoCookieSet: function () { 49 var userAgent = navigator?.userAgent; 50 51 return MAP_UA_NO_COOKIE_SET.some( function( forbidden ){ 52 return userAgent.includes( forbidden ); 53 }); 54 }, 55 set: function (name, value, days) { 56 57 if( this._isUserAgentNoCookieSet() ) 58 { 59 return null; 60 } 61 62 try { 63 if (days) { 64 var date = new Date(); 65 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 66 var expires = "; expires=" + date.toGMTString(); 67 } else 68 var expires = ""; 69 document.cookie = name + "=" + value + expires + "; path=/"; 70 } 71 catch( e ) 72 { 73 console.debug( e ); 74 return null; 75 } 76 }, 77 setGMTString: function (name, value, GMTString) { 78 79 if( this._isUserAgentNoCookieSet() ) 80 { 81 return null; 82 } 83 84 try { 85 86 var expires = "; expires=" + GMTString; 87 document.cookie = name + "=" + value + expires + "; path=/"; 88 } 89 catch( e ) 90 { 91 console.debug( e ); 92 return null; 93 } 94 }, 95 read: function (name) { 96 try { 97 var nameEQ = name + "="; 98 var ca = document.cookie.split(';'); 99 for (var i = 0; i < ca.length; i++) { 100 var c = ca[i]; 101 while (c.charAt(0) == ' ') { 102 c = c.substring(1, c.length); 103 } 104 if (c.indexOf(nameEQ) === 0) { 105 return c.substring(nameEQ.length, c.length); 106 } 107 } 108 return null; 109 } 110 catch( e ) 111 { 112 console.debug( e ); 113 return null; 114 } 115 }, 116 exists: function (name) { 117 return (this.read(name) !== null); 118 } 119 }; 120} 121 122var MAP = 123{ 124 set: function( args ) 125 { 126 127 try { 128 129 if( this.initted ) 130 { 131 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'MAP already initted: exiting' ); 132 return; 133 } 134 135 var current_url = window.location.href; 136 137 var isMatch = MAP_SYS.map_skip_regexp.some( function( rx ) { 138 return rx.test( current_url ); 139 }); 140 141 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'calling MAP set function' ); 142 143 if( typeof JSON.parse !== "function" ) 144 { 145 console.error( MAP_SYS.maplog + 'Error: My Agile Privacy requires JSON.parse but your browser lacks this support' ); 146 return; 147 } 148 if( typeof args.settings !== 'object' ) 149 { 150 this.settings = JSON.parse( args.settings ); 151 } 152 else 153 { 154 this.settings = args.settings; 155 } 156 157 if( !!this?.settings?.plugin_version ) 158 { 159 MAP_SYS.plugin_version = this?.settings?.plugin_version; 160 } 161 162 if( typeof CookieShield !== 'undefined' && 163 CookieShield 164 ) 165 { 166 MAP_SYS.cookie_shield_version = CookieShield.getVersion(); 167 } 168 169 if( ( !!this?.settings?.scan_mode && 170 this.settings.scan_mode == 'learning_mode' ) || 171 ( !!this?.settings?.verbose_remote_log && 172 this.settings.verbose_remote_log ) 173 ) 174 { 175 MAP_SYS.map_debug = true; 176 } 177 178 if( !!this?.settings?.cookie_reset_timestamp && 179 this.settings.cookie_reset_timestamp ) 180 { 181 if(!( typeof MAP_JSCOOKIE_SHIELD !== 'undefined' && MAP_JSCOOKIE_SHIELD ) ) 182 { 183 MAP_POSTFIX = '_' + this.settings.cookie_reset_timestamp; 184 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'MAP_POSTFIX=' + MAP_POSTFIX ); 185 } 186 } 187 188 if(!( typeof MAP_JSCOOKIE_SHIELD !== 'undefined' && MAP_JSCOOKIE_SHIELD ) ) 189 { 190 MAP_ACCEPTED_ALL_COOKIE_NAME = MAP_ACCEPTED_ALL_COOKIE_NAME + MAP_POSTFIX; 191 MAP_ACCEPTED_SOMETHING_COOKIE_NAME = MAP_ACCEPTED_SOMETHING_COOKIE_NAME + MAP_POSTFIX; 192 } 193 194 if( MAP_SYS?.map_debug && !!this?.settings.cookie_reset_timestamp && 195 this.settings.cookie_reset_timestamp ) 196 { 197 console.debug( MAP_SYS.maplog + 'using alt_accepted_all_cookie_name=' + MAP_ACCEPTED_ALL_COOKIE_NAME ); 198 console.debug( MAP_SYS.maplog + 'using alt_accepted_something_cookie_name=' + MAP_ACCEPTED_SOMETHING_COOKIE_NAME ); 199 } 200 201 this.blocked_friendly_name_string = null; 202 203 this.blocked_content_notification_shown = false;
204 205 this.bar_open = false; 206 207 this.settings = args.settings; 208 209 this.bar_elm = document.querySelector( this.settings.notify_div_id ); 210 this.showagain_elm = document.querySelector( "#" + this.settings.showagain_div_id ); 211 this.settingsModal = document.querySelector( '#mapSettingsPopup' ); 212 this.blocked_content_notification = document.querySelector( '#map-blocked-content-notification-area' ); 213 214 if( this.blocked_content_notification ) 215 { 216 this.map_blocked_elems_desc = this.blocked_content_notification.querySelector('.map_blocked_elems_desc'); 217 } 218 219 this.map_notification_message = this.bar_elm.querySelector( '.map_notification-message' ); 220 221 /* buttons */ 222 this.accept_button = this.bar_elm.querySelector( '.map-accept-button' ); 223 this.reject_button = this.bar_elm.querySelectorAll( '.map-reject-button' ); 224 this.customize_button = this.bar_elm.querySelector( '.map-customize-button' ); 225 226 if( MAP_SYS?.map_debug ) 227 { 228 console.groupCollapsed( MAP_SYS.maplog + 'settings:' ); 229 console.debug( this.settings ); 230 console.groupEnd(); 231 } 232 233 this.loadDependencies(); 234 this.toggleBar(); 235 this.createInlineNotify(); 236 this.attachEvents(); 237 238 this.attachAnimations(); 239 240 this.initted = true; 241 242 this.optimizeMobile(); 243 244 //for preserving scope 245 var that = this; 246 247 window.addEventListener('resize', function() { 248 that.optimizeMobile(); 249 }); 250 251 this.setupIabTCF(); 252 253 } 254 catch( error ) 255 { 256 console.error( error ); 257 } 258 }, 259 260 //inject code async 261 injectCode: function( src=null, callback=null ) 262 { 263 //for preserving scope 264 var that = this; 265 266 try { 267 268 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function injectCode src=' + src ); 269 270 if( src ) 271 { 272 const script = document.createElement( 'script' ); 273 script.async = true; 274 script.src = src; 275 script.onload = function() { 276 277 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'loaded script src=' + src ); 278 279 if( callback ) 280 { 281 callback(); 282 } 283 }; 284 285 document.body.append( script ); 286 } 287 288 } 289 catch( error ) 290 { 291 console.error( error ); 292 } 293 }, 294 295 //load dependencies 296 loadDependencies: function() 297 { 298 //for preserving scope 299 var that = this; 300 301 try { 302 303 var something_to_do = false; 304 305 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function loadDependencies' ); 306 307 //js shield 308 if( !( typeof MAP_JSCOOKIE_SHIELD !== 'undefined' && MAP_JSCOOKIE_SHIELD ) && 309 typeof map_full_config !== 'undefined' && typeof map_full_config?.js_shield_url !== 'undefined' && map_full_config?.js_shield_url ) 310 { 311 that.injectCode( map_full_config?.js_shield_url, function() { 312 } ); 313 314 something_to_do = true; 315 MAP_SYS.dependencies.push( map_full_config?.js_shield_url ); 316 } 317 318 //IabTCF 319 if( typeof map_full_config !== 'undefined' && typeof map_full_config?.load_iab_tcf !== 'undefined' && map_full_config?.load_iab_tcf && 320 typeof map_full_config?.iab_tcf_script_url !== 'undefined' && 321 typeof window?.initMyAgilePrivacyIabTCF === 'undefined' ) 322 { 323 that.injectCode( map_full_config?.iab_tcf_script_url, function() { 324 } ); 325 326 something_to_do = true; 327 MAP_SYS.dependencies.push( map_full_config?.iab_tcf_script_url ); 328 } 329 330 if( something_to_do ) 331 { 332 if( MAP_SYS?.map_debug ) 333 { 334 console.groupCollapsed( MAP_SYS.maplog + ' tried to load the following dependencies:' ); 335 console.log( MAP_SYS.dependencies ); 336 } 337 } 338 else 339 { 340 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + ' no depen
340dencies to load.' ); 341 } 342 343 console.groupEnd(); 344 345 } 346 catch( error ) 347 { 348 console.error( error ); 349 } 350 }, 351 352 //get consent status for consent mode 353 getGoogleConsentStatus: function( key ) 354 { 355 try { 356 357 return MAP_SYS?.current_gconsent[ key ]; 358 } 359 catch( error ) 360 { 361 console.error( error ); 362 } 363 }, 364 365 //f for updating given consent 366 updateGoogleConsent: function( key, value, updateStatusCookie = false) 367 { 368 //for preserving scope 369 var that = this; 370 371 try { 372 373 if( MAP_SYS?.cmode_v2 ) 374 { 375 if( MAP_SYS?.cmode_v2_implementation_type === 'native' ) 376 { 377 var newConsent = {}; 378 newConsent[key] = value; 379 380 gtag('consent', 'update', newConsent ); 381 } 382 383 if( MAP_SYS?.cmode_v2_implementation_type === 'gtm' ) 384 { 385 var newConsent = {}; 386 newConsent[key] = value; 387 388 gTagManagerConsentListeners.forEach( ( callback ) => { 389 callback( newConsent ); 390 }); 391 } 392 393 var currentGConsent = {...MAP_SYS?.current_gconsent}; 394 currentGConsent[key] = value; 395 MAP_SYS.current_gconsent = currentGConsent; 396 397 if( updateStatusCookie ) 398 { 399 that.saveGoogleConsentStatusToCookie( MAP_SYS?.current_gconsent ); 400 } 401 402 return true; 403 } 404 405 return false; 406 407 } 408 catch( error ) 409 { 410 console.error( error ); 411 } 412 413 }, 414 415 //from cookie value to object 416 parseGoogleConsentStatus: function( consentStatusValue ) 417 { 418 try { 419 420 // Split the encoded string into individual key-value pairs 421 var keyValuePairs = consentStatusValue.split('|'); 422 423 // Create an empty object to store the decoded values 424 var decodedObject = {}; 425 426 // Iterate over the key-value pairs 427 keyValuePairs.forEach( function( pair ) { 428 // Split each pair into key and value 429 var parts = pair.split(':'); 430 431 // Extract key and convert value to boolean 432 var key = parts[0]; 433 var value = ( parts[1] === 'true' ) ? 'granted' : 'denied'; 434
435 decodedObject[key] = value; 436 }); 437 438 return decodedObject; 439 440 } 441 catch( error ) 442 { 443 console.error( error ); 444 } 445 }, 446 447 //from consent object to cookie 448 saveGoogleConsentStatusToCookie : function( consentObject ) 449 { 450 try { 451 452 // Convert object values to a string 453 var encodedString = Object.keys( consentObject ) 454 .map(function( key ) { 455 return key + ':' + ( consentObject[key] === 'granted' ); 456 }) 457 .join('|'); 458 459 460 MAP_Cookie.set( MAP_CONSENT_STATUS, encodedString, MAP_SYS.map_cookie_expire ); 461 462 return true; 463 464 } 465 catch( error ) 466 { 467 console.error( error ); 468 } 469 }, 470 471 //for google tag manager cookie parsing (gtm) 472 exportGoogleConsentObjectFromCookie: function() 473 { 474 //for preserving scope 475 var that = this; 476 477 try { 478 479 var cookieValue = MAP_Cookie.read( MAP_CONSENT_STATUS ); 480 481 if( cookieValue ) 482 { 483 var this_gconsent = that.parseGoogleConsentStatus( cookieValue ); 484 485 return this_gconsent; 486 } 487 488 return null; 489 490 } 491 catch( error ) 492 { 493 console.error( error ); 494 } 495 }, 496 497 //set initial consent from google tag manager (gtm) 498 setFromGoogleTagManagerInitialConsent: function( gconsent ) 499 { 500 //for preserving scope 501 var that = this; 502 503 try { 504 505 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function setFromGoogleTagManagerInitialConsent' ); 506 507 if( gconsent ) 508 { 509 //save starting consent 510 MAP_SYS.starting_gconsent = {...gconsent}; 511 MAP_SYS.current_gconsent = {...gconsent}; 512 513 that.saveGoogleConsentStatusToCookie( gconsent ); 514 515 //init only status, not events 516 that.userPreferenceInit( true ); 517 } 518 519 } 520 catch( error ) 521 { 522 console.error( error ); 523 } 524 }, 525 526 //consent listener for google tag manager (gtm) 527 googleTagManagerConsentListener: function( callback ) 528 { 529 try { 530 531 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function googleTagManagerConsentListener' ); 532 533 if( typeof gTagManagerConsentListeners !== 'undefined' ) 534 { 535 gTagManagerConsentListeners.push( callback ); 536 } 537 538 } 539 catch( error ) 540 { 541 console.error( error ); 542 } 543 }, 544 545 //init data for consent mode 546 setupConsentModeV2 : function() 547 { 548 //for preserving scope 549 var that = this; 550 551 try { 552 553 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function setupConsentModeV2' ); 554 555 if( typeof map_full_config === 'undefined' ) 556 { 557 return false; 558 } 559 560 MAP_SYS.cmode_v2 = map_full_config?.enable_cmode_v2; 561 MAP_SYS.cmode_v2_implementation_type = map_full_config?.cmode_v2_implementation_type; 562 MAP_SYS.cmode_v2_forced_off_ga4_advanced = map_full_config?.cmode_v2_forced_off_ga4_advanced; 563 MAP_SYS.cmode_v2_js_on_error = map_full_config?.cmode_v2_js_on_error; 564 565 if( MAP_SYS.cmode_v2 && MAP_SYS.cmode_v2_implementation_type == 'gtm' ) 566 { 567 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting default value for consent mode (gtm)' ); 568 569 var cookieValue = MAP_Cookie.read( MAP_CONSENT_STATUS ); 570 571 if( cookieValue ) 572 { 573 var this_gconsent = that.parseGoogleConsentStatus( cookieValue ); 574 //setting initial current_gconsent value (deep copy using spread operator) 575 MAP_SYS.current_gconsent = {...this_gconsent}; 576 } 577 } 578 579 if( MAP_SYS.cmode_v2 && MAP_SYS.cmode_v2_implementation_type == 'native' ) 580 { 581 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting default value for consent mode (native)' ); 582 583 //save starting consent 584 MAP_SYS.starting_gconsent = map_full_config?.cmode_v2_default_consent_obj; 585 586 var cookieValue = MAP_Cookie.read( MAP_CONSENT_STATUS ); 587 588 if( cookieValue ) 589 { 590 var this_gconsent = that.parseGoogleConsentStatus( cookieValue ); 591 592 //setting initial current_gconsent value (deep copy using spread operator) 593 MAP_SYS.current_gconsent = { ...this_gconsent }; 594 595 try { 596 gtag( 'consent', 'default', { ...MAP_SYS.current_gconsent } ); 597 } 598 catch( error ) 599 { 600 console.error( error ); 601 } 602 } 603 else 604 { 605 //no cookie value case 606 607 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting default consent (native)' ); 608 609 //setting initial current_gconsent value (deep copy using spread operator) 610 MAP_SYS.current_gconsent = { ...MAP_SYS.starting_gconsent }; 611 612 try { 613 gtag( 'consent', 'default', { ...MAP_SYS.starting_gconsent } ); 614 } 615 catch( error ) 616 { 617 console.error( error ); 618 } 619 620 that.saveGoogleConsentStatusToCookie( MAP_SYS.current_gconsent ); 621 } 622 } 623 624 return true; 625 626 } 627 catch( error ) 628 {
629 console.error( error ); 630 } 631 }, 632 633 toggleBar: function() 634 { 635 //for preserving scope 636 var that = this; 637 638 try { 639 640 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function toggleBar' ); 641 642 if( !MAP_Cookie.exists( MAP_ACCEPTED_ALL_COOKIE_NAME ) && 643 !MAP_Cookie.exists( MAP_ACCEPTED_SOMETHING_COOKIE_NAME ) 644 ) 645 { 646 if( MAP_SYS.in_iab_context ) 647 { 648 (async() => { 649 650 while( !MAP_SYS.map_document_load ) 651 { 652 //console.log( 'not defined yet' ); 653 await new Promise( resolve => setTimeout( resolve, 10 ) ); 654 } 655 656 (async() => { 657 //console.log("waiting for variable"); 658 while( typeof window.MAPIABTCF_brief_html_initted == 'function' && 659 !window.MAPIABTCF_brief_html_initted() ) 660 { 661 //console.log( 'not defined yet' ); 662 await new Promise( resolve => setTimeout( resolve, 10 ) ); 663 } 664 //console.log("variable is defined"); 665 that.displayBar(); 666 667 setTimeout( function() { 668 var scroll_to_top = document.querySelector( '.map_notification-message.map-iab-context' ); 669 if(scroll_to_top) { 670 scroll_to_top.scrollIntoView( { behavior: 'smooth' } ); 671 } 672 }, 400); 673 674 })(); 675 676 })(); 677 } 678 else 679 { 680 that.displayBar(); 681 } 682 } 683 else 684 { 685 that.hideBar(); 686 } 687 688 this.showagain_elm.querySelectorAll( 'a.showConsent' ).forEach(function( $this ) { 689 $this.addEventListener('click', function(e) { 690 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered showConsent' ); 691 692 e.preventDefault(); 693 e.stopImmediatePropagation(); 694 695 //animation 696 var that_animation = MAP.bar_elm.getAttribute( 'data-animation' ); 697 var that_id_selector = '#' + MAP.bar_elm.getAttribute( 'id' ); 698 699 var animation_params = { 700 targets: that_id_selector, 701 easing: 'easeInOutQuad', 702 duration: 1000 703 }; 704 705 setTimeout( function() { 706 MAP.showagain_elm.style.display = 'none'; 707 }, 150 ); 708 709 anime( { 710 targets: MAP.showagain_elm, 711 easing: 'easeInOutQuad', 712 duration: 150, 713 opacity: 0, 714 complete: function( anim ) { 715 MAP.showagain_elm.style.display = 'none'; 716 } 717 } ); 718 719 setTimeout( function() { 720 721 try { 722 723 switch( that_animation ) 724 { 725 case 'slide': 726 727 var y_value = '0vh'; 728 var x_value = '0vw'; 729 730 if( MAP.bar_elm.classList.contains( 'map_floating_banner' ) ) 731 { 732 y_value = '3vh'; 733 x_value = '3vw'; 734 } 735 736 var $this = MAP.bar_elm; 737 738 if( MAP.bar_elm.className.includes( 'mapPositionBottom' ) ) { 739 $this.style.bottom = '-100vh'; 740 animation_params['bottom'] = y_value; 741 } 742 else if( MAP.bar_elm.className.includes( 'mapPositionTop' ) ) { 743 $this.style.top = '-100vh'; 744 animation_params['top'] = y_value; 745 } 746 else if( MAP.bar_elm.className.includes( 'mapPositionCenterLeft' ) ) { 747 $this.style.left = '-100vw'; 748 animation_params['left'] = x_value; 749 } 750 else if( MAP.bar_elm.className.includes( 'mapPositionCenterCenter' ) ) { 751 $this.style.top = '-100%'; 752 animation_params['top'] = '50%'; 753 } 754 else if( MAP.bar_elm.className.includes( 'mapPositionCenterRight' ) ) { 755 $this.style.right = '-100vw'; 756 animation_params['right'] = x_value; 757 } 758 759 MAP.bar_elm.style.display = 'block'; 760 anime( animation_params ); 761 break; 762 763 case 'fade': 764 document.querySelector( that_id_selector ).style.opacity = '0'; 765 MAP.bar_elm.style.display = 'block'; 766 767 animation_params['opacity'] = '1'; 768 animation_params['duration'] = '500'; 769 770 anime( animation_params ); 771 772 break; 773 774 case 'zoom': 775 document.querySelector( that_id_selector ).style.transform = 'scale(0)'; 776 MAP.bar_elm.style.display = 'block'; 777 778 animation_params['scale'] = '1'; 779 anime( animation_params ); 780 781 break; 782 783 default: // no animation -> value = "none" 784 MAP.bar_elm.style.display = 'block'; 785 break; 786 } 787 788 that.bar_open = true; 789 that.optimizeMobile(); 790 791 } 792 catch( error ) 793 { 794 console.error( error ); 795 } 796 797 },100 ); 798 799 800 }); 801 }); 802 803 //bof user consent review trigger 804 805 that.bar_elm.addEventListener( 'triggerShowAgainDisplay', function(e) { 806 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered triggerShowAgainDisplay' ); 807 808 e.preventDefault(); 809 e.stopImmediatePropagation(); 810 811 //animation 812 var that_animation = MAP.bar_elm.getAttribute('data-animation'); 813 var that_id_selector = '#' + MAP.bar_elm.getAttribute('id'); 814 815 var animation_params = { 816 targets: that_id_selector, 817 easing: 'easeInOutQuad', 818 duration: 1000 819 }; 820 821 setTimeout( function() { 822 MAP.showagain_elm.style.display = 'none'; 823 }, 150 ); 824 825 anime( { 826 targets: MAP.showagain_elm, 827 easing: 'easeInOutQuad', 828 duration: 150, 829 opacity: 0, 830 complete: function(anim) { 831 MAP.showagain_elm.style.display = 'none'; 832 } 833 } ); 834 835 setTimeout( function() { 836 837 try { 838 839 switch( that_animation ) 840 { 841 case 'slide': 842 843 var y_value = '0vh'; 844 var x_value = '0vw'; 845 846 if( MAP.bar_elm.classList.contains( 'map_floating_banner' ) ) 847 { 848 y_value = '3vh'; 849 x_value = '3vw'; 850 } 851 852 var element = document.querySelector( that_id_selector ); 853 854 if( MAP.bar_elm.className.includes( 'mapPositionBottom' ) ) { 855 element.style.bottom = '-100vh'; 856 animation_params['bottom'] = y_value; 857 } 858 else if( MAP.bar_elm.className.includes( 'mapPositionTop' ) ) { 859 element.style.top = '-100vh'; 860 animation_params['top'] = y_value; 861 } 862 else if( MAP.bar_elm.className.includes( 'mapPositionCenterLeft' ) ) { 863 element.style.left = '-100vw'; 864 animation_params['left'] = x_value; 865 } 866 else if( MAP.bar_elm.className.includes( 'mapPositionCenterCenter' ) ) { 867 element.style.top = '-100%'; 868 animation_params['top'] = '50%'; 869 } 870 else if( MAP.bar_elm.className.includes( 'mapPositionCenterRight') ) { 871 element.style.right = '-100vw'; 872 animation_params['right'] = x_value; 873 } 874 875 MAP.bar_elm.style.display = 'block'; 876 anime( animation_params ); 877 break; 878 879 case 'fade': 880 document.querySelector( that_id_selector ).style.opacity = '0'; 881 MAP.bar_elm.style.display = 'block'; 882 883 animation_params['opacity'] = '1'; 884 animation_params['duration'] = '500'; 885 886 anime( animation_params ); 887 888 break; 889 890 case 'zoom': 891 document.querySelector( that_id_selector ).style.transform = 'scale(0)'; 892 MAP.bar_elm.style.display = 'block'; 893 894 animation_params['scale'] = '1'; 895 anime( animation_params ); 896 break; 897 898 default: // no animation -> value = "none" 899 MAP.bar_elm.style.display = 'block'; 900 break; 901 } 902 903 that.bar_open = true; 904 that.optimizeMobile(); 905 } 906 catch( error ) 907 { 908 console.error( error ); 909 } 910 911 }, 100 ); 912 }); 913 914 document.body.addEventListener('click', function(e) { 915 916 var targetElement = e.target; 917 var matchFound = false;
918 var levelsToCheck = 2; 919 920 while( levelsToCheck > 0 && targetElement ) 921 { 922 if (targetElement.matches('.showConsentAgain')) { 923 matchFound = true; 924 break; 925 } 926 targetElement = targetElement.parentElement; 927 levelsToCheck--; 928 } 929 930 if( matchFound ) 931 { 932 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered showConsentAgain' ); 933 e.preventDefault(); 934 e.stopImmediatePropagation(); 935 936 var event = new CustomEvent('triggerShowAgainDisplay'); 937 that.bar_elm.dispatchEvent( event ); 938 } 939 }); 940 941 942 //eof user consent review trigger 943 } 944 catch( error ) 945 { 946 console.error( error ); 947 } 948 }, 949 950 createInlineNotify: function() 951 { 952 try { 953 954 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function createInlineNotify' ); 955 956 //for preserving scope 957 var that = this; 958 959 if( typeof CookieShield !== 'undefined' && 960 CookieShield ) 961 { 962 var detectedKeys = CookieShield.getDetectedKeys(); 963 964 Object.keys( detectedKeys ).forEach( function( key ) { 965 966 var api_key = detectedKeys[key]; 967 968 var $custom_ref = document.querySelector('.map_custom_notify.map_api_key_' + api_key); 969 970 if( $custom_ref ) 971 { 972 $custom_ref.style.display = 'block'; 973 } 974 }); 975 } 976 977 var $map_blocked_content = document.querySelectorAll( '.map_blocked_content' ); 978 979 $map_blocked_content.forEach( function( $this) { 980 981 var api_key = $this.getAttribute( 'data-cookie-api-key' ); 982 983 var $custom_ref = document.querySelectorAll( '.map_custom_notify.map_api_key_' + api_key ); 984 985 $custom_ref.forEach(function( customRef ) { 986 if( customRef ) 987 { 988 customRef.style.display = 'block'; 989 } 990 }); 991 992 }); 993 994 var $show_inline_notify = document.querySelectorAll( '.iframe_src_blocked.map_show_inline_notify' ); 995
996 $show_inline_notify.forEach( function( $this ) { 997 998 var height = $this.offsetHeight; 999 1000 var width = $this.offsetWidth; 1001 1002 var api_key = $this.getAttribute('data-cookie-api-key'); 1003 1004 var the_friendly_name = ''; 1005 var friendly_name = $this.getAttribute('data-friendly-name'); 1006 1007 if( friendly_name ) 1008 { 1009 the_friendly_name = friendly_name; 1010 } 1011 1012 $this.style.display = 'none'; 1013 1014 var html = "<div class='map_inline_notify showConsentAgain' data-cookie-api-key='"+api_key+"'>"+that.settings.blocked_content_text+"<br>"+the_friendly_name+"</div>"; 1015 1016 //temp div for inject via vanilla js 1017 var tempDiv = document.createElement( 'div' ); 1018 tempDiv.innerHTML = html; 1019 1020 var $injected = tempDiv.firstChild; 1021 $this.parentNode.insertBefore( $injected, $this.nextSibling ); 1022 1023 if( height > 0 ) 1024 { 1025 $injected.style.height = height + 'px'; 1026 } 1027 1028 if( width > 0 ) 1029 { 1030 $injected.style.width = width + 'px'; 1031 } 1032 1033 if( that.settings.inline_notify_color ) 1034 { 1035 $injected.style.color = that.settings.inline_notify_color; 1036 } 1037 1038 if( that.settings.inline_notify_background ) 1039 { 1040 $injected.style.backgroundColor = that.settings.inline_notify_background; 1041 } 1042 1043 }); 1044 1045 } 1046 catch( error ) 1047 { 1048 console.error( error ); 1049 } 1050 }, 1051 1052 setupIabTCF: function() 1053 { 1054 //for preserving scope 1055 var that = this; 1056 1057 try { 1058 1059 var $map_consent_extrawrapper = that.settingsModal.querySelector( '.map-consent-extrawrapper' ); 1060 1061 if( !!$map_consent_extrawrapper ) 1062 { 1063 MAP_SYS.in_iab_context = true; 1064 1065 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function setupIabTCF' ); 1066 1067 //first layer 1068 that.bar_elm.querySelectorAll( '.map-triggerGotoIABTCF' ).forEach( function( $this ) { 1069 $this.addEventListener( 'click', function( e ) { 1070 1071 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-triggerGotoIABTCF click' ); 1072 1073 e.preventDefault(); 1074 e.stopImmediatePropagation(); 1075 1076 MAP.settingsModal.classList.add( 'map-show' ); 1077 MAP.settingsModal.style.opacity = 0; 1078 MAP.settingsModal.offsetWidth; // Trigger a reflow to ensure the transition starts 1079 MAP.settingsModal.style.transition = 'opacity 1s'; 1080 MAP.settingsModal.style.opacity = 1; 1081 1082 MAP.settingsModal.classList.remove( 'map-blowup', 'map-out' ); 1083 MAP.settingsModal.classList.add( 'map-blowup' ); 1084 1085 document.body.classList.add( 'map-modal-open' ); 1086 1087 document.querySelector( '.map-settings-overlay' ).classList.add( 'map-show' ); 1088 1089 if( !document.querySelector( '.map-settings-mobile' ).offsetWidth ) 1090 { 1091 // MAP.settingsModal.find( '.map-nav-link:eq(0)' ).click(); 1092 MAP.settingsModal.querySelector('.map-nav-link').click(); 1093 } 1094 1095 $map_consent_extrawrapper.querySelectorAll( '.map-wrappertab-navigation li a[href="#map-privacy-iab-tcf-wrapper"]' ).forEach( function( $_this ) { 1096 $_this.click(); 1097 }); 1098 1099 }); 1100 }); 1101 1102 that.bar_elm.querySelectorAll( '.map-triggerGotoIABTCFVendors' ).forEach( function( $this ) { 1103 $this.addEventListener('click', function(e) { 1104 1105 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-triggerGotoIABTCFVendors click' ); 1106 1107 e.preventDefault(); 1108 e.stopImmediatePropagation(); 1109 1110 MAP.settingsModal.classList.add('map-show'); 1111 MAP.settingsModal.style.opacity = 0; 1112 1113 MAP.settingsModal.offsetWidth; // Trigger a reflow to ensure the transition starts 1114 MAP.settingsModal.style.transition = 'opacity 1s'; 1115 MAP.settingsModal.style.opacity = 1; 1116 1117 MAP.settingsModal.classList.remove( 'map-blowup', 'map-out' ); 1118 MAP.settingsModal.classList.add( 'map-blowup' ); 1119 1120 document.body.classList.add( 'map-modal-open' ); 1121 1122 document.querySelector( '.map-settings-overlay' ).classList.add( 'map-show' ); 1123 1124 var mapSettingsMobile = document.querySelector( '.map-settings-mobile' ); 1125 if( mapSettingsMobile && mapSettingsMobile.offsetWidth === 0 && mapSettingsMobile.offsetHeight === 0) 1126 { 1127 var firstNavLink = MAP.settingsModal.querySelector( '.map-nav-link' ); 1128 if( firstNavLink ) 1129 { 1130 firstNavLink.click(); 1131 } 1132 } 1133 1134 $map_consent_extrawrapper.querySelectorAll( '.map-wrappertab-navigation li a[href="#map-privacy-iab-tcf-wrapper"]' ).forEach( function( $_this ) { 1135 $_this.click(); 1136 }); 1137 1138 setTimeout( function() { 1139 1140 try { 1141
1142 var $vendor_list_button = document.querySelector( '#map-iab-tcf-vendor-list' ); 1143 1144 if( $vendor_list_button ) 1145 { 1146 $vendor_list_button.click(); 1147 1148 setTimeout( function() { 1149 var $vendor_list_scrollto = document.querySelector( '#map-iab-tcf-vendor-list-scroll-here' ); 1150 1151 if( $vendor_list_scrollto ) 1152 { 1153 $vendor_list_scrollto.scrollIntoView({ behavior: 'smooth' }); 1154 } 1155 }, 200 ); 1156 } 1157 } 1158 catch( error ) 1159 { 1160 console.error( error ); 1161 } 1162 1163 }, 200); 1164 }); 1165 }); 1166 1167 //bof nav part 1168 $map_consent_extrawrapper.querySelectorAll( '.map-wrappertab-navigation li a' ).forEach( function( $this ) { 1169 $this.addEventListener( 'click', function(e) { 1170 1171 e.preventDefault(); 1172 1173 var tabHref = $this.getAttribute( 'href' ); 1174 var lastIndex = tabHref.lastIndexOf('#'); 1175 if( lastIndex !== -1 ) 1176 { 1177 tabHref = tabHref.substring( lastIndex )?.replace( '#', '' ); 1178 } 1179 else 1180 { 1181 tabHref = 'map-privacy-iab-tcf-wrapper'; 1182 } 1183 1184 if( tabHref == 'map-privacy-iab-tcf-wrapper') 1185 { 1186 (async() => { 1187 1188 while( !MAP_SYS.map_document_load ) 1189 { 1190 //console.log( 'not defined yet' ); 1191 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1192 } 1193 1194 if( typeof window.MAPIABTCF_showCMPUI === 'function' ) 1195 { 1196 window.MAPIABTCF_showCMPUI(); 1197 } 1198 1199 })(); 1200 } 1201 else 1202 { 1203 (async() => { 1204 1205 while( !MAP_SYS.map_document_load ) 1206 { 1207 //console.log( 'not defined yet' ); 1208 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1209 } 1210 1211 if( typeof window.MAPIABTCF_hideCMPUI === 'function' ) 1212 { 1213 window.MAPIABTCF_hideCMPUI(); 1214 } 1215 1216 })(); 1217 1218 } 1219 1220 $map_consent_extrawrapper.querySelectorAll( '.map-wrappertab-navigation li a' ).forEach( function( $_this ) { 1221 $_this.classList.remove( 'active-wrappertab-nav' ); 1222 }); 1223 1224 $this.classList.add( 'active-wrappertab-nav' ); 1225 1226 $map_consent_extrawrapper.querySelectorAll( '.map-wrappertab' ).forEach( function( $_this ) { 1227 $_this.classList.remove( 'map-wrappertab-active' ); 1228 }); 1229 1230 var activeTab = $map_consent_extrawrapper.querySelector( '.map-wrappertab.' + tabHref ); 1231 if( activeTab ) 1232 { 1233 activeTab.classList.add( 'map-wrappertab-active' ); 1234 } 1235 1236 }); 1237 }); 1238 1239 //eof nav part 1240 1241 //bof IAB TCF init and events 1242 (async() => { 1243 1244 while( !MAP_SYS.map_document_load ) 1245 { 1246 //console.log( 'not defined yet' ); 1247 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1248 } 1249 1250 if( typeof window.initMyAgilePrivacyIabTCF === 'function' ) 1251 { 1252 var this_lang_code = null; 1253 1254 if( typeof map_lang_code !== 'undefined' ) 1255 { 1256 this_lang_code = map_lang_code; 1257 } 1258 1259 if( typeof map_full_config?.map_lang_code !== 'undefined' ) 1260 { 1261 this_lang_code = map_full_config?.map_lang_code; 1262 } 1263 1264 window.initMyAgilePrivacyIabTCF( this_lang_code ); 1265 } 1266 1267 })(); 1268 //eof IAB TCF init and events 1269 } 1270 1271 } 1272 catch( error ) 1273 { 1274 console.error( error ); 1275 } 1276 }, 1277 1278 attachEvents: function() 1279 { 1280 try { 1281 1282 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function attachEvents' ); 1283 1284 //for preserving scope 1285 1286 var that = this; 1287 1288 that.accept_button.addEventListener( 'click', function( e ) { 1289 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-accept-button click' ); 1290 1291 e.preventDefault(); 1292 e.stopImmediatePropagation(); 1293 1294 var $this = this; 1295 1296 //check consent-mode checkbox 1297 that.settingsModal.querySelectorAll( '.map-consent-mode-preference-checkbox' ).forEach( function( elem ) { 1298 elem.checked = true; 1299 1300 var consent_key = elem.getAttribute( 'data-consent-key' ); 1301 1302 that.updateGoogleConsent( consent_key, 'granted', true ); 1303 }); 1304 1305 //check user-preference checkbox 1306 that.settingsModal.querySelectorAll( '.map-user-preference-checkbox' ).forEach(function( elem ) { 1307 1308 var cookieName = 'map_cookie_' + elem.getAttribute( 'data-cookie-baseindex' ) + MAP_POSTFIX; 1309 1310 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting 1 to cookieName=' + cookieName ); 1311 1312 MAP_Cookie.set( cookieName, '1', MAP_SYS.map_cookie_expire ); 1313 1314 elem.checked = true; 1315 }); 1316 1317 //check iab-preference checkbox 1318 that.settingsModal.querySelectorAll( '.map-user-iab-preference-checkbox' ).forEach( function( elem ) { 1319 elem.checked = true; 1320 }); 1321 1322 (async() => { 1323 1324 while( !MAP_SYS.map_document_load ) 1325 { 1326 //console.log( 'not defined yet' ); 1327 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1328 } 1329 1330 if( typeof window.MAPIABTCF_acceptAllConsent === 'function' ) 1331 { 1332 window.MAPIABTCF_doSetUserInteraction(); 1333 window.MAPIABTCF_acceptAllConsent( true ); 1334 } 1335 1336 })(); 1337 1338 MAP.accept_close(); 1339 }); 1340 1341 1342 that.reject_button.forEach(function( button ) { 1343 button.addEventListener('click', function(e) { 1344 1345 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-reject-button click' ); 1346 1347 e.preventDefault(); 1348 e.stopImmediatePropagation(); 1349 1350 var $this = this; 1351 1352 //uncheck consent-mode checkbox 1353 that.settingsModal.querySelectorAll( '.map-consent-mode-preference-checkbox' ).forEach( function( elem ) { 1354 elem.checked = false;
1355 1356 var consent_key = elem.getAttribute( 'data-consent-key' ); 1357 1358 that.updateGoogleConsent( consent_key, 'denied', true ); 1359 }); 1360 1361 //uncheck user-preference checkbox 1362 that.settingsModal.querySelectorAll( '.map-user-preference-checkbox' ).forEach( function( elem ) { 1363 1364 var cookieName = 'map_cookie_' + elem.getAttribute( 'data-cookie-baseindex' ) + MAP_POSTFIX; 1365 1366 MAP_Cookie.set( cookieName, '-1', MAP_SYS.map_cookie_expire ); 1367 1368 elem.checked = false; 1369 }); 1370 1371 //uncheck iab-preference checkbox 1372 that.settingsModal.querySelectorAll( '.map-user-iab-preference-checkbox' ).forEach( function( elem ) { 1373 elem.checked = false; 1374 }); 1375 1376 (async() => { 1377 1378 while( !MAP_SYS.map_document_load ) 1379 { 1380 //console.log( 'not defined yet' ); 1381 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1382 } 1383 1384 if( typeof window.MAPIABTCF_denyAllConsent === 'function' ) 1385 { 1386 window.MAPIABTCF_doSetUserInteraction(); 1387 window.MAPIABTCF_denyAllConsent( true ); 1388 } 1389 1390 })(); 1391 1392 MAP.reject_close(); 1393 }); 1394 }); 1395 1396 1397 that.customize_button.addEventListener( 'click', function(e) { 1398 1399 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-customize-button click' ); 1400 1401 e.preventDefault(); 1402 e.stopImmediatePropagation(); 1403 1404 MAP.settingsModal.classList.add( 'map-show' ); 1405 MAP.settingsModal.style.opacity = 0; 1406 MAP.settingsModal.offsetWidth; // Trigger a reflow to ensure the transition starts 1407 MAP.settingsModal.style.transition = 'opacity 1s'; 1408 MAP.settingsModal.style.opacity = 1; 1409 1410 MAP.settingsModal.classList.remove( 'map-blowup', 'map-out' ); 1411 MAP.settingsModal.classList.add( 'map-blowup' ); 1412 1413 document.body.classList.add( 'map-modal-open' ); 1414 1415 document.querySelector( '.map-settings-overlay' ).classList.add( 'map-show' ); 1416 1417 var mapSettingsMobile = document.querySelector( '.map-settings-mobile' ); 1418 1419 if( mapSettingsMobile && mapSettingsMobile.offsetWidth === 0 && mapSettingsMobile.offsetHeight === 0 ) 1420 { 1421 var firstNavLink = MAP.settingsModal.querySelector( '.map-nav-link' ); 1422 if( firstNavLink ) 1423 { 1424 firstNavLink.click(); 1425 } 1426 } 1427 1428 var $map_consent_extrawrapper = that.settingsModal.querySelectorAll( '.map-consent-extrawrapper' ); 1429 1430 if( !!$map_consent_extrawrapper && $map_consent_extrawrapper?.length ) 1431 { 1432 var triggerElement = $map_consent_extrawrapper[0].querySelector( '.map-wrappertab-navigation li a[href="#map-privacy-cookie-thirdypart-wrapper"]' ); 1433 if( triggerElement ) 1434 { 1435 triggerElement.click(); 1436 } 1437 } 1438 1439 }); 1440 1441 document.querySelector('#mapModalClose').addEventListener('click', function(e) { 1442 1443 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered mapModalClose click' ); 1444 1445 e.preventDefault(); 1446 e.stopImmediatePropagation(); 1447 1448 MAP.closeSettingsPopup(); 1449 MAP.hideBar(); 1450 1451 }); 1452 1453 that.setupAccordion(); 1454 1455 if( typeof map_ajax !== 'undefined' && 1456 typeof map_ajax.cookie_process_delayed_mode !== 'undefined' && 1457 map_ajax.cookie_process_delayed_mode == 1 1458 ) 1459 { 1460 //wait for page load 1461 1462 (async() => { 1463 1464 while( !MAP_SYS.map_document_load ) 1465 { 1466 //console.log( 'not defined yet' ); 1467 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1468 } 1469 1470 that.userPreferenceInit( false ); 1471 1472 })(); 1473 1474 } 1475 else 1476 { 1477 that.userPreferenceInit( false ); 1478 } 1479 1480 } 1481 catch( error ) 1482 { 1483 console.error( error ); 1484 } 1485 }, 1486 1487 1488 attachAnimations: function() 1489 { 1490 try { 1491 1492 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function attachAnimations' ); 1493 1494 //for preserving scope 1495 var that = this; 1496 1497 if( that.bar_elm.querySelector( '#map-accept-button' ).getAttribute( 'data-animate' ) == 'true' ) 1498 { 1499 var acceptButton = document.querySelector( '#map-accept-button' ); 1500 1501 var animation = acceptButton.getAttribute( 'data-animation-effect' ); 1502 1503 var delay = parseInt(acceptButton.getAttribute( 'data-animation-delay') ) * 1000; 1504 1505 var repeat = parseInt(acceptButton.getAttribute( 'data-animation-repeat' ) ); 1506 1507 var all_animation_classes = ['animate__animated', animation] ; 1508 1509 var iteration_counter = 0; 1510 1511 var animInterval = setInterval( function() { 1512 if(iteration_counter == repeat) 1513 { 1514 clearInterval( animInterval ); 1515 } 1516 else 1517 { 1518 acceptButton.classList.add( ...all_animation_classes ); 1519 1520 setTimeout( function() { 1521 1522 acceptButton.classList.remove( ...all_animation_classes ); 1523 iteration_counter ++; 1524 1525 }, 900 ); 1526 } 1527 1528 }, delay ); 1529 1530 } 1531 1532 } 1533 catch( error ) 1534 {
1535 console.error( error ); 1536 } 1537 }, 1538 1539 checkBlockedContent: function() 1540 { 1541 try { 1542 1543 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function checkBlockedContent' ); 1544 1545 //for preserving scope 1546 var that = this; 1547 1548 var $map_blocked_content = document.querySelectorAll( '.map_blocked_content:not(._is_activated)' ); 1549 1550 if( !!$map_blocked_content && $map_blocked_content?.length ) 1551 { 1552 //calc data 1553 var blocked_friendly_name = []; 1554 1555 $map_blocked_content.forEach( function( $this ) { 1556 1557 var this_friendly_name = $this.getAttribute('data-friendly_name'); 1558 1559 if( this_friendly_name ) 1560 { 1561 blocked_friendly_name.push( this_friendly_name ); 1562 } 1563 1564 }); 1565 1566 if( typeof CookieShield !== 'undefined' && 1567 CookieShield && 1568 typeof CookieShield.getDetectedFriendlyNames !== 'undefined' ) 1569 { 1570 var other_names = CookieShield.getDetectedFriendlyNames(); 1571 1572 other_names.forEach( function( v ) { 1573 1574 if( v ) 1575 { 1576 if( v?.desc ) 1577 { 1578 blocked_friendly_name.push( v.desc ); 1579 } 1580 else 1581 { 1582 blocked_friendly_name.push( v ); 1583 } 1584 1585 } 1586 }); 1587 } 1588 1589 var blocked_friendly_name_unique = blocked_friendly_name.filter((v, i, a) => a.indexOf(v) === i); 1590 1591 that.blocked_friendly_name_string = blocked_friendly_name_unique.join( ', ' ); 1592 1593 //check if to show 1594 if( blocked_friendly_name_unique.length && 1595 ( !that.bar_open || that.settings.show_ntf_bar_on_not_yet_consent_choice ) ) 1596 { 1597 if( that.blocked_content_notification && that.blocked_content_notification ) 1598 { 1599 if( that.blocked_friendly_name_string ) 1600 { 1601 that.map_blocked_elems_desc.innerHTML = that.blocked_friendly_name_string; 1602 } 1603 else 1604 { 1605 that.map_blocked_elems_desc.style.opacity = 0; 1606 that.map_blocked_elems_desc.style.display = 'block'; 1607 1608 anime( { 1609 targets: that.map_blocked_elems_desc, 1610 easing: 'easeInOutQuad', 1611 duration: 150, 1612 opacity: 1, 1613 complete: function(anim) { 1614 } 1615 } ); 1616 1617 } 1618 1619 that.blocked_content_notification_shown = true; 1620 1621 var blocked_content_notify_auto_shutdown_time = 3000; 1622 1623 if( that.settings.blocked_content_notify_auto_shutdown_time ) 1624 { 1625 blocked_content_notify_auto_shutdown_time = that.settings.blocked_content_notify_auto_shutdown_time; 1626 } 1627 1628 setTimeout( function() { 1629 1630 try { 1631 1632 that.blocked_content_notification.style.opacity = 0; 1633 that.blocked_content_notification.style.display = 'block'; 1634 1635 anime( { 1636 targets: that.blocked_content_notification, 1637 easing: 'easeInOutQuad', 1638 duration: 150, 1639 opacity: 1, 1640 complete: function(anim) { 1641 } 1642 } ); 1643 1644 if( that.blocked_content_notification.classList.contains( 'autoShutDown' ) ) 1645 { 1646 setTimeout( function() { 1647 1648 1649 setTimeout( function() { 1650 that.blocked_content_notification.style.display = 'none'; 1651 }, 150 ); 1652 1653 anime( { 1654 targets: that.blocked_content_notification, 1655 easing: 'easeInOutQuad', 1656 duration: 150, 1657 opacity: 0, 1658 complete: function(anim) { 1659 that.blocked_content_notification.style.display = 'none'; 1660 } 1661 } ); 1662 1663 }, blocked_content_notify_auto_shutdown_time ); 1664 } 1665 } 1666 catch( error ) 1667 { 1668 console.error( error ); 1669 } 1670 1671 }, 1000 ); 1672 } 1673 } 1674 } 1675 else 1676 { 1677 if( that.blocked_content_notification ) 1678 { 1679 1680 setTimeout( function() { 1681 that.blocked_content_notification.style.display = 'none'; 1682 }, 150 ); 1683 1684 anime( { 1685 targets: that.blocked_content_notification, 1686 easing: 'easeInOutQuad', 1687 duration: 150, 1688 opacity: 0, 1689 complete: function(anim) { 1690 that.blocked_content_notification.style.display = 'none'; 1691 } 1692 } ); 1693 } 1694 } 1695 1696 this.administratorNotices(); 1697 1698 } 1699 catch( error ) 1700 { 1701 console.error( error ); 1702 } 1703 }, 1704 1705 displayBar: function() 1706 { 1707 try { 1708 1709 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function displayBar' ); 1710 1711 //for preserving scope 1712 var that = this; 1713 1714 //animation 1715 var that_animation = that.bar_elm.getAttribute( 'data-animation' ); 1716 1717 var that_id_selector = '#' + that.bar_elm.getAttribute( 'id' ); 1718 1719 var animation_params = { 1720 targets: that_id_selector, 1721 easing: 'easeInOutQuad', 1722 duration: 1000 1723 }; 1724 1725 var y_value = '0vh'; 1726 var x_value = '0vw'; 1727 1728 if( that.bar_elm.classList.contains( 'map_floating_banner' ) ) 1729 { 1730 y_value = '3vh'; 1731 x_value = '3vw'; 1732 } 1733 1734 var element = document.querySelector( that_id_selector ); 1735 1736 switch( that_animation ) 1737 { 1738 case 'slide': 1739 1740 if( element.className.includes( 'mapPositionBottom' ) ) 1741 { 1742 element.style.bottom = '-100vh'; 1743 animation_params['bottom'] = y_value; 1744 } 1745 else if( element.className.includes( 'mapPositionTop' ) ) 1746 { 1747 element.style.top = '-100vh'; 1748 animation_params['top'] = y_value; 1749 } 1750 else if( element.className.includes( 'mapPositionCenterLeft' ) ) 1751 { 1752 element.style.left = '-100vw'; 1753 animation_params['left'] = x_value; 1754 } 1755 else if( element.className.includes( 'mapPositionCenterCenter' ) ) 1756 { 1757 element.style.top = '-100%'; 1758 animation_params['top'] = '50%'; 1759 } 1760 else if( element.className.includes( 'mapPositionCenterRight' ) ) 1761 { 1762 element.style.right = '-100vw'; 1763 animation_params['right'] = x_value; 1764 } 1765 1766 element.style.display = 'block'; 1767 1768 anime( animation_params ); 1769 break; 1770
1771 case 'fade': 1772 element.style.opacity = '0'; 1773 1774 element.style.display = 'block'; 1775 1776 animation_params['opacity'] = '1'; 1777 animation_params['duration'] = '500'; 1778 1779 anime( animation_params ); 1780 1781 break; 1782 1783 case 'zoom': 1784 element.style.transform = 'scale(0)'; 1785 1786 element.style.display = 'block'; 1787 1788 animation_params['scale'] = '1'; 1789 anime( animation_params ); 1790 1791 break; 1792 1793 default: // no animation -> value = "none" 1794 element.style.display = 'block'; 1795 1796 break; 1797 } 1798 1799 setTimeout( function() { 1800 that.showagain_elm.style.display = 'none'; 1801 }, 150 ); 1802 1803 anime( { 1804 targets: that.showagain_elm, 1805 easing: 'easeInOutQuad', 1806 duration: 150, 1807 opacity: 0, 1808 complete: function( anim ) { 1809 that.showagain_elm.style.display = 'none'; 1810 } 1811 } ); 1812 1813 that.bar_open = true; 1814 1815 that.optimizeMobile(); 1816 1817 } 1818 catch( error ) 1819 { 1820 console.error( error ); 1821 } 1822 1823 }, 1824 1825 hideBar: function() 1826 { 1827 try { 1828 1829 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function hideBar' ); 1830 1831 //for preserving scope 1832 var that = this; 1833 1834 if( Boolean( this.settings.showagain_tab ) ) 1835 { 1836 //show 1837 that.showagain_elm.style.opacity = 0; 1838 that.showagain_elm.style.display = 'block'; 1839 1840 anime( { 1841 targets: this.showagain_elm, 1842 easing: 'easeInOutQuad', 1843 duration: 150, 1844 opacity: 1, 1845 complete: function(anim) { 1846 } 1847 } ); 1848 } 1849 else 1850 { 1851 setTimeout( function() { 1852 that.showagain_elm.style.display = 'none'; 1853 }, 150 ); 1854 1855 //hide 1856 anime( { 1857 targets: this.showagain_elm, 1858 easing: 'easeInOutQuad', 1859 duration: 150, 1860 opacity: 0, 1861 complete: function(anim) { 1862 that.showagain_elm.style.display = 'none'; 1863 } 1864 }); 1865 } 1866 1867 //hide 1868 //animation 1869 var that_animation = this.bar_elm.getAttribute( 'data-animation' ); 1870 1871 var that_id_selector = '#' + this.bar_elm.getAttribute( 'id' ); 1872 1873 setTimeout( function() { 1874 MAP.bar_elm.style.display = 'none'; 1875 }, 150 ); 1876 1877 var animation_params = { 1878 targets: that_id_selector, 1879 easing: 'easeInOutQuad', 1880 duration: 700, 1881 complete: function( anim ) { 1882 MAP.bar_elm.style.display = 'none'; 1883 } 1884 }; 1885 1886 switch( that_animation ) 1887 { 1888 case 'slide': 1889 1890 if( this.bar_elm.className.includes( 'mapPositionBottom' ) ) 1891 { 1892 animation_params['bottom'] = '-100vh'; 1893 } 1894 else if( this.bar_elm.className.includes( 'mapPositionTop' ) ) 1895 { 1896 animation_params['top'] = '-100vh'; 1897 } 1898 else if( this.bar_elm.className.includes( 'mapPositionCenterLeft' ) ) 1899 { 1900 animation_params['left'] = '-100vw'; 1901 } 1902 else if( this.bar_elm.className.includes( 'mapPositionCenterCenter' ) ) 1903 { 1904 animation_params['top'] = '-100%'; 1905 } 1906 else if( this.bar_elm.className.includes( 'mapPositionCenterRight' ) ) 1907 { 1908 animation_params['right'] = '-100vw'; 1909 } 1910 1911 anime( animation_params ); 1912 break; 1913 1914 case 'fade': 1915 1916 animation_params['opacity'] = '0'; 1917 animation_params['duration'] = '500'; 1918 1919 anime( animation_params ); 1920 1921 break; 1922 1923 case 'zoom': 1924 1925 animation_params['scale'] = '0'; 1926 anime( animation_params ); 1927 1928 1929 break; 1930 1931 default: // no animation -> value = "none" 1932 this.bar_elm.style.display = 'none'; 1933 1934 break; 1935 } 1936 1937 1938 1939 this.bar_open = false; 1940 1941 (async() => { 1942 1943 while( !MAP_SYS.map_document_load ) 1944 { 1945 //console.log( 'not defined yet' ); 1946 await new Promise( resolve => setTimeout( resolve, 10 ) ); 1947 } 1948 1949 if( typeof window.MAPIABTCF_hideCMPUI === 'function' ) 1950 { 1951 window.MAPIABTCF_hideCMPUI(); 1952 } 1953 1954 })(); 1955 1956 } 1957 catch( error ) 1958 { 1959 console.error( error ); 1960 } 1961 }, 1962 1963 optimizeMobile: function() 1964 { 1965 //for preserving scope 1966 var that = this; 1967 1968 setTimeout( function() { 1969 1970 try { 1971 1972 if( that.bar_open ) 1973 { 1974 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'optimizing for mobile view' ); 1975 1976 var viewport_width = window.innerWidth; 1977 1978 if( viewport_width <= 450 ) 1979 { 1980 var viewport_height = window.innerHeight; 1981 var internal_height = viewport_height - 250; 1982 1983 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'map mobile optimizing: viewport_width=' + viewport_width + ' , internal_height=' + internal_height ); 1984 1985 that.map_notification_message.classList.add( 'extraNarrow' ); 1986 that.map_notification_message.style.maxHeight = internal_height + 'px'; 1987 } 1988 else 1989 { 1990 that.map_notification_message.classList.remove( 'extraNarrow' ); 1991 that.map_notification_message.style.maxHeight = ''; 1992 } 1993 } 1994 1995 that.setOverflowMaxHeight(); 1996 1997 } 1998 catch( error ) 1999 { 2000 console.error( error ); 2001 } 2002 2003 }, 400 ); 2004 }, 2005 2006 accept_close: function() 2007 { 2008 //for preserving scope 2009 var that = this; 2010 2011 try { 2012 2013 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function accept_close' ); 2014
2015 MAP_Cookie.set( MAP_ACCEPTED_ALL_COOKIE_NAME, '1', MAP_SYS.map_cookie_expire ); 2016 2017 //animation 2018 var that_animation = this.bar_elm.getAttribute( 'data-animation' ); 2019 2020 var that_id_selector = '#' + this.bar_elm.getAttribute( 'id' ); 2021 2022 var animation_params = { 2023 targets: that_id_selector, 2024 easing: 'easeInOutQuad', 2025 duration: 700, 2026 complete: function( anim ) { 2027 MAP.bar_elm.style.display = 'none'; 2028 2029 } 2030 }; 2031 2032 switch( that_animation ) 2033 { 2034 case 'slide': 2035 if( this.bar_elm.className.includes( 'mapPositionBottom' ) ) { 2036 animation_params['bottom'] = '-100vh'; 2037 } 2038 else if( this.bar_elm.className.includes( 'mapPositionTop' ) ) { 2039 animation_params['top'] = '-100vh'; 2040 } 2041 else if( this.bar_elm.className.includes( 'mapPositionCenterLeft' ) ) { 2042 animation_params['left'] = '-100vw'; 2043 } 2044 else if( this.bar_elm.className.includes( 'mapPositionCenterCenter' ) ) { 2045 animation_params['top'] = '-100%'; 2046 } 2047 else if( this.bar_elm.className.includes( 'mapPositionCenterRight' ) ) { 2048 animation_params['right'] = '-100vw'; 2049 } 2050 2051 anime( animation_params ); 2052 break; 2053 2054 case 'fade': 2055 2056 animation_params['opacity'] = '0'; 2057 animation_params['duration'] = '500'; 2058 2059 anime( animation_params ); 2060 2061 break; 2062 2063 case 'zoom': 2064 2065 animation_params['scale'] = '0'; 2066 anime( animation_params ); 2067 2068 break; 2069 2070 default: // no animation -> value = "none" 2071 this.bar_elm.style.display = 'none'; 2072 break; 2073 } 2074 2075 if( Boolean( that.settings.showagain_tab ) ) 2076 { 2077 that.showagain_elm.style.opacity = 0; 2078 that.showagain_elm.style.display = 'block'; 2079 2080 anime( { 2081 targets: that.showagain_elm, 2082 easing: 'easeInOutQuad', 2083 duration: 150, 2084 opacity: 1, 2085 complete: function(anim) { 2086 } 2087 } ); 2088 } 2089 2090 that.tryToUnblockScripts( true ); 2091 2092 (async() => { 2093 2094 while( !MAP_SYS.map_document_load ) 2095 { 2096 //console.log( 'not defined yet' ); 2097 await new Promise( resolve => setTimeout( resolve, 10 ) ); 2098 } 2099 2100 if( typeof window.MAPIABTCF_hideCMPUI === 'function' ) 2101 { 2102 window.MAPIABTCF_hideCMPUI(); 2103 } 2104 2105 })(); 2106 2107 return false; 2108 2109 } 2110 catch( error ) 2111 { 2112 console.error( error ); 2113 } 2114 }, 2115 2116 reject_close: function() 2117 { 2118 //for preserving scope 2119 var that = this; 2120 2121 try { 2122 2123 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function reject_close' ); 2124 2125 MAP_Cookie.set( MAP_ACCEPTED_ALL_COOKIE_NAME, '-1', MAP_SYS.map_cookie_expire ); 2126 2127 //animation 2128 var that_animation = that.bar_elm.getAttribute( 'data-animation' ); 2129 2130 var that_id_selector = '#' + that.bar_elm.getAttribute( 'id' ); 2131 2132 var animation_params = { 2133 targets: that_id_selector, 2134 easing: 'easeInOutQuad', 2135 duration: 700, 2136 complete: function( anim ) { 2137 MAP.bar_elm.style.display = 'none'; 2138 } 2139 }; 2140 2141 switch( that_animation ) 2142 { 2143 case 'slide': 2144 2145 if( that.bar_elm.className.includes( 'mapPositionBottom' ) ) 2146 { 2147 animation_params['bottom'] = '-100vh'; 2148 } 2149 else if( that.bar_elm.className.includes( 'mapPositionTop' ) ) 2150 { 2151 animation_params['top'] = '-100vh'; 2152 } 2153 else if( that.bar_elm.className.includes( 'mapPositionCenterLeft' ) ) 2154 { 2155 animation_params['left'] = '-100vw'; 2156 } 2157 else if( that.bar_elm.className.includes( 'mapPositionCenterRight' ) ) 2158 { 2159 animation_params['right'] = '-100vw'; 2160 } 2161 2162 anime( animation_params ); 2163 break; 2164 2165 case 'fade': 2166 2167 animation_params['opacity'] = '0'; 2168 animation_params['duration'] = '500'; 2169 2170 anime( animation_params ); 2171 2172 break; 2173 2174 case 'zoom': 2175 2176 animation_params['scale'] = '0'; 2177 anime( animation_params ); 2178 2179 2180 break; 2181 2182 default: // no animation -> value = "none" 2183 that.bar_elm.style.display = 'none'; 2184 2185 break; 2186 } 2187 2188 that.bar_open = false; 2189 2190 if( Boolean( that.settings.showagain_tab ) ) 2191 { 2192 that.showagain_elm.style.opacity = 0; 2193 that.showagain_elm.style.display = 'block'; 2194 2195 anime( { 2196 targets: that.showagain_elm, 2197 easing: 'easeInOutQuad', 2198 duration: 150, 2199 opacity: 1, 2200 complete: function(anim) { 2201 } 2202 } ); 2203 } 2204 2205 that.tryToUnblockScripts( true ); 2206 2207 setTimeout( function() { 2208 that.checkBlockedContent(); 2209 }, 200 ); 2210 2211 (async() => { 2212 2213 while( !MAP_SYS.map_document_load ) 2214 { 2215 //console.log( 'not defined yet' ); 2216 await new Promise( resolve => setTimeout( resolve, 10 ) ); 2217 } 2218 2219 if( typeof window.MAPIABTCF_hideCMPUI === 'function' ) 2220 { 2221 window.MAPIABTCF_hideCMPUI(); 2222 } 2223 2224 })(); 2225 2226 return false;
2227 2228 } 2229 catch( error ) 2230 { 2231 console.error( error ); 2232 } 2233 }, 2234 2235 tryToUnblockScripts: function( from_user_interaction = false ) 2236 { 2237 try { 2238 2239 let need_reload = false; 2240 let do_calc_need_reload = false; 2241 2242 if( from_user_interaction ) 2243 { 2244 do_calc_need_reload = true; 2245 } 2246 2247 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + `tryToUnblockScripts from_user_interaction=${from_user_interaction}` ); 2248 2249 //for preserving scope 2250 var that = this; 2251 2252 var once_functions_to_execute = []; 2253 2254 var $map_cookie_description_wrapper = that.settingsModal.querySelectorAll( '.map_cookie_description_wrapper' ); 2255 2256 $map_cookie_description_wrapper.forEach( function( $this ) { 2257 2258 var baseIndex = $this.getAttribute('data-cookie-baseindex'); 2259 var cookieName = 'map_cookie_' + baseIndex + MAP_POSTFIX; 2260 var api_key = $this.getAttribute('data-cookie-api-key'); 2261 2262 if( do_calc_need_reload && $this.classList.contains( 'map_page_reload_on_user_consent' ) ) 2263 { 2264 need_reload = true; 2265 } 2266 2267 var cookieValue = MAP_Cookie.read( cookieName ); 2268 2269 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'debug ' + api_key + ' ' + cookieName + ' ' + cookieValue ); 2270 2271 var always_on = false; 2272 var activate_anyway = false; 2273 2274 if( $this.classList.contains( '_always_on' ) ) 2275 { 2276 always_on = true; 2277 } 2278 2279 //advanced consent mode ga4 2280 if( api_key == 'google_analytics' && 2281 typeof map_full_config !== 'undefined' && 2282 typeof map_full_config.cookie_api_key_not_to_block !== 'undefined' 2283 && map_full_config?.cookie_api_key_not_to_block?.includes( 'google_analytics' ) 2284 ) 2285 { 2286 activate_anyway = true; 2287 } 2288 2289 var accepted_all = false; 2290 2291 if( ( MAP_Cookie.exists( MAP_ACCEPTED_ALL_COOKIE_NAME ) && MAP_Cookie.read( cookieName ) == '1' ) ) 2292 { 2293 accepted_all = true; 2294 } 2295 2296 if( cookieValue == "1" || 2297 always_on || 2298 activate_anyway || 2299 accepted_all ) 2300 { 2301 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + '-->activating api_key=' + api_key + ' cookieName=' + cookieName + ' cookieValue=' + cookieValue + ' always_on=' + always_on + ' accepted_all=' + accepted_all ); 2302 2303 if( activate_anyway ) 2304 { 2305 $this.classList.add( '_is_activated_anyway' ); 2306 } 2307 else 2308 { 2309 $this.classList.add( '_is_activated' ); 2310 } 2311 2312 if( $this.classList.contains( '_with_code' ) ) 2313 { 2314 var $the_script = document.querySelector( 'script.my_agile_privacy_activate._js_noscript_type_mode[data-cookie-baseindex="'+baseIndex+'"]' ); 2315 2316 var $the_raw_script = document.querySelector( 'textarea.my_agile_privacy_activate._raw_type_mode[data-cookie-baseindex="'+baseIndex+'"]' ); 2317 2318 if( $the_script ) 2319 { 2320 if( !$the_script.classList.contains( '_is_activated' ) ) 2321 { 2322 $the_script.classList.add( '_is_activated' ); 2323 2324 var script = document.createElement( 'script' ); 2325 script.className = '_is_activated'; 2326 script.innerHTML = $the_script.innerHTML; 2327 2328 if( MAP_SYS?.map_debug ) console.debug( script.innerHTML ); 2329 2330 document.head.appendChild( script ); 2331 } 2332 } 2333 2334 if( $the_raw_script ) 2335 { 2336 if( !$the_raw_script.classList.contains( '_is_activated' ) ) 2337 { 2338 $the_raw_script.classList.add( '_is_activated' ); 2339 2340 var the_raw_script = $the_raw_script.value; 2341 2342 if( MAP_SYS?.map_debug ) console.debug( the_raw_script ); 2343 2344 var range = document.createRange(); 2345 range.selectNode( document.getElementsByTagName("body")[0] ); 2346 var documentFragment = range.createContextualFragment( the_raw_script ); 2347 document.body.appendChild( documentFragment ); 2348 } 2349 2350 } 2351 } 2352 2353 if( !!api_key ) 2354 { 2355 //bof custom notify 2356 var $custom_ref = document.querySelectorAll( '.map_custom_notify.map_api_key_' + api_key ); 2357 2358 $custom_ref.forEach(function( $_this ){ 2359 2360 if( $_this ) 2361 { 2362 var on_unblock_remove_class = $_this.getAttribute( 'data-on-unblock-remove-class' ); 2363 2364 if( on_unblock_remove_class ) 2365 { 2366 var $the_blocked_content = document.querySelectorAll( '.my_agile_privacy_activate[data-cookie-api-key="' + api_key + '"]' ); 2367 2368 $the_blocked_content.forEach( $thisent =>
2368 $thisent.classList.remove( on_unblock_remove_class ) ); 2369 } 2370 2371 $_this.remove(); 2372 } 2373 }); 2374 2375 //eof custom notify 2376 2377 var $map_src_script_blocked = document.querySelectorAll( 'script.my_agile_privacy_activate.autoscan_mode.map_src_script_blocked[data-cookie-api-key="'+api_key+'"]' ); 2378 2379 var $map_inline_script_blocked = document.querySelectorAll( 'script.my_agile_privacy_activate.autoscan_mode.map_inline_script_blocked[data-cookie-api-key="'+api_key+'"]' ); 2380 2381 var $iframe_src_blocked = document.querySelectorAll( 'iframe.my_agile_privacy_activate.autoscan_mode.iframe_src_blocked[data-cookie-api-key="'+api_key+'"]' ); 2382 2383 var $css_href_blocked = document.querySelectorAll( 'link.my_agile_privacy_activate.autoscan_mode.css_href_blocked[data-cookie-api-key="'+api_key+'"]' ); 2384 2385 var $img_src_blocked = document.querySelectorAll( 'img.my_agile_privacy_activate.autoscan_mode.img_src_blocked[data-cookie-api-key="'+api_key+'"]' ); 2386 2387 if( !!$map_src_script_blocked && $map_src_script_blocked?.length ) 2388 { 2389 $map_src_script_blocked.forEach( function( $_this ) { 2390 2391 if( !$_this.classList.contains( '_is_activated' ) ) 2392 { 2393 if( !$_this.classList.contains( 'mapWait' ) ) 2394 { 2395 $_this.classList.add( '_is_activated' ); 2396 } 2397 2398 if( $_this.classList.contains( 'custom_patch_apply' ) ) 2399 { 2400 var classes = $_this.className.split(' '); 2401 2402 classes.forEach(function(v) { 2403 if(v && v != '' && v.startsWith('map_trigger_custom_patch_') && typeof window[v] === 'function') { 2404 setTimeout( function() { 2405 window[v](); 2406 }, 4000 ); 2407 } 2408 }); 2409 } 2410 2411 if( $_this.classList.contains( 'once_custom_patch_apply' ) ) 2412 { 2413 var classes = $_this.className.split(' '); 2414 2415 classes.forEach(function(v) { 2416 if(v && v != '' && v.startsWith('map_trigger_custom_patch_') && typeof window[v] === 'function') { 2417 if( !once_functions_to_execute.includes( v )) { 2418 once_functions_to_execute.push( v ); 2419 } 2420 } 2421 }); 2422 } 2423 2424 if( $_this.classList.contains( 'mapWait' ) ) 2425 { 2426 setTimeout( function() { 2427 2428 //prevent block using createElementBackup 2429 var script = document.createElementBackup( 'script' ); 2430 script.className = '_is_activated'; 2431 script.setAttribute( 'type','text/javascript' ); 2432 2433 script = cloneNodeAttributeToAnother( $_this, script ); 2434 2435 var blocked_src = $_this.getAttribute( 'unblocked_src' ); 2436 2437 if( blocked_src ) 2438 { 2439 script.src = blocked_src; 2440 } 2441 2442 $_this.insertAdjacentElement( 'afterend', script ); 2443 2444 $_this.classList.add( '_is_activated' ); 2445 2446 }, 2000); 2447 } 2448 else 2449 { 2450 //prevent block using createElementBackup 2451 var script = document.createElementBackup( 'script' ); 2452 script.className = '_is_activated'; 2453 script.setAttribute( 'type','text/javascript' ); 2454 2455 script = cloneNodeAttributeToAnother( $_this, script ); 2456 2457 var blocked_src = $_this.getAttribute( 'unblocked_src' ); 2458 2459 if( blocked_src ) 2460 { 2461 script.src = blocked_src; 2462 } 2463 2464 $_this.insertAdjacentElement( 'afterend', script ); 2465 } 2466 } 2467 2468 }); 2469 2470 } 2471 2472 if( !!$map_inline_script_blocked && $map_inline_script_blocked?.length ) 2473 { 2474 $map_inline_script_blocked.forEach( function( $_this ) { 2475 2476 if( !$_this.classList.contains( '_is_activated' ) ) 2477 { 2478 if( !$_this.classList.contains('mapWait') ) 2479 { 2480 $_this.classList.add( '_is_activated' ); 2481 } 2482 2483 if( $_this.classList.contains( 'custom_patch_apply' ) ) 2484 { 2485 var classes = $_this.className.split(' '); 2486 2487 classes.forEach( function(v) { 2488 if( v && v != '' && v.startsWith('map_trigger_custom_patch_') && typeof window[v] === 'function' ) 2489 { 2490 setTimeout( function() { 2491 window[v](); 2492 }, 2200); 2493 } 2494 }); 2495 } 2496 2497 if( $_this.classList.contains( 'once_custom_patch_apply' ) ) 2498 { 2499 var classes = $_this.className.split(' '); 2500
2501 classes.forEach( function(v) { 2502 if( v && v != '' && v.startsWith('map_trigger_custom_patch_') && typeof window[v] === 'function' ) 2503 { 2504 if(!once_functions_to_execute.includes( v )) { 2505 once_functions_to_execute.push( v ); 2506 } 2507 } 2508 }); 2509 } 2510 2511 if( $_this.classList.contains( 'mapWait' ) ) 2512 { 2513 setTimeout( function() { 2514 var script = document.createElement( 'script' ); 2515 script.className = '_is_activated'; 2516 script.innerHTML = $_this.innerHTML; 2517 2518 if( MAP_SYS?.map_debug ) console.debug( script.innerHTML ); 2519 2520 document.head.appendChild( script ); 2521 2522 $_this.classList.add( '_is_activated' ); 2523 2524 }, 2200); 2525 } 2526 else 2527 { 2528 var script = document.createElement( 'script' ); 2529 script.className = '_is_activated'; 2530 script.innerHTML = $_this.innerHTML; 2531 2532 if( MAP_SYS?.map_debug ) console.debug( script.innerHTML ); 2533 2534 document.head.appendChild( script ); 2535 } 2536 } 2537 2538 }); 2539 2540 } 2541 2542 if( !!$iframe_src_blocked && $iframe_src_blocked?.length ) 2543 { 2544 $iframe_src_blocked.forEach( function( $_this ) { 2545 2546 if( !$_this.classList.contains( '_is_activated' ) ) 2547 { 2548 $_this.classList.add( '_is_activated' ); 2549 2550 $_this.setAttribute( 'src', $_this.getAttribute( 'unblocked_src' ) ); 2551 2552 $_this.style.display = 'block'; 2553 2554 var $ref = document.querySelectorAll( '.map_inline_notify[data-cookie-api-key="' + api_key + '"]'); 2555 2556 if( !!$ref && $ref?.length ) 2557 { 2558 $ref.forEach( function( $_ref ) { 2559 $_ref.remove(); 2560 }); 2561 } 2562 } 2563 }); 2564 } 2565 2566 if( !!$css_href_blocked && $css_href_blocked?.length ) 2567 { 2568 $css_href_blocked.forEach( function( $_this ) { 2569 2570 if( !$_this.classList.contains( '_is_activated' ) ) 2571 { 2572 $_this.classList.add( '_is_activated' ); 2573 2574 $_this.setAttribute( 'href', $_this.getAttribute( 'unblocked_href' ) ); 2575 } 2576 }); 2577 } 2578 2579 if( !!$img_src_blocked && $img_src_blocked?.length ) 2580 { 2581 $img_src_blocked.forEach( function( $_this ) { 2582 2583 if( !$_this.classList.contains( '_is_activated' ) ) 2584 { 2585 $_this.classList.add( '_is_activated' ); 2586 2587 $_this.setAttribute( 'src', $_this.getAttribute( 'unblocked_src' ) ); 2588 } 2589 }); 2590 } 2591 } 2592 } 2593 else 2594 { 2595 $this.classList.remove( '_is_activated' ); 2596 } 2597 2598 }); 2599 2600 if( need_reload ) 2601 { 2602 window.location.reload(); 2603 } 2604 2605 //execution of once custom patch functions 2606 once_functions_to_execute.forEach( function(v) { 2607 setTimeout( function() { 2608 window[v](); 2609 }, 1000 ); 2610 }); 2611 2612 setTimeout( function() { 2613 that.checkBlockedContent(); 2614 }, 500 ); 2615 2616 setTimeout( function() { 2617 var event = new Event('MAP_PRIVACY_CHANGE'); 2618 document.body.dispatchEvent(event); 2619 }, 100 ); 2620 2621 } 2622 catch( error ) 2623 { 2624 console.error( error ); 2625 } 2626 }, 2627 2628 //init user preferences and bind events 2629 //with only_init_status==true events are not binded 2630 userPreferenceInit: function( only_init_status = false ) 2631 { 2632 try { 2633 2634 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'userPreferenceInit only_init_status='+only_init_status ); 2635 2636 //for preserving scope 2637 var that = this; 2638 2639 //init part (cookie consent) 2640 that.settingsModal.querySelectorAll( '.map-user-preference-checkbox' ).forEach( function( $this ) { 2641 2642 var cookieName = 'map_cookie_' + $this.getAttribute('data-cookie-baseindex') + MAP_POSTFIX; 2643 2644 var cookieValue = MAP_Cookie.read( cookieName ); 2645 if( cookieValue == null ) 2646 { 2647 if( $this.checked ) 2648 { 2649 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting 1 to cookieName=' + cookieName ); 2650 2651 MAP_Cookie.set( cookieName, '1', MAP_SYS.map_cookie_expire ); 2652 } 2653 else 2654 { 2655 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting -1 to cookieName' + cookieName ); 2656 2657 MAP_Cookie.set( cookieName, '-1', MAP_SYS.map_cookie_expire ); 2658 } 2659 } 2660 else 2661 { 2662 if( cookieValue == "1" ) 2663 { 2664 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting checked for c
2664ookieName' + cookieName ); 2665 2666 $this.checked = true; 2667 } 2668 else 2669 { 2670 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting unchecked for cookieName' + cookieName ); 2671 2672 $this.checked = false; 2673 } 2674 } 2675 }); 2676 2677 //click event 2678 if( only_init_status == false ) 2679 { 2680 that.settingsModal.querySelectorAll( '.map-user-preference-checkbox' ).forEach(function($this) { 2681 $this.addEventListener('click', function(e) { 2682 2683 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-user-preference-checkbox click' ); 2684 2685 e.stopImmediatePropagation(); 2686 2687 var cookieName = 'map_cookie_' + $this.getAttribute('data-cookie-baseindex') + MAP_POSTFIX; 2688 2689 var currentToggleElm = that.settingsModal.querySelectorAll( '.map-user-preference-checkbox[data-cookie-baseindex="'+$this.getAttribute('data-cookie-baseindex')+'"]' ); 2690 2691 if( $this.checked ) 2692 { 2693 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting 1 to cookieName=' + cookieName ); 2694 2695 MAP_Cookie.set( cookieName, '1', MAP_SYS.map_cookie_expire ); 2696 currentToggleElm.forEach( elm => elm.checked = true ); 2697 } 2698 else 2699 { 2700 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting -1 to cookieName' + cookieName ); 2701 2702 MAP_Cookie.set( cookieName, '-1', MAP_SYS.map_cookie_expire ); 2703 currentToggleElm.forEach( elm => elm.checked = false ); 2704 } 2705 2706 MAP_Cookie.set( MAP_ACCEPTED_SOMETHING_COOKIE_NAME, '1', MAP_SYS.map_cookie_expire ); 2707 MAP_Cookie.set( MAP_ACCEPTED_ALL_COOKIE_NAME, '-1', MAP_SYS.map_cookie_expire ); 2708 2709 that.tryToUnblockScripts( true ); 2710 2711 }); 2712 }); 2713 } 2714 2715 //bof init part ( consent mode) 2716 that.settingsModal.querySelectorAll( '.map-consent-mode-preference-checkbox' ).forEach( function( $this ) { 2717 2718 var consent_key = $this.getAttribute( 'data-consent-key' ); 2719 2720 var consentStatus = that.getGoogleConsentStatus( consent_key ); 2721 2722 if( consentStatus === 'granted' ) 2723 { 2724 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting checked for consent_key' + consent_key ); 2725 2726 $this.checked = true; 2727 } 2728 else if( consentStatus === 'denied' ) 2729 { 2730 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'setting unchecked for consent_key' + consent_key ); 2731 2732 $this.checked = false; 2733 } 2734 }); 2735 //eof init part ( consent mode) 2736 2737 //bof consent mode - click event 2738 if( only_init_status == false ) 2739 { 2740 that.settingsModal.querySelectorAll( '.map-consent-mode-preference-checkbox' ).forEach(function($this) { 2741 $this.addEventListener('click', function(e) { 2742 2743 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-consent-mode-preference-checkbox click' ); 2744 2745 e.stopImmediatePropagation(); 2746 2747 var consent_key = $this.getAttribute( 'data-consent-key' ); 2748 2749 var currentToggleElm = that.settingsModal.querySelectorAll( '.map-consent-mode-preference-checkbox[data-consent-key="' + consent_key + '"]' ); 2750 2751 if( $this.checked ) 2752 { 2753 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + `setting granted to consent_key=${consent_key}` ); 2754 2755 that.updateGoogleConsent( consent_key, 'granted', true ); 2756 2757 currentToggleElm.forEach( elm => elm.checked = true ); 2758 } 2759 else 2760 { 2761 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + `setting denied to consent_key=${consent_key}` ); 2762 2763 that.updateGoogleConsent( consent_key, 'denied', true ); 2764 2765 currentToggleElm.forEach( elm => elm.checked = false ); 2766 } 2767 2768 MAP_Cookie.set( MAP_ACCEPTED_SOMETHING_COOKIE_NAME, '1', MAP_SYS.map_cookie_expire ); 2769 MAP_Cookie.set( MAP_ACCEPTED_ALL_COOKIE_NAME, '-1', MAP_SYS.map_cookie_expire ); 2770 2771 2772 }); 2773 }); 2774 } 2775 //eof consent mode - click event 2776 2777 if( only_init_status == false ) 2778 { 2779 //bof iab part - click event 2780 that.settingsModal.addEventListener( 'click', function( e ) { 2781 2782 var $this = e.target; 2783 2784 if( $this.matches( '.map-user-iab-preference-checkbox' ) ) 2785 { 2786 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-u
2786ser-iab-preference-checkbox click' ); 2787 2788 e.stopImmediatePropagation(); 2789 2790 var iab_category = $this.getAttribute( 'data-iab-category' ); 2791 var iab_key = $this.getAttribute( 'data-iab-key' ); 2792 var currentToggleElm = that.settingsModal.querySelectorAll( '.map-user-preference-checkbox[data-cookie-baseindex='+ $this.getAttribute('data-cookie-baseindex') + ']' ); 2793 2794 if( $this.checked ) 2795 { 2796 2797 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + `setting 1 to iab_category=${iab_category} , iab_key=${iab_key}` ); 2798 2799 (async() => { 2800 while (!MAP_SYS.map_document_load) { 2801 // console.log( 'not defined yet' ); 2802 await new Promise(resolve => setTimeout(resolve, 10)); 2803 } 2804 2805 if( typeof window.MAPIABTCF_updateConsent === 'function' ) 2806 { 2807 let updateHtml = false; 2808 if( iab_category === 'googleVendors' ) updateHtml = true; 2809 2810 window.MAPIABTCF_doSetUserInteraction(); 2811 window.MAPIABTCF_updateConsent( iab_category, parseInt( iab_key ), true, true, updateHtml ); 2812 } 2813 2814 })(); 2815 2816 currentToggleElm.forEach(elm => elm.checked = true); 2817 } 2818 else 2819 { 2820 2821 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + `setting 0 to iab_category=${iab_category} , iab_key=${iab_key}` ); 2822 2823 (async() => { 2824 while (!MAP_SYS.map_document_load) { 2825 // console.log( 'not defined yet' ); 2826 await new Promise(resolve => setTimeout(resolve, 10)); 2827 } 2828 2829 if( typeof window.MAPIABTCF_updateConsent === 'function' ) 2830 { 2831 let updateHtml = false; 2832 if(iab_category === 'googleVendors') updateHtml = true; 2833 2834 window.MAPIABTCF_doSetUserInteraction(); 2835 window.MAPIABTCF_updateConsent( iab_category, parseInt( iab_key ), false, true, updateHtml ); 2836 } 2837 2838 })(); 2839 2840 currentToggleElm.forEach(elm => elm.checked = false); 2841 } 2842 } 2843 2844 }); 2845 //eof iab part - click event 2846 2847 //bof iab part - deny all / accept all event 2848 that.settingsModal.addEventListener( 'click', function( e ) { 2849 var target = e.target; 2850 if( target.matches( '.map-privacy-iab-tcf-accept-all-button' ) ) 2851 { 2852 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-privacy-iab-tcf-accept-all-button click' ); 2853 2854 e.stopImmediatePropagation(); 2855 2856 that.settingsModal.querySelectorAll( '.map-user-iab-preference-checkbox ').forEach(function( $_this ) { 2857 $_this.checked = true; 2858 }); 2859 2860 (async() => { 2861 while (!MAP_SYS.map_document_load) { 2862 // console.log( 'not defined yet' ); 2863 await new Promise(resolve => setTimeout( resolve, 10 )); 2864 } 2865 2866 if( typeof window.MAPIABTCF_acceptAllConsent === 'function' ) 2867 { 2868 window.MAPIABTCF_doSetUserInteraction(); 2869 window.MAPIABTCF_acceptAllConsent( true ); 2870 } 2871 2872 })(); 2873 } 2874 }); 2875 2876 that.settingsModal.addEventListener( 'click', function( e ) { 2877 var target = e.target; 2878 if( target.matches( '.map-privacy-iab-tcf-deny-all-button' ) ) { 2879 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map-privacy-iab-tcf-deny-all-button' ); 2880 2881 e.stopImmediatePropagation(); 2882 2883 that.settingsModal.querySelectorAll( '.map-user-iab-preference-checkbox' ).forEach( function( $elem ) { 2884 $elem.checked = false; 2885 }); 2886 2887 (async() => { 2888 while (!MAP_SYS.map_document_load) { 2889 // console.log( 'not defined yet' ); 2890 await new Promise(resolve => setTimeout(resolve, 10)); 2891 } 2892 2893 if( typeof window.MAPIABTCF_denyAllConsent === 'function' ) 2894 { 2895 window.MAPIABTCF_doSetUserInteraction(); 2896 window.MAPIABTCF_denyAllConsent( true ); 2897 } 2898 2899 })(); 2900 } 2901 }); 2902 //eof iab part - deny all / accept all event 2903 } 2904 2905 if( only_init_status == false ) 2906 { 2907 that.tryToUnblockScripts( false ); 2908 } 2909 2910 } 2911 catch( error ) 2912 { 2913 console.error( error ); 2914 } 2915 }, 2916 2917 showNotificationBar: function( message = null, success = null ) 2918 { 2919 try { 2920 2921 var body = document.querySelector( 'body' ); 2922 var bar = document.querySelector( '#mapx_notification_bar' ); 2923 2924 var prev_message = "<span class='mapx_close_notification_bar'>Close</span>"; 2925 2926 if( bar ) 2927 { 2928 prev_message = bar.innerHTML + "<br>"; 2929 } 2930 else 2931 {
2932 bar = document.createElement( 'div' ); 2933 bar.setAttribute( 'id','mapx_notification_bar' ); 2934 body.append( bar ); 2935 2936 2937 document.addEventListener( 'click', function (event) { 2938 if(!event.target.matches( '.mapx_close_notification_bar' )) return; 2939 2940 event.preventDefault(); 2941 2942 bar.parentNode.removeChild( bar ); 2943 2944 }, false); 2945 } 2946 2947 var final_message = prev_message + '<b>[MyAgilePrivacy admin-only notification]</b> ' + message; 2948 2949 if( success == 1 ) 2950 { 2951 final_message = final_message + ' <span class="mapx_proxification_success_true">OK!</span>'; 2952 } 2953 2954 if( success == 2 ) 2955 { 2956 final_message = final_message + ' <span class="mapx_proxification_success_false">ERROR!</span>'; 2957 } 2958 2959 if( success == null ) 2960 { 2961 final_message = final_message; 2962 } 2963 2964 bar.innerHTML = final_message; 2965 2966 } 2967 catch( error ) 2968 { 2969 console.error( error ); 2970 } 2971 2972 }, 2973 2974 administratorNotices: function() 2975 { 2976 try { 2977 2978 if( typeof MAP.settings !== 'undefined' && 2979 MAP.settings.internal_debug 2980 ) 2981 { 2982 if( !!MAP?.settings.scan_mode && 2983 MAP.settings.scan_mode == 'learning_mode' ) 2984 { 2985 const this_blocked_friendly_name = []; 2986 2987 if( map_full_config?.cookie_api_key_remote_id_map_active && 2988 typeof map_full_config.cookie_api_key_remote_id_map_active === 'object') 2989 { 2990 Object.entries( map_full_config.cookie_api_key_remote_id_map_active). 2991 forEach( ([key, value] ) => { 2992 2993 const friendlyName = map_full_config?.cookie_api_key_friendly_name_map?.[key]; 2994 2995 if( friendlyName?.desc ) 2996 { 2997 this_blocked_friendly_name.push( friendlyName?.desc ); 2998 } 2999 }); 3000 } 3001 3002 const this_blocked_friendly_name_unique = this_blocked_friendly_name.filter((v, i, a) => a.indexOf(v) === i); 3003 3004 if( this_blocked_friendly_name_unique.length ) 3005 { 3006 this.showNotificationBar( 'The Cookie Shield has detected the following cookies so far: ' +this_blocked_friendly_name_unique.join( ', ' ) + '.', null ); 3007 } 3008 else 3009 { 3010 this.showNotificationBar( 'The Cookie Shield has not detected any cookies.', null ); 3011 } 3012 } 3013 3014 if( !!MAP?.settings.scan_mode && 3015 MAP.settings.scan_mode == 'turned_off' ) 3016 { 3017 this.showNotificationBar( 'Cookie Shield is turned off. Enable it in order to block cookies.', null ); 3018 } 3019 } 3020 3021 } 3022 catch( error ) 3023 { 3024 console.error( error ); 3025 } 3026 }, 3027 3028 //slideUp equivalent function (hide) 3029 slideUp: function( target, duration=500, callback=null ) 3030 { 3031 try { 3032 3033 target.style.transitionProperty = 'height, margin, padding'; 3034 target.style.transitionDuration = duration + 'ms'; 3035 target.style.boxSizing = 'border-box'; 3036 target.style.height = target.scrollHeight + 'px'; 3037 target.offsetHeight; 3038 target.style.overflow = 'hidden'; 3039 target.style.height = 0; 3040 target.style.paddingTop = 0; 3041 target.style.paddingBottom = 0; 3042 target.style.marginTop = 0; 3043 target.style.marginBottom = 0; 3044 3045 window.setTimeout( () => { 3046 3047 try { 3048 3049 target.style.display = 'none'; 3050 target.style.removeProperty('height'); 3051 target.style.removeProperty('padding-top'); 3052 target.style.removeProperty('padding-bottom'); 3053 target.style.removeProperty('margin-top'); 3054 target.style.removeProperty('margin-bottom'); 3055 target.style.removeProperty('overflow'); 3056 target.style.removeProperty('transition-duration'); 3057 target.style.removeProperty('transition-property'); 3058 3059 } 3060 catch( error ) 3061 { 3062 console.error( error ); 3063 } 3064 3065 }, duration); 3066 3067 if( callback ) 3068 { 3069 3070 } 3071 3072 } 3073 catch( error ) 3074 { 3075 console.error( error ); 3076 } 3077 3078 }, 3079 3080 //slideDown equivalent function (show) 3081 slideDown: function( target, duration=500, callback=null ) 3082 { 3083 try { 3084 3085 target.style.removeProperty('display'); 3086 let display = window.getComputedStyle(target).display; 3087 3088 if( display === 'none' ) 3089 { 3090 display = 'block'; 3091 } 3092 3093 target.style.display = display; 3094 let height = target.scrollHeight; 3095 3096 target.style.overflow = 'hidden'; 3097 target.style.height = 0; 3098 target.style.paddingTop = 0; 3099 target.style.paddingBottom = 0; 3100 target.style.marginTop = 0; 3101 target.style.marginBottom = 0; 3102 target.offsetHeight; 3103 target.style.boxSizing = 'border-box'; 3104 target.style.transitionProperty = "height, margin, padding"; 3105 target.style.transitionDuration = duration + 'ms'; 3106 target.style.height = height + 'px'; 3107 target.style.removeProperty('padding-top'); 3108 target.style.removeProperty('padding-bottom'); 3109 target.style.removeProperty('margin-top'); 3110 target.style.removeProperty('margin-bottom'); 3111 3112 window.setTimeout( () => { 3113 3114 try { 3115 3116 target.style.removeProperty('height'); 3117 target.style.removeProperty('overflow'); 3118 target.style.removeProperty('transition-duration'); 3119 target.style.removeProperty('transition-property'); 3120 3121 } 3122 catch( error ) 3123 { 3124 console.error( error ); 3125 } 3126 3127 }, duration); 3128 3129 } 3130 catch( error ) 3131 {
3132 console.error( error ); 3133 } 3134 }, 3135 3136 //set overflow height 3137 setOverflowMaxHeight: function() 3138 { 3139 var that = this; 3140 3141 try { 3142 3143 var $overflow_container = document.querySelector( '.map-cookielist-overflow-container' ); 3144 3145 if( $overflow_container ) 3146 { 3147 let $map_tab_container = $overflow_container.parentNode; 3148 let parentHeight = $map_tab_container.offsetHeight; 3149 3150 let cookie_list_height = 0; 3151 3152 Array.from( $overflow_container?.children ).forEach( child => { 3153 3154 var style = window.getComputedStyle( child ); 3155 var marginTop = parseInt( style.marginTop, 10 ); 3156 var marginBottom = parseInt( style.marginBottom, 10 ); 3157 cookie_list_height += child.offsetHeight + marginTop + marginBottom; 3158 3159 }); 3160 3161 //add the minimum height of one expanded item 3162 cookie_list_height += 150; 3163 3164 let siblingsHeight = 0; 3165 3166 Array.from( $map_tab_container?.children ).forEach( child => { 3167 3168 if( child !== $overflow_container ) 3169 { 3170 var style = window.getComputedStyle( child ); 3171 var marginTop = parseInt( style.marginTop, 10 ); 3172 var marginBottom = parseInt( style.marginBottom, 10 ); 3173 siblingsHeight += child.offsetHeight + marginTop + marginBottom; 3174 } 3175 3176 }); 3177 3178 if( parentHeight > cookie_list_height ) 3179 { 3180 // parent height is too high --> recalculate 3181 $map_tab_container.style.height = siblingsHeight + cookie_list_height + 'px'; 3182 3183 } 3184 else 3185 { 3186 // need overflow and cookie list height recalculate 3187 3188 // set calculated max-height to .overflow-cookielist-container 3189 let maxHeight = parentHeight - siblingsHeight; 3190 3191 $overflow_container.style.maxHeight = maxHeight + 'px'; 3192 } 3193 3194 } 3195 3196 } 3197 catch( error ) 3198 { 3199 console.error( error ); 3200 } 3201 }, 3202 3203 setupAccordion: function() 3204 { 3205 //for preserving scope 3206 var that = this; 3207 3208 try { 3209 3210 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function setupAccordion' ); 3211 3212 that.setOverflowMaxHeight(); 3213 3214 that.settingsModal.addEventListener ('click', function( e ) { 3215 var $this = e.target; 3216 if( $this.matches( '.map_expandItem' ) ) 3217 { 3218 var $parent = $this.parentElement; 3219 3220 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'triggered map_expandItem click' ); 3221 3222 e.preventDefault(); 3223 e.stopImmediatePropagation(); 3224 3225 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + '.map-tab-header click' ); 3226 3227 var $content = $parent.nextElementSibling; 3228 3229 if( $parent.classList.contains( 'map-tab-active' ) ) 3230 { 3231 $parent.classList.remove( 'map-tab-active' ); 3232 that.slideUp( $content, 500 ); 3233 } 3234 else 3235 { 3236 if( !$this.classList.contains( 'map-contextual-expansion' ) ) 3237 { 3238 document.querySelectorAll( '.map-tab-header' ).forEach( function( $_this ) { 3239 3240 $_this.classList.remove( 'map-tab-active' ); 3241 }); 3242 3243 document.querySelectorAll( '.map-tab-content' ).forEach( function( $_this ) { 3244 if( $_this !== $content ) 3245 { 3246 that.slideUp( $_this, 500 ); 3247 } 3248 }); 3249 } 3250 3251 $parent.classList.add( 'map-tab-active' ); 3252 that.slideDown( $content, 500 ); 3253 } 3254 } 3255 }); 3256 3257 } 3258 catch( error ) 3259 { 3260 console.error( error ); 3261 } 3262 }, 3263 3264 closeSettingsPopup: function() 3265 { 3266 try { 3267 3268 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'internal function closeSettingsPopup' ); 3269 3270 this.settingsModal.classList.remove( 'map-show' ); 3271 this.settingsModal.classList.add( 'map-out' ); 3272 document.body.classList.remove( 'map-modal-open' ); 3273 document.querySelectorAll( '.map-settings-overlay' ).forEach(function( $_this ) { 3274 $_this.classList.remove( 'map-show' ); 3275 }); 3276 3277 (async() => { 3278 3279 while( !MAP_SYS.map_document_load ) 3280 { 3281 //console.log( 'not defined yet' ); 3282 await new Promise( resolve => setTimeout( resolve, 10 ) ); 3283 } 3284 3285 if( typeof window.MAPIABTCF_hideCMPUI === 'function' ) 3286 { 3287 window.MAPIABTCF_hideCMPUI(); 3288 } 3289 3290 })(); 3291 3292 } 3293 catch( error ) 3294 { 3295 console.error( error ); 3296 } 3297 }, 3298 3299 checkJsShield: function() 3300 { 3301 try { 3302 3303 if( !( typeof map_ajax !== 'undefined' && map_ajax?.ajax_url ) ) 3304 { 3305 console.error( MAP_SYS.maplog + 'Error: missing map_ajax variable running checkJsShield function' ); 3306 return; 3307 } 3308 3309 if( typeof CookieShield === 'undefined' || 3310 ( 3311 typeof cookie_api_key_remote_id_map_active === 'undefined' || 3312 typeof map_full_config?.cookie_api_key_remote_id_map_active === 'undefined' ) 3313 ) 3314 { 3315 var data = { 3316 action: 'map_missing_cookie_shield', 3317 detected: 0, 3318 }; 3319 3320 MAP_SYS.map_missing_cookie_shield = 1; 3321 } 3322 else 3323 {
3324 var data = { 3325 action: 'map_missing_cookie_shield', 3326 detected: 1, 3327 }; 3328 3329 MAP_SYS.map_missing_cookie_shield = 0; 3330 } 3331 3332 fetch( map_ajax.ajax_url, { 3333 method: 'POST', 3334 headers: { 3335 'Content-Type': 'application/x-www-form-urlencoded' 3336 }, 3337 body: new URLSearchParams( data ) 3338 }) 3339 .then( response => response.text() ) 3340 .then( responseText => { 3341 console.debug( MAP_SYS.maplog, responseText ); 3342 }) 3343 .catch( error => console.error( 'Error sending data running checkJsShield function:', error ) ); 3344 3345 } 3346 catch( error ) 3347 { 3348 console.error( error ); 3349 } 3350 }, 3351 3352 checkConsentModeStatus: function() 3353 { 3354 try { 3355 3356 if( !( typeof map_ajax !== 'undefined' && map_ajax?.ajax_url ) ) 3357 { 3358 console.error( MAP_SYS.maplog + 'Error: missing map_ajax variable running checkConsentModeStatus function' ); 3359 return; 3360 } 3361 3362 const googleTagRegex = /^G-/; 3363 let is_consent_valid = false; 3364 let has_valid_google_tag = false; 3365 let error_motivation = ''; 3366 let error_code = null; 3367 3368 // Check if Consent Mode is enabled 3369 if( !MAP_SYS?.cmode_v2 ) 3370 { 3371 error_motivation = 'Consent Mode V2 not enabled'; 3372 error_code = 10; 3373 } 3374 // Check if dataLayer is defined and not null 3375 else if( typeof dataLayer === 'undefined' || dataLayer === null ) 3376 { 3377 error_motivation = 'missing dataLayer'; 3378 error_code = 20; 3379 } 3380 else 3381 { 3382 for( let i = 0; i < dataLayer.length; i++ ) 3383 { 3384 const item = dataLayer[i]; 3385 3386 if( item && ( Array.isArray( item ) || typeof item === 'object' ) ) 3387 { 3388 const firstArg = item[0]; 3389 const secondArg = item[1]; 3390
3391 // Check for consent set 3392 if( firstArg === 'consent' && secondArg === 'default' ) 3393 { 3394 is_consent_valid = true; 3395 } 3396 3397 // Check for Google Tag config 3398 if( firstArg === 'config' && googleTagRegex.test( secondArg ) ) 3399 { 3400 has_valid_google_tag = true; 3401 } 3402 3403 // Validate that Google Tag configs aren't set before consent 3404 if( !is_consent_valid ) 3405 { 3406 if( ( firstArg === 'config' && googleTagRegex.test( secondArg ) ) || firstArg === 'event' ) 3407 { 3408 error_motivation = `Consent is set after Google tag ${secondArg} `; 3409 error_code = 30; 3410 break; 3411 } 3412 } 3413 } 3414 } 3415 3416 // Check if consent was never set 3417 if( !is_consent_valid && error_code === null && MAP_SYS?.cmode_v2_implementation_type != 'gtm' ) 3418 { 3419 error_motivation = 'No consent set before Google tags'; 3420 error_code = 40; 3421 } 3422 3423 // Check if no Google Tag was validated 3424 if( !has_valid_google_tag && MAP_SYS?.cmode_v2_implementation_type != 'gtm' ) 3425 { 3426 error_motivation = 'Google Tag seems missing'; 3427 error_code = 50; 3428 } 3429 } 3430 3431 const result = { 3432 isValid: ( error_code === null ) ? true : false, 3433 reason: error_motivation, 3434 code: error_code 3435 }; 3436 3437 if( result.isValid ) 3438 { 3439 let the_message = 'The Consent Mode V2 is set up correctly.'; 3440 3441 console.log( MAP_SYS.maplog + the_message ); 3442 3443 //this.showNotificationBar( the_message, 1 ); 3444 } 3445 else 3446 { 3447 let the_message = 'The sending of consent is not set up correctly - ' + result.reason + '.'; 3448 3449 console.log( MAP_SYS.maplog + the_message ); 3450 3451 //this.showNotificationBar( the_message, 2 ); 3452 } 3453 3454 // Prepare data to be sent to the server 3455 const data = { 3456 action: 'map_check_consent_mode_status', 3457 is_consent_valid: ( result.isValid ) ? 1 : 0, 3458 error_motivation: result.reason, 3459 error_code: result.code 3460 }; 3461 3462 // Logic for sending data based on the conditions 3463 if( ( MAP_SYS.cmode_v2_js_on_error === true && result.isValid ) || 3464 ( MAP_SYS.cmode_v2_js_on_error === false && !result.isValid ) 3465 ) 3466 { 3467 fetch( map_ajax.ajax_url, { 3468 method: 'POST', 3469 headers: { 3470 'Content-Type': 'application/x-www-form-urlencoded' 3471 }, 3472 body: new URLSearchParams(data) 3473 }) 3474 .then(response => response.text()) 3475 .then(responseText => { 3476 console.debug( MAP_SYS.maplog, responseText ); 3477 }) 3478 .catch( error => console.error( 'Error sending data running checkConsentModeStatus function:', error ) ); 3479 } 3480 3481 } 3482 catch( error ) 3483 { 3484 console.error( error ); 3485 } 3486 }, 3487 3488 sendDetectedKeys: function( key ) 3489 { 3490 try { 3491 3492 if( !( typeof map_ajax !== 'undefined' && map_ajax?.ajax_url ) ) 3493 { 3494 console.error( MAP_SYS.maplog + 'Error: missing map_ajax variable running sendDetectedKeys function' ); 3495 return; 3496 } 3497 3498 if( typeof CookieShield !== 'undefined' && 3499 CookieShield ) 3500 { 3501 var detectableKeys = CookieShield.getDetectableKeys(); 3502 var detectedKeys = CookieShield.getDetectedKeys(); 3503 3504 MAP_SYS.map_detectableKeys = detectableKeys; 3505 MAP_SYS.map_detectedKeys = detectedKeys; 3506 3507 if( map_ajax ) 3508 { 3509 var detectableKeys_to_send = null; 3510 3511 if( detectableKeys && detectableKeys.length > 0 ) 3512 { 3513 detectableKeys_to_send = detectableKeys.join( ',' ); 3514 } 3515 3516 var detectedKeys_to_send = null; 3517 3518 if( detectedKeys && detectedKeys.length > 0 ) 3519 { 3520 detectedKeys_to_send = detectedKeys.join( ',' ); 3521 } 3522 3523 if( key ) 3524 { 3525 var data = { 3526 action: 'map_remote_save_detected_keys', 3527 key : key, 3528 detectableKeys: detectableKeys_to_send, 3529 detectedKeys: detectedKeys_to_send 3530 }; 3531 } 3532 else 3533 { 3534 var data = { 3535 action: 'map_save_detected_keys', 3536 detectableKeys: detectableKeys_to_send, 3537 detectedKeys: detectedKeys_to_send 3538 }; 3539 } 3540 3541 fetch(map_ajax.ajax_url, { 3542 method: 'POST', 3543 headers: { 3544 'Content-Type': 'application/x-www-form-urlencoded' 3545 }, 3546 body: new URLSearchParams( data ) 3547 }) 3548 .then( response => response.text() ) 3549 .then( responseText => { 3550 console.groupCollapsed( MAP_SYS.maplog + 'sendDetectedKeys detectableKeys=' + detectableKeys_to_send + ' , detectedKeys=' + detectedKeys_to_send + ' with response :' ); 3551 console.debug( MAP_SYS.maplog, responseText ); 3552 console.groupEnd(); 3553 }); 3554 } 3555 } 3556 3557 } 3558 catch( error ) 3559 {
3560 console.error( error ); 3561 } 3562 }, 3563 3564 //inspect cookie script configuration 3565 debugCookieScripts: function() 3566 { 3567 try { 3568 3569 var list = []; 3570 3571 var $scripts = document.querySelectorAll( 'script.my_agile_privacy_activate._js_noscript_type_mode, textarea.my_agile_privacy_activate._raw_type_mode'); 3572 3573 $scripts.forEach(function($this) { 3574 3575 var cookie_name = $this.getAttribute( 'data-cookie-name' ); 3576 var cookie_api_key = $this.getAttribute( 'data-cookie-api-key' ); 3577 3578 var code = null; 3579 var mode = null; 3580 3581 if( $this.classList.contains( '_js_noscript_type_mode' ) ) { 3582 mode = 'js_noscript'; 3583 code = $this.innerHTML; 3584 } 3585 3586 if( $this.classList.contains( '_raw_type_mode' ) ) { 3587 mode = 'raw'; 3588 code = $this.firstChild.nodeValue; 3589 } 3590 3591 var object = { 3592 'cookie_name': cookie_name, 3593 'cookie_api_key': cookie_api_key, 3594 'mode': mode, 3595 'code': code 3596 }; 3597 3598 list.push( object ); 3599 3600 }); 3601 3602 return list; 3603 3604 } 3605 catch( error ) 3606 { 3607 console.error( error ); 3608 } 3609 }, 3610 3611 //get list of available cookies 3612 getAvailableCookieList: function() 3613 { 3614 try { 3615 3616 var list = []; 3617 3618 var $my_agile_privacy_activated = document.querySelectorAll( '.map_cookie_description_wrapper' ); 3619 3620 $my_agile_privacy_activated.forEach( function( $this ) { 3621 3622 var cookie_name = $this.getAttribute( 'data-cookie-name' ); 3623 var cookie_api_key = $this.getAttribute( 'data-cookie-api-key' ); 3624 3625 if( cookie_api_key ) 3626 { 3627 list.push( cookie_api_key ); 3628 } 3629 else 3630 { 3631 list.push( cookie_name ); 3632 } 3633 3634 }); 3635 3636 return list; 3637 3638 } 3639 catch( error ) 3640 { 3641 console.error( error ); 3642 } 3643 }, 3644 3645 //get list of activated cookies 3646 getActivatedCookiesList: function() 3647 { 3648 try { 3649 3650 var list = []; 3651 3652 var $my_agile_privacy_activated = document.querySelectorAll( '.map_cookie_description_wrapper._is_activated' ); 3653 3654 $my_agile_privacy_activated.forEach(function( $this ) { 3655 3656 var cookie_name = $this.getAttribute( 'data-cookie-name' ); 3657 var cookie_api_key = $this.getAttribute( 'data-cookie-api-key' ); 3658 3659 if( cookie_api_key ) 3660 { 3661 list.push( cookie_api_key ); 3662 } 3663 else 3664 { 3665 list.push( cookie_name ); 3666 } 3667 3668 }); 3669 3670 return list; 3671 3672 } 3673 catch( error ) 3674 { 3675 console.error( error ); 3676 } 3677 }, 3678 3679 //get list of disactivated cookies 3680 getDisactivatedCookiesList: function() 3681 { 3682 try { 3683 3684 var list = []; 3685 3686 var $my_agile_privacy_activated = document.querySelectorAll( '.map_cookie_description_wrapper:not(._is_activated)' ); 3687 3688 $my_agile_privacy_activated.forEach( function( $this ) { 3689 3690 var cookie_name = $this.getAttribute( 'data-cookie-name' ); 3691 var cookie_api_key = $this.getAttribute( 'data-cookie-api-key' ); 3692 3693 if( cookie_api_key ) 3694 { 3695 list.push( cookie_api_key ); 3696 } 3697 else 3698 { 3699 list.push( cookie_name ); 3700 } 3701 3702 }); 3703 3704 return list; 3705 3706 } 3707 catch( error ) 3708 { 3709 console.error( error ); 3710 } 3711 } 3712} 3713 3714document.addEventListener('DOMContentLoaded', function() { 3715 3716 try { 3717 3718 if( window !== window.parent ) 3719 { 3720 console.debug( MAP_SYS.maplog + 'prevent run on iframe' ); 3721 return false; 3722 } 3723 3724 if( typeof map_cookiebar_settings !== 'undefined' ) 3725 { 3726 MAP_SYS.map_initted = true; 3727 3728 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'initting' ); 3729 3730 MAP.set({ 3731 settings : map_cookiebar_settings 3732 }); 3733 } 3734 3735 setTimeout( function() { 3736 3737 if( window !== window.parent ) 3738 { 3739 console.debug( MAP_SYS.maplog + 'prevent run on iframe' ); 3740 return false; 3741 } 3742 3743 if( !MAP_SYS.map_initted && 3744 typeof map_cookiebar_settings !== 'undefined' ) 3745 { 3746 try { 3747 3748 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'initting' ); 3749 3750 MAP.set({ 3751 settings : map_cookiebar_settings 3752 }); 3753 3754 MAP_SYS.map_initted = true; 3755 3756 } 3757 catch( error ) 3758 { 3759 console.error( error ); 3760 } 3761 } 3762 3763 }, 3000 ); 3764 3765 setTimeout( function() { 3766 3767 MAP_SYS.map_document_load = true; 3768 3769 }, 5000 ); 3770 3771 } 3772 catch( error ) 3773 { 3774 console.error( error ); 3775 } 3776 3777}); 3778 3779window.addEventListener('load', function() { 3780 3781 try { 3782 3783 MAP_SYS.map_document_load = true; 3784 3785 if( window !== window.parent ) 3786 { 3787 console.debug( MAP_SYS.maplog + 'prevent run on iframe' ); 3788 return false;
3789 } 3790 3791 if( !MAP_SYS.map_initted && 3792 typeof map_cookiebar_settings !== 'undefined' ) 3793 { 3794 3795 try { 3796 3797 if( MAP_SYS?.map_debug ) console.debug( MAP_SYS.maplog + 'initting' ); 3798 3799 MAP.set({ 3800 settings : map_cookiebar_settings 3801 }); 3802 3803 MAP_SYS.map_initted = true; 3804 3805 } 3806 catch( error ) 3807 { 3808 console.error( error ); 3809 } 3810 } 3811 3812 if( 3813 map_ajax && 3814 MAP.settings 3815 ) 3816 { 3817 MAP.checkJsShield(); 3818 3819 setTimeout( function() { 3820 MAP.checkConsentModeStatus(); 3821 }, 800 ); 3822 } 3823 3824 if( typeof CookieShield !== 'undefined' && 3825 CookieShield && 3826 MAP 3827 ) 3828 { 3829 if( 3830 map_ajax && 3831 MAP.settings && 3832 ( 3833 ( 3834 MAP.settings.scan_mode && 3835 MAP.settings.scan_mode == 'learning_mode' 3836 ) || 3837 ( 3838 map_ajax.force_js_learning_mode == 1 3839 ) 3840 ) 3841 ) 3842 { 3843 MAP.sendDetectedKeys( null ); 3844 } 3845 3846 if( typeof URLSearchParams !== 'undefined' && 3847 URLSearchParams ) 3848 { 3849 var queryString = window.location.search; 3850 3851 if( queryString ) 3852 { 3853 var urlParams = new URLSearchParams( queryString ); 3854 3855 var auto_activate_cookies_with_key = urlParams.get( 'auto_activate_cookies_with_key' ) 3856 if( auto_activate_cookies_with_key ) 3857 { 3858 MAP.sendDetectedKeys( auto_activate_cookies_with_key ); 3859 } 3860 } 3861 } 3862 } 3863 3864 } 3865 catch( error ) 3866 { 3867 console.error( error ); 3868 } 3869}); 3870 3871//f. for cloning node attribute to another (only valid attributes) 3872function cloneNodeAttributeToAnother( $source, dest ) 3873{ 3874 //console.log( $source ); 3875 //console.log( dest ); 3876 3877 var exclusion_list = [ 3878 'type', 3879 'src', 3880 'unblocked_src', 3881 'class', 3882 'data-cookie-api-key', 3883 'data-friendly_name' 3884 ]; 3885 3886 for( var att, i = 0, atts = $source.attributes, n = atts.length; i < n; i++ ) 3887 { 3888 att = atts[i]; 3889 3890 if( typeof att.nodeName !== 'undefined' && !exclusion_list.includes( att.nodeName ) ) 3891 { 3892 dest.setAttribute( att.nodeName, att.nodeValue ); 3893 } 3894 } 3895 3896 return dest; 3897} 3898 3899//f. for dom element recreating and previous event removal 3900function internalRecreateNode( el, withChildren ){ 3901 try { 3902 3903 if(withChildren) { 3904 el.parentNode.replaceChild(el.cloneNode(true), el); 3905 } 3906 else 3907 { 3908 var newEl = el.cloneNode(false); 3909 while (el.hasChildNodes()) newEl.appendChild(el.firstChild); 3910 el.parentNode.replaceChild(newEl, el); 3911 } 3912 } catch( e ) 3913 { 3914 console.debug( e ); 3915 } 3916} 3917 3918//wpcf7 3919function map_trigger_custom_patch_1() 3920{ 3921 console.debug( MAP_SYS.maplog + 'map_trigger_custom_patch_1' ); 3922 3923 try { 3924 internalRecreateNode( document.querySelector( 'form.wpcf7-form' ), true ); 3925 } 3926 catch (e) { 3927 console.debug( e ); 3928 } 3929 3930 const c = new CustomEvent("DOMContentLoaded", { 3931 }); 3932 document.dispatchEvent(c); 3933 3934 try { 3935 wpcf7.submit = null; 3936 } catch (e) { 3937 console.debug( e ); 3938 } 3939} 3940 3941//avia maps 3942function map_trigger_custom_patch_2() 3943{ 3944 console.debug( MAP_SYS.maplog + 'map_trigger_custom_patch_2' ); 3945 3946 document.querySelectorAll( '.av_gmaps_confirm_link.av_text_confirm_link.av_text_confirm_link_visible' ).forEach( function( element ) { 3947 element.click(); 3948 }); 3949 3950} 3951 3952//octorate 3953function map_trigger_custom_patch_3() 3954{ 3955 try { 3956 octorate.octobook.Widget.show(); 3957 } catch (e) { 3958 setTimeout( map_trigger_custom_patch_3, 100 ); 3959 console.debug( e ); 3960 } 3961} 3962 3963//consent mode early as possible initialization 3964if( typeof MAP !== 'undefined' && typeof MAP.setupConsentModeV2 !== 'undefined' ) 3965{ 3966 MAP.setupConsentModeV2(); 3967} 3968
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.