| 1 |
(function () { |
| 2 |
var _typoKeys = { |
| 3 |
family:'font-family', weight:'font-weight', style:'font-style', |
| 4 |
transform:'text-transform', 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 |
}; |
| 10 |
var _typoUnits = { size:'sizeUnit', lineHeight:'lineHeightUnit', letterSpacing:'letterSpacingUnit', wordSpacing:'wordSpacingUnit' }; |
| 11 |
var _typoUnitDefaults = { size:'px', lineHeight:'', letterSpacing:'px', wordSpacing:'px' }; |
| 12 |
function typoCssVarsForEl(el, obj, prefix) { |
| 13 |
if (!obj || typeof obj !== 'object') return; |
| 14 |
Object.keys(_typoKeys).forEach(function (k) { |
| 15 |
var v = obj[k]; if (v === undefined || v === '') return; |
| 16 |
var prop = _typoKeys[k]; |
| 17 |
var base = k.replace(/Desktop|Tablet|Mobile/, ''); |
| 18 |
var uKey = _typoUnits[base]; |
| 19 |
if (uKey && typeof v === 'number') v = v + (obj[uKey] || _typoUnitDefaults[base] || ''); |
| 20 |
el.style.setProperty(prefix + prop, v); |
| 21 |
}); |
| 22 |
} |
| 23 |
function init() { |
| 24 |
document.querySelectorAll('.bkbg-obs-app').forEach(function (el) { |
| 25 |
if (el.dataset.rendered) return; |
| 26 |
el.dataset.rendered = '1'; |
| 27 |
|
| 28 |
var opts; |
| 29 |
try { opts = JSON.parse(el.dataset.opts || '{}'); } catch (e) { opts = {}; } |
| 30 |
|
| 31 |
var o = Object.assign({ |
| 32 |
eyebrow: 'Get Started', |
| 33 |
heading: 'Up and Running in Minutes', |
| 34 |
subtext: 'Follow these simple steps to get set up and start seeing results.', |
| 35 |
steps: [ |
| 36 |
{ number: '01', icon: '🔑', title: 'Create Your Account', description: 'Sign up in under 60 seconds — no credit card required.', ctaLabel: 'Sign Up Free', ctaUrl: '#' }, |
| 37 |
{ number: '02', icon: '⚙️', title: 'Configure Your Settings', description: 'Customize the platform to match your workflow.', ctaLabel: '', ctaUrl: '' }, |
| 38 |
{ number: '03', icon: '🚀', title: 'Launch and Grow', description: 'Go live with confidence. Our team is here to support you.', ctaLabel: 'View Docs', ctaUrl: '#' } |
| 39 |
], |
| 40 |
layout: 'horizontal', |
| 41 |
showNumbers: true, |
| 42 |
showIcons: true, |
| 43 |
showStepCtas: false, |
| 44 |
connectorStyle: 'line', |
| 45 |
mainCtaLabel: 'Start for Free', |
| 46 |
mainCtaUrl: '#', |
| 47 |
showMainCta: true, |
| 48 |
bgColor: '#ffffff', |
| 49 |
headingColor: '#111827', |
| 50 |
subColor: '#6b7280', |
| 51 |
eyebrowColor: '#6366f1', |
| 52 |
stepNumBg: '#6366f1', |
| 53 |
stepNumColor: '#ffffff', |
| 54 |
stepTitleColor: '#111827', |
| 55 |
stepDescColor: '#6b7280', |
| 56 |
connectorColor: '#e5e7eb', |
| 57 |
cardBg: '#f9fafb', |
| 58 |
ctaBg: '#6366f1', |
| 59 |
ctaColor: '#ffffff', |
| 60 |
accentColor: '#6366f1', |
| 61 |
maxWidth: 1000, |
| 62 |
paddingTop: 80, |
| 63 |
paddingBottom: 80 |
| 64 |
}, opts); |
| 65 |
|
| 66 |
el.parentElement && (el.parentElement.style.background = o.bgColor); |
| 67 |
|
| 68 |
var inner = document.createElement('div'); |
| 69 |
inner.className = 'bkbg-obs-wrap bkbg-obs-inner'; |
| 70 |
inner.style.cssText = 'max-width:' + o.maxWidth + 'px;margin:0 auto;padding:' + o.paddingTop + 'px 24px ' + o.paddingBottom + 'px;'; |
| 71 |
|
| 72 |
typoCssVarsForEl(inner, o.headingTypo, '--bkbg-obs-hd-'); |
| 73 |
typoCssVarsForEl(inner, o.subtextTypo, '--bkbg-obs-st-'); |
| 74 |
typoCssVarsForEl(inner, o.eyebrowTypo, '--bkbg-obs-ey-'); |
| 75 |
typoCssVarsForEl(inner, o.stepTitleTypo, '--bkbg-obs-stt-'); |
| 76 |
typoCssVarsForEl(inner, o.stepDescTypo, '--bkbg-obs-sd-'); |
| 77 |
|
| 78 |
/* Header */ |
| 79 |
var header = document.createElement('div'); |
| 80 |
header.className = 'bkbg-obs-header'; |
| 81 |
|
| 82 |
var eyebrow = document.createElement('p'); |
| 83 |
eyebrow.className = 'bkbg-obs-eyebrow'; |
| 84 |
eyebrow.style.color = o.eyebrowColor; |
| 85 |
eyebrow.innerHTML = o.eyebrow; |
| 86 |
|
| 87 |
var heading = document.createElement('h2'); |
| 88 |
heading.className = 'bkbg-obs-heading'; |
| 89 |
heading.style.color = o.headingColor; |
| 90 |
heading.innerHTML = o.heading; |
| 91 |
|
| 92 |
var sub = document.createElement('p'); |
| 93 |
sub.className = 'bkbg-obs-sub'; |
| 94 |
sub.style.color = o.subColor; |
| 95 |
sub.innerHTML = o.subtext; |
| 96 |
|
| 97 |
header.appendChild(eyebrow); |
| 98 |
header.appendChild(heading); |
| 99 |
header.appendChild(sub); |
| 100 |
inner.appendChild(header); |
| 101 |
|
| 102 |
/* Grid */ |
| 103 |
var cols = (o.steps || []).length || 3; |
| 104 |
var grid = document.createElement('div'); |
| 105 |
grid.className = 'bkbg-obs-grid layout-' + o.layout + ' connector-' + o.connectorStyle; |
| 106 |
|
| 107 |
if (o.layout === 'horizontal' || o.layout === 'cards') { |
| 108 |
grid.style.gridTemplateColumns = 'repeat(' + cols + ',1fr)'; |
| 109 |
} |
| 110 |
|
| 111 |
if (o.connectorStyle === 'line' && o.layout === 'horizontal') { |
| 112 |
grid.style.setProperty('--steps', String(cols)); |
| 113 |
/* visual connector injected via CSS, but we can also inline it */ |
| 114 |
var pseudoHint = grid; /* CSS handles ::before */ |
| 115 |
} |
| 116 |
|
| 117 |
(o.steps || []).forEach(function (step) { |
| 118 |
var card = document.createElement('div'); |
| 119 |
card.className = 'bkbg-obs-step-card'; |
| 120 |
card.style.background = o.cardBg; |
| 121 |
|
| 122 |
/* Top: number + icon */ |
| 123 |
var top = document.createElement('div'); |
| 124 |
top.className = 'bkbg-obs-step-top'; |
| 125 |
|
| 126 |
if (o.showNumbers) { |
| 127 |
var num = document.createElement('span'); |
| 128 |
num.className = 'bkbg-obs-step-num'; |
| 129 |
num.style.cssText = 'background:' + o.stepNumBg + ';color:' + o.stepNumColor; |
| 130 |
num.textContent = step.number; |
| 131 |
top.appendChild(num); |
| 132 |
} |
| 133 |
|
| 134 |
if (o.showIcons) { |
| 135 |
var icon = document.createElement('span'); |
| 136 |
icon.className = 'bkbg-obs-step-icon'; |
| 137 |
var _IP = window.bkbgIconPicker; |
| 138 |
var _iType = step.iconType || 'custom-char'; |
| 139 |
if (_IP && _iType !== 'custom-char') { |
| 140 |
var _in = _IP.buildFrontendIcon(_iType, step.icon, step.iconDashicon, step.iconImageUrl, step.iconDashiconColor); |
| 141 |
if (_in) icon.appendChild(_in); else icon.textContent = step.icon || ''; |
| 142 |
} else { icon.textContent = step.icon || ''; } |
| 143 |
if (icon.textContent || icon.childNodes.length) top.appendChild(icon); |
| 144 |
} |
| 145 |
|
| 146 |
card.appendChild(top); |
| 147 |
|
| 148 |
var body = document.createElement('div'); |
| 149 |
|
| 150 |
var title = document.createElement('div'); |
| 151 |
title.className = 'bkbg-obs-step-title'; |
| 152 |
title.style.color = o.stepTitleColor; |
| 153 |
title.textContent = step.title; |
| 154 |
|
| 155 |
var desc = document.createElement('div'); |
| 156 |
desc.className = 'bkbg-obs-step-desc'; |
| 157 |
desc.style.color = o.stepDescColor; |
| 158 |
desc.textContent = step.description; |
| 159 |
|
| 160 |
body.appendChild(title); |
| 161 |
body.appendChild(desc); |
| 162 |
|
| 163 |
if (o.showStepCtas && step.ctaLabel && step.ctaUrl) { |
| 164 |
var stepCta = document.createElement('a'); |
| 165 |
stepCta.className = 'bkbg-obs-step-cta'; |
| 166 |
stepCta.href = step.ctaUrl; |
| 167 |
stepCta.style.color = o.accentColor; |
| 168 |
stepCta.textContent = step.ctaLabel; |
| 169 |
body.appendChild(stepCta); |
| 170 |
} |
| 171 |
|
| 172 |
card.appendChild(body); |
| 173 |
grid.appendChild(card); |
| 174 |
|
| 175 |
/* Connector line styling via ::before relies on CSS variable */ |
| 176 |
if (o.connectorStyle === 'line') { |
| 177 |
grid.style.setProperty('--connector-color', o.connectorColor); |
| 178 |
} |
| 179 |
}); |
| 180 |
|
| 181 |
inner.appendChild(grid); |
| 182 |
|
| 183 |
/* Main CTA */ |
| 184 |
if (o.showMainCta && o.mainCtaLabel) { |
| 185 |
var ctaWrap = document.createElement('div'); |
| 186 |
ctaWrap.className = 'bkbg-obs-main-cta-wrap'; |
| 187 |
|
| 188 |
var cta = document.createElement('a'); |
| 189 |
cta.className = 'bkbg-obs-main-cta'; |
| 190 |
cta.href = o.mainCtaUrl; |
| 191 |
cta.style.cssText = 'background:' + o.ctaBg + ';color:' + o.ctaColor; |
| 192 |
cta.textContent = o.mainCtaLabel; |
| 193 |
ctaWrap.appendChild(cta); |
| 194 |
inner.appendChild(ctaWrap); |
| 195 |
} |
| 196 |
|
| 197 |
el.appendChild(inner); |
| 198 |
}); |
| 199 |
} |
| 200 |
|
| 201 |
if (document.readyState !== 'loading') { init(); } |
| 202 |
else { document.addEventListener('DOMContentLoaded', init); } |
| 203 |
})(); |
| 204 |
|