Blog - Ideen mit Kisten

So baut ihr euch ein schickes Wandregal aus unseren Kisten!
// Auffaelliges, aber dezentes Button-Styling fuer beide Eintraege (einmalig) function injectStyle() { if (document.getElementById('hbRevocationStyle')) return; var css = '#hbRevocationButton,#hbRevocationButtonBottom{' + 'display:inline-flex;align-items:center;gap:6px;' + 'background:#2d2d2d;color:#fff !important;' + 'font-weight:700;font-size:14px;line-height:1;' + 'padding:10px 18px;border-radius:3px;' + 'text-decoration:none !important;white-space:nowrap;' + 'box-shadow:0 1px 2px rgba(0,0,0,.12);' + 'transition:background-color .2s ease;' + 'margin:6px 0;' + '}' + '#hbRevocationButton svg,#hbRevocationButtonBottom svg{' + 'width:16px;height:16px;flex:0 0 auto;display:block;' + '}' + '#hbRevocationButton:hover,#hbRevocationButtonBottom:hover,' + '#hbRevocationButton:focus,#hbRevocationButtonBottom:focus{' + 'background:#1a1a1a;color:#fff !important;' + '}' + '.footer--bottom .service--entry:has(#hbRevocationButtonBottom){' + 'display:inline-flex;align-items:center;' + '}'; var st = document.createElement('style'); st.id = 'hbRevocationStyle'; st.appendChild(document.createTextNode(css)); document.head.appendChild(st); } // Icon (stroke = currentColor, passt sich der Button-Textfarbe an) var ICON = ''; var LABEL = ICON + 'Vertrag widerrufen'; function inject() { injectStyle(); // 1) Echter Widget-Button in der Footer-Spalte "Shop Service" (id MUSS hbRevocationButton sein) if (!document.getElementById('hbRevocationButton')) { var ul1 = null; var cols = document.querySelectorAll('footer .footer--column'); for (var i = 0; i < cols.length; i++) { var h = cols[i].querySelector('.column--headline'); if (h && h.textContent.indexOf('Shop Service') !== -1) { ul1 = cols[i].querySelector('ul.navigation--list') || cols[i].querySelector('ul'); break; } } if (ul1) { var a1 = document.createElement('a'); a1.id = 'hbRevocationButton'; a1.className = 'navigation--link'; a1.href = HREF; a1.setAttribute('data-shop-id', SHOP_ID); a1.setAttribute('data-key', DATA_KEY); a1.setAttribute('data-preview', 'false'); a1.setAttribute('data-lang', 'de'); a1.rel = 'noopener'; a1.target = '_blank'; a1.title = 'Vertrag widerrufen'; a1.setAttribute('aria-label', 'Widerrufsformular öffnen'); a1.innerHTML = LABEL; var li1 = document.createElement('li'); li1.className = 'navigation--entry'; li1.setAttribute('role', 'menuitem'); li1.appendChild(a1); ul1.appendChild(li1); } } // 2) Zweiter Link in der unteren Service-Leiste -> oeffnet dasselbe Modal, sonst Formular direkt if (!document.getElementById('hbRevocationButtonBottom')) { var serviceList = document.querySelector('.footer--bottom .service--list') || document.querySelector('.footer--service-menu .service--list') || document.querySelector('ul.service--list'); if (serviceList) { var a2 = document.createElement('a'); a2.id = 'hbRevocationButtonBottom'; a2.className = 'service--link'; a2.href = HREF; a2.rel = 'noopener'; a2.target = '_blank'; a2.title = 'Vertrag widerrufen'; a2.setAttribute('aria-label', 'Widerrufsformular öffnen'); a2.innerHTML = LABEL; a2.addEventListener('click', function (e) { var main = document.getElementById('hbRevocationButton'); var ov = relocateOverlay(); // Wenn das Widget das Modal aktiviert hat, dieses ausloesen if (main && ov) { e.preventDefault(); main.click(); } // sonst: normaler Link -> Formular oeffnet im neuen Tab }); var li2 = document.createElement('li'); li2.className = 'service--entry'; li2.setAttribute('role', 'menuitem'); li2.appendChild(a2); serviceList.appendChild(li2); } } // Händlerbund-Widget-Loader (einmalig) -> macht aus Button 1 das Modal if (!document.getElementById('hbRevocationScript')) { var s = document.createElement('script'); s.id = 'hbRevocationScript'; s.async = true; s.src = 'https://connect.haendlerbund.de/widgets/revocation-button.js'; document.body.appendChild(s); } // Sobald das Widget das Overlay erzeugt hat, nach verschieben (Mobile-Fix) var tries = 0; var iv = setInterval(function () { if (relocateOverlay() || ++tries > 50) clearInterval(iv); }, 200); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', inject); } else { inject(); } })();