| 1 |
(function () { |
| 2 |
function typoCssVarsForEl(typo, prefix, el) { |
| 3 |
if (!typo || typeof typo !== 'object') return; |
| 4 |
var m = { family:'font-family', weight:'font-weight', transform:'text-transform', style:'font-style', decoration:'text-decoration', |
| 5 |
sizeDesktop:'font-size-d', sizeTablet:'font-size-t', sizeMobile:'font-size-m', |
| 6 |
lineHeightDesktop:'line-height-d', lineHeightTablet:'line-height-t', lineHeightMobile:'line-height-m', |
| 7 |
letterSpacingDesktop:'letter-spacing-d', letterSpacingTablet:'letter-spacing-t', letterSpacingMobile:'letter-spacing-m', |
| 8 |
wordSpacingDesktop:'word-spacing-d', wordSpacingTablet:'word-spacing-t', wordSpacingMobile:'word-spacing-m' }; |
| 9 |
Object.keys(m).forEach(function (k) { |
| 10 |
if (typo[k] !== undefined && typo[k] !== '') { |
| 11 |
var v = typo[k], u = typo[k + 'Unit'] || ''; |
| 12 |
if (/Desktop|Tablet|Mobile/.test(k) && typeof v === 'number') v = v + (u || 'px'); |
| 13 |
el.style.setProperty(prefix + m[k], '' + v); |
| 14 |
} |
| 15 |
}); |
| 16 |
} |
| 17 |
|
| 18 |
function init() { |
| 19 |
document.querySelectorAll('.bkbg-dms-app').forEach(function (el) { |
| 20 |
if (el.dataset.rendered) return; |
| 21 |
el.dataset.rendered = '1'; |
| 22 |
|
| 23 |
var opts; |
| 24 |
try { opts = JSON.parse(el.dataset.opts || '{}'); } catch (e) { opts = {}; } |
| 25 |
|
| 26 |
var o = Object.assign({ |
| 27 |
badge: '✨ No credit card required', |
| 28 |
heading: 'See It in Action — Request a Demo', |
| 29 |
subtext: 'Get a personalised walkthrough from our team and discover how Blockenberg can transform your workflow in under 30 minutes.', |
| 30 |
ctaMode: 'button', |
| 31 |
ctaLabel: 'Book a Free Demo', ctaUrl: '#', |
| 32 |
ctaSecLabel: 'Start Free Trial', ctaSecUrl: '#', showCtaSec: true, |
| 33 |
formPlaceholder: 'Enter your work email', formSubmitLabel: 'Request Demo', formAction: '', |
| 34 |
trustItems: [{ icon: '� |
| 35 |
', text: 'No credit card required' }, { icon: '⚡', text: '5-minute setup' }, { icon: '🔒', text: 'SOC 2 certified' }, { icon: '🎯', text: 'Cancel anytime' }], |
| 36 |
showTrust: true, |
| 37 |
socialStats: [{ number: '10,000+', label: 'Active teams' }, { number: '4.9/5', label: 'G2 rating' }, { number: '98%', label: 'Customer satisfaction' }], |
| 38 |
showStats: true, |
| 39 |
imageUrl: '', showImage: true, |
| 40 |
layout: 'centered', maxWidth: 1100, paddingTop: 100, paddingBottom: 100, |
| 41 |
bgColor: '#0f172a', headingColor: '#f8fafc', subColor: '#94a3b8', |
| 42 |
badgeBg: 'rgba(99,102,241,0.15)', badgeColor: '#a5b4fc', |
| 43 |
ctaBg: '#6366f1', ctaColor: '#ffffff', |
| 44 |
ctaSecBg: 'transparent', ctaSecColor: '#a5b4fc', |
| 45 |
trustColor: '#94a3b8', statNumColor: '#f8fafc', statLabelColor: '#64748b', |
| 46 |
imageBg: '#1e293b', accentColor: '#6366f1' |
| 47 |
}, opts); |
| 48 |
|
| 49 |
el.parentElement && (el.parentElement.style.background = o.bgColor); |
| 50 |
|
| 51 |
var isSplit = o.layout === 'split-left' || o.layout === 'split-right'; |
| 52 |
|
| 53 |
var inner = document.createElement('div'); |
| 54 |
inner.className = 'bkbg-dms-inner layout-' + o.layout; |
| 55 |
inner.style.cssText = 'max-width:' + o.maxWidth + 'px;margin:0 auto;padding:' + o.paddingTop + 'px 24px ' + o.paddingBottom + 'px;'; |
| 56 |
|
| 57 |
/* Typography CSS vars */ |
| 58 |
inner.style.setProperty('--bkbg-dms-hdg-fs', (o.headingFontSize || 36) + 'px'); |
| 59 |
inner.style.setProperty('--bkbg-dms-sub-fs', (o.subtextFontSize || 18) + 'px'); |
| 60 |
if (opts.typoHeading) typoCssVarsForEl(opts.typoHeading, '--bkbg-dms-hdg-', inner); |
| 61 |
if (opts.typoSubtext) typoCssVarsForEl(opts.typoSubtext, '--bkbg-dms-sub-', inner); |
| 62 |
|
| 63 |
/* Text column */ |
| 64 |
var textCol = document.createElement('div'); |
| 65 |
textCol.className = 'bkbg-dms-text'; |
| 66 |
|
| 67 |
if (o.badge) { |
| 68 |
var badge = document.createElement('div'); |
| 69 |
badge.className = 'bkbg-dms-badge'; |
| 70 |
badge.style.cssText = 'background:' + o.badgeBg + ';color:' + o.badgeColor; |
| 71 |
badge.textContent = o.badge; |
| 72 |
textCol.appendChild(badge); |
| 73 |
} |
| 74 |
|
| 75 |
var h2 = document.createElement('h2'); |
| 76 |
h2.className = 'bkbg-dms-heading'; |
| 77 |
h2.style.color = o.headingColor; |
| 78 |
h2.innerHTML = o.heading; |
| 79 |
textCol.appendChild(h2); |
| 80 |
|
| 81 |
var sub = document.createElement('p'); |
| 82 |
sub.className = 'bkbg-dms-sub'; |
| 83 |
sub.style.color = o.subColor; |
| 84 |
sub.innerHTML = o.subtext; |
| 85 |
textCol.appendChild(sub); |
| 86 |
|
| 87 |
/* CTA */ |
| 88 |
var ctaRow = document.createElement('div'); |
| 89 |
ctaRow.className = 'bkbg-dms-cta-row'; |
| 90 |
|
| 91 |
if (o.ctaMode === 'button') { |
| 92 |
var btn = document.createElement('a'); |
| 93 |
btn.className = 'bkbg-dms-btn-primary'; |
| 94 |
btn.href = o.ctaUrl; |
| 95 |
btn.style.cssText = 'background:' + o.ctaBg + ';color:' + o.ctaColor; |
| 96 |
btn.textContent = o.ctaLabel; |
| 97 |
ctaRow.appendChild(btn); |
| 98 |
if (o.showCtaSec) { |
| 99 |
var btnSec = document.createElement('a'); |
| 100 |
btnSec.className = 'bkbg-dms-btn-sec'; |
| 101 |
btnSec.href = o.ctaSecUrl; |
| 102 |
btnSec.style.cssText = 'color:' + o.ctaSecColor + ';border:1px solid ' + o.ctaSecColor + '88'; |
| 103 |
btnSec.textContent = o.ctaSecLabel; |
| 104 |
ctaRow.appendChild(btnSec); |
| 105 |
} |
| 106 |
} else { |
| 107 |
var form = document.createElement('form'); |
| 108 |
form.className = 'bkbg-dms-form-preview'; |
| 109 |
if (o.formAction) form.action = o.formAction; |
| 110 |
form.method = 'post'; |
| 111 |
|
| 112 |
var input = document.createElement('input'); |
| 113 |
input.type = 'email'; |
| 114 |
input.className = 'bkbg-dms-input-fake'; |
| 115 |
input.placeholder = o.formPlaceholder; |
| 116 |
input.style.color = o.subColor; |
| 117 |
form.appendChild(input); |
| 118 |
|
| 119 |
var submit = document.createElement('button'); |
| 120 |
submit.type = 'submit'; |
| 121 |
submit.className = 'bkbg-dms-submit-fake'; |
| 122 |
submit.style.cssText = 'background:' + o.ctaBg + ';color:' + o.ctaColor; |
| 123 |
submit.textContent = o.formSubmitLabel; |
| 124 |
form.appendChild(submit); |
| 125 |
ctaRow.appendChild(form); |
| 126 |
} |
| 127 |
textCol.appendChild(ctaRow); |
| 128 |
|
| 129 |
/* Trust */ |
| 130 |
if (o.showTrust && o.trustItems.length) { |
| 131 |
var trust = document.createElement('div'); |
| 132 |
trust.className = 'bkbg-dms-trust'; |
| 133 |
var _IP = window.bkbgIconPicker; |
| 134 |
o.trustItems.forEach(function (item) { |
| 135 |
var span = document.createElement('span'); |
| 136 |
span.className = 'bkbg-dms-trust-item'; |
| 137 |
span.style.color = o.trustColor; |
| 138 |
var iconSpan = document.createElement('span'); |
| 139 |
iconSpan.className = 'bkbg-dms-trust-icon'; |
| 140 |
var _iType = item.iconType || 'custom-char'; |
| 141 |
if (_IP && _iType !== 'custom-char') { |
| 142 |
var _in = _IP.buildFrontendIcon(_iType, item.icon, item.iconDashicon, item.iconImageUrl, item.iconDashiconColor); |
| 143 |
if (_in) iconSpan.appendChild(_in); |
| 144 |
else iconSpan.textContent = item.icon; |
| 145 |
} else { |
| 146 |
iconSpan.textContent = item.icon; |
| 147 |
} |
| 148 |
span.appendChild(iconSpan); |
| 149 |
span.appendChild(document.createTextNode(item.text)); |
| 150 |
trust.appendChild(span); |
| 151 |
}); |
| 152 |
textCol.appendChild(trust); |
| 153 |
} |
| 154 |
|
| 155 |
/* Stats */ |
| 156 |
if (o.showStats && o.socialStats.length) { |
| 157 |
var stats = document.createElement('div'); |
| 158 |
stats.className = 'bkbg-dms-stats'; |
| 159 |
o.socialStats.forEach(function (stat) { |
| 160 |
var sd = document.createElement('div'); |
| 161 |
sd.className = 'bkbg-dms-stat'; |
| 162 |
var snum = document.createElement('div'); |
| 163 |
snum.className = 'bkbg-dms-stat-num'; |
| 164 |
snum.style.color = o.statNumColor; |
| 165 |
snum.textContent = stat.number; |
| 166 |
var slabel = document.createElement('div'); |
| 167 |
slabel.className = 'bkbg-dms-stat-label'; |
| 168 |
slabel.style.color = o.statLabelColor; |
| 169 |
slabel.textContent = stat.label; |
| 170 |
sd.appendChild(snum); |
| 171 |
sd.appendChild(slabel); |
| 172 |
stats.appendChild(sd); |
| 173 |
}); |
| 174 |
textCol.appendChild(stats); |
| 175 |
} |
| 176 |
|
| 177 |
inner.appendChild(textCol); |
| 178 |
|
| 179 |
/* Image */ |
| 180 |
if (o.showImage) { |
| 181 |
var imgCol = document.createElement('div'); |
| 182 |
imgCol.className = isSplit ? 'bkbg-dms-image-col' : 'bkbg-dms-image-centered'; |
| 183 |
imgCol.style.background = o.imageBg; |
| 184 |
if (o.imageUrl) { |
| 185 |
var img = document.createElement('img'); |
| 186 |
img.className = 'bkbg-dms-screenshot'; |
| 187 |
img.src = o.imageUrl; |
| 188 |
img.alt = ''; |
| 189 |
imgCol.appendChild(img); |
| 190 |
} else { |
| 191 |
var ph = document.createElement('div'); |
| 192 |
ph.className = 'bkbg-dms-img-placeholder'; |
| 193 |
ph.style.cssText = 'background:' + o.accentColor + '22;color:' + o.accentColor; |
| 194 |
ph.textContent = '🖥'; |
| 195 |
imgCol.appendChild(ph); |
| 196 |
} |
| 197 |
inner.appendChild(imgCol); |
| 198 |
} |
| 199 |
|
| 200 |
el.appendChild(inner); |
| 201 |
}); |
| 202 |
} |
| 203 |
|
| 204 |
if (document.readyState !== 'loading') { init(); } |
| 205 |
else { document.addEventListener('DOMContentLoaded', init); } |
| 206 |
})(); |
| 207 |
|