(function(){
var activeThumb = 0;
var DEFAULTS = {
inputBullets: 'Keinerlei Programmierkenntnisse noetig, alle erforderlichen Eingaben erfolgen direkt und intuitiv im online Editor.\nFarbliche Personalisierung moeglich per Farbauswahlfunktion im Editor\nLive Vorschau, sie sehen sofort was ihre Eingabe bewirkt.\nbis zu 12 Bilder\nHTML Export direkt in den Zwischenspeicher (klicken, einfuegen, fertig)'
};
function setDefaults(){
var csDefaults=[
{img:'https://primary.jwwb.nl/public/k/s/j/temp-ffjdsjxsjdrzqjuhntwc/01_00227-hirschmann-elka-4012-pg-7-4-polig-gerade-10-high.jpg',title:'Hirschmann ELKA 4012 PG 7'},
{img:'https://primary.jwwb.nl/public/k/s/j/temp-ffjdsjxsjdrzqjuhntwc/01_00224-pv140r1k1t1nfr1-parker-dension-axial-kolben-pumpe-mit-variabler-verdr-ngung-07-high.jpg',title:'Parker Axialkolbenpumpe'},
{img:'https://primary.jwwb.nl/public/k/s/j/temp-ffjdsjxsjdrzqjuhntwc/01_00196-siemens-3nw7534-1hg-sicherungshalter-30-a-600-v-high.jpg',title:'Siemens Sicherungshalter'},
{img:'https://primary.jwwb.nl/public/k/s/j/temp-ffjdsjxsjdrzqjuhntwc/01_00181-abb-3hne00313-1-teach-pendant-handprogrammierger-t-high.jpg',title:'ABB Teach Pendant'},
{img:'https://primary.jwwb.nl/public/k/s/j/temp-ffjdsjxsjdrzqjuhntwc/01_00180-phoenix-fiber-optic-termination-kit-fast-connection-tool-glasfaserkabel-werkzeugkoffer-02-high.jpg',title:'Phoenix Fiber Optic Kit'}
];
csDefaults.forEach(function(d,i){
var imgEl=document.getElementById('cs-img-'+(i+1));
var titleEl=document.getElementById('cs-title-'+(i+1));
if(imgEl&&!imgEl.value.trim()) imgEl.value=d.img;
if(titleEl&&!titleEl.value.trim()) titleEl.value=d.title;
});
Object.keys(DEFAULTS).forEach(function(id){
var el=document.getElementById(id);
if(el && !el.value.trim()) el.value=DEFAULTS[id];
});
}
function buildModal(id,title,warnBg,warnColor,warnText,placeholder){
if(document.getElementById("modal-"+id)) return;
var m=document.createElement("div");
m.id="modal-"+id;
m.style.cssText="display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.55);z-index:99999;align-items:center;justify-content:center;";
var rid="rte-modal-"+id;
m.innerHTML='
'
+'
'
+''+title+''
+'
'
+'
'+warnText+'
'
+'
'
+''
+''
+''
+''
+'
'
+'
'+placeholder+'
'
+'
'
+''
+''
+'
';
document.body.appendChild(m);
}
function buildColorPickers(){
var eBody=document.getElementById('editor-body');
if(!eBody||document.getElementById('custom-colors')) return;
var cmEl=document.getElementById('colorMain');
if(!cmEl) return;
var rowEl=cmEl;
while(rowEl.parentNode!==eBody) rowEl=rowEl.parentNode;
var pal=['#002f6c','#1a3a6b','#003366','#0066cc','#0099cc','#2c3e50','#e53238','#cc0000','#8b0000','#d4351c','#ff6600','#f39c12','#008000','#2e8b57','#27ae60','#1abc9c','#800080','#9b59b6','#000000','#333333','#555555','#777777','#999999','#ffffff'];
var div=document.createElement('div');
div.id='custom-colors';
function mkRow(lbl,tgt,defVal){
var h='
'+lbl+':
';
h+='
';
for(var i=0;i
';}
h+='
';
return h;
}
var caVal=(document.getElementById('colorAccent')||{value:'#e53238'}).value;
div.innerHTML=mkRow('Hauptfarbe','Main',cmEl.value)+mkRow('Akzentfarbe','Accent',caVal);
eBody.insertBefore(div,rowEl.nextElementSibling);
}
function buildColorPresets(){
var eBody=document.getElementById('editor-body');
if(!eBody||document.getElementById('color-presets')) return;
var cc=document.getElementById('custom-colors');
if(!cc) return;
var pr=[['Classic eBay','#002f6c','#e53238'],['Luxury Gold','#1a1a2e','#d4a832'],['Bold Tech','#1a1a1a','#cc0000'],['Nature Outdoor','#2d572c','#ff6600'],['Clean Eco','#333333','#27ae60'],['Sport Energy','#0047ab','#ff8c00'],['Elegant Wine','#800020','#d4a832'],['Modern Teal','#008080','#ff6b6b'],['Modern Tech','#2d2d2d','#e53238'],['Midnight Blue','#0f172a','#38bdf8']];
var div=document.createElement('div');
div.id='color-presets';
var h='
Schnellkonfig:
';
h+='
';
for(var i=0;i';
h+='
SHOP • KONTAKT
';
h+='
';
h+=''+p[0]+'';
h+='49,95
';
h+='
AKTIV
TAB
';
h+='
';
}
h+='';
div.innerHTML=h;
eBody.insertBefore(div,cc);
}
function buildLogoAlign(){
var eBody=document.getElementById('editor-body');
if(!eBody||document.getElementById('logo-align-btns')) return;
var imgInp=document.getElementById('inputLogoImg');
if(!imgInp) return;
var imgParent=imgInp;
while(imgParent.parentNode!==eBody) imgParent=imgParent.parentNode;
var div=document.createElement('div');
div.id='logo-align-btns';
div.style.cssText='display:flex;gap:4px;margin-bottom:8px;';
div.innerHTML='Ausrichtung:'
+''
+''
+'';
eBody.insertBefore(div,imgParent.nextSibling);
}
function buildCategoryPreview(){
var badges=document.getElementById('pv-badges');
if(!badges||!badges.parentNode) return;
if(document.getElementById('pv-categories')) return;
var cat=document.createElement('div');
cat.id='pv-categories';
cat.style.cssText='display:none;';
badges.parentNode.insertBefore(cat,badges.nextSibling);
}
function buildCategoryEditor(){
var eBody=document.getElementById('editor-body');
if(!eBody||document.getElementById('cat-section')) return;
var inputLogo=document.getElementById('inputLogo');
if(!inputLogo) return;
var logoParent=inputLogo;
while(logoParent.parentNode!==eBody) logoParent=logoParent.parentNode;
var logoTitle=logoParent.previousElementSibling;
var sec=document.createElement('div');
sec.id='cat-section';
sec.innerHTML='
Shop-Kategorieleiste
'
+'
Nur eBay-interne Links verwenden!
'
+''
+'';
eBody.insertBefore(sec,logoTitle);
}
function init(){
var app=document.getElementById('app');
if(!app) return;
document.body.appendChild(app);
var _tn=document.getElementById('pv-topnav');
if(_tn&&_tn.parentNode) Array.from(_tn.parentNode.children).forEach(function(ch){ if(ch.tagName==='P'&&!ch.textContent.trim()) ch.style.display='none'; });
var _cr2=document.querySelector('.color-row');
if(_cr2){ _cr2.querySelectorAll('p').forEach(function(p){ if(!p.textContent.trim()) p.style.display='none'; }); _cr2.querySelectorAll('br').forEach(function(br){ br.style.display='none'; }); }
app.style.cssText='position:fixed!important;top:32px!important;left:0!important;right:0!important;bottom:0!important;display:flex!important;z-index:9000!important;background:#e9ecef!important;';
setDefaults();
if(typeof applyCrossSell==='function') applyCrossSell();
applyColors(); applyLinks(); applyLogo(); applyProduct(); applyGallery(); applyTabs();
buildModal("impressum","Impressum bearbeiten","#fff3cd","#856404","Pflichtangabe gemaess SS 5 TMG fuer gewerbliche Anbieter.","
[Firmenname]
[Strasse Hausnummer]
[PLZ Ort]
E-Mail: [ihre@email.de]
Tel.: [+49 ...]
");
buildModal("agb","AGB bearbeiten","#fff3cd","#856404","Verwenden Sie eigene, rechtlich geprufte AGB.","
[Ihre AGB hier eintragen]
");
buildModal("widerruf","Widerrufsbelehrung bearbeiten","#f8d7da","#721c24","Rechtspflicht gemaess SS 312g, 355 BGB.","
");
buildModal("barriere","Barrierefreiheit bearbeiten","#d1ecf1","#0c5460","BFSG gilt ab 28.06.2025 fuer gewerbliche Anbieter.","
[Erklaerung zur Barrierefreiheit hier eintragen]
");
window._logoAlign='left';
buildLogoAlign();
buildColorPickers();
buildColorPresets();
var _cr=document.querySelector('.color-row');
var _cc=document.getElementById('custom-colors');
if(_cr&&_cc&&_cr.parentNode){
var _resetEl=_cr.nextElementSibling;
while(_resetEl&&(_resetEl.id==='color-presets'||_resetEl.id==='custom-colors')) _resetEl=_resetEl.nextElementSibling;
var _imgUrl='https://templates24-uiuzqhzpfq.live-website.com/wp-content/uploads/2026/06/Farbpicker.png';
var _fp=document.createElement('div');
_fp.id='free-color-pick';
_fp.innerHTML='
Freie Farbauswahl:
'
+'
'
+'
Hauptfarbe
'
+'
Akzent
'
+'
';
_cc.parentNode.insertBefore(_fp,_cc.nextSibling);
var _mw=document.getElementById('fcp-main-wrap');
var _aw=document.getElementById('fcp-accent-wrap');
_mw.innerHTML='';
_aw.innerHTML='';
var _cmI=document.getElementById('colorMain');
var _caI=document.getElementById('colorAccent');
_cmI.style.cssText='position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;cursor:pointer;';
_caI.style.cssText='position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;cursor:pointer;';
_mw.appendChild(_cmI);
_aw.appendChild(_caI);
_cr.style.display='none';
if(_resetEl){ _resetEl.style.cssText='margin-top:10px;'; _fp.appendChild(_resetEl); }
}
buildCategoryPreview();
buildCategoryEditor();
applyCategories();
setTimeout(function(){ applyProduct(); applyGallery(); applyTabs(); applyCategories(); }, 100);
}
window.openModal=function(id){var m=document.getElementById(id);if(m)m.style.display="flex";};
window.closeModal=function(id){var m=document.getElementById(id);if(m){m.style.display="none";applyTabs();}};
window.applyColors = function(){
var cm=(document.getElementById('colorMain')||{value:'#002f6c'}).value;
var ca=(document.getElementById('colorAccent')||{value:'#e53238'}).value;
var _hm=document.getElementById('hexMain'); if(_hm) _hm.value=cm;
var _hp=document.getElementById('hexMainPrev'); if(_hp) _hp.style.background=cm;
var _ha=document.getElementById('hexAccent'); if(_ha) _ha.value=ca;
var _hp2=document.getElementById('hexAccentPrev'); if(_hp2) _hp2.style.background=ca;
var el;
el=document.getElementById('pv-topnav'); if(el) el.style.background=cm;
el=document.getElementById('pv-logo-row'); if(el) el.style.borderBottomColor=cm;
el=document.getElementById('pv-price'); if(el) el.style.color=ca;
['badge1','badge2','badge3'].forEach(function(id){ var b=document.getElementById(id); if(b) b.style.color=cm; });
document.querySelectorAll('.pv-thumb.active').forEach(function(t){ t.style.borderColor=cm; });
// Tab-Farben aktualisieren
var cm2 = cm;
document.querySelectorAll('.pvt-label').forEach(function(l){
l.style.background = l.classList.contains('active') ? cm2 : '#1a3a6b';
});
el=document.getElementById('pv-tabs'); if(el){ el.style.borderBottomColor='transparent'; el.style.borderBottomWidth='0'; }
// Alle pvt-labels faerben (Produkt + Legal)
document.querySelectorAll('.pvt-label').forEach(function(l){ l.style.background=l.classList.contains('active')?ca:cm; l.style.color='#fff'; });
// RTE-Felder: Fokus-Rahmen in Hauptfarbe
document.querySelectorAll('.rte-content').forEach(function(r){ r.style.borderColor=cm; });
// Akzentfarbe: aktiver Tab Unterstrich
document.querySelectorAll('.pvt-label.active').forEach(function(l){ });
var catBar=document.getElementById('pv-categories');
if(catBar&&catBar.firstElementChild) catBar.firstElementChild.style.background=cm;
};
window.applyLinks = function(){
var map={linkShop:'pv-link-shop',linkKontakt:'pv-link-kontakt',linkBew:'pv-link-bew'};
Object.keys(map).forEach(function(inp){
var i=document.getElementById(inp), l=document.getElementById(map[inp]);
if(i&&l) l.href=i.value||'#';
});
};
window.applyLogo = function(){
var text=document.getElementById('inputLogo');
var imgInp=document.getElementById('inputLogoImg');
var pvText=document.getElementById('pv-logo-text');
var pvImg=document.getElementById('pv-logo-img');
if(!pvText||!pvImg) return;
var imgVal=imgInp?imgInp.value.trim():'';
if(imgVal){ pvImg.src=imgVal; pvImg.style.cssText='display:inline-block;max-width:100%;max-height:150px;object-fit:contain;'; pvText.style.display='none'; }
else {
pvText.textContent=(text&&text.value.trim())?text.value.trim():'[Ihr Firmenname / Shop-Name]';
pvText.style.display='inline'; pvImg.style.display='none';
}
var logoRow=document.getElementById('pv-logo-row');
if(logoRow) logoRow.style.textAlign=window._logoAlign||'left';
};
window.applyProduct = function(){
var ca=(document.getElementById('colorAccent')||{value:'#e53238'}).value;
var titleEl=document.getElementById('pv-title');
var titleIn=document.getElementById('inputTitle');
if(titleEl) titleEl.textContent=(titleIn&&titleIn.value.trim())?titleIn.value.trim():'[Ihr Artikeltitel]';
var priceEl=document.getElementById('pv-price');
var priceIn=document.getElementById('inputPrice');
if(priceEl){
priceEl.innerHTML=((priceIn&&priceIn.value.trim())?priceIn.value.trim():'0,00')+' €';
priceEl.style.color=ca;
}
var bulletsEl=document.getElementById('pv-bullets');
var bulletsIn=document.getElementById('inputBullets');
if(bulletsEl&&bulletsIn){
var ca2=ca; var html='';
bulletsIn.value.split('\n').forEach(function(l){
var ln=l.trim();
if(ln) html+='
'
+'✓'+ln+'
';
});
bulletsEl.innerHTML=html;
}
};
window.applyGallery = function(){
var cm=(document.getElementById('colorMain')||{value:'#002f6c'}).value;
var rows=document.querySelectorAll('#img-list .img-row input');
var urls=[]; rows.forEach(function(inp){ var v=inp.value.trim(); if(v) urls.push(v); });
var mainImg=document.getElementById('pv-main-img');
var thumbsEl=document.getElementById('pv-thumbs');
if(!mainImg||!thumbsEl) return;
if(urls.length===0){ mainImg.innerHTML='Kein Bild'; thumbsEl.innerHTML=''; return; }
if(activeThumb>=urls.length) activeThumb=0;
mainImg.innerHTML='';
var thumbHTML='';
urls.forEach(function(url,i){
var border=i===activeThumb?'2px solid '+cm:'1px solid #ddd';
thumbHTML+='
'
+'
';
});
thumbsEl.innerHTML=thumbHTML;
};
window.setThumb=function(idx){ activeThumb=idx; applyGallery(); };
window.addImg=function(){
var list=document.getElementById('img-list'); if(!list) return;
var rows=list.querySelectorAll('.img-row');
if(rows.length>=12){ alert('Maximal 12 Bilder erlaubt.'); return; }
var div=document.createElement('div'); div.className='img-row';
div.innerHTML=''
+'';
list.appendChild(div);
};
window.removeImg=function(btn){ var row=btn.parentElement; row.parentElement.removeChild(row); applyGallery(); };
// ---- TABS ----
window.showLegalTab=function(idx){
var legalIds=[3,4,5,6,7];
// Legal pvt-content active setzen
legalIds.forEach(function(i){
var el=document.getElementById("pvt"+i);
if(el) el.classList.toggle("active", i===idx);
});
// Legal nav labels active setzen
var navEl=document.getElementById("pv-tabs-legal-nav");
if(navEl) navEl.querySelectorAll(".pvt-label").forEach(function(l,i){
l.classList.toggle("active", legalIds[i]===idx);
});
applyColors();
};
window.showTab=function(idx){
document.querySelectorAll('.pvt-label').forEach(function(l,i){ l.classList.toggle('active',i===idx); });
document.querySelectorAll('.pvt-content').forEach(function(c,i){ c.classList.toggle('active',i===idx); });
applyColors(); // Tab-Farben aktualisieren
};
window.applyTabs=function(){
var el;
el=document.getElementById('pvt0');
var b=document.getElementById('rte-beschr'); if(el&&b) el.innerHTML=b.innerHTML;
// Zahlung: Toggle-Auswahl + Text
var zahlung='';
var onBtns=[];
document.querySelectorAll('#zahlung-btns .tgl-btn.on').forEach(function(b){ onBtns.push(b.innerHTML); });
if(onBtns.length){
zahlung='
';
cs.innerHTML=html;
};
window.applyCategories=function(){
var cm=(document.getElementById('colorMain')||{value:'#002f6c'}).value;
var catEl=document.getElementById('pv-categories');
if(!catEl) return;
var rows=document.querySelectorAll('#cat-list .cat-row');
var items=[];
rows.forEach(function(row){
var nameInp=row.querySelector('.cat-name');
var urlInp=row.querySelector('.cat-url');
var name=nameInp?nameInp.value.trim():'';
var url=urlInp?urlInp.value.trim():'';
if(name) items.push({name:name,url:url});
});
if(items.length===0){ catEl.style.display='none'; catEl.innerHTML=''; return; }
catEl.style.display='block';
var html='
';
}
tabVersand+=((document.getElementById('rte-versand')||{innerHTML:''}).innerHTML);
// Galerie
var galHTML='';
if(urls.length>0){
var radios='',mains='',css='';
galHTML='
'+radios+css
+'
'+mains+'
'
+'
'+thumbsH+'
';
} else { galHTML=''; }
var logoHTML=logoImg?''
:''+(logo||'[Shop-Name]')+'';
var bulletsHTML='';
bulletsRaw.split('\n').forEach(function(l){
var ln=l.trim();
if(ln) bulletsHTML+='
'
+'✓'+ln+'
';
});
// CSS-only Tab-System fuer Export
var pIds=['ptab1','ptab2','ptab3'];
var pLabels=['PRODUKTBESCHREIBUNG','ZAHLUNG','VERSAND'];
var pContents=[tabBeschr,tabZahlung,tabVersand];
var pRadios=''; var pCSS='';
var pNav='
';
for(var i=0;i<3;i++) pNav+='';
pNav+='
';
var pBody='
';
for(var i=0;i<3;i++) pBody+='
'+pContents[i]+'
';
pBody+='
';
var prodBlock='
'+pRadios+pCSS+pNav+pBody+'
';
var lIds=['ltab1','ltab2','ltab3','ltab4','ltab5'];
var lLabels=['IMPRESSUM','AGB','WIDERRUF','DATENSCHUTZ','BARRIEREFREIHEIT'];
var _impE=(document.getElementById('rte-modal-impressum')||{innerHTML:''}).innerHTML;
var _agbE=(document.getElementById('rte-modal-agb')||{innerHTML:''}).innerHTML;
var _widE=(document.getElementById('rte-modal-widerruf')||{innerHTML:''}).innerHTML;
var _datE=(document.getElementById('rte-modal-datenschutz')||{innerHTML:''}).innerHTML;
var _barE=(document.getElementById('rte-modal-barriere')||{innerHTML:''}).innerHTML;
var lContents=[_impE,_agbE,_widE,_datE,_barE];
var lRadios=''; var lCSS='';
var lNav='
';
for(var i=0;i<5;i++) lNav+='';
lNav+='
';
var lBody='
';
for(var i=0;i<5;i++) lBody+='
'+lContents[i]+'
';
lBody+='
';
// Cross-Selling Export
var csExp='';
var csExpItems=[];
for(var i=1;i<=5;i++){
var csImg=(document.getElementById('cs-img-'+i)||{value:''}).value.trim();
var csTitle=(document.getElementById('cs-title-'+i)||{value:''}).value.trim();
var csUrl=(document.getElementById('cs-url-'+i)||{value:''}).value.trim();
if(csTitle||csImg) csExpItems.push({img:csImg,title:csTitle,url:csUrl});
}
if(csExpItems.length>0){
csExp='
';
var catExpItems=[];
document.querySelectorAll('#cat-list .cat-row').forEach(function(row){
var n=row.querySelector('.cat-name');
var u=row.querySelector('.cat-url');
if(n&&n.value.trim()) catExpItems.push({name:n.value.trim(),url:u?u.value.trim():''});
});
var catBarExp='';
if(catExpItems.length>0){
catBarExp='