(function(){if(/^\/category\/vergleichstests(\/|$)/.test(location.pathname)){location.replace(„/vergleichstests/“);}})();
Genussreich.de im Test
Genussreich.de im Test Mit Herz [...]
(function(){
var h=document.querySelector(‚.gt-hdr‘); if(!h) return;
function toggle(btn,panel,cls){var open=!panel.classList.contains(‚is-open‘);
[].forEach.call(h.querySelectorAll(‚.is-open‘),function(x){x.classList.remove(‚is-open‘);});
[].forEach.call(h.querySelectorAll(‚[aria-expanded=“true“]‘),function(x){x.setAttribute(‚aria-expanded‘,’false‘);});
if(open){panel.classList.add(‚is-open‘);btn.setAttribute(‚aria-expanded‘,’true‘);if(cls)cls();}}
var sb=h.querySelector(‚.gt-hdr__such-btn‘), sp=document.getElementById(‚gt-hdr-suche‘);
sb.addEventListener(‚click‘,function(e){e.stopPropagation();toggle(sb,sp,function(){var i=document.getElementById(‚gt-hdr-q‘);if(i)i.focus();});});
var mb=h.querySelector(‚.gt-hdr__burger‘), mp=document.getElementById(‚gt-hdr-mobil‘);
mb.addEventListener(‚click‘,function(e){e.stopPropagation();toggle(mb,mp);});
[].forEach.call(h.querySelectorAll(‚.gt-hdr__btn‘),function(tb){var tl=tb.parentNode;
tb.addEventListener(‚click‘,function(e){e.stopPropagation();var o=!tl.classList.contains(‚is-open‘);
[].forEach.call(h.querySelectorAll(‚.gt-hdr__has-sub.is-open‘),function(x){if(x!==tl){x.classList.remove(‚is-open‘);var b=x.querySelector(‚.gt-hdr__btn‘);if(b)b.setAttribute(‚aria-expanded‘,’false‘);}});
tl.classList.toggle(‚is-open‘,o);tb.setAttribute(‚aria-expanded‘,o?’true‘:’false‘);});});
// Produkttests: neue Beiträge der Kategorie 1303 beim ersten Öffnen ergänzen
var pt=h.querySelector(‚.gt-hdr__has-sub–pt‘), ptGeladen=false;
function ptLaden(){
if(ptGeladen||!window.fetch) return; ptGeladen=true;
fetch(‚/wp-json/wp/v2/posts?categories=1303&per_page=30&_fields=link,title‘).then(function(r){if(!r.ok) throw 0;return r.json();}).then(function(list){
[[‚gt-hdr-produkttests‘,‘:last-child‘],[‚gt-hdr-m-produkttests‘,‘:last-child‘]].forEach(function(z){
var ul=document.getElementById(z[0]); if(!ul) return;
var da=[].map.call(ul.querySelectorAll(‚a‘),function(a){return a.href.replace(/\/$/,“);});
var ende=ul.querySelector(‚li:last-child‘);
list.forEach(function(p){
if(da.indexOf(String(p.link).replace(/\/$/,“))!==-1) return;
var d=document.createElement(‚div‘);d.innerHTML=(p.title&&p.title.rendered)||“;
var t=(d.textContent||“).split(/\s[–—-]\s|:\s/)[0].replace(/\s+(Test(\s+und\s+Erfahrungsbericht)?|Erfahrungen|Erfahrungsbericht|im\s+Test)$/i,“).trim();
var li=document.createElement(‚li‘),a=document.createElement(‚a‘);a.href=p.link;a.textContent=t;li.appendChild(a);ul.insertBefore(li,ende);
});
});
}).catch(function(){});
}
if(pt){pt.addEventListener(‚mouseenter‘,ptLaden);pt.addEventListener(‚focusin‘,ptLaden);}
var mbtn=h.querySelector(‚.gt-hdr__burger‘); if(mbtn) mbtn.addEventListener(‚click‘,ptLaden);
document.addEventListener(‚click‘,function(e){if(!h.contains(e.target)){[].forEach.call(h.querySelectorAll(‚.is-open‘),function(x){x.classList.remove(‚is-open‘);});[].forEach.call(h.querySelectorAll(‚[aria-expanded=“true“]‘),function(x){x.setAttribute(‚aria-expanded‘,’false‘);});}});
h.addEventListener(‚keydown‘,function(e){if(e.key===’Escape‘){[].forEach.call(h.querySelectorAll(‚.is-open‘),function(x){x.classList.remove(‚is-open‘);});[].forEach.call(h.querySelectorAll(‚[aria-expanded=“true“]‘),function(x){x.setAttribute(‚aria-expanded‘,’false‘);});}});
})();
Genussreich.de im Test Mit Herz [...]