1/* 2 Usage: 3 <script src="https://my.domain.com/resources/um/integrations/core-consent-status/consent-status.js"></script> 4 var twentyThreeConsentStatus = new TwentyThreeConsentStatus('my.domain.com'); 5 twentyThreeConsentStatus.setConsentStatus('given'); 6 twentyThreeConsentStatus.setConsentStatus('denied'); 7 */ 8 9(function(){ 10 TwentyThreeConsentStatus = function(domain){ 11 var $this = this; 12 $this.domain = domain; 13 14 $this.setContentStatus = $this.setConsentStatus = function(consent){ 15 if (consent !== 'given') { 16 consent = 'denied'; 17 } 18 var message = "consent"+consent; 19 20 var hosts = document.querySelectorAll('iframe[src^="https://'+$this.domain+'"]'); 21 if(hosts.length>0) { 22 // If there are existing hosts, post to them. 23 hosts.forEach(function(host){ 24 host.contentWindow.postMessage(message, '*') 25 }); 26 } else { 27 // If not, create a new one. 28 // (This will serve as a host on subsequent calls.) 29 var hostUrl = 'https://'+$this.domain+'/resources/um/integrations/core-consent-status/host.html#'+message; 30 var frame = window.document.createElement('iframe'); 31 frame.style.width = '1px'; 32 frame.style.height = '1px'; 33 frame.style.border = '0'; 34 frame.style.visibility = 'hidden'; 35 window.document.body.appendChild(frame); 36 frame.src = hostUrl; 37 } 38 } 39 return $this; 40 } 41})();
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.