const latin1ToUtf8 = (string) => { const replacements = { '€': '€', '‚': '‚', 'Æ’': 'ƒ', '„': '„', '…': '…', 'â€\u00A0': '†', '‡': '‡', 'ˆ': 'ˆ', '‰': '‰', 'Å\u00A0': 'Š', '‹': '‹', 'Å’': 'Œ', 'Ž': 'Ž', '‘': '‘', '’': '’', '“': '“', 'â€\u009D': '”', '•': '•', '–': '–', '—': '—', Ëœ: '˜', 'â„¢': '™', 'Å¡': 'š', '›': '›', 'Å“': 'œ', 'ž': 'ž', 'Ÿ': 'Ÿ', ' ': ' ', '¡': '¡', '¢': '¢', '£': '£', '¤': '¤', 'Â¥': '¥', '¦': '¦', '§': '§', '¨': '¨', '©': '©', ª: 'ª', '«': '«', '¬': '¬', '­': '­', '®': '®', '¯': '¯', '°': '°', '±': '±', '²': '²', '³': '³', '´': '´', µ: 'µ', '¶': '¶', '·': '·', '¸': '¸', '¹': '¹', º: 'º', '»': '»', '¼': '¼', '½': '½', '¾': '¾', '¿': '¿', 'À': 'À', 'Â': 'Â', Ã: 'Ã', 'Ä': 'Ä', 'Ã…': 'Å', 'Æ': 'Æ', 'Ç': 'Ç', È: 'È', 'É': 'É', Ê: 'Ê', 'Ë': 'Ë', ÃŒ: 'Ì', 'Ã\u008D': 'Í', ÃŽ: 'Î', 'Ã\u008F': 'Ï', 'Ã\u0090': 'Ð', 'Ñ': 'Ñ', 'Ã’': 'Ò', 'Ó': 'Ó', 'Ô': 'Ô', 'Õ': 'Õ', 'Ö': 'Ö', '×': '×', 'Ø': 'Ø', 'Ù': 'Ù', Ú: 'Ú', 'Û': 'Û', Ü: 'Ü', 'Ã\u009D': 'Ý', Þ: 'Þ', ß: 'ß', 'Ã\u00A0': 'à', 'á': 'á', 'â': 'â', 'ã': 'ã', 'ä': 'ä', 'Ã¥': 'å', 'æ': 'æ', 'ç': 'ç', 'è': 'è', 'é': 'é', ê: 'ê', 'ë': 'ë', 'ì': 'ì', 'Ã\u00AD': 'í', 'î': 'î', 'ï': 'ï', 'ð': 'ð', 'ñ': 'ñ', 'ò': 'ò', 'ó': 'ó', 'ô': 'ô', õ: 'õ', 'ö': 'ö', '÷': '÷', 'ø': 'ø', 'ù': 'ù', ú: 'ú', 'û': 'û', 'ü': 'ü', 'ý': 'ý', 'þ': 'þ', 'ÿ': 'ÿ', }; const matchRegex = new RegExp(Object.keys(replacements).join('|'), 'gu'); return string.replace(matchRegex, (match) => replacements[match]).normalize(); }; const updateIptcCredits = () => { // if (!window.location.pathname.match(/[a-zA-Z]{2}((_|-)[a-zA-Z]{2}){0,1}\/blog/)) return; // nur auf Blog-Seiten const images = document.querySelectorAll('img'); images.forEach(img => { let imgHost; try { imgHost = new URL(img.src).host; } catch { return; } // Diese Abfrage Funktioniert innerhalb von Webflow nicht, da die Bilder hier immmer über ein CDN geladen werden //if (imgHost !== window.location.host) return; EXIF.getData(img, function () { if (img.hasAttribute('data-ignore-copyright')) return; let artist = EXIF.getTag(this, 'Artist') || EXIF.getTag(this, 'XPAuthor') || EXIF.getTag(this, 'Copyright'); if (img.hasAttribute('data-author')) { artist = img.dataset.author; } if (!artist) return; // kein Autor hinterlegt if (img.parentNode.querySelector('.iptc-credit')) return; // Label ist bereits vorhanden const creditText = `© ${artist}`; // Wrapper anlegen, um absolut positionieren zu können const wrapper = document.createElement('span'); wrapper.style.position = 'relative'; wrapper.style.display = getComputedStyle(img).display === 'block' ? 'block' : 'inline-block'; if (img.classList.contains('copyright-wrapper-full')) { wrapper.style.width = '100%'; wrapper.style.height = '100%'; } img.parentNode.insertBefore(wrapper, img); wrapper.appendChild(img); // Label erstellen const label = document.createElement('span'); label.classList.add('iptc-credit'); label.textContent = latin1ToUtf8(creditText); Object.assign(label.style, { position: 'absolute', right: '10px', bottom: '10px', fontFamily: 'Arial, sans-serif', fontSize: '7pt', color: 'rgb(0,0,0)', writingMode: 'vertical-rl', // vertikal rechts‑nach‑links transform: 'rotate(180deg)', // umdrehen → unten‑nach‑oben // textShadow: '0 0 1pt rgba(0,0,0,1)', lineHeight: '1', pointerEvents: 'none', userSelect: 'none', zIndex: '10', backgroundColor: 'rgba(255, 255, 255, 0.8)', padding: '0.1rem', }); wrapper.appendChild(label); }); }); }; setTimeout(updateIptcCredits, 3000);