(function(){
"use strict";
/* --------------------------------------------
* Fonts (nur einmal)
* -------------------------------------------- */
if (!document.getElementById('dgi-badge-fonts')) {
var style = document.createElement('style');
style.id = 'dgi-badge-fonts';
style.textContent =
'@font-face{' +
'font-family:"Roboto";' +
'font-weight:400;' +
'font-style:normal;' +
'font-display:swap;' +
'src:url("https://www.dginet.de/wp-content/fonts/roboto-v30-latin-ext_latin-regular.woff") format("woff");' +
'}' +
'@font-face{' +
'font-family:"DGI Exo";' +
'font-weight:400;' +
'font-style:normal;' +
'font-display:swap;' +
'src:url("https://www.dginet.de/wp-content/fonts/exo-v20-latin-ext_latin-regular.woff") format("woff");' +
'}' +
'@font-face{' +
'font-family:"DGI Exo";' +
'font-weight:700;' +
'font-style:normal;' +
'font-display:swap;' +
'src:url("https://www.dginet.de/wp-content/fonts/exo-v20-latin-ext_latin-700.woff") format("woff");' +
'}';
document.head.appendChild(style);
}
var data = {"slug":"oleg-yaroslavskyy-2","vorname":"Oleg","nachname":"Yaroslavskyy","gender":"m","titel":"Dr.","titel2":"","titel3":"","badge":"","badgetxt":"","qualifikation":{"Curriculum Impl":"true","QualiErhalt Impl":"false","Curriculum ImplProth":"false","QualiErhalt ImplProth":"false","Curriculum ImplProthZahnt":"false","Tätigkeitsschwerpunkt Impl":"false","Tätigkeitsschwerpunkt ImplProth":"false","Tätigkeitsschwerpunkt ImplProthZahnt":"false","Experte":"false","QualiErhalt Experte":"false","Spezialist":"false","QualiErhalt Spezialist":"false","Master ImplSTI":"false","Master ImplParoSTI":"false","gutachter_dgi":"false","ImplFort":"false"},"bild":"","targetUrl":"https://www.dginet.de/qualifikationsstufen/"};
var badgeKey = "curriculum-implscript";
var containerId = "dgiBadge-curriculum-implscript";
if (!userHasBadge(data, badgeKey)) {
renderError(containerId, 'USER_NO_QUALIFICATION', 'Benutzer hat diese Qualifikation nicht');
return;
}
if (!data.badge || data.badge === '') {
renderError(containerId, 'NO_BADGE_IMAGE', 'Kein Badge-Bild konfiguriert für: curriculum-implscript');
return;
}
var container = document.getElementById(containerId);
if (!container) {
console.error('DGI BADGE ERROR: Container #' + containerId + ' nicht gefunden');
return;
}
container.innerHTML = buildBadgeHTML(data);
/* --------------------------------------------
* Mobile-Optimierung via Skala
* - misst tatsächliche Breite nach dem Insert
* - setzt CSS-Variable --dgi-scale
* - aktiviert mobile mode bei sehr schmalen Breiten
* -------------------------------------------- */
applyScaleAndMobileMode(container);
/* ============================================
* HILFSFUNKTIONEN
* ============================================ */
function applyScaleAndMobileMode(containerEl) {
try {
var a = containerEl.querySelector('a.dgi-badge-wrapper');
if (!a) return;
// Breite bestimmen: Containerbreite, fallback viewport
var w = containerEl.getBoundingClientRect().width || Math.min(window.innerWidth || 380, 380);
// Manche Layouts geben dem Container "auto" ohne echte Breite -> dann wrapper max 380, aber wir skalieren trotzdem sinnvoll
if (!w || w < 10) w = Math.min(window.innerWidth || 380, 380);
var scale = Math.min(1, Math.max(0.65, w / 380)); // clamp: nicht kleiner als 0.65 (sonst unlesbar)
a.style.setProperty('--dgi-scale', String(scale.toFixed(4)));
// Mobile-Mode: zusätzlicher Verdichtungsfaktor, wenn sehr schmal
if (w < 330) a.classList.add('dgi-badge--mobile');
else a.classList.remove('dgi-badge--mobile');
// Extra Einrückung für schmale Mobile-Ansichten
if (w < 360) {
a.style.setProperty('--dgi-leftpad-extra', '18px');
} else {
a.style.setProperty('--dgi-leftpad-extra', '0px');
}
// Extra padding-top nur für Mobile
if (w < 360) {
a.style.setProperty('--dgi-top-extra', '3px'); // ← Wert kannst du feinjustieren (4–8px)
} else {
a.style.setProperty('--dgi-top-extra', '0px');
}
// Bei Resize erneut anwenden (einmalig pro Badge-Render)
if (!a.__dgiResizeBound) {
a.__dgiResizeBound = true;
window.addEventListener('resize', function(){
// requestAnimationFrame für Safari smoother
window.requestAnimationFrame(function(){ applyScaleAndMobileMode(containerEl); });
}, { passive: true });
}
} catch(e) {}
}
function buildBadgeHTML(d) {
// Styles: alles über --dgi-scale skalierbar machen
// Mobile-Mode (Klasse dgi-badge--mobile) bekommt ein paar Verdichtungen über inline style hooks (per CSS-Variable)
// Hinweis: Wir verwenden calc() mit --dgi-scale, damit Text/Abstände wirklich kleiner werden und "reinpassen".
var styles = {
wrapper:
"all:initial;" +
"background:transparent!important;" +
"display:block!important;" +
"position:relative!important;" +
"width:100%!important;" +
"max-width:380px!important;" +
"aspect-ratio:380/150!important;" +
"height:auto!important;" +
"text-decoration:none!important;" +
"box-sizing:border-box!important;" +
"font-family:'DGI Exo','Roboto',sans-serif!important;" +
"cursor:pointer!important;" +
"overflow:hidden!important;" +
"--dgi-scale:1;" +
"--dgi-tight:1;" + // wird im Mobile-Mode runtergesetzt (siehe data-attr via Klasse)
"--dgi-leftpad-extra:0;" +
"--dgi-top-extra:0;",
bgImage:
"all:initial;" +
"position:absolute!important;" +
"top:0!important;left:0!important;" +
"width:100%!important;height:100%!important;" +
"object-fit:cover!important;" +
"display:block!important;",
content:
"all:initial;" +
"position:absolute!important;" +
"inset:0!important;" +
"display:flex!important;" +
"flex-direction:column!important;" +
"box-sizing:border-box!important;" +
"padding:" +
"calc(8px * var(--dgi-scale) * var(--dgi-tight)) " +
"calc(14px * var(--dgi-scale) * var(--dgi-tight)) " +
"calc(8px * var(--dgi-scale) * var(--dgi-tight)) " +
"calc((150px + var(--dgi-leftpad-extra)) * var(--dgi-scale) * var(--dgi-tight))" +
"!important;",
topSection:
"all:initial;" +
"flex:0 0 auto!important;" +
"color:#004A80!important;" +
"display:flex!important;" +
"flex-direction:column!important;" +
"justify-content:center!important;" +
"box-sizing:border-box!important;" +
"padding-top:calc(6px * var(--dgi-scale) * var(--dgi-tight) + 8px + var(--dgi-top-extra))!important;" +
"padding-left:calc(5px * var(--dgi-scale) * var(--dgi-tight))!important;",
bottomSection:
"all:initial;" +
"flex:1 1 auto!important;" +
"color:#666666!important;" +
"display:flex!important;" +
"flex-direction:column!important;" +
"justify-content:center!important;" +
"box-sizing:border-box!important;" +
"padding-left:calc(5px * var(--dgi-scale) * var(--dgi-tight))!important;",
titleText:
"all:initial;margin:0!important;padding:0!important;" +
"font-size:calc(14px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"font-weight:400!important;" +
"line-height:1.15!important;" +
"color:#004A80!important;" +
"font-family:'DGI Exo','Roboto',sans-serif!important;" +
"display:block!important;",
nameText:
"all:initial;margin:0!important;padding:0!important;" +
"font-size:calc(16px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"font-weight:700!important;" +
"line-height:1.1!important;" +
"color:#004A80!important;" +
"font-family:'DGI Exo','Roboto',sans-serif!important;" +
"display:block!important;" +
"white-space:nowrap!important;" +
"overflow:hidden!important;" +
"text-overflow:ellipsis!important;",
titel3Text:
"all:initial;margin:0!important;padding:0!important;" +
"font-size:calc(14px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"font-weight:400!important;" +
"line-height:1.1!important;" +
"color:#004A80!important;" +
"font-family:'DGI Exo','Roboto',sans-serif!important;" +
"display:inline!important;",
descText:
"all:initial;margin:0!important;padding:0!important;" +
"font-size:calc(11px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"line-height:1.15!important;" +
"color:#666666!important;" +
"font-family:'Roboto',sans-serif!important;" +
"display:block!important;" +
"max-height:100%!important;" +
"overflow:hidden!important;"
};
var html = '';
html += '<a href="' + esc(d.targetUrl) + '" target="_blank" rel="noopener" class="dgi-badge-wrapper" style="' + styles.wrapper + '">';
html += '<img src="' + esc(d.badge) + '" alt="DGI Badge" style="' + styles.bgImage + '">';
html += '<div class="dgi-badge-content" style="' + styles.content + '">';
html +=   '<div class="dgi-badge-top" style="' + styles.topSection + '">';
html +=     '<p class="dgi-badge-title" style="' + styles.titleText + '">' + esc(d.titel || '') + '</p>';
// Name + Titel3 (Titel3 separat)
html +=     '<p class="dgi-badge-name" style="' + styles.nameText + '">';
html +=       esc(d.vorname || '') + ' ' + esc(d.nachname || '');
if (d.titel3) {
html += ' <span class="dgi-badge-titel3" style="' + styles.titel3Text + '">' + esc(d.titel3) + '</span>';
}
html +=     '</p>';
html +=   '</div>';
html +=   '<div class="dgi-badge-bottom" style="' + styles.bottomSection + '">';
html +=     '<p class="dgi-badge-desc" style="' + styles.descText + '">' + sanitizeHtml(d.badgetxt || '') + '</p>';
html +=   '</div>';
html += '</div>';
html += '</a>';
// Mini-CSS nur für den Mobile-Mode (Klasse) -> reduziert "tightness"
// Da viele Styles inline + !important sind, steuern wir über CSS-Variablen im wrapper.
html += '<style>' +
'a.dgi-badge-wrapper.dgi-badge--mobile{--dgi-tight:0.92!important;}' + // ca. 12% kompakter
'</style>';
return html;
}
function userHasBadge(data, badge) {
if (!data || !data.qualifikation) return false;
var normalize = function(s) {
return String(s || '')
.toLowerCase()
.trim()
.replace(/[\s_]+/g, '-')
.replace(/-+/g, '-')
.replace(/ä/g, 'ae')
.replace(/ö/g, 'oe')
.replace(/ü/g, 'ue')
.replace(/ß/g, 'ss');
};
var isTrue = function(v) {
return v === true || v === 'true' || v === 1 || v === '1' ||
v === 'yes' || v === 'on' || v === 'ja' || v === 'wahr';
};
var wanted = normalize(badge);
var q = data.qualifikation;
if (q && typeof q === 'object' && !Array.isArray(q)) {
for (var key in q) {
if (Object.prototype.hasOwnProperty.call(q, key)) {
if (normalize(key) === wanted && isTrue(q[key])) return true;
}
}
return false;
}
if (Array.isArray(q)) {
for (var i = 0; i < q.length; i++) {
if (normalize(q[i]) === wanted) return true;
}
return false;
}
return false;
}
function renderError(containerId, errorCode, message) {
var container = document.getElementById(containerId);
if (container) {
container.innerHTML =
'<p style="color:#d32f2f;font-size:13px;padding:8px;border:1px solid #d32f2f;border-radius:4px;background:#ffebee;margin:0;font-family:' +
"'DGI Exo','Roboto',sans-serif" + '!important;">' +
'<strong>DGI Badge Fehler:</strong> ' + esc(message) +
' <small style="opacity:0.7;">(' + esc(errorCode) + ')</small>' +
'</p>';
}
console.error('DGI BADGE ERROR [' + errorCode + ']: ' + message);
}
function esc(str) {
var div = document.createElement('div');
div.textContent = String(str == null ? '' : str);
return div.innerHTML;
}
function sanitizeHtml(str) {
if (!str) return '';
var temp = String(str)
.replace(/<br\s*\/?>/gi, '___BR___')
.replace(/<b>/gi, '___B_OPEN___')
.replace(/<\/b>/gi, '___B_CLOSE___')
.replace(/<strong>/gi, '___STRONG_OPEN___')
.replace(/<\/strong>/gi, '___STRONG_CLOSE___')
.replace(/<i>/gi, '___I_OPEN___')
.replace(/<\/i>/gi, '___I_CLOSE___')
.replace(/<em>/gi, '___EM_OPEN___')
.replace(/<\/em>/gi, '___EM_CLOSE___')
.replace(/<u>/gi, '___U_OPEN___')
.replace(/<\/u>/gi, '___U_CLOSE___')
.replace(/<ul>/gi, '___UL_OPEN___')
.replace(/<\/ul>/gi, '___UL_CLOSE___')
.replace(/<li>/gi, '___LI_OPEN___')
.replace(/<\/li>/gi, '___LI_CLOSE___');
var div = document.createElement('div');
div.textContent = temp;
var escaped = div.innerHTML;
return escaped
.replace(/___BR___/g, '<br>')
.replace(/___B_OPEN___/g, '<b>')
.replace(/___B_CLOSE___/g, '</b>')
.replace(/___STRONG_OPEN___/g, '<strong>')
.replace(/___STRONG_CLOSE___/g, '</strong>')
.replace(/___I_OPEN___/g, '<i>')
.replace(/___I_CLOSE___/g, '</i>')
.replace(/___EM_OPEN___/g, '<em>')
.replace(/___EM_CLOSE___/g, '</em>')
.replace(/___U_OPEN___/g, '<u>')
.replace(/___U_CLOSE___/g, '</u>')
.replace(/___UL_OPEN___/g, '<ul style="' + getListStyles() + '">')
.replace(/___UL_CLOSE___/g, '</ul>')
.replace(/___LI_OPEN___/g, '<li style="' + getListItemStyles() + '"><span style="' + getBulletStyles() + '">·</span>')
.replace(/___LI_CLOSE___/g, '</li>');
}
function getListStyles() {
return "all:revert;" +
"margin:0!important;" +
"padding:0!important;" +
"list-style:none!important;" +
"font-size:inherit!important;" +
"line-height:inherit!important;" +
"color:inherit!important;" +
"font-family:inherit!important;" +
"box-sizing:border-box!important;";
}
function getListItemStyles() {
return "all:revert;" +
"margin:0!important;" +
"padding:0 0 0 calc(14px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"text-indent:calc(-14px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"list-style:none!important;" +
"display:block!important;" +
"font-size:inherit!important;" +
"line-height:inherit!important;" +
"color:inherit!important;" +
"background:none!important;" +
"border:none!important;" +
"position:relative!important;" +
"font-family:inherit!important;" +
"box-sizing:border-box!important;";
}
function getBulletStyles() {
return "all:initial;display:inline-block!important;" +
"width:calc(12px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"margin:0!important;" +
"padding:0!important;" +
"font-size:calc(14px * var(--dgi-scale) * var(--dgi-tight))!important;" +
"line-height:1!important;" +
"color:inherit!important;" +
"text-align:left!important;" +
"font-weight:bold!important;" +
"vertical-align:baseline!important;";
}
})();
