spec-up-t 1.2.4 → 1.2.6
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/assets/compiled/body.js +11 -8
- package/assets/compiled/head.css +7 -4
- package/assets/css/add-bootstrap-classes-to-images.css +34 -0
- package/assets/css/collapse-definitions.css +41 -0
- package/assets/css/create-pdf.css +339 -0
- package/assets/css/horizontal-scroll-hint.css +6 -0
- package/assets/css/image-full-size.css +40 -0
- package/assets/css/index.css +5 -0
- package/assets/css/search.css +8 -8
- package/assets/css/terms-and-definitions.css +3 -3
- package/assets/js/add-bootstrap-classes-to-images.js +95 -0
- package/assets/js/collapse-definitions.js +259 -34
- package/assets/js/collapse-meta-info.js +37 -10
- package/assets/js/collapsibleMenu.js +0 -24
- package/assets/js/create-alphabet-index.js +11 -2
- package/assets/js/create-term-filter.js +47 -17
- package/assets/js/hide-show-utility-container.js +16 -0
- package/assets/js/horizontal-scroll-hint.js +2 -2
- package/assets/js/image-full-size.js +74 -0
- package/assets/js/insert-trefs.js +135 -49
- package/assets/js/search.js +46 -20
- package/{src → config}/asset-map.json +6 -0
- package/{src/config → config}/paths.js +2 -2
- package/gulpfile.js +1 -1
- package/index.js +5 -5
- package/package.json +1 -1
- package/src/README.md +3 -3
- package/src/collect-external-references.js +2 -2
- package/src/collectExternalReferences/fetchTermsFromIndex.1.js +340 -0
- package/src/collectExternalReferences/fetchTermsFromIndex.js +1 -1
- package/src/collectExternalReferences/processXTrefsData.js +1 -1
- package/src/create-pdf.js +330 -21
- package/src/create-term-index.js +126 -22
- package/src/health-check/tref-term-checker.js +1 -1
- package/src/health-check.js +1 -1
- package/src/init.js +1 -1
- package/src/insert-term-index.js +5 -5
- package/src/install-from-boilerplate/add-scripts-keys.js +3 -1
- package/src/install-from-boilerplate/boilerplate/gitignore +1 -1
- package/src/markdown-it-extensions.js +2 -2
- package/src/utils/fetch.js +14 -14
- package/assets/css/pdf-styles.css +0 -170
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/* PDF Styling for optimized print layout */
|
|
2
|
+
/* Target the pdf-document class that's added during PDF generation */
|
|
3
|
+
|
|
4
|
+
/* ===== GENERAL LAYOUT STYLING ===== */
|
|
5
|
+
.pdf-document * {
|
|
6
|
+
box-sizing: border-box !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Basic layout settings */
|
|
10
|
+
body.pdf-document {
|
|
11
|
+
max-width: 100% !important;
|
|
12
|
+
width: 100% !important;
|
|
13
|
+
margin: 0 !important;
|
|
14
|
+
padding: 0 !important;
|
|
15
|
+
overflow-x: hidden !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Content container sizing */
|
|
19
|
+
.pdf-document .container,
|
|
20
|
+
.pdf-document main,
|
|
21
|
+
.pdf-document section,
|
|
22
|
+
.pdf-document article,
|
|
23
|
+
.pdf-document .content,
|
|
24
|
+
.pdf-document div[class*="container"],
|
|
25
|
+
.pdf-document div[class*="col-"],
|
|
26
|
+
.pdf-document .row,
|
|
27
|
+
.pdf-document .container-sm,
|
|
28
|
+
.pdf-document .container-md,
|
|
29
|
+
.pdf-document .container-lg,
|
|
30
|
+
.pdf-document .container-xl {
|
|
31
|
+
max-width: 95% !important;
|
|
32
|
+
width: 95% !important;
|
|
33
|
+
margin-left: auto !important;
|
|
34
|
+
margin-right: auto !important;
|
|
35
|
+
padding-left: 0 !important;
|
|
36
|
+
padding-right: 0 !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Force columns to full width */
|
|
40
|
+
.pdf-document .col,
|
|
41
|
+
.pdf-document [class*="col-"] {
|
|
42
|
+
flex: 0 0 100% !important;
|
|
43
|
+
max-width: 100% !important;
|
|
44
|
+
padding: 0 !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ===== COMMON ELEMENT STYLING ===== */
|
|
48
|
+
|
|
49
|
+
/* Basic styling for tables */
|
|
50
|
+
.pdf-document table {
|
|
51
|
+
width: 100% !important;
|
|
52
|
+
max-width: 100% !important;
|
|
53
|
+
margin-bottom: 1rem;
|
|
54
|
+
table-layout: fixed !important;
|
|
55
|
+
page-break-inside: avoid !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Title styling */
|
|
59
|
+
.pdf-document .pdf-title {
|
|
60
|
+
font-size: 24pt !important;
|
|
61
|
+
margin-bottom: 0.5rem !important;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Consistent image handling */
|
|
65
|
+
.pdf-document img {
|
|
66
|
+
max-width: 100% !important;
|
|
67
|
+
height: auto !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Links in PDF */
|
|
71
|
+
.pdf-document a {
|
|
72
|
+
color: #000 !important;
|
|
73
|
+
text-decoration: none !important;
|
|
74
|
+
border-bottom: none !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Code blocks */
|
|
78
|
+
.pdf-document pre,
|
|
79
|
+
.pdf-document code {
|
|
80
|
+
white-space: pre-wrap !important;
|
|
81
|
+
word-break: break-word !important;
|
|
82
|
+
max-width: 100% !important;
|
|
83
|
+
overflow: visible !important;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Page break control */
|
|
87
|
+
.pdf-document h1,
|
|
88
|
+
.pdf-document h2,
|
|
89
|
+
.pdf-document h3,
|
|
90
|
+
.pdf-document h4 {
|
|
91
|
+
page-break-after: avoid !important;
|
|
92
|
+
page-break-inside: avoid !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.pdf-document figure {
|
|
96
|
+
page-break-inside: avoid !important;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Make fixed elements static for PDF */
|
|
100
|
+
.pdf-document .fixed-top,
|
|
101
|
+
.pdf-document .fixed-bottom,
|
|
102
|
+
.pdf-document .sticky-top,
|
|
103
|
+
.pdf-document .position-fixed,
|
|
104
|
+
.pdf-document .position-sticky {
|
|
105
|
+
position: static !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Hide elements not needed in PDF */
|
|
109
|
+
.pdf-document .offcanvas.show,
|
|
110
|
+
.pdf-document .meta-info-toggle-button {
|
|
111
|
+
display: none !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ===== TABLE OF CONTENTS STYLING ===== */
|
|
115
|
+
.pdf-document #toc,
|
|
116
|
+
.pdf-document #pdf-toc {
|
|
117
|
+
break-before: page !important;
|
|
118
|
+
page-break-before: always !important;
|
|
119
|
+
padding: 2rem 0 1rem !important;
|
|
120
|
+
margin-bottom: 2rem !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Content after TOC starts on new page */
|
|
124
|
+
.pdf-document #toc + *,
|
|
125
|
+
.pdf-document #pdf-toc + * {
|
|
126
|
+
break-before: page !important;
|
|
127
|
+
page-break-before: always !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* TOC header */
|
|
131
|
+
.pdf-document #toc h2,
|
|
132
|
+
.pdf-document #pdf-toc h2 {
|
|
133
|
+
font-size: 24pt !important;
|
|
134
|
+
text-align: center !important;
|
|
135
|
+
margin-bottom: 1.5rem !important;
|
|
136
|
+
font-weight: bold !important;
|
|
137
|
+
border-bottom: 1px solid #000 !important;
|
|
138
|
+
padding-bottom: 0.5rem !important;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* TOC list basics */
|
|
142
|
+
.pdf-document #toc ul,
|
|
143
|
+
.pdf-document #pdf-toc ul {
|
|
144
|
+
margin: 0 !important;
|
|
145
|
+
padding: 0 !important;
|
|
146
|
+
list-style-type: none !important;
|
|
147
|
+
width: 100% !important;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* TOC nested lists */
|
|
151
|
+
.pdf-document #toc ul ul,
|
|
152
|
+
.pdf-document #pdf-toc ul ul {
|
|
153
|
+
padding-left: 1rem !important;
|
|
154
|
+
margin: 0.2rem 0 0.2rem 1rem !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* TOC list items */
|
|
158
|
+
.pdf-document #toc li,
|
|
159
|
+
.pdf-document #pdf-toc li {
|
|
160
|
+
position: relative !important;
|
|
161
|
+
width: 100% !important;
|
|
162
|
+
margin: 0 0 0.5rem 0 !important;
|
|
163
|
+
padding: 0 20px 0 0 !important;
|
|
164
|
+
line-height: 1.5 !important;
|
|
165
|
+
display: flex !important;
|
|
166
|
+
align-items: baseline !important;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* TOC list styles for different levels */
|
|
170
|
+
.pdf-document #toc > ul > li,
|
|
171
|
+
.pdf-document #pdf-toc > ul > li {
|
|
172
|
+
font-weight: bold !important;
|
|
173
|
+
margin-bottom: 0.7rem !important;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.pdf-document #toc > ul > li > ul > li,
|
|
177
|
+
.pdf-document #pdf-toc > ul > li > ul > li {
|
|
178
|
+
font-weight: normal !important;
|
|
179
|
+
margin-bottom: 0.5rem !important;
|
|
180
|
+
margin-left: 0.5rem !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.pdf-document #toc > ul > li > ul > li > ul > li,
|
|
184
|
+
.pdf-document #pdf-toc > ul > li > ul > li > ul > li {
|
|
185
|
+
font-style: italic !important;
|
|
186
|
+
margin-bottom: 0.3rem !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* TOC items with nested lists */
|
|
190
|
+
.pdf-document #toc li:has(> ul),
|
|
191
|
+
.pdf-document #pdf-toc li:has(> ul) {
|
|
192
|
+
flex-direction: column !important;
|
|
193
|
+
align-items: flex-start !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.pdf-document #toc li:has(> ul) > ul,
|
|
197
|
+
.pdf-document #pdf-toc li:has(> ul) > ul {
|
|
198
|
+
margin-top: 0.3rem !important;
|
|
199
|
+
width: 100% !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* TOC link styling */
|
|
203
|
+
.pdf-document #toc ul li a,
|
|
204
|
+
.pdf-document #pdf-toc ul li a,
|
|
205
|
+
.pdf-document #pdf-toc .toc-title {
|
|
206
|
+
color: #000 !important;
|
|
207
|
+
text-decoration: none !important;
|
|
208
|
+
font-weight: normal !important;
|
|
209
|
+
white-space: nowrap !important;
|
|
210
|
+
overflow: hidden !important;
|
|
211
|
+
text-overflow: ellipsis !important;
|
|
212
|
+
max-width: 80% !important;
|
|
213
|
+
border-bottom: none !important;
|
|
214
|
+
background-color: transparent !important;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Dotted leader line */
|
|
218
|
+
.pdf-document #toc ul li .dotted-leader,
|
|
219
|
+
.pdf-document #pdf-toc ul li .dotted-leader,
|
|
220
|
+
.pdf-document #pdf-toc .toc-leader {
|
|
221
|
+
flex-grow: 1 !important;
|
|
222
|
+
border-bottom: 1px dotted #aaa !important;
|
|
223
|
+
margin: 0 0.3rem !important;
|
|
224
|
+
position: relative !important;
|
|
225
|
+
bottom: 0.3rem !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* TOC row layout */
|
|
229
|
+
.pdf-document #pdf-toc .toc-row {
|
|
230
|
+
display: flex !important;
|
|
231
|
+
width: 100% !important;
|
|
232
|
+
align-items: baseline !important;
|
|
233
|
+
position: relative !important;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* ===== PAGE NUMBER STYLING ===== */
|
|
237
|
+
/* Page margin for right side numbers */
|
|
238
|
+
@page {
|
|
239
|
+
margin-right: 25mm !important;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Page number styling - simplified and consolidated */
|
|
243
|
+
.pdf-document .page-number,
|
|
244
|
+
.pdf-document #pdf-toc .toc-page-number,
|
|
245
|
+
.pdf-document #toc ul li span.page-number,
|
|
246
|
+
.pdf-document #pdf-toc ul li span.page-number {
|
|
247
|
+
display: inline-block !important;
|
|
248
|
+
text-align: right !important;
|
|
249
|
+
font-size: 11pt !important;
|
|
250
|
+
background-color: white !important;
|
|
251
|
+
padding: 0 4px !important;
|
|
252
|
+
margin: 0 !important;
|
|
253
|
+
min-width: 2rem !important;
|
|
254
|
+
white-space: nowrap !important;
|
|
255
|
+
font-weight: normal !important;
|
|
256
|
+
z-index: 9999 !important;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* Page number positioning */
|
|
260
|
+
.pdf-document #pdf-toc ul li > div:last-child,
|
|
261
|
+
.pdf-document #toc ul li > div:last-child {
|
|
262
|
+
position: absolute !important;
|
|
263
|
+
right: 0 !important;
|
|
264
|
+
background-color: white !important;
|
|
265
|
+
padding: 0 5px !important;
|
|
266
|
+
z-index: 100 !important;
|
|
267
|
+
width: 3rem !important;
|
|
268
|
+
min-width: 3rem !important;
|
|
269
|
+
max-width: 3rem !important;
|
|
270
|
+
flex-shrink: 0 !important;
|
|
271
|
+
margin-left: auto !important;
|
|
272
|
+
text-align: right !important;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* ===== DEFINITION LIST STYLING ===== */
|
|
276
|
+
/* Clean definition list styling */
|
|
277
|
+
.pdf-document dl.terms-and-definitions-list > dt,
|
|
278
|
+
.pdf-document dl.terms-and-definitions-list > dd {
|
|
279
|
+
background-color: transparent !important;
|
|
280
|
+
border: none !important;
|
|
281
|
+
border-radius: 0 !important;
|
|
282
|
+
padding: 0.5rem 0 !important;
|
|
283
|
+
color: #000 !important;
|
|
284
|
+
page-break-inside: avoid !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.pdf-document dl.terms-and-definitions-list > dt {
|
|
288
|
+
margin-top: 1em !important;
|
|
289
|
+
font-weight: bold !important;
|
|
290
|
+
page-break-after: avoid !important;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Always show definitions content in PDF */
|
|
294
|
+
.pdf-document dl > dd.meta-info-content-wrapper,
|
|
295
|
+
.pdf-document dl > dd.collapsed.meta-info-content-wrapper {
|
|
296
|
+
display: block !important;
|
|
297
|
+
max-height: none !important;
|
|
298
|
+
height: auto !important;
|
|
299
|
+
overflow: visible !important;
|
|
300
|
+
padding: 0.5rem 0 !important;
|
|
301
|
+
margin: 0 !important;
|
|
302
|
+
line-height: normal !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* Clean styling for transclusion */
|
|
306
|
+
.pdf-document dt.transcluded-xref-term,
|
|
307
|
+
.pdf-document dd.transcluded-xref-term {
|
|
308
|
+
background: transparent !important;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* Remove unwanted elements */
|
|
312
|
+
.pdf-document dl.terms-and-definitions-list > dt::before,
|
|
313
|
+
.pdf-document dl.terms-and-definitions-list > dd::before {
|
|
314
|
+
display: none !important;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Definition paragraphs */
|
|
318
|
+
.pdf-document dl.terms-and-definitions-list dd p {
|
|
319
|
+
padding-left: 0 !important;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/* Definition tables */
|
|
323
|
+
.pdf-document dl.terms-and-definitions-list dd table {
|
|
324
|
+
margin: 0.5em 0 !important;
|
|
325
|
+
border-collapse: collapse !important;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.pdf-document dl.terms-and-definitions-list dd table th,
|
|
329
|
+
.pdf-document dl.terms-and-definitions-list dd table td {
|
|
330
|
+
border: 0.5pt solid #888 !important;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file CSS for full-size image display
|
|
3
|
+
* @author Kor Dwarshuis
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* Container that holds the full-size image */
|
|
8
|
+
.image-container-full-page {
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
background-color: rgba(0, 0, 0, 0.9);
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
z-index: 10000;
|
|
19
|
+
padding: 20px;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
cursor: zoom-out;
|
|
22
|
+
animation: fadeIn 0.3s ease-in-out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Style for the image inside the container */
|
|
26
|
+
.image-container-full-page img {
|
|
27
|
+
max-width: 90%;
|
|
28
|
+
max-height: 90%;
|
|
29
|
+
object-fit: contain;
|
|
30
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes fadeIn {
|
|
34
|
+
from {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
}
|
|
37
|
+
to {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
package/assets/css/index.css
CHANGED
|
@@ -11,6 +11,11 @@ body:not([hashscroll]) dt:has(:target) {
|
|
|
11
11
|
animation: highlight-target-parent-dt 3.5s 0.25s ease;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
dl.terms-and-definitions-list>.highlight {
|
|
15
|
+
background-color: yellow !important;
|
|
16
|
+
transition: background-color 0.3s ease-in-out;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
svg[icon] {
|
|
15
20
|
width: 1.25em;
|
|
16
21
|
height: 1.25em;
|
package/assets/css/search.css
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/* Basic styles */
|
|
11
|
-
.highlight-matches-search
|
|
11
|
+
.highlight-matches-search {
|
|
12
12
|
font-size: 1em;
|
|
13
13
|
outline: 3px solid #1d6dae39;
|
|
14
14
|
outline-offset: 5px;
|
|
@@ -17,33 +17,33 @@
|
|
|
17
17
|
transition: outline 0.3s ease-in-out;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.highlight-matches-search
|
|
20
|
+
.highlight-matches-search.active {
|
|
21
21
|
outline: 3px solid #1d6dae;
|
|
22
22
|
/* Works in tandem with the setTimeout in JS: */
|
|
23
23
|
transition: outline 0.3s ease-in-out;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/* Specific styles */
|
|
27
|
-
.highlight-matches-DIF-search
|
|
27
|
+
.highlight-matches-DIF-search {
|
|
28
28
|
background-color: #1d6dae11;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.highlight-matches-ToIP-search
|
|
31
|
+
.highlight-matches-ToIP-search {
|
|
32
32
|
background-color: #a9dde0b0;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.highlight-matches-BTC-search
|
|
35
|
+
.highlight-matches-BTC-search {
|
|
36
36
|
background-color: #f19019a1;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.highlight-matches-KERI-search
|
|
39
|
+
.highlight-matches-KERI-search {
|
|
40
40
|
background-color: #b5d070d5;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
.highlight-matches-SSI-search
|
|
43
|
+
.highlight-matches-SSI-search {
|
|
44
44
|
background-color: yellow;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.highlight-matches-GLEIF-search
|
|
47
|
+
.highlight-matches-GLEIF-search {
|
|
48
48
|
background-color: #52dac6a6;
|
|
49
49
|
}
|
|
@@ -231,9 +231,9 @@ html.dense-info dl.terms-and-definitions-list>dt>span {
|
|
|
231
231
|
position: relative;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
dt.transcluded-xref-term,
|
|
235
|
-
dd.transcluded-xref-term {
|
|
236
|
-
background: #a9dde03b
|
|
234
|
+
dl.terms-and-definitions-list>dt.transcluded-xref-term,
|
|
235
|
+
dl.terms-and-definitions-list>dd.transcluded-xref-term {
|
|
236
|
+
background: #a9dde03b;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/* Fix for all buttons */
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file adds Bootstrap classes to images for better responsiveness and styling.
|
|
3
|
+
* @author Kor Dwarshuis
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Function to add Bootstrap classes to images for better responsiveness
|
|
9
|
+
*/
|
|
10
|
+
function addBootstrapClassesToImages() {
|
|
11
|
+
const images = document.querySelectorAll('#content img');
|
|
12
|
+
images.forEach(image => {
|
|
13
|
+
// Add Bootstrap responsive image class
|
|
14
|
+
image.classList.add('img-fluid');
|
|
15
|
+
|
|
16
|
+
// Optional: Add rounded corners
|
|
17
|
+
image.classList.add('rounded');
|
|
18
|
+
|
|
19
|
+
// Optional: Add subtle shadow for better appearance
|
|
20
|
+
image.classList.add('shadow-sm');
|
|
21
|
+
|
|
22
|
+
// Add appropriate margins
|
|
23
|
+
image.classList.add('my-3');
|
|
24
|
+
|
|
25
|
+
// Create a figure element for images that are not already in one
|
|
26
|
+
if (!image.closest('figure') && !image.parentElement.classList.contains('image-container')) {
|
|
27
|
+
// Check if not already wrapped
|
|
28
|
+
const figure = document.createElement('figure');
|
|
29
|
+
figure.classList.add('figure', 'text-center');
|
|
30
|
+
|
|
31
|
+
// Get the original parent and replace the image with the figure
|
|
32
|
+
const parent = image.parentElement;
|
|
33
|
+
parent.replaceChild(figure, image);
|
|
34
|
+
|
|
35
|
+
// Add the image to the figure
|
|
36
|
+
figure.appendChild(image);
|
|
37
|
+
|
|
38
|
+
// If the image has an alt text, create a caption
|
|
39
|
+
if (image.alt && image.alt.trim() !== '') {
|
|
40
|
+
const figcaption = document.createElement('figcaption');
|
|
41
|
+
figcaption.classList.add('figure-caption', 'text-center');
|
|
42
|
+
figcaption.textContent = image.alt;
|
|
43
|
+
figure.appendChild(figcaption);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initialize the image enhancement with Bootstrap classes
|
|
51
|
+
*/
|
|
52
|
+
function initImageBootstrapClasses() {
|
|
53
|
+
const markdownElement = document.querySelector('#content');
|
|
54
|
+
|
|
55
|
+
if (markdownElement) {
|
|
56
|
+
// Initialize bootstrap classes for all existing images
|
|
57
|
+
addBootstrapClassesToImages();
|
|
58
|
+
|
|
59
|
+
// Add a mutation observer to detect dynamically added images
|
|
60
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
61
|
+
const observer = new MutationObserver((mutations) => {
|
|
62
|
+
let shouldUpdate = false;
|
|
63
|
+
|
|
64
|
+
mutations.forEach(mutation => {
|
|
65
|
+
// Check if new nodes were added
|
|
66
|
+
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
|
|
67
|
+
// Look for added images
|
|
68
|
+
mutation.addedNodes.forEach(node => {
|
|
69
|
+
if (node.nodeType === 1) { // Element node
|
|
70
|
+
// Check if node is an image or contains images
|
|
71
|
+
shouldUpdate = node.tagName === 'IMG' || node.querySelector?.('img');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (shouldUpdate) {
|
|
78
|
+
// Apply Bootstrap classes to newly added images
|
|
79
|
+
addBootstrapClassesToImages();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Start observing content changes
|
|
84
|
+
observer.observe(markdownElement, {
|
|
85
|
+
childList: true,
|
|
86
|
+
subtree: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Run when the DOM is fully loaded
|
|
93
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
94
|
+
initImageBootstrapClasses();
|
|
95
|
+
});
|