PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.7
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.7
2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
blockenberg / blocks / certification-wall / frontend.js

frontend.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.7, at blocks/certification-wall/frontend.js

164 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2 function typoCssVarsForEl(typo, prefix, el) {
3 if (!typo) return;
4 if (typo.family) el.style.setProperty(prefix + 'font-family', "'" + typo.family + "', sans-serif");
5 if (typo.weight) el.style.setProperty(prefix + 'font-weight', typo.weight);
6 if (typo.transform) el.style.setProperty(prefix + 'text-transform', typo.transform);
7 if (typo.style) el.style.setProperty(prefix + 'font-style', typo.style);
8 if (typo.decoration) el.style.setProperty(prefix + 'text-decoration', typo.decoration);
9 var su = typo.sizeUnit || 'px';
10 if (typo.sizeDesktop !== '' && typo.sizeDesktop != null) el.style.setProperty(prefix + 'font-size-d', typo.sizeDesktop + su);
11 if (typo.sizeTablet !== '' && typo.sizeTablet != null) el.style.setProperty(prefix + 'font-size-t', typo.sizeTablet + su);
12 if (typo.sizeMobile !== '' && typo.sizeMobile != null) el.style.setProperty(prefix + 'font-size-m', typo.sizeMobile + su);
13 var lhu = typo.lineHeightUnit || '';
14 if (typo.lineHeightDesktop !== '' && typo.lineHeightDesktop != null) el.style.setProperty(prefix + 'line-height-d', typo.lineHeightDesktop + lhu);
15 if (typo.lineHeightTablet !== '' && typo.lineHeightTablet != null) el.style.setProperty(prefix + 'line-height-t', typo.lineHeightTablet + lhu);
16 if (typo.lineHeightMobile !== '' && typo.lineHeightMobile != null) el.style.setProperty(prefix + 'line-height-m', typo.lineHeightMobile + lhu);
17 var lsu = typo.letterSpacingUnit || 'px';
18 if (typo.letterSpacingDesktop !== '' && typo.letterSpacingDesktop != null) el.style.setProperty(prefix + 'letter-spacing-d', typo.letterSpacingDesktop + lsu);
19 if (typo.letterSpacingTablet !== '' && typo.letterSpacingTablet != null) el.style.setProperty(prefix + 'letter-spacing-t', typo.letterSpacingTablet + lsu);
20 if (typo.letterSpacingMobile !== '' && typo.letterSpacingMobile != null) el.style.setProperty(prefix + 'letter-spacing-m', typo.letterSpacingMobile + lsu);
21 var wsu = typo.wordSpacingUnit || 'px';
22 if (typo.wordSpacingDesktop !== '' && typo.wordSpacingDesktop != null) el.style.setProperty(prefix + 'word-spacing-d', typo.wordSpacingDesktop + wsu);
23 if (typo.wordSpacingTablet !== '' && typo.wordSpacingTablet != null) el.style.setProperty(prefix + 'word-spacing-t', typo.wordSpacingTablet + wsu);
24 if (typo.wordSpacingMobile !== '' && typo.wordSpacingMobile != null) el.style.setProperty(prefix + 'word-spacing-m', typo.wordSpacingMobile + wsu);
25 }
26
27 function init() {
28 document.querySelectorAll('.bkbg-crt-app').forEach(function (el) {
29 if (el.dataset.rendered) return;
30 el.dataset.rendered = '1';
31
32 var opts;
33 try { opts = JSON.parse(el.dataset.opts || '{}'); } catch (e) { opts = {}; }
34
35 var o = Object.assign({
36 eyebrow: 'Trusted & Verified',
37 heading: 'Our Certifications & Accreditations',
38 subtext: 'Industry-recognised credentials that demonstrate our commitment to excellence.',
39 certs: [
40 { name: 'ISO 9001:2015', issuer: 'ISO', year: '2023', imageUrl: '', verifyUrl: '#' },
41 { name: 'AWS Certified', issuer: 'Amazon', year: '2023', imageUrl: '', verifyUrl: '#' }
42 ],
43 layout: 'grid', columns: 3, showYear: true, showIssuer: true, showVerify: true,
44 verifyLabel: 'Verify Certificate',
45 maxWidth: 1100, paddingTop: 80, paddingBottom: 80,
46 bgColor: '#f8fafc', headingColor: '#111827', subColor: '#6b7280', eyebrowColor: '#6366f1',
47 cardBg: '#ffffff', cardBorder: '#e2e8f0', nameColor: '#111827', issuerColor: '#6b7280',
48 accentColor: '#6366f1', verifyColor: '#6366f1'
49 }, opts);
50
51 el.parentElement && (el.parentElement.style.background = o.bgColor);
52
53 if (el.parentElement) {
54 typoCssVarsForEl(o.typoHeading, '--bkbg-crt-h-', el.parentElement);
55 typoCssVarsForEl(o.typoSubtext, '--bkbg-crt-s-', el.parentElement);
56 typoCssVarsForEl(o.typoCertName, '--bkbg-crt-cn-', el.parentElement);
57 }
58
59 var inner = document.createElement('div');
60 inner.className = 'bkbg-crt-inner';
61 inner.style.cssText = 'max-width:' + o.maxWidth + 'px;margin:0 auto;padding:' + o.paddingTop + 'px 24px ' + o.paddingBottom + 'px;';
62
63 /* Header */
64 var header = document.createElement('div');
65 header.className = 'bkbg-crt-header';
66 header.style.cssText = 'text-align:center;margin-bottom:48px;';
67
68 var ey = document.createElement('p');
69 ey.className = 'bkbg-crt-eyebrow';
70 ey.style.color = o.eyebrowColor;
71 ey.innerHTML = o.eyebrow;
72
73 var h2 = document.createElement('h2');
74 h2.className = 'bkbg-crt-heading';
75 h2.style.color = o.headingColor;
76 h2.innerHTML = o.heading;
77
78 var sub = document.createElement('p');
79 sub.className = 'bkbg-crt-sub';
80 sub.style.color = o.subColor;
81 sub.innerHTML = o.subtext;
82
83 header.appendChild(ey);
84 header.appendChild(h2);
85 header.appendChild(sub);
86 inner.appendChild(header);
87
88 /* Grid */
89 var grid = document.createElement('div');
90 grid.className = 'bkbg-crt-grid layout-' + o.layout;
91 if (o.layout !== 'list') {
92 grid.style.gridTemplateColumns = 'repeat(' + o.columns + ',1fr)';
93 }
94
95 (o.certs || []).forEach(function (cert) {
96 var card = document.createElement('div');
97 card.className = 'bkbg-crt-card';
98 card.style.cssText = 'background:' + o.cardBg + ';border-color:' + o.cardBorder;
99
100 /* Badge */
101 if (cert.imageUrl) {
102 var img = document.createElement('img');
103 img.className = 'bkbg-crt-badge';
104 img.src = cert.imageUrl;
105 img.alt = cert.name;
106 card.appendChild(img);
107 } else {
108 var ph = document.createElement('div');
109 ph.className = 'bkbg-crt-badge-placeholder';
110 ph.style.cssText = 'background:' + o.accentColor + '22;color:' + o.accentColor;
111 ph.textContent = '🏆';
112 card.appendChild(ph);
113 }
114
115 /* Body */
116 var body = document.createElement('div');
117 body.className = 'bkbg-crt-card-body';
118
119 var name = document.createElement('div');
120 name.className = 'bkbg-crt-name';
121 name.style.color = o.nameColor;
122 name.textContent = cert.name;
123 body.appendChild(name);
124
125 if (o.showIssuer && cert.issuer) {
126 var issuer = document.createElement('div');
127 issuer.className = 'bkbg-crt-issuer';
128 issuer.style.color = o.issuerColor;
129 issuer.textContent = cert.issuer;
130 body.appendChild(issuer);
131 }
132
133 if (o.showYear && cert.year) {
134 var year = document.createElement('div');
135 year.className = 'bkbg-crt-year';
136 year.style.color = o.issuerColor;
137 year.textContent = cert.year;
138 body.appendChild(year);
139 }
140
141 if (o.showVerify && cert.verifyUrl) {
142 var verify = document.createElement('a');
143 verify.className = 'bkbg-crt-verify';
144 verify.href = cert.verifyUrl;
145 verify.target = '_blank';
146 verify.rel = 'noopener noreferrer';
147 verify.style.color = o.verifyColor;
148 verify.textContent = o.verifyLabel;
149 body.appendChild(verify);
150 }
151
152 card.appendChild(body);
153 grid.appendChild(card);
154 });
155
156 inner.appendChild(grid);
157 el.appendChild(inner);
158 });
159 }
160
161 if (document.readyState !== 'loading') { init(); }
162 else { document.addEventListener('DOMContentLoaded', init); }
163 })();
164