spec-up-t 1.1.55 → 1.2.1
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 +59 -8
- package/assets/compiled/head.css +13 -12
- package/assets/css/adjust-font-size.css +11 -0
- package/assets/css/collapse-meta-info.css +27 -8
- package/assets/css/create-term-filter.css +11 -0
- package/assets/css/index.css +15 -0
- package/assets/css/prism.css +176 -153
- package/assets/css/prism.dark.css +157 -0
- package/assets/css/prism.default.css +180 -0
- package/assets/css/terms-and-definitions.1.css +223 -0
- package/assets/css/terms-and-definitions.css +214 -100
- package/assets/js/addAnchorsToTerms.js +1 -1
- package/assets/js/collapse-definitions.js +2 -1
- package/assets/js/collapse-meta-info.js +25 -11
- package/assets/js/create-term-filter.js +61 -0
- package/assets/js/horizontal-scroll-hint.js +159 -0
- package/assets/js/index.1.js +137 -0
- package/assets/js/index.js +2 -1
- package/assets/js/insert-trefs.js +122 -116
- package/assets/js/insert-xrefs.1.js +372 -0
- package/assets/js/{show-commit-hashes.js → insert-xrefs.js} +67 -7
- package/assets/js/prism.dark.js +24 -0
- package/assets/js/prism.default.js +23 -0
- package/assets/js/prism.js +4 -5
- package/assets/js/search.js +1 -1
- package/assets/js/toggle-dense-info.js +40 -0
- package/branches.md +4 -24
- package/index.js +429 -190
- package/index.new.js +662 -0
- package/package.json +1 -2
- package/src/asset-map.json +9 -5
- package/src/collect-external-references.js +16 -9
- package/src/collectExternalReferences/fetchTermsFromIndex.js +328 -0
- package/src/collectExternalReferences/processXTrefsData.js +73 -18
- package/src/create-pdf.js +385 -89
- package/src/health-check/term-references-checker.js +3 -2
- package/src/health-check/tref-term-checker.js +18 -17
- package/src/markdown-it-extensions.js +134 -103
- package/src/prepare-tref.js +61 -24
- package/src/utils/fetch.js +100 -0
- package/templates/template.html +12 -7
- package/assets/js/css-helper.js +0 -30
- package/src/collectExternalReferences/fetchTermsFromGitHubRepository.js +0 -232
- package/src/collectExternalReferences/fetchTermsFromGitHubRepository.test.js +0 -385
- package/src/collectExternalReferences/octokitClient.js +0 -96
|
@@ -1,26 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Terms and Definitions Styling
|
|
3
|
+
* Organized by component and functionality
|
|
4
|
+
*/
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
/* ====== GENERAL HEADING STYLES ====== */
|
|
7
|
+
h2,
|
|
8
|
+
h3,
|
|
9
|
+
h4,
|
|
10
|
+
h5,
|
|
11
|
+
h6 {
|
|
12
|
+
margin-top: 1.5em !important;
|
|
4
13
|
}
|
|
5
14
|
|
|
6
|
-
|
|
7
|
-
/* START The “#” before every term that serves as an anchor */
|
|
8
|
-
.toc-anchor {
|
|
9
|
-
font-size: 0.875em;
|
|
10
|
-
color: inherit;
|
|
11
|
-
text-decoration: none;
|
|
12
|
-
/* opacity: 0.35; */
|
|
13
|
-
color: #73c2df;
|
|
14
|
-
transition: opacity 0.3s ease;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.toc-anchor:hover {
|
|
18
|
-
opacity: 1;
|
|
19
|
-
}
|
|
20
|
-
/* END */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* Terminology Section Utility Container */
|
|
15
|
+
/* ====== TERMINOLOGY SECTION CONTAINER ====== */
|
|
24
16
|
#terminology-section-utility-container {
|
|
25
17
|
display: flex;
|
|
26
18
|
flex-wrap: wrap;
|
|
@@ -30,135 +22,257 @@ h2,h3,h4,h5,h6 {
|
|
|
30
22
|
width: 100%;
|
|
31
23
|
}
|
|
32
24
|
|
|
33
|
-
/* Small devices (landscape phones, 576px and up) */
|
|
34
25
|
@media (min-width: 576px) {
|
|
35
26
|
#terminology-section-utility-container {
|
|
36
27
|
position: sticky;
|
|
37
28
|
top: 3.5em;
|
|
29
|
+
z-index: 10; /* Higher z-index to ensure it stays on top */
|
|
38
30
|
}
|
|
39
31
|
}
|
|
40
|
-
/* End Terminology Section Utility Container */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/* Transclusions */
|
|
44
|
-
.transcluded-xref-term {
|
|
45
|
-
background: #a9dde03b !important;
|
|
46
|
-
padding: 0.5em;
|
|
47
|
-
margin: 1em 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.transclusion-heading {
|
|
51
|
-
font-size: 1.3em;
|
|
52
|
-
font-weight: bold;
|
|
53
|
-
margin: 1em 0 0.5em;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
dl.terms-and-definitions-list>dd.transcluded-xref-term-embedded {
|
|
57
|
-
background-image: linear-gradient(45deg,
|
|
58
|
-
hsl(190deg 60% 95%) 0%,
|
|
59
|
-
hsl(189deg 60% 93%) 8%,
|
|
60
|
-
hsl(189deg 60% 91%) 17%,
|
|
61
|
-
hsl(188deg 60% 89%) 25%,
|
|
62
|
-
hsl(188deg 60% 87%) 33%,
|
|
63
|
-
hsl(187deg 60% 85%) 42%,
|
|
64
|
-
hsl(186deg 60% 83%) 50%,
|
|
65
|
-
hsl(190deg 60% 83%) 58%,
|
|
66
|
-
hsl(193deg 60% 83%) 67%,
|
|
67
|
-
hsl(197deg 60% 83%) 75%,
|
|
68
|
-
hsl(202deg 60% 83%) 83%,
|
|
69
|
-
hsl(207deg 60% 83%) 92%,
|
|
70
|
-
hsl(212deg 60% 83%) 100%) !important;
|
|
71
|
-
|
|
72
|
-
}
|
|
73
32
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/* Start No xref found */
|
|
82
|
-
.btn,
|
|
83
|
-
.no-xref-found-message {
|
|
84
|
-
font-variant: small-caps;
|
|
85
|
-
text-transform: uppercase;
|
|
33
|
+
/* ====== ANCHOR LINKS ====== */
|
|
34
|
+
.toc-anchor {
|
|
35
|
+
font-size: 0.875em;
|
|
36
|
+
color: #73c2df;
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
transition: opacity 0.3s ease;
|
|
86
39
|
}
|
|
87
40
|
|
|
88
|
-
.
|
|
89
|
-
|
|
90
|
-
color: #03365f !important;
|
|
91
|
-
margin: 0 0.5em;
|
|
92
|
-
padding: 0 0.8em;
|
|
93
|
-
border-radius: 0.25rem;
|
|
94
|
-
font-size: 0.8rem;
|
|
41
|
+
.toc-anchor:hover {
|
|
42
|
+
opacity: 1;
|
|
95
43
|
}
|
|
96
|
-
/* End No xref found */
|
|
97
44
|
|
|
98
|
-
/*
|
|
45
|
+
/* ====== DEFINITION LIST STYLING (BOOTSTRAP CARD STYLE) ====== */
|
|
99
46
|
dl.terms-and-definitions-list {
|
|
100
47
|
margin: 0;
|
|
101
48
|
padding: 0;
|
|
49
|
+
position: relative;
|
|
50
|
+
z-index: 1; /* Set a baseline z-index for the whole list */
|
|
102
51
|
}
|
|
103
52
|
|
|
104
|
-
|
|
53
|
+
/* ====== DEFAULT STYLING ====== */
|
|
54
|
+
/* Term styling (dt) */
|
|
55
|
+
dl.terms-and-definitions-list > dt {
|
|
105
56
|
font-weight: 700;
|
|
106
|
-
/* Bootstrap uses 700 for bold */
|
|
107
57
|
margin: 0;
|
|
108
58
|
background-color: var(--card-bg-dt);
|
|
109
59
|
border: 1px solid var(--card-border);
|
|
110
|
-
padding: 0.
|
|
111
|
-
/* Bootstrap card-header padding */
|
|
60
|
+
padding: 0.5rem 1.25rem; /* Increased vertical padding for better readability */
|
|
112
61
|
border-radius: 0.375rem 0.375rem 0 0;
|
|
113
|
-
/* Bootstrap default border-radius */
|
|
114
62
|
box-shadow: 0 0.125rem 0.25rem var(--card-shadow);
|
|
115
63
|
color: var(--card-text);
|
|
64
|
+
position: relative; /* Position relative for stacking */
|
|
65
|
+
line-height: 1.5; /* Improve line spacing */
|
|
66
|
+
font-size: 1.05em; /* Slightly larger font for better hierarchy */
|
|
67
|
+
align-items: center; /* Vertically center the content */
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* This adds spacing between the term text and the buttons */
|
|
71
|
+
dl.terms-and-definitions-list > dt > span {
|
|
72
|
+
margin-right: 1.5em; /* Add spacing to the right of the term text */
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/* Increase the size for all buttons in definition terms */
|
|
77
|
+
dl.terms-and-definitions-list > dt .btn {
|
|
78
|
+
font-size: 1.2em !important; /* Increase button size */
|
|
116
79
|
}
|
|
117
80
|
|
|
118
|
-
dl.terms-and-definitions-list>
|
|
81
|
+
dl.terms-and-definitions-list > dt:hover {
|
|
82
|
+
background-color: var(--card-hover-bg);
|
|
83
|
+
transition: background-color 0.2s ease-in-out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Add a subtle indicator to each term */
|
|
87
|
+
dl.terms-and-definitions-list > dt::before {
|
|
88
|
+
content: "";
|
|
89
|
+
width: 4px;
|
|
90
|
+
height: 70%;
|
|
91
|
+
background-color: #73c2df;
|
|
92
|
+
position: absolute;
|
|
93
|
+
left: 0;
|
|
94
|
+
border-radius: 0 2px 2px 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Definition styling (dd) - using the original simpler styling */
|
|
98
|
+
dl.terms-and-definitions-list > dd {
|
|
119
99
|
margin: 0;
|
|
120
100
|
background-color: var(--card-bg);
|
|
121
101
|
border: 1px solid var(--card-border);
|
|
122
102
|
border-top: none;
|
|
123
|
-
padding:
|
|
103
|
+
padding: 0.75rem 2rem;
|
|
124
104
|
color: var(--card-text);
|
|
125
|
-
overflow: scroll;
|
|
126
105
|
width: 100%;
|
|
106
|
+
position: relative;
|
|
127
107
|
}
|
|
128
108
|
|
|
129
|
-
/* Style paragraphs inside dd */
|
|
109
|
+
/* Style paragraphs inside dd - using original styling */
|
|
130
110
|
dl.terms-and-definitions-list dd p {
|
|
131
|
-
margin: 0;
|
|
111
|
+
margin: 0; /* Original margin for paragraphs */
|
|
132
112
|
color: var(--card-text);
|
|
113
|
+
padding-left: 0.5rem;
|
|
133
114
|
}
|
|
134
115
|
|
|
135
|
-
/* Remove
|
|
136
|
-
dl.terms-and-definitions-list
|
|
116
|
+
/* Remove the blue line indicator for dd */
|
|
117
|
+
dl.terms-and-definitions-list > dd::before {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Improve table styling in definitions */
|
|
122
|
+
dl.terms-and-definitions-list dd table {
|
|
123
|
+
margin: 1em 0;
|
|
124
|
+
width: 100%;
|
|
125
|
+
border-collapse: collapse;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
dl.terms-and-definitions-list dd table th,
|
|
129
|
+
dl.terms-and-definitions-list dd table td {
|
|
130
|
+
padding: 0.5em;
|
|
131
|
+
border: 1px solid #ddd;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
dl.terms-and-definitions-list dd table th {
|
|
135
|
+
background-color: #f5f5f5;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Borders and spacing between elements */
|
|
139
|
+
dl.terms-and-definitions-list dt + dd {
|
|
137
140
|
border-bottom: none;
|
|
138
141
|
}
|
|
139
|
-
|
|
142
|
+
|
|
143
|
+
dl.terms-and-definitions-list dd + dd {
|
|
140
144
|
border-top: none;
|
|
141
145
|
border-bottom: none;
|
|
142
146
|
}
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
margin-top: 1.5rem;
|
|
147
|
-
/* Bootstrap-like spacing between cards */
|
|
148
|
+
dl.terms-and-definitions-list dd + dt {
|
|
149
|
+
margin-top: 0.5rem;
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
/*
|
|
152
|
+
/* Last definition in a group */
|
|
151
153
|
dl.terms-and-definitions-list dd.last-dd {
|
|
152
154
|
border-radius: 0 0 0.375rem 0.375rem;
|
|
153
|
-
/* Rounded bottom corners */
|
|
154
155
|
border-bottom: 1px solid var(--card-border);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
/*
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/*
|
|
158
|
+
/* ====== DENSE INFO STYLING ====== */
|
|
159
|
+
/* Apply original, more condensed styling when the html element has class "dense-info" */
|
|
160
|
+
html.dense-info dl.terms-and-definitions-list > dt {
|
|
161
|
+
padding: 0.1rem 1.25rem;
|
|
162
|
+
display: block; /* Revert from flexbox to block */
|
|
163
|
+
line-height: inherit;
|
|
164
|
+
font-size: inherit;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
html.dense-info dl.terms-and-definitions-list > dt::before {
|
|
168
|
+
display: none; /* Remove the blue indicator bar */
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
html.dense-info dl.terms-and-definitions-list > dt > span {
|
|
172
|
+
margin-right: 0; /* Remove spacing for term text */
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* No need to change dd styling in dense-info mode since it's already using the original styling */
|
|
176
|
+
html.dense-info dl.terms-and-definitions-list > dd {
|
|
177
|
+
padding: 0.75rem 1.25rem;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* ====== TRANSCLUSIONS STYLING ====== */
|
|
181
|
+
/* Base transclusion styles */
|
|
182
|
+
.transcluded-xref-term {
|
|
183
|
+
position: relative;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
dt.transcluded-xref-term,
|
|
187
|
+
dd.transcluded-xref-term {
|
|
188
|
+
background: #a9dde03b !important;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Fix for all buttons */
|
|
192
|
+
.btn {
|
|
193
|
+
font-variant: small-caps;
|
|
194
|
+
text-transform: uppercase;
|
|
195
|
+
position: relative;
|
|
196
|
+
z-index: 5; /* Higher z-index for all buttons */
|
|
162
197
|
}
|
|
163
198
|
|
|
164
|
-
|
|
199
|
+
.collapse-all-defs-button {
|
|
200
|
+
float: right;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.transclusion-heading {
|
|
204
|
+
font-size: 1.3em;
|
|
205
|
+
font-weight: bold;
|
|
206
|
+
margin: 1em 0 0.5em;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Embedded transclusions in definition lists */
|
|
210
|
+
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded {
|
|
211
|
+
position: relative;
|
|
212
|
+
padding-left: 2.5rem;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded::before {
|
|
216
|
+
content: "";
|
|
217
|
+
position: absolute;
|
|
218
|
+
left: 0;
|
|
219
|
+
top: 0;
|
|
220
|
+
bottom: 0;
|
|
221
|
+
width: 2rem;
|
|
222
|
+
border-right: 1px dashed #a9dde0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Arrow styling for transclusions */
|
|
226
|
+
dl.terms-and-definitions-list span.transcluded-xref-term::after,
|
|
227
|
+
dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded::after {
|
|
228
|
+
content: "";
|
|
229
|
+
position: absolute;
|
|
230
|
+
left: 0.5rem;
|
|
231
|
+
top: 50%;
|
|
232
|
+
width: 1rem;
|
|
233
|
+
height: 1rem;
|
|
234
|
+
transform: translateY(-50%);
|
|
235
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-box-arrow-right' viewBox='0 0 16 16' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z'/%3E%3Cpath fill-rule='evenodd' d='M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z'/%3E%3C/svg%3E");
|
|
236
|
+
background-size: contain;
|
|
237
|
+
background-repeat: no-repeat;
|
|
238
|
+
background-position: center;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Inline span styling for transclusions */
|
|
242
|
+
dl.terms-and-definitions-list span.transcluded-xref-term {
|
|
243
|
+
padding-left: 1.5rem;
|
|
244
|
+
display: inline-block;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
dl.terms-and-definitions-list span.transcluded-xref-term::before {
|
|
248
|
+
content: "";
|
|
249
|
+
position: absolute;
|
|
250
|
+
left: 0;
|
|
251
|
+
top: 0;
|
|
252
|
+
bottom: 0;
|
|
253
|
+
width: 1.2rem;
|
|
254
|
+
border-right: 1px dashed #a9dde0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
dl.terms-and-definitions-list span.transcluded-xref-term::after {
|
|
258
|
+
width: 0.8rem;
|
|
259
|
+
height: 0.8rem;
|
|
260
|
+
left: 0.2rem;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.placeholder-tref {
|
|
264
|
+
display: none;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/* ====== ERROR MESSAGES ====== */
|
|
268
|
+
/* No cross-reference found styling */
|
|
269
|
+
.no-xref-found-message {
|
|
270
|
+
background: #f8c481;
|
|
271
|
+
color: #03365f;
|
|
272
|
+
margin: 0 0.5em;
|
|
273
|
+
padding: 0 0.8em;
|
|
274
|
+
border-radius: 0.25rem;
|
|
275
|
+
font-size: 0.8rem;
|
|
276
|
+
font-variant: small-caps;
|
|
277
|
+
text-transform: uppercase;
|
|
278
|
+
}
|
|
@@ -20,7 +20,7 @@ function addAnchorsToTerms() {
|
|
|
20
20
|
const id = dt.getAttribute('id');
|
|
21
21
|
const a = document.createElement('a');
|
|
22
22
|
a.setAttribute('href', `#${id}`);
|
|
23
|
-
a.setAttribute('class', 'toc-anchor');
|
|
23
|
+
a.setAttribute('class', 'toc-anchor d-print-none');
|
|
24
24
|
a.innerHTML = '# '; // was '§';
|
|
25
25
|
dt.parentNode.insertBefore(a, dt);
|
|
26
26
|
});
|
|
@@ -13,12 +13,13 @@ function collapseDefinitions() {
|
|
|
13
13
|
button.innerHTML = isHidden ? '▲' : '▼';
|
|
14
14
|
button.title = isHidden ? 'Collapse all definitions' : 'Expand all definitions';
|
|
15
15
|
});
|
|
16
|
+
document.querySelector('html').classList.toggle('defs-hidden');
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
// Add button as last child of every <dl>
|
|
19
20
|
dts.forEach(dt => {
|
|
20
21
|
const button = document.createElement('button');
|
|
21
|
-
button.classList.add('collapse-all-defs-button', 'btn', 'p-0', 'fs-5', 'd-flex', 'align-items-center','justify-content-center');
|
|
22
|
+
button.classList.add('collapse-all-defs-button', 'd-print-none', 'btn', 'p-0', 'fs-5', 'd-flex', 'align-items-center','justify-content-center');
|
|
22
23
|
button.innerHTML = '▲';
|
|
23
24
|
button.setAttribute('id', 'toggleButton');
|
|
24
25
|
dt.appendChild(button);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file This file creates a collapsible meta info section for each term definition on the page. It is used to hide meta information about a term definition by default and show it when the user clicks the button.
|
|
3
3
|
* @author Kor Dwarshuis
|
|
4
|
-
* @version 0.0.
|
|
4
|
+
* @version 0.0.2
|
|
5
5
|
* @since 2025-02-16
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -13,12 +13,22 @@ function createToggleButton(element) {
|
|
|
13
13
|
toggleButton.title = 'Meta info';
|
|
14
14
|
|
|
15
15
|
// Add event listener to the button
|
|
16
|
-
toggleButton.addEventListener('click', function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
toggleButton.addEventListener('click', function(e) {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
|
|
20
|
+
// Get the wrapper containing the meta info
|
|
21
|
+
const isCollapsed = element.classList.contains('collapsed');
|
|
22
|
+
|
|
23
|
+
// Toggle the collapsed state
|
|
24
|
+
if (isCollapsed) {
|
|
25
|
+
// If collapsed, expand it
|
|
26
|
+
element.classList.remove('collapsed');
|
|
27
|
+
// Force reflow to ensure transition works properly
|
|
28
|
+
element.getBoundingClientRect();
|
|
20
29
|
} else {
|
|
21
|
-
|
|
30
|
+
// If expanded, collapse it
|
|
31
|
+
element.classList.add('collapsed');
|
|
22
32
|
}
|
|
23
33
|
});
|
|
24
34
|
|
|
@@ -36,25 +46,29 @@ function createToggleButton(element) {
|
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
// Find all elements with class 'collapsible' and make them collapsible
|
|
39
|
-
document.addEventListener('DOMContentLoaded', function
|
|
49
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
40
50
|
const collapsibles = document.querySelectorAll('dl > dd:has(table)');
|
|
41
51
|
|
|
42
|
-
collapsibles.forEach(function
|
|
43
|
-
//
|
|
52
|
+
collapsibles.forEach(function(element) {
|
|
53
|
+
// Add meta-info-content-wrapper class
|
|
54
|
+
element.classList.add('meta-info-content-wrapper');
|
|
55
|
+
|
|
56
|
+
// Wrap content in a div for proper spacing
|
|
44
57
|
const wrapper = document.createElement('div');
|
|
58
|
+
wrapper.classList.add('meta-info-inner-wrapper');
|
|
45
59
|
|
|
46
60
|
// Move all children except potential existing buttons into wrapper
|
|
47
61
|
while (element.firstChild && element.firstChild !== element.querySelector('.meta-info-toggle-button')) {
|
|
48
62
|
wrapper.appendChild(element.firstChild);
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
if (!element.querySelector('.meta-info-toggle-button')) { // Check if already has a button
|
|
65
|
+
if (!element.querySelector('.meta-info-toggle-button')) { // Check if already has a button
|
|
52
66
|
createToggleButton(element);
|
|
53
67
|
}
|
|
54
68
|
|
|
55
69
|
element.appendChild(wrapper);
|
|
56
70
|
|
|
57
|
-
//
|
|
71
|
+
// Collapse by default on load
|
|
58
72
|
element.classList.add('collapsed');
|
|
59
73
|
});
|
|
60
74
|
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file This file creates an alphabet index for the terms
|
|
3
|
+
* @author Kor Dwarshuis
|
|
4
|
+
* @version 0.0.1
|
|
5
|
+
* @since 2024-09-19
|
|
6
|
+
*/
|
|
7
|
+
function createTermFilter() {
|
|
8
|
+
const terminologySectionUtilityContainer = document.getElementById("terminology-section-utility-container");
|
|
9
|
+
|
|
10
|
+
// Create checkboxes container
|
|
11
|
+
const checkboxesContainer = document.createElement('div');
|
|
12
|
+
checkboxesContainer.className = 'd-flex mt-0';
|
|
13
|
+
|
|
14
|
+
// Create and configure checkbox for local terms
|
|
15
|
+
const localTermsCheckboxDiv = document.createElement('div');
|
|
16
|
+
localTermsCheckboxDiv.className = 'form-check me-3';
|
|
17
|
+
localTermsCheckboxDiv.innerHTML = `
|
|
18
|
+
<input class="form-check-input" type="checkbox" id="showLocalTermsCheckbox" checked>
|
|
19
|
+
<label class="form-check-label" for="showLocalTermsCheckbox">
|
|
20
|
+
Show local terms
|
|
21
|
+
</label>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
// Create and configure checkbox for external terms
|
|
25
|
+
const externalTermsCheckboxDiv = document.createElement('div');
|
|
26
|
+
externalTermsCheckboxDiv.className = 'form-check ms-3';
|
|
27
|
+
externalTermsCheckboxDiv.innerHTML = `
|
|
28
|
+
<input class="form-check-input" type="checkbox" id="showExternalTermsCheckbox" checked>
|
|
29
|
+
<label class="form-check-label" for="showExternalTermsCheckbox">
|
|
30
|
+
Show external terms
|
|
31
|
+
</label>
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
// Add event listeners to checkboxes
|
|
35
|
+
localTermsCheckboxDiv.querySelector('#showLocalTermsCheckbox').addEventListener('change', function(event) {
|
|
36
|
+
if (!event.target.checked) {
|
|
37
|
+
document.querySelector('html').classList.add('hide-local-terms');
|
|
38
|
+
} else {
|
|
39
|
+
document.querySelector('html').classList.remove('hide-local-terms');
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
externalTermsCheckboxDiv.querySelector('#showExternalTermsCheckbox').addEventListener('change', function(event) {
|
|
44
|
+
if (!event.target.checked) {
|
|
45
|
+
document.querySelector('html').classList.add('hide-external-terms');
|
|
46
|
+
} else {
|
|
47
|
+
document.querySelector('html').classList.remove('hide-external-terms');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Append checkboxes to container
|
|
52
|
+
checkboxesContainer.appendChild(localTermsCheckboxDiv);
|
|
53
|
+
checkboxesContainer.appendChild(externalTermsCheckboxDiv);
|
|
54
|
+
|
|
55
|
+
// Add checkboxes to the terminology section utility container
|
|
56
|
+
terminologySectionUtilityContainer.appendChild(checkboxesContainer);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
60
|
+
createTermFilter();
|
|
61
|
+
});
|