widebible-embed 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/embed.esm.js +965 -0
- package/dist/embed.min.js +564 -0
- package/dist/index.d.ts +27 -0
- package/package.json +38 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
/* widebible-embed v1.0.0 | MIT | https://widget.widebible.com */
|
|
2
|
+
"use strict";(()=>{var h={site:"widebible",name:"WideBible",domain:"widebible.com",apiBase:"https://widebible.com/api/v1/bible",votdEndpoint:"https://widebible.com/api/v1/verse-of-the-day/",searchPath:"/search/",accent:"#4F46E5",attribute:"data-widebible",religion:"christianity",scriptureLabel:"Bible",defaultTranslation:"kjv"};function C(t){return`
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
|
6
|
+
--site-accent: ${t};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wide-widget {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
min-width: 280px;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
border: 1px solid var(--border);
|
|
15
|
+
background: var(--bg);
|
|
16
|
+
color: var(--text);
|
|
17
|
+
font-size: 15px;
|
|
18
|
+
line-height: 1.6;
|
|
19
|
+
transition: border-color 0.2s;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.wide-widget[data-theme="light"] {
|
|
23
|
+
--bg: #ffffff;
|
|
24
|
+
--text: #1a1a1a;
|
|
25
|
+
--border: #e5e7eb;
|
|
26
|
+
--accent: var(--site-accent);
|
|
27
|
+
--muted: #6b7280;
|
|
28
|
+
--ribbon: #f9fafb;
|
|
29
|
+
--badge-bg: #f3f4f6;
|
|
30
|
+
--badge-text: #374151;
|
|
31
|
+
--link: var(--site-accent);
|
|
32
|
+
--copy-bg: #f3f4f6;
|
|
33
|
+
--copy-hover: #e5e7eb;
|
|
34
|
+
--input-bg: #ffffff;
|
|
35
|
+
--input-border: #d1d5db;
|
|
36
|
+
--input-focus: var(--site-accent);
|
|
37
|
+
--shadow: 0 1px 3px rgba(0,0,0,0.08);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.wide-widget[data-theme="dark"] {
|
|
41
|
+
--bg: #1a1a1a;
|
|
42
|
+
--text: #f3f4f6;
|
|
43
|
+
--border: #374151;
|
|
44
|
+
--accent: var(--site-accent);
|
|
45
|
+
--muted: #9ca3af;
|
|
46
|
+
--ribbon: #111111;
|
|
47
|
+
--badge-bg: #374151;
|
|
48
|
+
--badge-text: #d1d5db;
|
|
49
|
+
--link: #93c5fd;
|
|
50
|
+
--copy-bg: #374151;
|
|
51
|
+
--copy-hover: #4b5563;
|
|
52
|
+
--input-bg: #111111;
|
|
53
|
+
--input-border: #4b5563;
|
|
54
|
+
--input-focus: var(--site-accent);
|
|
55
|
+
--shadow: 0 1px 3px rgba(0,0,0,0.4);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.wide-widget[data-theme="sepia"] {
|
|
59
|
+
--bg: #f5f0e8;
|
|
60
|
+
--text: #3d3529;
|
|
61
|
+
--border: #d4c5a9;
|
|
62
|
+
--accent: var(--site-accent);
|
|
63
|
+
--muted: #8b7d6b;
|
|
64
|
+
--ribbon: #ede8df;
|
|
65
|
+
--badge-bg: #e8e0d0;
|
|
66
|
+
--badge-text: #5c4f3d;
|
|
67
|
+
--link: #7c5c3b;
|
|
68
|
+
--copy-bg: #e8e0d0;
|
|
69
|
+
--copy-hover: #ddd4c0;
|
|
70
|
+
--input-bg: #f5f0e8;
|
|
71
|
+
--input-border: #c4b49a;
|
|
72
|
+
--input-focus: var(--site-accent);
|
|
73
|
+
--shadow: 0 1px 3px rgba(61,53,41,0.12);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.wide-widget *, .wide-widget *::before, .wide-widget *::after {
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Loading state */
|
|
81
|
+
.wide-loading {
|
|
82
|
+
padding: 20px 16px;
|
|
83
|
+
text-align: center;
|
|
84
|
+
color: var(--muted);
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
gap: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.wide-spinner {
|
|
93
|
+
width: 16px;
|
|
94
|
+
height: 16px;
|
|
95
|
+
border: 2px solid var(--border);
|
|
96
|
+
border-top-color: var(--accent);
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
animation: wide-spin 0.7s linear infinite;
|
|
99
|
+
display: inline-block;
|
|
100
|
+
flex-shrink: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes wide-spin {
|
|
104
|
+
to { transform: rotate(360deg); }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Error state */
|
|
108
|
+
.wide-error {
|
|
109
|
+
padding: 16px;
|
|
110
|
+
color: var(--muted);
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
text-align: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.wide-error a {
|
|
116
|
+
color: var(--link);
|
|
117
|
+
text-decoration: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.wide-error a:hover {
|
|
121
|
+
text-decoration: underline;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Scripture ribbon blockquote */
|
|
125
|
+
.wide-ribbon {
|
|
126
|
+
border-left: 4px solid var(--accent);
|
|
127
|
+
background: var(--ribbon);
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 14px 16px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.wide-ribbon.compact {
|
|
133
|
+
padding: 10px 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Scripture text */
|
|
137
|
+
.wide-verse-text {
|
|
138
|
+
font-family: Georgia, 'Times New Roman', 'Palatino Linotype', serif;
|
|
139
|
+
font-size: 16px;
|
|
140
|
+
line-height: 1.75;
|
|
141
|
+
color: var(--text);
|
|
142
|
+
margin: 0 0 8px 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.wide-verse-text.compact {
|
|
146
|
+
font-size: 14px;
|
|
147
|
+
line-height: 1.6;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Original language text */
|
|
151
|
+
.wide-original {
|
|
152
|
+
font-size: 18px;
|
|
153
|
+
line-height: 1.8;
|
|
154
|
+
color: var(--muted);
|
|
155
|
+
margin: 8px 0 0 0;
|
|
156
|
+
font-family: serif;
|
|
157
|
+
direction: auto;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Content area */
|
|
161
|
+
.wide-body {
|
|
162
|
+
padding: 14px 16px 12px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.wide-body.compact {
|
|
166
|
+
padding: 10px 12px 10px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Reference + badges */
|
|
170
|
+
.wide-meta {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
flex-wrap: wrap;
|
|
174
|
+
gap: 6px;
|
|
175
|
+
margin-bottom: 10px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.wide-ref {
|
|
179
|
+
font-size: 13px;
|
|
180
|
+
font-weight: 600;
|
|
181
|
+
color: var(--text);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.wide-badge {
|
|
185
|
+
display: inline-block;
|
|
186
|
+
font-size: 11px;
|
|
187
|
+
font-weight: 500;
|
|
188
|
+
padding: 2px 7px;
|
|
189
|
+
border-radius: 4px;
|
|
190
|
+
background: var(--badge-bg);
|
|
191
|
+
color: var(--badge-text);
|
|
192
|
+
text-transform: uppercase;
|
|
193
|
+
letter-spacing: 0.04em;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Actions row */
|
|
197
|
+
.wide-actions {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: space-between;
|
|
201
|
+
gap: 8px;
|
|
202
|
+
padding: 10px 16px;
|
|
203
|
+
border-top: 1px solid var(--border);
|
|
204
|
+
background: var(--bg);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.wide-actions.compact {
|
|
208
|
+
padding: 8px 12px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.wide-link {
|
|
212
|
+
font-size: 12px;
|
|
213
|
+
font-weight: 500;
|
|
214
|
+
color: var(--link);
|
|
215
|
+
text-decoration: none;
|
|
216
|
+
display: inline-flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
gap: 4px;
|
|
219
|
+
transition: opacity 0.15s;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.wide-link:hover {
|
|
223
|
+
opacity: 0.8;
|
|
224
|
+
text-decoration: underline;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.wide-link svg {
|
|
228
|
+
width: 12px;
|
|
229
|
+
height: 12px;
|
|
230
|
+
flex-shrink: 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.wide-copy-btn {
|
|
234
|
+
background: var(--copy-bg);
|
|
235
|
+
color: var(--text);
|
|
236
|
+
border: none;
|
|
237
|
+
border-radius: 5px;
|
|
238
|
+
padding: 5px 10px;
|
|
239
|
+
font-size: 12px;
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
display: inline-flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
gap: 5px;
|
|
244
|
+
transition: background 0.15s;
|
|
245
|
+
font-family: inherit;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.wide-copy-btn:hover {
|
|
249
|
+
background: var(--copy-hover);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.wide-copy-btn svg {
|
|
253
|
+
width: 13px;
|
|
254
|
+
height: 13px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* Title */
|
|
258
|
+
.wide-title {
|
|
259
|
+
font-size: 17px;
|
|
260
|
+
font-weight: 700;
|
|
261
|
+
color: var(--text);
|
|
262
|
+
margin: 0 0 6px 0;
|
|
263
|
+
line-height: 1.3;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.wide-subtitle {
|
|
267
|
+
font-size: 13px;
|
|
268
|
+
color: var(--muted);
|
|
269
|
+
margin: 0 0 10px 0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.wide-summary {
|
|
273
|
+
font-size: 14px;
|
|
274
|
+
color: var(--text);
|
|
275
|
+
margin: 0;
|
|
276
|
+
line-height: 1.65;
|
|
277
|
+
display: -webkit-box;
|
|
278
|
+
-webkit-line-clamp: 4;
|
|
279
|
+
-webkit-box-orient: vertical;
|
|
280
|
+
overflow: hidden;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Verse count / stat badges */
|
|
284
|
+
.wide-stat {
|
|
285
|
+
display: inline-flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
gap: 4px;
|
|
288
|
+
font-size: 12px;
|
|
289
|
+
color: var(--muted);
|
|
290
|
+
background: var(--badge-bg);
|
|
291
|
+
border-radius: 4px;
|
|
292
|
+
padding: 3px 8px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Compare layout */
|
|
296
|
+
.wide-compare-grid {
|
|
297
|
+
display: grid;
|
|
298
|
+
grid-template-columns: 1fr 1fr;
|
|
299
|
+
gap: 12px;
|
|
300
|
+
padding: 14px 16px;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@media (max-width: 480px) {
|
|
304
|
+
.wide-compare-grid {
|
|
305
|
+
grid-template-columns: 1fr;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.wide-compare-col {
|
|
310
|
+
border-left: 3px solid var(--accent);
|
|
311
|
+
padding-left: 10px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.wide-compare-label {
|
|
315
|
+
font-size: 11px;
|
|
316
|
+
font-weight: 600;
|
|
317
|
+
color: var(--muted);
|
|
318
|
+
text-transform: uppercase;
|
|
319
|
+
letter-spacing: 0.05em;
|
|
320
|
+
margin-bottom: 6px;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.wide-compare-text {
|
|
324
|
+
font-family: Georgia, serif;
|
|
325
|
+
font-size: 14px;
|
|
326
|
+
line-height: 1.7;
|
|
327
|
+
color: var(--text);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/* Search box */
|
|
331
|
+
.wide-search-wrap {
|
|
332
|
+
padding: 14px 16px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.wide-search-form {
|
|
336
|
+
display: flex;
|
|
337
|
+
gap: 8px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.wide-search-input {
|
|
341
|
+
flex: 1;
|
|
342
|
+
padding: 8px 12px;
|
|
343
|
+
border: 1px solid var(--input-border);
|
|
344
|
+
border-radius: 6px;
|
|
345
|
+
background: var(--input-bg);
|
|
346
|
+
color: var(--text);
|
|
347
|
+
font-size: 14px;
|
|
348
|
+
font-family: inherit;
|
|
349
|
+
outline: none;
|
|
350
|
+
transition: border-color 0.15s;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.wide-search-input:focus {
|
|
354
|
+
border-color: var(--input-focus);
|
|
355
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--input-focus) 20%, transparent);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.wide-search-input::placeholder {
|
|
359
|
+
color: var(--muted);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.wide-search-btn {
|
|
363
|
+
background: var(--accent);
|
|
364
|
+
color: #fff;
|
|
365
|
+
border: none;
|
|
366
|
+
border-radius: 6px;
|
|
367
|
+
padding: 8px 16px;
|
|
368
|
+
font-size: 14px;
|
|
369
|
+
font-weight: 500;
|
|
370
|
+
cursor: pointer;
|
|
371
|
+
font-family: inherit;
|
|
372
|
+
transition: opacity 0.15s;
|
|
373
|
+
white-space: nowrap;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.wide-search-btn:hover {
|
|
377
|
+
opacity: 0.9;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/* Powered by footer */
|
|
381
|
+
.wide-powered {
|
|
382
|
+
display: block;
|
|
383
|
+
text-align: center;
|
|
384
|
+
padding: 8px 16px;
|
|
385
|
+
font-size: 11px;
|
|
386
|
+
color: var(--muted);
|
|
387
|
+
border-top: 1px solid var(--border);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.wide-powered a {
|
|
391
|
+
color: var(--link);
|
|
392
|
+
text-decoration: none;
|
|
393
|
+
font-weight: 500;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.wide-powered a:hover {
|
|
397
|
+
text-decoration: underline;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* VOTD header accent bar */
|
|
401
|
+
.wide-accent-bar {
|
|
402
|
+
height: 3px;
|
|
403
|
+
background: var(--accent);
|
|
404
|
+
width: 100%;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Person card avatar placeholder */
|
|
408
|
+
.wide-person-header {
|
|
409
|
+
display: flex;
|
|
410
|
+
align-items: center;
|
|
411
|
+
gap: 12px;
|
|
412
|
+
padding: 14px 16px 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.wide-person-icon {
|
|
416
|
+
width: 42px;
|
|
417
|
+
height: 42px;
|
|
418
|
+
border-radius: 50%;
|
|
419
|
+
background: var(--badge-bg);
|
|
420
|
+
display: flex;
|
|
421
|
+
align-items: center;
|
|
422
|
+
justify-content: center;
|
|
423
|
+
flex-shrink: 0;
|
|
424
|
+
color: var(--accent);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.wide-person-icon svg {
|
|
428
|
+
width: 22px;
|
|
429
|
+
height: 22px;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.wide-person-name {
|
|
433
|
+
font-size: 16px;
|
|
434
|
+
font-weight: 700;
|
|
435
|
+
color: var(--text);
|
|
436
|
+
margin: 0;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.wide-person-era {
|
|
440
|
+
font-size: 12px;
|
|
441
|
+
color: var(--muted);
|
|
442
|
+
margin: 2px 0 0 0;
|
|
443
|
+
}
|
|
444
|
+
`}function l(t,e){let r=t.attachShadow({mode:"open"}),n=document.createElement("style");return n.textContent=C(e.accent),r.appendChild(n),r}function u(t,e,r){let n=e.dataset.theme||"light",i=e.dataset.size||"default",s=document.createElement("div");return s.className=["wide-widget",r].filter(Boolean).join(" "),s.setAttribute("data-theme",n),s.setAttribute("data-size",i),t.appendChild(s),s}function f(t){t.innerHTML=`
|
|
445
|
+
<div class="wide-loading">
|
|
446
|
+
<span class="wide-spinner"></span>
|
|
447
|
+
Loading\u2026
|
|
448
|
+
</div>
|
|
449
|
+
`}function c(t,e,r){t.innerHTML=`
|
|
450
|
+
<div class="wide-error">
|
|
451
|
+
<p>${e}</p>
|
|
452
|
+
<a href="https://${r.domain}" target="_blank" rel="noopener">
|
|
453
|
+
Visit ${r.name}
|
|
454
|
+
</a>
|
|
455
|
+
</div>
|
|
456
|
+
`}var w='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>',b='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>',E='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',L='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>';function g(t){return`<span class="wide-powered">Powered by <a href="https://${t.domain}" target="_blank" rel="noopener">${t.name}</a></span>`}function k(t,e){t.addEventListener("click",()=>{var r;(r=navigator.clipboard)==null||r.writeText(e).then(()=>{t.innerHTML=`${E} Copied!`,setTimeout(()=>{t.innerHTML=`${b} Copy`},2e3)}).catch(()=>{let n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),t.innerHTML=`${E} Copied!`,setTimeout(()=>{t.innerHTML=`${b} Copy`},2e3)})})}function P(t){let e=t.match(/^(.+?)\s+(\d+):(\d+)$/);if(e)return{book:e[1],chapter:e[2],verse:e[3]};let r=t.match(/^(\d+):(\d+)$/);return r?{book:"",chapter:r[1],verse:r[2]}:null}function U(t,e,r){let n=P(e);if(!n)return"";let i=new URLSearchParams;return n.book&&i.set("book",n.book),i.set("chapter",n.chapter),i.set("verse",n.verse),r&&i.set("translation",r),`${t.apiBase}/verses/?${i.toString()}`}function j(t,e,r,n){let i=r.dataset.size==="compact",s=r.dataset.showOriginal==="true",a=e.reference||r.dataset.ref||"",o=e.translation||n.defaultTranslation,d=e.url||`https://${n.domain}`,p=s&&e.original_text?`<p class="wide-original" lang="${e.original_language||""}">${e.original_text}</p>`:"";t.innerHTML=`
|
|
457
|
+
<div class="wide-ribbon${i?" compact":""}">
|
|
458
|
+
<p class="wide-verse-text${i?" compact":""}">${e.text}</p>
|
|
459
|
+
${p}
|
|
460
|
+
</div>
|
|
461
|
+
<div class="wide-body${i?" compact":""}">
|
|
462
|
+
<div class="wide-meta">
|
|
463
|
+
<span class="wide-ref">${a}</span>
|
|
464
|
+
<span class="wide-badge">${o.toUpperCase()}</span>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
<div class="wide-actions${i?" compact":""}">
|
|
468
|
+
<a class="wide-link" href="${d}" target="_blank" rel="noopener">
|
|
469
|
+
Read on ${n.name} ${w}
|
|
470
|
+
</a>
|
|
471
|
+
<button class="wide-copy-btn" type="button">
|
|
472
|
+
${b} Copy
|
|
473
|
+
</button>
|
|
474
|
+
</div>
|
|
475
|
+
${g(n)}
|
|
476
|
+
`;let m=t.querySelector(".wide-copy-btn");m&&k(m,`${e.text} \u2014 ${a}`)}function S(t,e){let r=l(t,e),n=u(r,t);f(n);let i=t.dataset.ref||"",s=t.dataset.translation||e.defaultTranslation;if(!i){c(n,"Missing data-ref attribute.",e);return}let a=U(e,i,s);if(!a){c(n,`Could not parse reference: "${i}"`,e);return}fetch(a).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}).then(o=>{let d="results"in o&&Array.isArray(o.results)?o.results[0]:o;if(!d||!d.text)throw new Error("No verse found");j(n,d,t,e)}).catch(()=>{c(n,`Could not load "${i}". Visit ${e.name} to read scripture.`,e)})}function N(t){let e=t.match(/^(.+?)\s+(\d+)$/);if(e)return{book:e[1],chapter:e[2]};let r=t.match(/^(\d+)$/);return r?{book:"",chapter:r[1]}:null}function A(t,e){let r=t.split(/\s+/);return r.length<=e?t:r.slice(0,e).join(" ")+"\u2026"}function M(t,e){let r=l(t,e),n=u(r,t);f(n);let i=t.dataset.ref||"";if(!i){c(n,"Missing data-ref attribute.",e);return}let s=N(i);if(!s){c(n,`Could not parse chapter reference: "${i}"`,e);return}let a=s.book?`${e.apiBase}/chapters/${encodeURIComponent(s.book)}/${s.chapter}/`:`${e.apiBase}/chapters/${s.chapter}/`;fetch(a).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}).then(o=>{var v;let d=o.title||o.name||i,p=o.book_name||o.book||"",m=o.summary||o.description||"",y=(v=o.verse_count)!=null?v:Array.isArray(o.verses)?o.verses.length:null,$=o.url||`https://${e.domain}`,x=m?A(m,100):"";n.innerHTML=`
|
|
477
|
+
<div class="wide-body">
|
|
478
|
+
<div class="wide-meta">
|
|
479
|
+
${p?`<span class="wide-badge">${p}</span>`:""}
|
|
480
|
+
${y!=null?`<span class="wide-stat">${y} verses</span>`:""}
|
|
481
|
+
</div>
|
|
482
|
+
<h3 class="wide-title">${d}</h3>
|
|
483
|
+
${x?`<p class="wide-summary">${x}</p>`:""}
|
|
484
|
+
</div>
|
|
485
|
+
<div class="wide-actions">
|
|
486
|
+
<a class="wide-link" href="${$}" target="_blank" rel="noopener">
|
|
487
|
+
Read full chapter on ${e.name} ${w}
|
|
488
|
+
</a>
|
|
489
|
+
</div>
|
|
490
|
+
${g(e)}
|
|
491
|
+
`}).catch(()=>{c(n,`Could not load chapter "${i}". Visit ${e.name} to read scripture.`,e)})}function O(t,e){let r=t.split(/\s+/);return r.length<=e?t:r.slice(0,e).join(" ")+"\u2026"}function H(t,e){let r=l(t,e),n=u(r,t);f(n);let i=t.dataset.slug||"";if(!i){c(n,"Missing data-slug attribute.",e);return}let s=`${e.apiBase}/people/${encodeURIComponent(i)}/`;fetch(s).then(a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()}).then(a=>{var x,v;let o=a.name||a.full_name||i,d=a.era||a.period||"",p=a.bio||a.description||"",m=(v=(x=a.verse_count)!=null?x:a.mentioned_verses)!=null?v:null,y=a.url||`https://${e.domain}/people/${i}/`,$=p?O(p,150):"";n.innerHTML=`
|
|
492
|
+
<div class="wide-person-header">
|
|
493
|
+
<div class="wide-person-icon">${L}</div>
|
|
494
|
+
<div>
|
|
495
|
+
<p class="wide-person-name">${o}</p>
|
|
496
|
+
${d?`<p class="wide-person-era">${d}</p>`:""}
|
|
497
|
+
</div>
|
|
498
|
+
</div>
|
|
499
|
+
<div class="wide-body">
|
|
500
|
+
<div class="wide-meta">
|
|
501
|
+
${m!=null?`<span class="wide-stat">${m} verses</span>`:""}
|
|
502
|
+
</div>
|
|
503
|
+
${$?`<p class="wide-summary">${$}</p>`:""}
|
|
504
|
+
</div>
|
|
505
|
+
<div class="wide-actions">
|
|
506
|
+
<a class="wide-link" href="${y}" target="_blank" rel="noopener">
|
|
507
|
+
Learn more on ${e.name} ${w}
|
|
508
|
+
</a>
|
|
509
|
+
</div>
|
|
510
|
+
${g(e)}
|
|
511
|
+
`}).catch(()=>{c(n,`Could not load "${i}". Visit ${e.name} for biblical figures.`,e)})}function q(t){let e=new URLSearchParams,r=t.match(/^(.+?)\s+(\d+):(\d+)$/);if(r)return e.set("book",r[1]),e.set("chapter",r[2]),e.set("verse",r[3]),e;let n=t.match(/^(\d+):(\d+)$/);return n&&(e.set("chapter",n[1]),e.set("verse",n[2])),e}async function B(t,e){var o,d;let r=q(e),n=`${t.apiBase}/verses/?${r.toString()}`,i=await fetch(n);if(!i.ok)throw new Error(`HTTP ${i.status}`);let s=await i.json(),a=(d=(o=s.results)==null?void 0:o[0])!=null?d:s;if(!(a!=null&&a.text))throw new Error("No verse data");return{text:a.text,reference:a.reference||e,url:a.url}}function V(t,e){let r=l(t,e),n=u(r,t);f(n);let i=t.dataset.a||"",s=t.dataset.b||"";if(!i||!s){c(n,"Missing data-a or data-b attributes.",e);return}Promise.all([B(e,i),B(e,s)]).then(([a,o])=>{let d=`https://${e.domain}/compare/`;n.innerHTML=`
|
|
512
|
+
<div class="wide-compare-grid">
|
|
513
|
+
<div class="wide-compare-col">
|
|
514
|
+
<p class="wide-compare-label">${a.reference}</p>
|
|
515
|
+
<p class="wide-compare-text">${a.text}</p>
|
|
516
|
+
</div>
|
|
517
|
+
<div class="wide-compare-col">
|
|
518
|
+
<p class="wide-compare-label">${o.reference}</p>
|
|
519
|
+
<p class="wide-compare-text">${o.text}</p>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
<div class="wide-actions">
|
|
523
|
+
<a class="wide-link" href="${d}" target="_blank" rel="noopener">
|
|
524
|
+
Compare on ${e.name} ${w}
|
|
525
|
+
</a>
|
|
526
|
+
</div>
|
|
527
|
+
${g(e)}
|
|
528
|
+
`}).catch(()=>{c(n,`Could not load comparison. Visit ${e.name} to compare scripture.`,e)})}var _="wide_votd_";function z(){return new Date().toISOString().slice(0,10)}function G(t){try{let e=`${_}${t}`,r=localStorage.getItem(e);if(!r)return null;let n=JSON.parse(r);return n.date!==z()?(localStorage.removeItem(e),null):n.data}catch(e){return null}}function F(t,e){try{let r=`${_}${t}`;localStorage.setItem(r,JSON.stringify({date:z(),data:e}))}catch(r){}}function D(t,e){let r=l(t,e),n=u(r,t);f(n);let i=t.dataset.size==="compact";function s(o){let d=o.translation||e.defaultTranslation,p=o.url||`https://${e.domain}`;n.innerHTML=`
|
|
529
|
+
<div class="wide-accent-bar"></div>
|
|
530
|
+
<div class="wide-ribbon${i?" compact":""}">
|
|
531
|
+
<p class="wide-verse-text${i?" compact":""}">${o.text}</p>
|
|
532
|
+
</div>
|
|
533
|
+
<div class="wide-body${i?" compact":""}">
|
|
534
|
+
<div class="wide-meta">
|
|
535
|
+
<span class="wide-ref">${o.reference}</span>
|
|
536
|
+
<span class="wide-badge">${d.toUpperCase()}</span>
|
|
537
|
+
<span class="wide-badge">Verse of the Day</span>
|
|
538
|
+
</div>
|
|
539
|
+
</div>
|
|
540
|
+
<div class="wide-actions${i?" compact":""}">
|
|
541
|
+
<a class="wide-link" href="${p}" target="_blank" rel="noopener">
|
|
542
|
+
More at ${e.name} ${w}
|
|
543
|
+
</a>
|
|
544
|
+
<button class="wide-copy-btn" type="button">
|
|
545
|
+
${b} Copy
|
|
546
|
+
</button>
|
|
547
|
+
</div>
|
|
548
|
+
${g(e)}
|
|
549
|
+
`;let m=n.querySelector(".wide-copy-btn");m&&k(m,`${o.text} \u2014 ${o.reference}`)}let a=G(e.site);if(a){s(a);return}fetch(e.votdEndpoint).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.json()}).then(o=>{if(!(o!=null&&o.text))throw new Error("No VOTD data");F(e.site,o),s(o)}).catch(()=>{c(n,`Could not load verse of the day. Visit ${e.name} for daily scripture.`,e)})}function W(t,e){let r=l(t,e),n=u(r,t),i=t.dataset.placeholder||`Search ${e.scriptureLabel}\u2026`;n.innerHTML=`
|
|
550
|
+
<div class="wide-search-wrap">
|
|
551
|
+
<form class="wide-search-form" action="https://${e.domain}${e.searchPath}" method="get" target="_blank">
|
|
552
|
+
<input
|
|
553
|
+
class="wide-search-input"
|
|
554
|
+
type="search"
|
|
555
|
+
name="q"
|
|
556
|
+
placeholder="${i}"
|
|
557
|
+
aria-label="${i}"
|
|
558
|
+
autocomplete="off"
|
|
559
|
+
/>
|
|
560
|
+
<button class="wide-search-btn" type="submit">Search</button>
|
|
561
|
+
</form>
|
|
562
|
+
</div>
|
|
563
|
+
${g(e)}
|
|
564
|
+
`}function T(t,e,r){switch(e){case"verse":S(t,r);break;case"chapter":M(t,r);break;case"person":H(t,r);break;case"compare":V(t,r);break;case"votd":D(t,r);break;case"search":W(t,r);break;default:break}}function R(t){document.querySelectorAll(`[${t.attribute}]`).forEach(r=>{if(r.shadowRoot)return;let n=r.dataset[t.attribute.replace("data-","")];n&&T(r,n,t)})}(function(){let e=h;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>R(e)):R(e),new MutationObserver(n=>{n.forEach(i=>{i.addedNodes.forEach(s=>{var o;if(s.nodeType!==Node.ELEMENT_NODE)return;let a=s;if(a.hasAttribute(e.attribute)&&!a.shadowRoot){let d=a.dataset[e.attribute.replace("data-","")];d&&T(a,d,e)}(o=a.querySelectorAll)==null||o.call(a,`[${e.attribute}]`).forEach(d=>{if(!d.shadowRoot){let p=d.dataset[e.attribute.replace("data-","")];p&&T(d,p,e)}})})})}).observe(document.body||document.documentElement,{childList:!0,subtree:!0})})();})();
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* widebible-embed — TypeScript declarations
|
|
3
|
+
*
|
|
4
|
+
* The embed script is self-executing. Simply import it to activate widgets.
|
|
5
|
+
* All configuration is provided via data-* attributes on DOM elements.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {};
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElement {
|
|
12
|
+
/** Widget type attribute for WideBible */
|
|
13
|
+
dataset: DOMStringMap & {
|
|
14
|
+
'widebible'?: 'verse' | 'chapter' | 'person' | 'compare' | 'votd' | 'search';
|
|
15
|
+
ref?: string;
|
|
16
|
+
slug?: string;
|
|
17
|
+
a?: string;
|
|
18
|
+
b?: string;
|
|
19
|
+
theme?: 'light' | 'dark' | 'sepia';
|
|
20
|
+
size?: 'default' | 'compact';
|
|
21
|
+
translation?: string;
|
|
22
|
+
showOriginal?: 'true' | 'false';
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
lang?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "widebible-embed",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Embed WideBible scripture widgets on any website. Lightweight (~5KB gzipped), zero dependencies, Shadow DOM isolation, 3 themes (light/dark/sepia).",
|
|
5
|
+
"main": "dist/embed.min.js",
|
|
6
|
+
"module": "dist/embed.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"christianity",
|
|
15
|
+
"embed",
|
|
16
|
+
"widget",
|
|
17
|
+
"scripture",
|
|
18
|
+
"widebible",
|
|
19
|
+
"widebible.com",
|
|
20
|
+
"verse",
|
|
21
|
+
"api",
|
|
22
|
+
"shadow-dom",
|
|
23
|
+
"zero-dependencies"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://widget.widebible.com",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/dobestan/widebible-embed"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/dobestan/widebible-embed/issues"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"author": "WideHoly <hello@wideholy.com>",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
|
+
}
|