PageSourceSearch

https://planet-tree.de/cdn/shop/t/14/assets/pt-consent.js?v=21346262708579501081791076125

js planet-tree.de collected 2026-10-04 20:05:17 UTC 15,295 bytes, 2 lines download raw bytes

1(function(){"use strict";if(window.PTConsent)return;var state={analytics:!1,marketing:!1,preferences:!1},apiReady=!1,bannerReady=!1,pending=!1,blocked=[],listeners=[],api,methods={analytics:"analyticsProcessingAllowed",marketing:"marketingAllowed",preferences:"preferencesProcessingAllowed"};function allowed(category2){return state[category2]===!0}function category(url){var u;try{u=new URL(String(url||""),location.href)}catch(_){return""}var h=u.hostname.toLowerCase(),p=u.pathname;return h==="partner.planet-tree.de"&&/^\/api2\/(pt_analytics\/event|cert\/emoji\/usage)/.test(p)||/(^|\.)(shgcdn3\.com|analytics\.getshogun\.com|google-analytics\.com|clarity\.ms|hotjar\.com|hotjar\.io)$/.test(h)||h==="staticxx.s3.amazonaws.com"&&p.indexOf("aio_stats")!==-1?"analytics":/(^|\.)(connect\.facebook\.net|facebook\.com|googleadservices\.com|googlesyndication\.com|doubleclick\.net|googletagmanager\.com|analytics\.tiktok\.com|business-api\.tiktok\.com|bat\.bing\.com|hyj\.mobi|releva\.nz|taboola\.com|trc\.taboola\.com|tr\.snapchat\.com|sc-static\.net|ct\.pinterest\.com|s\.pinimg\.com|alb\.reddit\.com|redditstatic\.com|redretarget\.com|wetracked\.io|emailsys1a\.net)$/.test(h)||h==="spfy-pxl.archive-digger.com"||h==="apps.omegatheme.com"&&p.indexOf("facebook-pixel")!==-1||/^www\.google\.[a-z.]+$/.test(h)&&/^\/(?:pagead|ccm|ads)\//.test(p)||h==="cdn.shopify.com"&&/\/(?:facebook-pixel|google-pixel)[^/]*\.js$/.test(p)?"marketing":/^(?:fonts\.googleapis\.com|fonts\.gstatic\.com)$/.test(h)||/^(?:www\.)?google\.[a-z.]+$/.test(h)&&/^\/maps(?:\/|$)/.test(p)||h==="maps.google.com"||/(^|\.)(fw-cdn\.com|elfsight\.com)$/.test(h)||/(^|\.)(youtube\.com|youtube-nocookie\.com|player\.vimeo\.com)$/.test(h)?"preferences":""}function forbidden(url){var c=category(url);return c&&!allowed(c)}function sync(){if(!(!api||pending)){var consent;try{consent=api.currentVisitorConsent()}catch(_){return}if(!(!consent||!Object.keys(methods).every(function(c){return consent[c]==="yes"||consent[c]==="no"||consent[c]===""})))return apiReady=!0,Object.keys(methods).forEach(function(c){try{state[c]=consent[c]==="yes"&&api[methods[c]]()===!0}catch(_){state[c]=!1}}),navigator.globalPrivacyControl===!0&&(state.marketing=!1),updateSignals(),release(),listeners.forEach(function(f){try{f()}catch(_){}}),document.dispatchEvent(new CustomEvent("pt:consent",{detail:Object.assign({},state)})),!0}}window.dataLayer=window.dataLayer||[],window.gtag=window.gtag||function(){window.dataLayer.push(arguments)};function updateSignals(first){window.gtag("consent",first?"default":"update",{analytics_storage:allowed("analytics")?"granted":"denied",ad_storage:allowed("marketing")?"granted":"denied",ad_user_data:allowed("marketing")?"granted":"denied",ad_personalization:allowed("marketing")?"granted":"denied",functionality_storage:allowed("preferences")?"granted":"denied",personalization_storage:allowed("preferences")?"granted":"denied",security_storage:"granted"})}updateSignals(!0),window.gtag("set","ads_data_redaction",!0),window.gtag("set","url_passthrough",!1);var setAttribute=Element.prototype.setAttribute,removeAttribute=Element.prototype.removeAttribute;function hold(node,url){var c=category(url);return!c||allowed(c)?!1:node.tagName==="IMG"?(removeAttribute.call(node,"src"),!0):(node.hasAttribute("data-pt-consent-src")||blocked.push(node),setAttribute.call(node,"data-pt-consent-src",String(url)),setAttribute.call(node,"data-pt-consent-category",c),node.tagName==="SCRIPT"&&(node.hasAttribute("data-pt-consent-type")||setAttribute.call(node,"data-pt-consent-type",node.getAttribute("type")||""),setAttribute.call(node,"type","text/plain")),removeAttribute.call(node,node.tagName==="LINK"?"href":"src"),!0)}[HTMLScriptElement,HTMLImageElement,HTMLIFrameElement,HTMLLinkElement].forEach(function(ctor){var attribute=ctor===HTMLLinkElement?"href":"src",desc=Object.getOwnPropertyDescriptor(ctor.prototype,attribute);!desc||!desc.configurable||Object.defineProperty(ctor.prototype,attribute,{configurable:!0,enumerable:desc.enumerable,get:desc.get,set:function(url){hold(this,url)||desc.set.call(this,url)}})}),Element.prototype.setAttribute=function(name,value){if(!((String(name).toLowerCase()==="src"&&/^(SCRIPT|IMG|IFRAME)$/.test(this.tagName)||String(name).toLowerCase()==="href"&&this.tagName==="LINK")&&hold(this,value)))return setAttribute.apply(this,arguments)};function checkNode(node){!node||node.nodeType!==1||(/^(SCRIPT|IMG|IFRAME)$/.test(node.tagName)&&node.getAttribute("src")&&hold(node,node.getAttribute("src")),node.tagName==="LINK"&&node.getAttribute("href")&&hold(node,node.getAttribute("href")),node.querySelectorAll&&node.querySelectorAll("script[src],iframe[src],img[src],link[href]").forEach(function(n){hold(n,n.getAttribute(n.tagName==="LINK"?"href":"src"))}))}["appendChild","insertBefore","replaceChild"].forEach(function(method){var original=Node.prototype[method];Node.prototype[method]=function(node){return checkNode(node),original.apply(this,arguments)}});function release(){document.querySelectorAll("[data-pt-consent-src],[data-pt-consent-inline]").forEach(function(node){blocked.indexOf(node)<0&&blocked.push(node)}),blocked=blocked.filter(function(node){if(!node.isConnected||!allowed(node.getAttribute("data-pt-consent-category")))return!0;var src=node.getAttribute("data-pt-consent-src");if(node.tagName==="SCRIPT"){var replacement=document.createElement("script");
1Array.from(node.attributes).forEach(function(a){a.name!=="type"&&a.name.indexOf("data-pt-consent")!==0&&setAttribute.call(replacement,a.name,a.value)});var type=node.getAttribute("data-pt-consent-type");type&&(replacement.type=type),src?(replacement.async=node.hasAttribute("async"),replacement.src=src):replacement.textContent=node.textContent,["load","error"].forEach(function(type2){replacement.addEventListener(type2,function(){node.dispatchEvent(new Event(type2))})}),node.parentNode.replaceChild(replacement,node)}else removeAttribute.call(node,"data-pt-consent-src"),node.tagName==="LINK"?node.href=src:node.src=src;return!1})}var originalFetch=window.fetch;if(originalFetch&&(window.fetch=function(resource){var url=typeof resource=="string"||resource instanceof URL?resource:resource&&resource.url;return forbidden(url)?Promise.reject(new TypeError("Optional request requires consent")):originalFetch.apply(this,arguments)}),navigator.sendBeacon){var originalBeacon=navigator.sendBeacon;navigator.sendBeacon=function(url){return forbidden(url)?!1:originalBeacon.apply(this,arguments)}}var open=XMLHttpRequest.prototype.open,send=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(method,url){return this.__ptPrivacyUrl=url,open.apply(this,arguments)},XMLHttpRequest.prototype.send=function(){if(forbidden(this.__ptPrivacyUrl)){this.abort();return}return send.apply(this,arguments)};var analyticsKeys=/^(?:pta_(?!ignore)|_shg_|_ga(?:_|$)|_gid$|_gat(?:_|$))/,marketingKeys=/^(?:_fb[pc]$|_gcl_|_uet|_ttp$|_tt_enable_cookie$|tt_(?:appInfo|pageId|pixel_session_index|sessionId)$|_epik$|_pin_|_rdt_|OT_FBPLID$)/;function optionalKey(key){return analyticsKeys.test(key)?"analytics":marketingKeys.test(key)?"marketing":""}var storageSet=Storage.prototype.setItem;Storage.prototype.setItem=function(key,value){var c=optionalKey(String(key));if(!c||allowed(c))return storageSet.apply(this,arguments)};var cookieDescriptor=Object.getOwnPropertyDescriptor(Document.prototype,"cookie");cookieDescriptor&&cookieDescriptor.configurable&&Object.defineProperty(Document.prototype,"cookie",{configurable:!0,enumerable:cookieDescriptor.enumerable,get:cookieDescriptor.get,set:function(value){var key=String(value).split("=")[0].trim(),c=optionalKey(key);(!c||allowed(c)||/max-age\s*=\s*0/i.test(value))&&cookieDescriptor.set.call(this,value)}});function cleanup(){[function(){return localStorage},function(){return sessionStorage}].forEach(function(get){try{var storage=get();Object.keys(storage).forEach(function(k){var c=optionalKey(k);c&&!allowed(c)&&storage.removeItem(k)})}catch(_){}}),document.cookie.split(";").forEach(function(part){var key=part.split("=")[0].trim(),c=optionalKey(key);!c||allowed(c)||["",location.hostname,".planet-tree.de"].forEach(function(domain){document.cookie=key+"=; Max-Age=0; Path=/; SameSite=Lax; Secure"+(domain?"; Domain="+domain:"")})})}function registerChoice(values,done){if(!apiReady||pending){done(new Error("privacy_unavailable"));return}var previous=Object.assign({},state),choice={};Object.keys(state).forEach(function(c){choice[c]=values[c]===!0,choice[c]||(state[c]=!1)}),navigator.globalPrivacyControl===!0&&(choice.marketing=state.marketing=!1),choice.sale_of_data=choice.marketing,pending=!0,updateSignals(),cleanup();var finished=!1,verificationTimer=null;function confirmed(){try{var saved=api.currentVisitorConsent();return Object.keys(state).every(function(c){return saved[c]===(choice[c]?"yes":"no")})}catch(_){return!1}}var timer=setTimeout(function(){finish(confirmed()?null:new Error("privacy_timeout"))},1e4);function finish(error){if(!finished){if(finished=!0,clearTimeout(timer),clearTimeout(verificationTimer),pending=!1,error){done(error);return}sync(),cleanup();var revoked=Object.keys(state).some(function(c){return previous[c]&&!state[c]});done(null,revoked)}}function verify(){if(!finished){if(clearTimeout(verificationTimer),confirmed()){finish(null);return}verificationTimer=setTimeout(verify,100)}}try{api.setTrackingConsent(choice,function(result){result&&result.error&&!confirmed()?finish(new Error("privacy_failed")):verify()}),verify()}catch(_){finish(new Error("privacy_failed"))}}window.PTConsent={version:"2026-10-04.5",allowed:allowed,category:category,onChange:function(fn){listeners.push(fn)},save:registerChoice,ready:function(){return apiReady},bannerReady:function(){return bannerReady},state:function(){return Object.assign({},state)}},document.addEventListener("visitorConsentCollected",sync);var attempts=0,loading=!1,loadTimer=null;function scheduleAPI(delay){loadTimer!==null||apiReady||attempts>=300||(loadTimer=setTimeout(function(){loadTimer=null,loadAPI()},delay))}function loadAPI(){if(window.Shopify&&window.Shopify.customerPrivacy&&(api=window.Shopify.customerPrivacy,sync())){clearTimeout(loadTimer),loadTimer=null,cleanup();return}if(!loading&&window.Shopify&&typeof window.Shopify.loadFeatures=="function"){loading=!0;try{window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],function(){loading=!1,window.Shopify.customerPrivacy?loadAPI():scheduleAPI(250)})}catch(_){loading=!1}}++attempts<300&&scheduleAPI(100)}window.addEventListener("online",function(){apiReady||(attempts=0,loadAPI())});function ui(){var template=document.getElementById("pt-cookie-template"),box=document.getElementById("pt-cookie-banner");if(!box&&template&&(box=template.content.querySelector("#pt-cookie-banner").cloneNode(!0)),!box)return;var details=box.querySelector("#pt-cookie-details"),status=box.querySelector("#pt-cookie-status"),openings=0;function announceUI(value){document.documentElement.setAttribute("data-pt-consent-ui",value),document.documentElement.setAttribute("data-pt-consent-openings",String(openings)),document.dispatchEvent(new CustomEvent("pt:consent-ui"))}announceUI("checking");var lastFocus,openedByUser=!1,requestedSettings=!1;function markBannerReady(){bannerReady||(bannerReady=!0,document.dispatchEvent(new CustomEvent("pt:consent-ui-ready")))}function chosen(){if(!apiReady)return!1;try{var c=api.currentVisitorConsent();
1return["analytics","marketing","preferences"].every(function(k){return c[k]==="yes"||c[k]==="no"})}catch(_){return!1}}function hide(){box.open&&typeof box.close=="function"&&box.close(),box.hidden=!0,openedByUser=!1,template&&box.isConnected&&box.remove(),document.documentElement.classList.remove("pt-cookie-modal-open"),lastFocus&&lastFocus.isConnected&&lastFocus.focus({preventScroll:!0}),announceUI("closed")}function show(expanded){if(!apiReady){requestedSettings=requestedSettings||!!expanded,attempts=0,loadAPI();return}expanded&&(openedByUser=!0);var opening=box.hidden;opening&&(lastFocus=document.activeElement,openings+=1),box.isConnected||document.body.appendChild(box),box.hidden=!1,details.hidden=!expanded,box.querySelector('[data-pt-action="close"]').hidden=!chosen(),box.querySelectorAll("[data-pt-purpose]").forEach(function(el){el.checked=allowed(el.getAttribute("data-pt-purpose"))}),box.querySelector('[data-pt-action="settings"]').setAttribute("aria-expanded",String(!!expanded)),typeof box.showModal=="function"&&!box.open&&box.showModal(),document.documentElement.classList.add("pt-cookie-modal-open"),(opening||expanded)&&box.querySelector("h2").focus({preventScroll:!0}),markBannerReady(),announceUI("shown")}function refresh(){if(!(!apiReady||pending)){if(requestedSettings){requestedSettings=!1,show(!0);return}if(chosen()){!openedByUser&&!box.hidden&&hide(),markBannerReady(),box.hidden&&announceUI("closed");return}openedByUser||show(!1)}}box.addEventListener("cancel",function(event){event.preventDefault(),chosen()&&!pending&&hide()}),box.addEventListener("keydown",function(event){event.key==="Escape"&&(event.preventDefault(),event.stopPropagation(),chosen()&&!pending&&hide())}),listeners.push(refresh),refresh(),document.addEventListener("click",function(event){var link=event.target.closest('a[href*="/pages/gdpr-e-privacy"], [data-pt-cookie-settings]');link&&(event.preventDefault(),show(!0))}),box.addEventListener("click",function(event){var button=event.target.closest("[data-pt-action]");if(button){var action=button.getAttribute("data-pt-action");if(action==="settings"){details.hidden=!details.hidden,button.setAttribute("aria-expanded",String(!details.hidden));return}if(action==="close"){chosen()&&!pending&&hide();return}var choice={analytics:action==="accept",marketing:action==="accept",preferences:action==="accept"};action==="save"&&box.querySelectorAll("[data-pt-purpose]").forEach(function(el){choice[el.getAttribute("data-pt-purpose")]=el.checked});var initialChoice=!chosen();status.textContent="Deine Auswahl wird gespeichert \u2026",box.querySelectorAll("button").forEach(function(el){el.disabled=!0}),registerChoice(choice,function(error,revoked){if(box.querySelectorAll("button").forEach(function(el){el.disabled=!1}),error){status.textContent="Deine Auswahl konnte noch nicht gespeichert werden. Bitte versuche es erneut. Optionales Tracking bleibt gesperrt, soweit du es nicht schon erlaubt hast.";return}if(initialChoice&&event.isTrusted&&window.fetch)try{window.fetch("https://partner.planet-tree.de/api2/pt_consent/decision",{method:"POST",credentials:"omit",referrerPolicy:"no-referrer",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify({version:"2026-10-03.1",analytics:state.analytics===!0,marketing:state.marketing===!0,preferences:state.preferences===!0})}).catch(function(){})}catch(_){}status.textContent="",hide(),revoked&&Promise.resolve(window.PTQuickEntry&&window.PTQuickEntry.save?window.PTQuickEntry.save():null).catch(function(){}).finally(function(){location.reload()})})}}),/\/pages\/gdpr-e-privacy\/?$/.test(location.pathname)&&show(!0),loadAPI()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ui):ui(),loadAPI()})();
2//# sourceMappingURL=/cdn/shop/t/14/assets/pt-consent.js.map?v=21346262708579501081791076125

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.