/* * © 2026 template-generator24.de - All Rights Reserved * Unauthorized copying of this file, via any medium, is strictly prohibited * Proprietary and confidential. Written by template-generator24.de */ (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 buildEulaModal(){ if(document.getElementById('modal-eula')) return; var m=document.createElement('div'); m.id='modal-eula'; m.style.cssText='display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.6);z-index:99999;justify-content:center;align-items:center;'; var box=document.createElement('div'); box.style.cssText='background:#fff;border-radius:10px;padding:30px;max-width:740px;width:90%;max-height:85vh;overflow-y:auto;position:relative;box-shadow:0 8px 32px rgba(0,0,0,0.3);'; var closeBtn='
'; var deTitle='

🇩🇪 Geistiges Eigentum und Nutzungsrechte

'; var deText='

' +'1. Eigentum an der Software: Alle Rechte an dem geistigen Eigentum, einschließlich, aber nicht beschränkt auf den Quellcode, die Software-Architektur, das Design der Benutzeroberfläche, Grafiken, Algorithmen und die spezifischen JSON-Dateistrukturen, die innerhalb des Generators verwendet werden, verbleiben das ausschließliche Eigentum von DJ-Industrieteilehandel, Inhaber: Danijel Jeremic, Odenwaldstraße 5, 76461 Muggensturm.

' +'2. Nutzungsrecht für den Kunden: Mit dem Kauf eines gültigen Abonnements (einschließlich des bezahlten Testzugangs) erhält der Nutzer ein nicht-exklusives, nicht-übertragbares, widerrufliches, weltweites Recht, den Generator zur Erstellung von eBay-Verkaufsvorlagen für die eigenen gewerblichen oder selbständigen geschäftlichen Aktivitäten zu nutzen.

' +'3. Einschränkungen: Dem Nutzer ist es strikt untersagt:
' +'• Den Quellcode des Generators zurückzuentwickeln (Reverse Engineering), zu dekompilieren oder zu kopieren.
' +'• Die Generator-Software oder deren Kernfunktionen an Dritte weiterzuverkaufen, zu vermieten oder als White-Label-Produkt anzubieten.
' +'• Automatisierte Bots oder Scraper zu verwenden, um Daten oder Code von der Plattform zu extrahieren.

' +'4. Eigentum an den erzeugten Inhalten: Die durch die Software generierten HTML-Templates sowie die vom Nutzer heruntergeladenen, exportierten JSON-Konfigurationsdateien sind Eigentum des Nutzers. Der Nutzer behält das unbeschränkte Recht, diese generierten Codes zu nutzen, zu ändern und bei eBay hochzuladen, auch nachdem das Abonnement abgelaufen oder gekündigt ist.' +'

'; var enTitle='

🇺🇸 Intellectual Property and Usage License

'; var enText='

' +'1. Ownership of the Software: All intellectual property rights, including but not limited to source code, software architecture, user interface design, graphics, algorithms, and the unique JSON file structures used within the Generator, remain the exclusive property of DJ-Industrieteilehandel, Owner: Danijel Jeremic, Odenwaldstrasse 5, 76461 Muggensturm, Germany.

' +'2. License to the User: Upon purchasing a valid subscription (including the paid trial access), the User is granted a non-exclusive, non-transferable, revocable, worldwide license to use the Generator for the purpose of creating eBay listing templates for their own commercial or professional business activities.

' +'3. Restrictions: The User is strictly prohibited from:
' +'• Reverse-engineering, decompiling, or copying the source code of the Generator.
' +'• Reselling, renting, or white-labeling the Generator software or its core functionality to third parties.
' +'• Using automated bots or scrapers to extract data or code from the platform.

' +'4. Ownership of Generated Output: The HTML templates generated by the software, as well as the exported JSON configuration files downloaded by the User, are the property of the User. The User retains the unlimited right to use, modify, and upload these generated codes to eBay, even after the subscription has expired or has been canceled.' +'

'; var footer='

' +'© 2026 DJ-Industrieteilehandel, Owner: Danijel Jeremic. All rights reserved.' +'

'; box.innerHTML = closeBtn + deTitle + deText + enTitle + enText + footer; m.appendChild(box); m.addEventListener('click', function(e){ if(e.target===m) closeModal('modal-eula'); }); document.body.appendChild(m); } function init(){ var app=document.getElementById('app'); if(!app) return; document.body.appendChild(app); // Fix: preview-frame overflow hidden to prevent badge bleed setTimeout(function(){ var _pf=document.getElementById('preview-frame'); if(_pf) _pf.style.overflow='hidden'; var _pvb=document.getElementById('pv-badges'); if(_pvb){ _pvb.style.flexWrap='wrap'; _pvb.style.gap='8px 16px'; _pvb.style.overflowX='hidden'; } },100); // Fix: product right column flex overflow var _pvTitle=document.getElementById('pv-title'); if(_pvTitle&&_pvTitle.parentElement){ var _rc=_pvTitle.parentElement; _rc.style.minWidth='0'; _rc.style.wordBreak='break-word'; _rc.style.overflowWrap='break-word'; } 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(); var _liEl=document.getElementById('inputLogoImg');if(_liEl&&!_liEl.value){_liEl.value='https://templates24-uiuzqhzpfq.live-website.com/wp-content/uploads/2026/06/Template-generator24.de-Baner-860x150-1.png';var _pvL=document.getElementById('pv-logo-img');if(_pvL){_pvL.src=_liEl.value;_pvL.style.display='block';}} var _hm=document.getElementById('colorMain');if(_hm)_hm.value='#192b57';var _ha=document.getElementById('colorAccent');if(_ha)_ha.value='#e96a20';var _hxm=document.getElementById('hexMain');if(_hxm)_hxm.value='#192b57';var _hxa=document.getElementById('hexAccent');if(_hxa)_hxa.value='#e96a20';if(typeof applyColors==='function')buildEulaModal(); applyColors(); var _gUrls=['https://template-generator24.de/wp-content/uploads/2026/06/template-generator24.de-der-online-Live-Generator-1.png','https://templates24-uiuzqhzpfq.live-website.com/wp-content/uploads/2026/06/Template-generator24.de-Design-vorlagen-und-Personalisierung-3.png','https://template-generator24.de/wp-content/uploads/2026/06/template-generator24.de-der-online-Generator-mit-intuitiver-Bedienung.png','https://template-generator24.de/wp-content/uploads/2026/06/template-generator24.de-der-online-Generator-mit-Cross-Selling-und-Rechtstextangabefeldern.png','https://template-generator24.de/wp-content/uploads/2026/06/template-generator24.de-der-online-Generator-Bezahl-und-Versand-Icon.png','https://template-generator24.de/wp-content/uploads/2026/06/template-generator24.de-der-online-Generator-mit-einem-Click-Design-lokal-Speichern-und-Ebay-HTMLCode-exportieren.png'];var _gRows=document.querySelectorAll('.img-row');var _needed=_gUrls.length-_gRows.length;for(var _gi=0;_gi<_needed;_gi++){if(typeof addImg==='function')addImg();}var _gRows2=document.querySelectorAll('.img-row');_gUrls.forEach(function(u,i){if(_gRows2[i]){var inp=_gRows2[i].querySelector('input');if(inp)inp.value=u;}});if(typeof applyGallery==='function')applyGallery(); 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.","

[Widerrufsbelehrung hier eintragen]

"); buildModal("datenschutz","Datenschutz bearbeiten","#d1ecf1","#0c5460","Datenschutzerklaerung gemaess DSGVO Art.13 erforderlich.","

[Datenschutzerklaerung hier eintragen]

"); 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(); buildUploadZone(); // Build editor footer with legal links (function(){ var eBody = document.getElementById('editor-body'); if(!eBody) return; var ft = document.createElement('div'); ft.style.cssText = 'border-top:2px solid #dee2e6;margin-top:20px;padding:16px 12px 8px;text-align:center;'; ft.innerHTML = '

' + '© 2026 DJ-Industrieteilehandel (template-generator24.de)' + '

' + '

' + 'Impressum' + '  |  ' + 'AGB' + '  |  ' + 'Datenschutz' + '
' + 'Legal Notice' + '  |  ' + 'Terms of Service' + '  |  ' + 'Privacy Policy' + '

'; eBody.appendChild(ft); })(); setTimeout(function(){ applyProduct(); applyGallery(); applyTabs(); applyCategories(); adaptLayout(); }, 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){ var _cur=(document.getElementById('priceCurrency')||{value:'\x26euro;'}).value;var _tax=(document.getElementById('priceTax')||{value:''}).value;priceEl.innerHTML=((priceIn&&priceIn.value.trim())?priceIn.value.trim():'0,00')+' '+_cur+(_tax?' '+_tax:''); 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='

Akzeptierte Zahlungsarten:

'; zahlung+='
' +onBtns.map(function(h){ return ''+h+''; }).join('') +'
'; } var rz=document.getElementById('rte-zahlung'); if(rz) zahlung+=rz.innerHTML; el=document.getElementById('pvt1'); if(el) el.innerHTML=zahlung; // Versand: Toggle-Auswahl + Text var versand=''; var onShip=[]; document.querySelectorAll('#versand-btns .tgl-btn.on').forEach(function(b){ onShip.push(b.innerHTML); }); if(onShip.length){ versand='

Versandoptionen:

'; versand+='
' +onShip.map(function(h){ return ''+h+''; }).join('') +'
'; } var rv=document.getElementById('rte-versand'); if(rv) versand+=rv.innerHTML; el=document.getElementById('pvt2'); if(el) el.innerHTML=versand; var _imp=document.getElementById('rte-modal-impressum'); el=document.getElementById('pvt3'); if(el) el.innerHTML=_imp?_imp.innerHTML:'

[Impressum hier eintragen]

'; var _a=document.getElementById('rte-modal-agb'); el=document.getElementById('pvt4'); if(el) el.innerHTML=_a?_a.innerHTML:'

[AGB hier eintragen]

'; var _w=document.getElementById('rte-modal-widerruf'); el=document.getElementById('pvt5'); if(el) el.innerHTML=_w?_w.innerHTML:'

[Widerruf hier eintragen]

'; var _d=document.getElementById('rte-modal-datenschutz'); el=document.getElementById('pvt6'); if(el) el.innerHTML=_d?_d.innerHTML:'

[Datenschutz hier eintragen]

'; var _b=document.getElementById('rte-modal-barriere'); el=document.getElementById('pvt7'); if(el) el.innerHTML=_b?_b.innerHTML:'

[Barrierefreiheit hier eintragen]

'; }; // ---- RTE ---- window.applyCrossSell=function(){ var cs=document.getElementById('pv-crosssell'); if(!cs) return; var items=[]; for(var i=1;i<=5;i++){ var img=(document.getElementById('cs-img-'+i)||{value:''}).value.trim(); var title=(document.getElementById('cs-title-'+i)||{value:''}).value.trim(); var url=(document.getElementById('cs-url-'+i)||{value:''}).value.trim(); if(title||img) items.push({img:img,title:title,url:url}); } if(items.length===0){ cs.style.display='none'; cs.innerHTML=''; return; } cs.style.display='block'; var html='
'; html+='
Das koennte Sie auch interessieren
'; html+='
'; items.forEach(function(p){ html+=''; html+='
'; if(p.img) html+=''; else html+='
'; html+='
'+p.title+'
'; html+='
'; }); html+='
'; 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='
' +'
'; items.forEach(function(item){ html+=''+item.name+''; }); html+='
'; catEl.innerHTML=html; }; window.addCat=function(){ var list=document.getElementById('cat-list'); if(!list) return; var rows=list.querySelectorAll('.cat-row'); if(rows.length>=8){ alert('Maximal 8 Kategorien erlaubt.'); return; } var div=document.createElement('div'); div.className='cat-row'; div.style.cssText='display:flex;gap:4px;margin-bottom:4px;'; div.innerHTML='' +'' +''; list.appendChild(div); }; window.removeCat=function(btn){ var row=btn.parentElement; row.parentElement.removeChild(row); applyCategories(); }; window.setLogoAlign=function(align){ window._logoAlign=align; var ca=(document.getElementById('colorAccent')||{value:'#e53238'}).value; document.querySelectorAll('#logo-align-btns button').forEach(function(btn){ var isActive=btn.getAttribute('data-align')===align; btn.style.background=isActive?ca:'#f8f9fa'; btn.style.color=isActive?'#fff':'#333'; btn.style.borderColor=isActive?ca:'#ced4da'; }); applyLogo(); }; window.pickColor=function(tgt,color){ if(!/^#[0-9a-fA-F]{6}$/.test(color)) return; var inp=document.getElementById('color'+tgt); if(inp) inp.value=color; var hex=document.getElementById('hex'+tgt); if(hex) hex.value=color; var prev=document.getElementById('hex'+tgt+'Prev'); if(prev) prev.style.background=color; applyColors(); applyProduct(); applyGallery(); }; window.applyPreset=function(main,accent){ var cm=document.getElementById('colorMain'); var ca=document.getElementById('colorAccent'); if(cm) cm.value=main; if(ca) ca.value=accent; applyColors(); applyProduct(); applyGallery(); }; window.rteCmd=function(id,cmd){ var el=document.getElementById(id); if(!el) return; el.focus(); document.execCommand(cmd,false,null); applyTabs(); }; window.rteSize=function(id,size){ var el=document.getElementById(id); if(!el) return; el.focus(); document.execCommand('fontSize',false,'7'); var fonts=el.querySelectorAll('font[size="7"]'); fonts.forEach(function(f){ var span=document.createElement('span'); span.style.fontSize=size; span.innerHTML=f.innerHTML; f.parentNode.replaceChild(span,f); }); applyTabs(); }; window.rteClear=function(id){ var el=document.getElementById(id); if(!el) return; el.focus(); document.execCommand('removeFormat',false,null); applyTabs(); }; // ---- TOGGLE BUTTONS ---- window.togglePay=function(btn){ btn.classList.toggle('on'); applyTabs(); }; window.toggleShip=function(btn){ btn.classList.toggle('on'); applyTabs(); }; // ---- FARBEN RESET ---- window.resetColors=function(){ document.getElementById('colorMain').value='#002f6c'; document.getElementById('colorAccent').value='#e53238'; applyColors(); applyProduct(); applyGallery(); }; // ---- DESIGN SPEICHERN ---- window.saveDesign=function(){ var imgUrls=[]; document.querySelectorAll('#img-list .img-row input').forEach(function(inp){ imgUrls.push(inp.value.trim()); }); var payOn=[]; var payOnHTML=[]; document.querySelectorAll('#zahlung-btns .tgl-btn.on').forEach(function(b){ payOn.push(b.textContent.trim()); payOnHTML.push(b.innerHTML); }); var shipOn=[]; var shipOnHTML=[]; document.querySelectorAll('#versand-btns .tgl-btn.on').forEach(function(b){ shipOn.push(b.textContent.trim()); shipOnHTML.push(b.innerHTML); }); var catItems=[]; document.querySelectorAll('#cat-list .cat-row').forEach(function(row){ var n=row.querySelector('.cat-name'); var u=row.querySelector('.cat-url'); catItems.push({name:n?n.value.trim():'',url:u?u.value.trim():''}); }); var csItems=[]; for(var i=1;i<=5;i++) csItems.push({img:(document.getElementById('cs-img-'+i)||{value:''}).value,title:(document.getElementById('cs-title-'+i)||{value:''}).value,url:(document.getElementById('cs-url-'+i)||{value:''}).value}); var design={ generator_source:'template-generator24.de', version:2, colorMain:(document.getElementById('colorMain')||{value:'#002f6c'}).value, colorAccent:(document.getElementById('colorAccent')||{value:'#e53238'}).value, linkShop:(document.getElementById('linkShop')||{value:''}).value, linkKontakt:(document.getElementById('linkKontakt')||{value:''}).value, linkBew:(document.getElementById('linkBew')||{value:''}).value, inputLogo:(document.getElementById('inputLogo')||{value:''}).value, inputLogoImg:(document.getElementById('inputLogoImg')||{value:''}).value, inputTitle:(document.getElementById('inputTitle')||{value:''}).value, inputPrice:(document.getElementById('inputPrice')||{value:''}).value, priceCurrency:(document.getElementById('priceCurrency')||{value:'\x26euro;'}).value, priceTax:(document.getElementById('priceTax')||{value:''}).value, inputBullets:(document.getElementById('inputBullets')||{value:''}).value, imgUrls:imgUrls, rteBeschr:(document.getElementById('rte-beschr')||{innerHTML:''}).innerHTML, rteZahlung:(document.getElementById('rte-zahlung')||{innerHTML:''}).innerHTML, rteVersand:(document.getElementById('rte-versand')||{innerHTML:''}).innerHTML, rteImpressum:(document.getElementById('rte-modal-impressum')||{innerHTML:''}).innerHTML, rteAgb:(document.getElementById('rte-modal-agb')||{innerHTML:''}).innerHTML, rteWiderruf:(document.getElementById('rte-modal-widerruf')||{innerHTML:''}).innerHTML, rteDatenschutz:(document.getElementById('rte-modal-datenschutz')||{innerHTML:''}).innerHTML, rteBarriere:(document.getElementById('rte-modal-barriere')||{innerHTML:''}).innerHTML, csItems:csItems, payOn:payOn, shipOn:shipOn, catItems:catItems, logoAlign:window._logoAlign||'left' }; var blob=new Blob([JSON.stringify(design,null,2)],{type:'application/json'}); var url=URL.createObjectURL(blob); var a=document.createElement('a'); a.href=url; a.download='mein-ebay-design.json'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; // ---- DESIGN LADEN ---- window.loadDesign=function(event){ var file=event.target.files[0]; if(!file) return; var reader=new FileReader(); reader.onload=function(e){ try { var d=JSON.parse(e.target.result); function setVal(id,val){ var el=document.getElementById(id); if(el&&val!==undefined) el.value=val; } function setHTML(id,val){ var el=document.getElementById(id); if(el&&val!==undefined) el.innerHTML=val; } setVal('colorMain',d.colorMain); setVal('colorAccent',d.colorAccent); setVal('linkShop',d.linkShop); setVal('linkKontakt',d.linkKontakt); setVal('linkBew',d.linkBew); setVal('inputLogo',d.inputLogo); setVal('inputLogoImg',d.inputLogoImg); setVal('inputTitle',d.inputTitle); setVal('inputPrice',d.inputPrice); if(d.priceCurrency){var _pcEl=document.getElementById('priceCurrency');if(_pcEl)_pcEl.value=d.priceCurrency;} if(d.priceTax){var _ptEl=document.getElementById('priceTax');if(_ptEl)_ptEl.value=d.priceTax;} setVal('inputBullets',d.inputBullets); setHTML('rte-beschr',d.rteBeschr); setHTML('rte-zahlung',d.rteZahlung); setHTML('rte-versand',d.rteVersand); // Rechtstext-Modals if(d.rteImpressum!==undefined) setHTML('rte-modal-impressum',d.rteImpressum); if(d.rteAgb!==undefined) setHTML('rte-modal-agb',d.rteAgb); if(d.rteWiderruf!==undefined) setHTML('rte-modal-widerruf',d.rteWiderruf); if(d.rteDatenschutz!==undefined) setHTML('rte-modal-datenschutz',d.rteDatenschutz); if(d.rteBarriere!==undefined) setHTML('rte-modal-barriere',d.rteBarriere); if(d.csItems&&Array.isArray(d.csItems)) d.csItems.forEach(function(p,i){ setVal('cs-img-'+(i+1),p.img); setVal('cs-title-'+(i+1),p.title); setVal('cs-url-'+(i+1),p.url); }); if(typeof applyCrossSell==='function') applyCrossSell(); // Bilder if(d.imgUrls&&Array.isArray(d.imgUrls)){ var list=document.getElementById('img-list'); if(list){ list.innerHTML=''; d.imgUrls.forEach(function(url,i){ var div=document.createElement('div'); div.className='img-row'; div.innerHTML='' +''; list.appendChild(div); }); } } // Toggle-Buttons if(d.payOn) document.querySelectorAll('#zahlung-btns .tgl-btn').forEach(function(b){ b.classList.toggle('on', d.payOn.indexOf(b.textContent.trim())>-1); }); if(d.shipOn) document.querySelectorAll('#versand-btns .tgl-btn').forEach(function(b){ b.classList.toggle('on', d.shipOn.indexOf(b.textContent.trim())>-1); }); if(d.catItems&&Array.isArray(d.catItems)){ var catList=document.getElementById('cat-list'); if(catList){ catList.innerHTML=''; d.catItems.forEach(function(item){ if(!item.name&&!item.url) return; var div=document.createElement('div'); div.className='cat-row'; div.style.cssText='display:flex;gap:4px;margin-bottom:4px;'; div.innerHTML='' +'' +''; catList.appendChild(div); }); } } if(d.logoAlign&&typeof setLogoAlign==='function') setLogoAlign(d.logoAlign); applyColors(); applyLinks(); applyLogo(); applyProduct(); applyGallery(); applyTabs(); applyCategories(); var btn=document.querySelector('.btn-load'); if(btn){ var o=btn.textContent; btn.textContent='\u2713 Geladen!'; btn.style.background='#28a745'; setTimeout(function(){ btn.textContent=o; btn.style.background=''; },2000); } } catch(err){ alert('Fehler: Ungueltige Design-Datei.'); } }; reader.readAsText(file); event.target.value=''; }; // ---- EXPORT ---- window.exportHTML=function(){ // DigiMember Export-Lock var dmBody = document.body; var dmLevel = dmBody ? (dmBody.className || '') : ''; var isSubscriber = dmLevel.indexOf('digimember-member') > -1 && dmLevel.indexOf('digimember-test') === -1; if(!isSubscriber){ var overlay = document.getElementById('export-lock-overlay'); if(!overlay){ overlay = document.createElement('div'); overlay.id = 'export-lock-overlay'; overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(25,43,87,.85);z-index:99999;display:flex;align-items:center;justify-content:center;'; overlay.innerHTML = '
' + '
🔒
' + '

HTML-Export nur für Abonnenten

' + '

Im Testzeitraum steht die Live-Vorschau zur Verfügung. Für den HTML-Export und unbegrenzte Nutzung bitte upgraden.

' + 'Jetzt Abo abschließen →
' + '' + '
'; document.body.appendChild(overlay); } else { overlay.style.display = 'flex'; } return; } var cm=(document.getElementById('colorMain')||{value:'#002f6c'}).value; var ca=(document.getElementById('colorAccent')||{value:'#e53238'}).value; var logo=(document.getElementById('inputLogo')||{value:''}).value.trim(); var logoImg=(document.getElementById('inputLogoImg')||{value:''}).value.trim(); var lShop=(document.getElementById('linkShop')||{value:'https://ebay.de'}).value||'https://ebay.de'; var lKon=(document.getElementById('linkKontakt')||{value:'https://ebay.de'}).value||'https://ebay.de'; var lBew=(document.getElementById('linkBew')||{value:'https://ebay.de'}).value||'https://ebay.de'; var title=(document.getElementById('inputTitle')||{value:''}).value.trim(); var price=((document.getElementById('inputPrice')||{value:'0,00'}).value.trim())||'0,00'; var bulletsRaw=(document.getElementById('inputBullets')||{value:''}).value; var urls=[]; document.querySelectorAll('#img-list .img-row input').forEach(function(inp){ var v=inp.value.trim(); if(v) urls.push(v); }); // Tab-Inhalte var tabBeschr=(document.getElementById('rte-beschr')||{innerHTML:''}).innerHTML; var payOn=[]; var payOnHTML=[]; document.querySelectorAll('#zahlung-btns .tgl-btn.on').forEach(function(b){ payOn.push(b.textContent.trim()); payOnHTML.push(b.innerHTML); }); var shipOn=[]; var shipOnHTML=[]; document.querySelectorAll('#versand-btns .tgl-btn.on').forEach(function(b){ shipOn.push(b.textContent.trim()); shipOnHTML.push(b.innerHTML); }); var tabZahlung=''; if(payOnHTML.length){ tabZahlung='

Akzeptierte Zahlungsarten:

'; tabZahlung+='
' +payOnHTML.map(function(h){ return ''+h+''; }).join('') +'
'; } tabZahlung+=((document.getElementById('rte-zahlung')||{innerHTML:''}).innerHTML); var tabVersand=''; if(shipOnHTML.length){ tabVersand='

Versandoptionen:

'; tabVersand+='
' +shipOnHTML.map(function(h){ return ''+h+''; }).join('') +'
'; } 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' :''+(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+=''; 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+=''; 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='
'; csExp+='
Das koennte Sie auch interessieren
'; csExp+='
'; csExpItems.forEach(function(p){ csExp+=''; csExp+='
'; if(p.img) csExp+=''; else csExp+='
'; csExp+='
'+p.title+'
'; csExp+='
'; }); csExp+='
'; } var legalBlock='
'+''+lRadios+lCSS+lNav+lBody+'
'; 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='
'; catExpItems.forEach(function(item){ catBarExp+=''+item.name+''; }); catBarExp+='
'; } var html='
' +'
' +'SHOP' +'KONTAKT' +'BEWERTUNGEN
' +'
' +'Top-Bewertet' +'+ Blitzversand' +'Gepruefter Haendler
' +catBarExp +'
'+logoHTML+'
' +'' +'' +'
'+galHTML+'' +'
'+title+'
' +'
'+price+' €
' +'
'+bulletsHTML+'
' +prodBlock+csExp+legalBlock +'
Template-Design by template-generator24.de
'+'
Zahlungs- und Versand-Icons: Matthias Slovig, 50north.de, Lizenz: CC BY 4.0
' +'
'; navigator.clipboard.writeText(html).then(function(){ var btn=document.getElementById('btn-copy'); if(btn){ var o=btn.textContent; btn.textContent='\u2713 Kopiert!'; btn.style.background='#28a745'; setTimeout(function(){ btn.textContent=o; btn.style.background=''; },2000); } }).catch(function(){ var ta=document.createElement('textarea'); ta.value=html; ta.style.cssText='position:fixed;opacity:0;'; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); var btn=document.getElementById('btn-copy'); if(btn){ btn.textContent='\u2713 Kopiert!'; setTimeout(function(){ btn.textContent='eBay Template Code kopieren'; },2000); } }); }; window.resetToPlaceholders=function(){var cm=document.getElementById('colorMain');if(cm)cm.value='#002f6c';var ca=document.getElementById('colorAccent');if(ca)ca.value='#e53238';var hm=document.getElementById('hexMain');if(hm)hm.value='#002f6c';var ha=document.getElementById('hexAccent');if(ha)ha.value='#e53238';var ls=document.getElementById('linkShop');if(ls)ls.value='';var lk=document.getElementById('linkKontakt');if(lk)lk.value='';var lb=document.getElementById('linkBew');if(lb)lb.value='';var lt=document.getElementById('inputLogo');if(lt)lt.value='';var li=document.getElementById('inputLogoImg');if(li)li.value='';var ti=document.getElementById('inputTitle');if(ti)ti.value='[Ihr Artikeltitel]';var pi=document.getElementById('inputPrice');if(pi)pi.value='0,00';var pc=document.getElementById('priceCurrency');if(pc)pc.value='\x26euro;';var pt=document.getElementById('priceTax');if(pt)pt.value='';var bu=document.getElementById('inputBullets');if(bu)bu.value='';document.querySelectorAll('.img-row input').forEach(function(inp){inp.value='';});var rows=document.querySelectorAll('.img-row');for(var i=3;i-1){galTitle=allTitles[i];break;}} if(!galTitle||document.getElementById("upload-zone")) return; var zone=document.createElement("div");zone.id="upload-zone";zone.className="upload-zone"; zone.innerHTML='
📷 Bilder hier ablegen oder klicken zum Auswählen
JPG, PNG, WEBP – max. 5 MB
'; var fi=document.createElement("input");fi.type="file";fi.id="upload-fi";fi.multiple=true;fi.accept="image/*";fi.style.display="none"; var tr=document.createElement("div");tr.id="upload-thumb-row";tr.className="upload-thumb-row"; // Hinweisbox (warn-info) finden und Zone danach einfügen var warnInfo=galTitle.parentNode.querySelector(".warn-info"); var insertAfter=warnInfo?warnInfo:galTitle; galTitle.parentNode.insertBefore(zone,insertAfter.nextSibling); galTitle.parentNode.insertBefore(fi,zone.nextSibling); galTitle.parentNode.insertBefore(tr,fi.nextSibling); zone.addEventListener("click",function(){fi.click();}); zone.addEventListener("dragover",function(e){e.preventDefault();zone.classList.add("drag-over");}); zone.addEventListener("dragleave",function(){zone.classList.remove("drag-over");}); zone.addEventListener("drop",function(e){e.preventDefault();zone.classList.remove("drag-over");doUpload(e.dataTransfer.files);}); fi.addEventListener("change",function(){doUpload(fi.files);fi.value="";}); } function doUpload(files){ if(!window.ebayUpload){alert("Upload nicht verfuegbar.");return;} var MAX=12;var current=document.querySelectorAll("#img-list .img-row").length; var arr=Array.from(files).slice(0,MAX-current); if(!arr.length){alert("Max. 12 Bilder bereits erreicht.");return;} var zone=document.getElementById("upload-zone"); var bar=document.getElementById("upload-bar"); var bw=bar?bar.parentNode:null; if(zone)zone.classList.add("uploading"); if(bw)bw.style.display="block"; var done=0; var existingRows=document.querySelectorAll("#img-list .img-row input"); var hasUpload=false; existingRows.forEach(function(inp){if(inp.value&&inp.value.indexOf("ebay-bilder")>-1)hasUpload=true;}); if(!hasUpload){ document.querySelectorAll("#img-list .img-row").forEach(function(r){r.parentNode.removeChild(r);}); var tr2=document.getElementById("upload-thumb-row");if(tr2)tr2.innerHTML=""; } arr.forEach(function(file){ if(file.size>5*1024*1024){alert(file.name+": max. 5 MB");done++;checkDone();return;} var fd=new FormData(); fd.append("image",file,file.name); fd.append("action","ebay_upload_image"); fd.append("nonce",window.ebayUpload.nonce); fetch(window.ebayUpload.url,{method:"POST",body:fd,credentials:"include"}) .then(function(r){return r.json();}) .then(function(d){ done++; if(bar)bar.style.width=Math.round(done/arr.length*100)+"%"; if(d.success&&d.data&&d.data.url){addImgRow(d.data.url);addThumb(d.data.url);applyGallery();} else{console.warn("Fehler:",d);} checkDone(); }) .catch(function(e){done++;console.error(e);checkDone();}); }); function checkDone(){if(done>=arr.length){if(zone)zone.classList.remove("uploading");setTimeout(function(){if(bw)bw.style.display="none";if(bar)bar.style.width="0%";},1000);}} } function addImgRow(url){ var list=document.getElementById("img-list");if(!list)return; var n=list.querySelectorAll(".img-row").length+1; var row=document.createElement("div");row.className="img-row"; row.innerHTML=''; list.appendChild(row); } function addThumb(url){ var row=document.getElementById("upload-thumb-row");if(!row)return; var div=document.createElement("div");div.className="upload-thumb"; div.dataset.url=url; div.innerHTML=''; // Drag & Drop Sortierung div.draggable=true; div.addEventListener("mousedown",function(e){e.stopPropagation();}); div.addEventListener("dragstart",function(e){ e.stopPropagation(); e.dataTransfer.effectAllowed="move"; e.dataTransfer.setData("text/plain","thumb"); div.classList.add("dragging"); window._dragThumb=div; }); div.addEventListener("dragend",function(e){ e.stopPropagation(); div.classList.remove("dragging"); document.querySelectorAll(".upload-thumb").forEach(function(t){t.classList.remove("drag-over-thumb");}); syncImgList(); }); div.addEventListener("dragover",function(e){e.preventDefault();e.stopPropagation();e.dataTransfer.dropEffect="move";}); div.addEventListener("dragenter",function(e){e.stopPropagation();if(window._dragThumb&&window._dragThumb!==div){div.classList.add("drag-over-thumb");}}); div.addEventListener("dragleave",function(e){e.stopPropagation();div.classList.remove("drag-over-thumb");}); div.addEventListener("drop",function(e){e.preventDefault();e.stopPropagation();div.classList.remove("drag-over-thumb");if(window._dragThumb&&window._dragThumb!==div){var r=div.parentNode;r.insertBefore(window._dragThumb,div);}}); row.appendChild(div); updateThumbNumbers(); } function updateThumbNumbers(){ document.querySelectorAll(".upload-thumb").forEach(function(t,i){ var n=t.querySelector(".sort-num");if(n)n.textContent=(i+1); }); } function syncImgList(){ // img-list neu aufbauen basierend auf Thumb-Reihenfolge var thumbs=document.querySelectorAll(".upload-thumb"); var list=document.getElementById("img-list");if(!list)return; // Alle bestehenden Zeilen entfernen list.querySelectorAll(".img-row").forEach(function(r){r.parentNode.removeChild(r);}); // Neue Zeilen in Thumb-Reihenfolge thumbs.forEach(function(t,i){ var url=t.dataset.url;if(!url)return; var row=document.createElement("div");row.className="img-row"; row.innerHTML='' +''; list.appendChild(row); }); updateThumbNumbers(); applyGallery(); } window.removeUploadThumb=function(btn,url){ var t=btn.parentNode;if(t)t.parentNode.removeChild(t); document.querySelectorAll("#img-list .img-row input").forEach(function(inp){if(inp.value===url){var r=inp.parentNode;if(r)r.parentNode.removeChild(r);}}); syncImgList(); }; // ---- RESPONSIVE LAYOUT ---- function adaptLayout(){ var w = window.innerWidth; var editor = document.getElementById("editor-pane"); var preview = document.getElementById("preview-pane"); if(!editor || !preview) return; var editorW; if(w >= 1800) editorW = 560; // großer Monitor else if(w >= 1400) editorW = 500; // Full HD normal else if(w >= 1200) editorW = 460; // Standard else if(w >= 1000) editorW = 400; // kleines Laptop else if(w >= 800) editorW = 340; // sehr kleines Fenster else editorW = 280; // minimal var minPreview = 500; if(w - editorW - 3 < minPreview) editorW = w - minPreview - 3; if(editorW < 280) editorW = 280; editor.style.width = editorW + "px"; editor.style.flexShrink = "0"; } window.addEventListener("resize", adaptLayout); })();