| 1 |
(function () { |
| 2 |
function typoCssVarsForEl(typo, prefix, el) { |
| 3 |
if (!typo || typeof typo !== 'object') return; |
| 4 |
var map = { |
| 5 |
family: 'font-family', weight: 'font-weight', transform: 'text-transform', |
| 6 |
style: 'font-style', decoration: 'text-decoration', |
| 7 |
sizeDesktop: 'font-size-d', sizeTablet: 'font-size-t', sizeMobile: 'font-size-m', sizeUnit: 'font-size-unit', |
| 8 |
lineHeightDesktop: 'line-height-d', lineHeightTablet: 'line-height-t', lineHeightMobile: 'line-height-m', lineHeightUnit: 'line-height-unit', |
| 9 |
letterSpacingDesktop: 'letter-spacing-d', letterSpacingTablet: 'letter-spacing-t', letterSpacingMobile: 'letter-spacing-m', letterSpacingUnit: 'letter-spacing-unit', |
| 10 |
wordSpacingDesktop: 'word-spacing-d', wordSpacingTablet: 'word-spacing-t', wordSpacingMobile: 'word-spacing-m', wordSpacingUnit: 'word-spacing-unit' |
| 11 |
}; |
| 12 |
Object.keys(map).forEach(function (k) { |
| 13 |
if (typo[k] !== undefined && typo[k] !== '') { |
| 14 |
var v = typo[k]; |
| 15 |
if (typeof v === 'number') { |
| 16 |
var css = map[k]; |
| 17 |
var unit = ''; |
| 18 |
if (css.indexOf('font-size') === 0 && css !== 'font-size-unit') unit = typo.sizeUnit || 'px'; |
| 19 |
else if (css.indexOf('line-height') === 0 && css !== 'line-height-unit') unit = typo.lineHeightUnit || ''; |
| 20 |
else if (css.indexOf('letter-spacing') === 0 && css !== 'letter-spacing-unit') unit = typo.letterSpacingUnit || 'px'; |
| 21 |
else if (css.indexOf('word-spacing') === 0 && css !== 'word-spacing-unit') unit = typo.wordSpacingUnit || 'px'; |
| 22 |
v = v + unit; |
| 23 |
} |
| 24 |
el.style.setProperty(prefix + map[k], v); |
| 25 |
} |
| 26 |
}); |
| 27 |
} |
| 28 |
|
| 29 |
function esc(str) { |
| 30 |
return String(str || '').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); |
| 31 |
} |
| 32 |
|
| 33 |
function init() { |
| 34 |
document.querySelectorAll('.bkbg-evr-app').forEach(function (el) { |
| 35 |
if (el.dataset.rendered) return; |
| 36 |
el.dataset.rendered = '1'; |
| 37 |
|
| 38 |
var opts; |
| 39 |
try { opts = JSON.parse(el.dataset.opts || '{}'); } catch (e) { opts = {}; } |
| 40 |
|
| 41 |
var o = Object.assign({ |
| 42 |
eventName: 'Event Name 2026', |
| 43 |
eventDate: '', |
| 44 |
eventLocation: '', |
| 45 |
showMeta: true, |
| 46 |
summary: '', |
| 47 |
showSummary: true, |
| 48 |
stats: [], |
| 49 |
showStats: true, |
| 50 |
highlights: [], |
| 51 |
showHighlights: true, |
| 52 |
highlightsLabel: 'Key Highlights', |
| 53 |
nextEventInfo: '', |
| 54 |
showNextEvent: true, |
| 55 |
bgColor: '#f8fafc', |
| 56 |
borderColor: '#e2e8f0', |
| 57 |
accentColor: '#7c3aed', |
| 58 |
headerBg: '#7c3aed', |
| 59 |
titleColor: '#ffffff', |
| 60 |
metaColor: '#ddd6fe', |
| 61 |
summaryColor: '#374151', |
| 62 |
statsBg: '#7c3aed', |
| 63 |
statNumColor: '#ffffff', |
| 64 |
statLabelColor: '#ddd6fe', |
| 65 |
highlightColor: '#374151', |
| 66 |
highlightBg: '#ffffff', |
| 67 |
highlightBorder: '#e2e8f0', |
| 68 |
nextBg: '#ede9fe', |
| 69 |
nextTextColor: '#5b21b6', |
| 70 |
borderRadius: 12, |
| 71 |
paddingTop: 0, |
| 72 |
paddingBottom: 0 |
| 73 |
}, opts); |
| 74 |
|
| 75 |
var wrap = document.createElement('div'); |
| 76 |
wrap.className = 'bkbg-evr-wrap'; |
| 77 |
wrap.style.cssText = [ |
| 78 |
'background:' + o.bgColor, |
| 79 |
'border-radius:' + o.borderRadius + 'px', |
| 80 |
'overflow:hidden', |
| 81 |
'padding-top:' + o.paddingTop + 'px', |
| 82 |
'padding-bottom:' + o.paddingBottom + 'px' |
| 83 |
].join(';'); |
| 84 |
|
| 85 |
typoCssVarsForEl(o.typoTitle, '--bkbg-evr-ttl-', wrap); |
| 86 |
typoCssVarsForEl(o.typoSummary, '--bkbg-evr-sm-', wrap); |
| 87 |
|
| 88 |
/* HEADER */ |
| 89 |
var header = document.createElement('div'); |
| 90 |
header.className = 'bkbg-evr-header'; |
| 91 |
header.style.background = o.headerBg; |
| 92 |
|
| 93 |
if (o.eventName) { |
| 94 |
var h2 = document.createElement('h2'); |
| 95 |
h2.className = 'bkbg-evr-title'; |
| 96 |
h2.style.color = o.titleColor; |
| 97 |
h2.innerHTML = o.eventName; |
| 98 |
header.appendChild(h2); |
| 99 |
} |
| 100 |
|
| 101 |
if (o.showMeta && (o.eventDate || o.eventLocation)) { |
| 102 |
var meta = document.createElement('div'); |
| 103 |
meta.className = 'bkbg-evr-meta'; |
| 104 |
|
| 105 |
function metaChip(icon, text) { |
| 106 |
if (!text) return; |
| 107 |
var c = document.createElement('div'); |
| 108 |
c.className = 'bkbg-evr-meta-item'; |
| 109 |
c.style.color = o.metaColor; |
| 110 |
c.textContent = icon + ' ' + text; |
| 111 |
meta.appendChild(c); |
| 112 |
} |
| 113 |
|
| 114 |
metaChip('� |
| 115 |
', o.eventDate); |
| 116 |
metaChip('📍', o.eventLocation); |
| 117 |
header.appendChild(meta); |
| 118 |
} |
| 119 |
wrap.appendChild(header); |
| 120 |
|
| 121 |
/* STATS */ |
| 122 |
if (o.showStats && (o.stats || []).length) { |
| 123 |
var statsBar = document.createElement('div'); |
| 124 |
statsBar.className = 'bkbg-evr-stats'; |
| 125 |
statsBar.style.background = o.statsBg; |
| 126 |
|
| 127 |
var grid = document.createElement('div'); |
| 128 |
grid.className = 'bkbg-evr-stats-grid'; |
| 129 |
grid.style.gridTemplateColumns = 'repeat(' + Math.min(o.stats.length, 4) + ', 1fr)'; |
| 130 |
|
| 131 |
o.stats.forEach(function (s) { |
| 132 |
var statEl = document.createElement('div'); |
| 133 |
statEl.className = 'bkbg-evr-stat'; |
| 134 |
|
| 135 |
var numEl = document.createElement('span'); |
| 136 |
numEl.className = 'bkbg-evr-stat-num'; |
| 137 |
numEl.style.color = o.statNumColor; |
| 138 |
numEl.textContent = s.number || ''; |
| 139 |
statEl.appendChild(numEl); |
| 140 |
|
| 141 |
var lbl = document.createElement('span'); |
| 142 |
lbl.className = 'bkbg-evr-stat-label'; |
| 143 |
lbl.style.color = o.statLabelColor; |
| 144 |
lbl.textContent = s.label || ''; |
| 145 |
statEl.appendChild(lbl); |
| 146 |
|
| 147 |
grid.appendChild(statEl); |
| 148 |
}); |
| 149 |
|
| 150 |
statsBar.appendChild(grid); |
| 151 |
wrap.appendChild(statsBar); |
| 152 |
} |
| 153 |
|
| 154 |
/* BODY */ |
| 155 |
var body = document.createElement('div'); |
| 156 |
body.className = 'bkbg-evr-body'; |
| 157 |
|
| 158 |
if (o.showSummary && o.summary) { |
| 159 |
var sumEl = document.createElement('p'); |
| 160 |
sumEl.className = 'bkbg-evr-summary'; |
| 161 |
sumEl.style.color = o.summaryColor; |
| 162 |
sumEl.innerHTML = o.summary; |
| 163 |
body.appendChild(sumEl); |
| 164 |
} |
| 165 |
|
| 166 |
if (o.showHighlights && (o.highlights || []).length) { |
| 167 |
var hlLabel = document.createElement('div'); |
| 168 |
hlLabel.className = 'bkbg-evr-highlights-label'; |
| 169 |
hlLabel.style.color = o.accentColor; |
| 170 |
hlLabel.textContent = o.highlightsLabel || 'Key Highlights'; |
| 171 |
body.appendChild(hlLabel); |
| 172 |
|
| 173 |
var hlList = document.createElement('div'); |
| 174 |
hlList.className = 'bkbg-evr-highlights'; |
| 175 |
var _IP = window.bkbgIconPicker; |
| 176 |
|
| 177 |
o.highlights.forEach(function (h) { |
| 178 |
if (!h.text && !h.icon) return; |
| 179 |
var item = document.createElement('div'); |
| 180 |
item.className = 'bkbg-evr-highlight'; |
| 181 |
item.style.cssText = 'background:' + o.highlightBg + ';border:1px solid ' + o.highlightBorder + ';'; |
| 182 |
|
| 183 |
var iconEl = document.createElement('span'); |
| 184 |
iconEl.className = 'bkbg-evr-highlight-icon'; |
| 185 |
var _iType = h.iconType || 'custom-char'; |
| 186 |
if (_IP && _iType !== 'custom-char') { |
| 187 |
var _in = _IP.buildFrontendIcon(_iType, h.icon, h.iconDashicon, h.iconImageUrl, h.iconDashiconColor); |
| 188 |
if (_in) iconEl.appendChild(_in); |
| 189 |
else iconEl.textContent = h.icon || ''; |
| 190 |
} else { |
| 191 |
iconEl.textContent = h.icon || ''; |
| 192 |
} |
| 193 |
if (h.icon || _iType !== 'custom-char') item.appendChild(iconEl); |
| 194 |
|
| 195 |
var textEl = document.createElement('span'); |
| 196 |
textEl.className = 'bkbg-evr-highlight-text'; |
| 197 |
textEl.style.color = o.highlightColor; |
| 198 |
textEl.textContent = h.text || ''; |
| 199 |
item.appendChild(textEl); |
| 200 |
|
| 201 |
hlList.appendChild(item); |
| 202 |
}); |
| 203 |
body.appendChild(hlList); |
| 204 |
} |
| 205 |
|
| 206 |
if (o.showNextEvent && o.nextEventInfo) { |
| 207 |
var nextEl = document.createElement('div'); |
| 208 |
nextEl.className = 'bkbg-evr-next'; |
| 209 |
nextEl.style.cssText = 'background:' + o.nextBg + ';color:' + o.nextTextColor + ';'; |
| 210 |
nextEl.textContent = '� |
| 211 |
' + o.nextEventInfo; |
| 212 |
body.appendChild(nextEl); |
| 213 |
} |
| 214 |
|
| 215 |
wrap.appendChild(body); |
| 216 |
el.parentNode.insertBefore(wrap, el); |
| 217 |
}); |
| 218 |
} |
| 219 |
|
| 220 |
if (document.readyState !== 'loading') { init(); } |
| 221 |
else { document.addEventListener('DOMContentLoaded', init); } |
| 222 |
})(); |
| 223 |
|