1"use strict"; 2 3 4/* ---------- Polyfill: Array.from ---------- */ 5Array.from || (Array.from = function() { 6 var r; 7 try { 8 r = Symbol.iterator ? Symbol.iterator : "Symbol(Symbol.iterator)"; 9 } catch { 10 r = "Symbol(Symbol.iterator)"; 11 } 12 var t = Object.prototype.toString, 13 n = function(r) { return typeof r === "function" || t.call(r) === "[object Function]"; }, 14 o = Math.pow(2, 53) - 1, 15 e = function(r) { 16 var t = (function(r) { 17 var t = Number(r); 18 return isNaN(t) ? 0 : t !== 0 && isFinite(t) ? (t > 0 ? 1 : -1) * Math.floor(Math.abs(t)) : t; 19 })(r); 20 return Math.min(Math.max(t, 0), o); 21 }; 22 23 24 return function(t) { 25 var o = Object(t), 26 a = n(o[r]); 27 28 29 if (t == null && !a) 30 throw new TypeError("Array.from requires an array-like object or iterator - not null or undefined"); 31 32 33 var i, u = arguments.length > 1 ? arguments[1] : void 0; 34 35 36 if (u !== void 0) { 37 if (!n(u)) 38 throw new TypeError("Array.from: when provided, the second argument must be a function"); 39 arguments.length > 2 && (i = arguments[2]); 40 } 41 42 43 var f = e(o.length); 44 45 46 return (function(r, t, n, o, e, a) { 47 for (var i = 0; i < n || e; ) { 48 var u = o(i), 49 f = e ? u.value : u; 50 51 52 if (e && u.done) return t; 53 54 55 t[i] = a 56 ? r === void 0 57 ? a(f, i) 58 : a.call(r, f, i) 59 : f; 60 61 62 i++; 63 } 64 65 66 if (e) 67 throw new TypeError("Array.from: provided arrayLike or iterator has length more than 2 ** 52 - 1"); 68 69 70 t.length = n; 71 return t; 72 })(i, n(this) ? Object(new this(f)) : new Array(f), f, function(t, n) { 73 var o = t && nr; 74 return function(r) { return t ? o.next() : n[r]; }; 75 }(a, o), a, u); 76 }; 77}()); 78 79 80/* ---------- Cookie Script Observer ---------- */ 81var CookieObserverSpace = 150; 82var CookieObserverTarget = document.querySelector("#cookiescript_badge"); 83var CookieObserverConfig = { attributes: true }; 84 85 86/* Header fixed/sticky? */ 87function isHeaderFix() { 88 var header = document.querySelector(".js-stickybit-parent #header") || 89 document.querySelector("[data-js-header]"); 90 if (header) { 91 var pos = window.getComputedStyle(header).position; 92 return pos === "fixed" || pos === "sticky"; 93 } 94 return false; 95} 96 97 98function moveBodyDown() { 99 var header = document.querySelector(".js-stickybit-parent #header") || 100 document.querySelector("[data-js-header]"); 101 102 103 if (document.body) { 104 document.body.style.marginTop = CookieObserverSpace + "px"; 105 } 106 if (isHeaderFix() && header) { 107 header.style.top = CookieObserverSpace + "px"; 108 } 109} 110 111 112function moveBodyUp() { 113 var header = document.querySelector(".js-stickybit-parent #header") || 114 document.querySelector("[data-js-header]"); 115 116 117 if (document.body) { 118 document.body.style.marginTop = "0"; 119 } 120 if (isHeaderFix() && header) { 121 header.style.top = "0"; 122 } 123} 124 125 126function callback(mutations, observer) { 127 var hasInjected = false; 128 var injected = document.querySelector("#cookiescript_injected"); 129 130 131 var expandEvents = mutations.filter(function(m) { 132 return injected && 133 CookieObserverSpace !== injected.offsetHeight && 134 (CookieObserverSpace = injected.offsetHeight), 135 injected && m.target && m.target.id === injected.id && (hasInjected = true), 136 m.target && m.target.getAttribute && m.target.getAttribute("style") === ""; 137 }).length > 0; 138 139 140 var collapseEvents = mutations.filter(function(m) { 141 return m.target && 142 m.target.getAttribute && 143 (m.target.getAttribute("style") || "") === "display: none;"; 144 }).length > 0; 145 146 147 if (hasInjected ? expandEvents : collapseEvents) { 148 moveBodyDown(); 149 } else if ((hasInjected ? collapseEvents : expandEvents)) { 150 moveBodyUp(); 151 } 152} 153 154 155function addObserverForCSNode(node) { 156 if (!(node instanceof Element)) { 157 console.warn("CookieScript: Observer target is not a DOM element â", node); 158 return; 159 } 160 161 162 if (node.id === "cookiescript_injected") { 163 moveBodyDown(); 164 } 165 166 167 try { 168 new MutationObserver(callback).observe(node, CookieObserverConfig); 169 } catch (e) { 170 console.error("CookieScript: Failed to observe node:", node, e); 171 } 172} 173 174 175/* ---- INIT (Function Declaration, wird gehoistet) ---- */
176function init() { 177 var body = document.body; 178 if (!body) { 179 console.warn("CookieScript: document.body not available â aborting init()"); 180 return; 181 } 182 183 184 new MutationObserver(function(mutations, observer) { 185 mutations.forEach(function(mutation) { 186 if (mutation.type === "childList") { 187 var candidates = Array.from(mutation.addedNodes).filter(function(node) { 188 return node instanceof Element && 189 (node.id === "cookiescript_injected" || node.id === "cookiescript_badge"); 190 }); 191 192 193 if (candidates.length >= 1) { 194 addObserverForCSNode(candidates[0]); 195 observer.disconnect(); 196 } 197 } 198 }); 199 }).observe(body, { childList: true }); 200} 201 202 203/* ---------- Auto-Init (steht NACH der Definition) ---------- */ 204if (window.$) { 205 window.$(document).ready(init); 206} else { 207 if (document.readyState === "loading") { 208 document.addEventListener("DOMContentLoaded", init); 209 } else { 210 init(); 211 } 212} 213 214
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.