spec-up-t 1.2.3 → 1.2.5

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.
Files changed (61) hide show
  1. package/.sonarlint/connectedMode.json +5 -0
  2. package/assets/compiled/body.js +35 -32
  3. package/assets/compiled/head.css +7 -5
  4. package/assets/compiled/head.js +3 -3
  5. package/assets/css/add-bootstrap-classes-to-images.css +34 -0
  6. package/assets/css/adjust-font-size.css +6 -11
  7. package/assets/css/backToTop.css +0 -1
  8. package/assets/css/image-full-size.css +44 -0
  9. package/assets/css/index.css +1 -2
  10. package/assets/css/pdf-styles.css +23 -27
  11. package/assets/css/repo-issues.css +0 -6
  12. package/assets/css/search.css +0 -1
  13. package/assets/css/sidebar-toc.css +13 -12
  14. package/assets/css/terms-and-definitions.css +43 -37
  15. package/assets/js/add-bootstrap-classes-to-images.js +98 -0
  16. package/assets/js/add-href-to-snapshot-link.js +2 -1
  17. package/assets/js/addAnchorsToTerms.js +0 -1
  18. package/assets/js/adjust-font-size.js +0 -9
  19. package/assets/js/create-alphabet-index.js +12 -3
  20. package/assets/js/create-term-filter.js +12 -0
  21. package/assets/js/custom-elements.js +13 -18
  22. package/assets/js/declare-markdown-it.js +1 -1
  23. package/assets/js/hide-show-utility-container.js +17 -0
  24. package/assets/js/highlightMenuItems.js +3 -3
  25. package/assets/js/image-full-size.js +76 -0
  26. package/assets/js/index.js +1 -5
  27. package/assets/js/insert-trefs.js +2 -2
  28. package/assets/js/modal.js +3 -3
  29. package/assets/js/search.js +15 -3
  30. package/assets/js/utils.js +2 -3
  31. package/index.js +7 -17
  32. package/package.json +2 -2
  33. package/src/README.md +3 -3
  34. package/src/add-remove-xref-source.js +0 -2
  35. package/src/asset-map.json +5 -0
  36. package/src/collect-external-references.js +187 -179
  37. package/src/collectExternalReferences/fetchTermsFromIndex.js +2 -1
  38. package/src/config/paths.js +2 -2
  39. package/src/create-external-specs-list.js +1 -1
  40. package/src/create-term-index.js +126 -22
  41. package/src/fix-markdown-files.js +152 -90
  42. package/src/health-check/external-specs-checker.js +173 -94
  43. package/src/health-check/output-gitignore-checker.js +327 -191
  44. package/src/health-check/specs-configuration-checker.js +288 -210
  45. package/src/health-check/term-references-checker.js +200 -123
  46. package/src/health-check/tref-term-checker.js +264 -179
  47. package/src/health-check.js +52 -36
  48. package/src/init.js +1 -4
  49. package/src/insert-term-index.js +5 -5
  50. package/src/install-from-boilerplate/add-scripts-keys.js +3 -1
  51. package/src/install-from-boilerplate/boilerplate/gitignore +2 -1
  52. package/src/install-from-boilerplate/config-system-files.js +9 -1
  53. package/src/install-from-boilerplate/copy-system-files.js +1 -1
  54. package/src/markdown-it-extensions.js +199 -106
  55. package/src/references.js +1 -2
  56. package/src/utils/doesUrlExist.js +7 -5
  57. package/src/utils/fetch.js +14 -14
  58. package/templates/template.html +1 -2
  59. package/assets/js/insert-xrefs.js +0 -370
  60. package/src/create-term-relations.js +0 -131
  61. package/src/prepare-tref.js +0 -174
@@ -26,7 +26,8 @@ h6 {
26
26
  #terminology-section-utility-container {
27
27
  position: sticky;
28
28
  top: 3.5em;
29
- z-index: 10; /* Higher z-index to ensure it stays on top */
29
+ z-index: 10;
30
+ /* Higher z-index to ensure it stays on top */
30
31
  }
31
32
  }
32
33
 
@@ -47,43 +48,51 @@ dl.terms-and-definitions-list {
47
48
  margin: 0;
48
49
  padding: 0;
49
50
  position: relative;
50
- z-index: 1; /* Set a baseline z-index for the whole list */
51
+ z-index: 1;
52
+ /* Set a baseline z-index for the whole list */
51
53
  }
52
54
 
53
55
  /* ====== DEFAULT STYLING ====== */
54
56
  /* Term styling (dt) */
55
- dl.terms-and-definitions-list > dt {
57
+ dl.terms-and-definitions-list>dt {
56
58
  font-weight: 700;
57
59
  margin: 0;
58
60
  background-color: var(--card-bg-dt);
59
61
  border: 1px solid var(--card-border);
60
- padding: 0.5rem 1.25rem; /* Increased vertical padding for better readability */
62
+ padding: 0.5rem 1.25rem;
63
+ /* Increased vertical padding for better readability */
61
64
  border-radius: 0.375rem 0.375rem 0 0;
62
65
  color: var(--card-text);
63
- position: relative; /* Position relative for stacking */
64
- line-height: 1.5; /* Improve line spacing */
65
- font-size: 1.05em; /* Slightly larger font for better hierarchy */
66
- align-items: center; /* Vertically center the content */
66
+ position: relative;
67
+ /* Position relative for stacking */
68
+ line-height: 1.5;
69
+ /* Improve line spacing */
70
+ font-size: 1.05em;
71
+ /* Slightly larger font for better hierarchy */
72
+ align-items: center;
73
+ /* Vertically center the content */
67
74
  }
68
75
 
69
76
  /* This adds spacing between the term text and the buttons */
70
- dl.terms-and-definitions-list > dt > span {
71
- margin-right: 1.5em; /* Add spacing to the right of the term text */
77
+ dl.terms-and-definitions-list>dt>span {
78
+ margin-right: 1.5em;
79
+ /* Add spacing to the right of the term text */
72
80
  }
73
81
 
74
82
 
75
83
  /* Increase the size for all buttons in definition terms */
76
- dl.terms-and-definitions-list > dt .btn {
77
- font-size: 1.2em !important; /* Increase button size */
84
+ dl.terms-and-definitions-list>dt .btn {
85
+ font-size: 1.2em !important;
86
+ /* Increase button size */
78
87
  }
79
88
 
80
- dl.terms-and-definitions-list > dt:hover {
89
+ dl.terms-and-definitions-list>dt:hover {
81
90
  background-color: var(--card-hover-bg);
82
91
  transition: background-color 0.2s ease-in-out;
83
92
  }
84
93
 
85
94
  /* Definition styling (dd) */
86
- dl.terms-and-definitions-list > dd {
95
+ dl.terms-and-definitions-list>dd {
87
96
  margin: 0;
88
97
  background-color: var(--card-bg);
89
98
  border: 1px solid var(--card-border);
@@ -102,7 +111,7 @@ dl.terms-and-definitions-list dd p {
102
111
  }
103
112
 
104
113
  /* Remove the blue line indicator for dd */
105
- dl.terms-and-definitions-list > dd::before {
114
+ dl.terms-and-definitions-list>dd::before {
106
115
  display: none;
107
116
  }
108
117
 
@@ -173,16 +182,16 @@ dl>dd:has(table).meta-info-content-wrapper>div {
173
182
  */
174
183
 
175
184
  /* Borders and spacing between elements */
176
- dl.terms-and-definitions-list dt + dd {
185
+ dl.terms-and-definitions-list dt+dd {
177
186
  border-bottom: none;
178
187
  }
179
188
 
180
- dl.terms-and-definitions-list dd + dd {
189
+ dl.terms-and-definitions-list dd+dd {
181
190
  border-top: none;
182
191
  border-bottom: none;
183
192
  }
184
193
 
185
- dl.terms-and-definitions-list dd + dt {
194
+ dl.terms-and-definitions-list dd+dt {
186
195
  margin-top: 1rem;
187
196
  }
188
197
 
@@ -194,9 +203,10 @@ dl.terms-and-definitions-list dd.last-dd {
194
203
 
195
204
  /* ====== DENSE INFO STYLING ====== */
196
205
  /* Apply original, more condensed styling when the html element has class "dense-info" */
197
- html.dense-info dl.terms-and-definitions-list > dt {
206
+ html.dense-info dl.terms-and-definitions-list>dt {
198
207
  padding: 0.1rem 1.25rem;
199
- display: block; /* Revert from flexbox to block */
208
+ display: block;
209
+ /* Revert from flexbox to block */
200
210
  line-height: inherit;
201
211
  font-size: inherit;
202
212
  }
@@ -205,12 +215,14 @@ html.dense-info dl.terms-and-definitions-list dd+dt {
205
215
  margin-top: 0.3rem;
206
216
  }
207
217
 
208
- html.dense-info dl.terms-and-definitions-list > dt::before {
209
- display: none; /* Remove the blue indicator bar */
218
+ html.dense-info dl.terms-and-definitions-list>dt::before {
219
+ display: none;
220
+ /* Remove the blue indicator bar */
210
221
  }
211
222
 
212
- html.dense-info dl.terms-and-definitions-list > dt > span {
213
- margin-right: 0; /* Remove spacing for term text */
223
+ html.dense-info dl.terms-and-definitions-list>dt>span {
224
+ margin-right: 0;
225
+ /* Remove spacing for term text */
214
226
  }
215
227
 
216
228
  /* ====== TRANSCLUSIONS STYLING ====== */
@@ -229,7 +241,8 @@ dd.transcluded-xref-term {
229
241
  font-variant: small-caps;
230
242
  text-transform: uppercase;
231
243
  position: relative;
232
- z-index: 5; /* Higher z-index for all buttons */
244
+ z-index: 5;
245
+ /* Higher z-index for all buttons */
233
246
  }
234
247
 
235
248
  .collapse-all-defs-button {
@@ -243,7 +256,7 @@ dd.transcluded-xref-term {
243
256
  }
244
257
 
245
258
  /* Embedded transclusions in definition lists */
246
- dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded {
259
+ dl.terms-and-definitions-list>dd.transcluded-xref-term-embedded {
247
260
  position: relative;
248
261
  padding-left: 2.5rem;
249
262
  padding-top: 0.3rem;
@@ -254,15 +267,15 @@ dl.terms-and-definitions-list > dd.transcluded-xref-term-embedded {
254
267
  dl.terms-and-definitions-list span.transcluded-xref-term::after {
255
268
  content: "";
256
269
  position: absolute;
257
- left: 0.5rem;
258
270
  top: 50%;
259
- width: 1rem;
260
- height: 1rem;
261
271
  transform: translateY(-50%);
262
272
  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");
263
273
  background-size: contain;
264
274
  background-repeat: no-repeat;
265
275
  background-position: center;
276
+ width: 0.8rem;
277
+ height: 0.8rem;
278
+ left: 0.2rem;
266
279
  }
267
280
 
268
281
  /* Inline span styling for transclusions */
@@ -271,12 +284,6 @@ dl.terms-and-definitions-list span.transcluded-xref-term {
271
284
  display: inline-block;
272
285
  }
273
286
 
274
- dl.terms-and-definitions-list span.transcluded-xref-term::after {
275
- width: 0.8rem;
276
- height: 0.8rem;
277
- left: 0.2rem;
278
- }
279
-
280
287
  .placeholder-tref {
281
288
  display: none;
282
289
  }
@@ -292,5 +299,4 @@ dl.terms-and-definitions-list span.transcluded-xref-term::after {
292
299
  font-size: 0.8rem;
293
300
  font-variant: small-caps;
294
301
  text-transform: uppercase;
295
- }
296
-
302
+ }
@@ -0,0 +1,98 @@
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
+ if (node.tagName === 'IMG') {
71
+ shouldUpdate = true;
72
+ } else if (node.querySelector && node.querySelector('img')) {
73
+ shouldUpdate = true;
74
+ }
75
+ }
76
+ });
77
+ }
78
+ });
79
+
80
+ if (shouldUpdate) {
81
+ // Apply Bootstrap classes to newly added images
82
+ addBootstrapClassesToImages();
83
+ }
84
+ });
85
+
86
+ // Start observing content changes
87
+ observer.observe(markdownElement, {
88
+ childList: true,
89
+ subtree: true
90
+ });
91
+ }
92
+ }
93
+ }
94
+
95
+ // Run when the DOM is fully loaded
96
+ document.addEventListener('DOMContentLoaded', () => {
97
+ initImageBootstrapClasses();
98
+ });
@@ -13,7 +13,8 @@ function addHrefToSnapshotLink() {
13
13
  const currentUrl = window.location.href;
14
14
 
15
15
  // Regex to match up to and including the 'versions/' directory (if it exists)
16
- const versionsMatch = currentUrl.match(/^(https?:\/\/[^\/]+(?:\/[^\/]+)*)\/versions\/(?:[^\/]+\/)?/);
16
+ const versionsRegex = new RegExp('^(https?://[^/]+(?:/[^/]+)*)/versions/(?:[^/]+/)?');
17
+ const versionsMatch = versionsRegex.exec(currentUrl);
17
18
 
18
19
  // If we are already in the 'versions' directory or deeper, strip down to 'versions/'
19
20
  // Otherwise, append '/versions/' to the current directory
@@ -16,7 +16,6 @@ function addAnchorsToTerms() {
16
16
  dts.forEach(item => {
17
17
 
18
18
  const dt = findDeepestSpan(item);
19
- // dt.classList.add('toc-anchor');
20
19
  const id = dt.getAttribute('id');
21
20
  const a = document.createElement('a');
22
21
  a.setAttribute('href', `#${id}`);
@@ -6,7 +6,6 @@
6
6
 
7
7
  function adjustFontSize() {
8
8
  const body = document.body;
9
- const DEFAULT_SIZE = parseFloat(window.getComputedStyle(body).fontSize); // Define default font size for reset
10
9
 
11
10
  function adjust(change) {
12
11
  // Get current font size from body (in pixels)
@@ -21,17 +20,9 @@ function adjustFontSize() {
21
20
  }
22
21
  }
23
22
 
24
- function reset() {
25
- const body = document.body;
26
-
27
- // Set font size to default value
28
- body.style.fontSize = `${DEFAULT_SIZE}px`;
29
- }
30
-
31
23
  // Add event listeners to buttons
32
24
  document.getElementById('decreaseBtn').addEventListener('click', () => adjust(-2));
33
25
  document.getElementById('increaseBtn').addEventListener('click', () => adjust(2));
34
- // document.getElementById('resetBtn').addEventListener('click', reset);
35
26
  }
36
27
 
37
28
  document.addEventListener("DOMContentLoaded", function () {
@@ -5,14 +5,23 @@
5
5
  * @since 2024-09-19
6
6
  */
7
7
  function createAlphabetIndex() {
8
- const terminologySectionUtilityContainer = document.getElementById("terminology-section-utility-container");
8
+ // Check if the terms and definitions list exists
9
+ // If it doesn't exist, exit the function
10
+ // This prevents errors when the script is run on pages without the terms and definitions list
11
+ // and ensures that the script only runs when necessary
9
12
  const termsListElement = document.querySelector(".terms-and-definitions-list");
10
- const dtElements = termsListElement.querySelectorAll("dt");
13
+ const dtElements = termsListElement ? termsListElement.querySelectorAll("dt") : [];
14
+
15
+ if (dtElements.length === 0) {
16
+ return;
17
+ }
18
+
19
+ const terminologySectionUtilityContainer = document.getElementById("terminology-section-utility-container");
11
20
  const alphabetIndex = {};
12
21
 
13
22
  dtElements.forEach(dt => {
14
23
  const span = dt.querySelector("span");
15
- if (span && span.id) {
24
+ if (span?.id) {
16
25
  const termId = span.id;
17
26
  const firstChar = termId.charAt(termId.indexOf("term:") + 5).toUpperCase();
18
27
  if (!alphabetIndex[firstChar]) {
@@ -5,6 +5,18 @@
5
5
  * @since 2024-09-19
6
6
  */
7
7
  function createTermFilter() {
8
+ // Check if the terms and definitions list exists
9
+ // If it doesn't exist, exit the function
10
+ // This prevents errors when the script is run on pages without the terms and definitions list
11
+ // and ensures that the script only runs when necessary
12
+ const termsListElement = document.querySelector(".terms-and-definitions-list");
13
+ const dtElements = termsListElement ? termsListElement.querySelectorAll("dt") : [];
14
+
15
+ if (dtElements.length === 0) {
16
+ return;
17
+ }
18
+
19
+
8
20
  const terminologySectionUtilityContainer = document.getElementById("terminology-section-utility-container");
9
21
 
10
22
  // Create checkboxes container
@@ -24,17 +24,16 @@ customElements.define('slide-panels', class SidePanels extends HTMLElement {
24
24
  close (){
25
25
  this.removeAttribute('open');
26
26
  }
27
+
27
28
  attributeChangedCallback(attr, last, current) {
28
- switch(attr) {
29
- case 'open': for (let child of this.children) {
29
+ if (attr === 'open') {
30
+ for (let child of this.children) {
30
31
  if (child.id === current) child.setAttribute('open', '');
31
32
  else child.removeAttribute('open', '');
32
33
  }
33
- break;
34
34
  }
35
35
  }
36
36
  });
37
-
38
37
  customElements.define('detail-box', class DetailBox extends HTMLElement {
39
38
  static get observedAttributes() {
40
39
  return ['open'];
@@ -60,23 +59,19 @@ customElements.define('detail-box', class DetailBox extends HTMLElement {
60
59
  this.toggleAttribute('open');
61
60
  }
62
61
  attributeChangedCallback(attr, last, current) {
63
- switch(attr) {
64
- case 'open':
65
- for (let node of this.children) {
66
- if (node.tagName === 'SECTION') {
67
- if (current !== null) {
68
- if (node.offsetHeight < node.scrollHeight) {
69
- node.style.height = node.scrollHeight + 'px';
70
- }
62
+ if (attr === 'open') {
63
+ for (let node of this.children) {
64
+ if (node.tagName === 'SECTION') {
65
+ if (current !== null) {
66
+ if (node.offsetHeight < node.scrollHeight) {
67
+ node.style.height = node.scrollHeight + 'px';
71
68
  }
72
- else if (node.offsetHeight > 0) {
73
- node.style.height = node.offsetHeight + 'px';
74
- let scroll = this.scrollHeight;
75
- node.style.height = 0;
76
- }
77
- break;
69
+ } else if (node.offsetHeight > 0) {
70
+ node.style.height = node.offsetHeight + 'px';
71
+ node.style.height = 0;
78
72
  }
79
73
  }
74
+ }
80
75
  }
81
76
  }
82
77
  });
@@ -1,5 +1,5 @@
1
1
 
2
- var md = window.markdownit({
2
+ const md = window.markdownit({
3
3
  html: true, // Allow raw HTML in Markdown
4
4
  linkify: true, // Automatically convert URLs to clickable links
5
5
  typographer: true // Enable smart quotes and other typographic enhancements
@@ -0,0 +1,17 @@
1
+ function hideShowUtilityContainer() {
2
+ // Check if the terms and definitions list exists
3
+ // If it doesn't exist, exit the function
4
+ // This prevents errors when the script is run on pages without the terms and definitions list
5
+ // and ensures that the script only runs when necessary
6
+ const termsListElement = document.querySelector(".terms-and-definitions-list");
7
+ const dtElements = termsListElement ? termsListElement.querySelectorAll("dt") : [];
8
+
9
+ if (dtElements.length === 0) {
10
+ document.getElementById("terminology-section-utility-container")?.remove();
11
+ // document.getElementById("terminology-section-utility-container")?.style.display = "none";
12
+ }
13
+ }
14
+
15
+ document.addEventListener("DOMContentLoaded", function () {
16
+ hideShowUtilityContainer();
17
+ });
@@ -18,7 +18,7 @@ function highlightMenuItems() {
18
18
  if (menuItem) {
19
19
  menuItem.classList.add("highlight-cfib41dyhcd99sm");
20
20
  menuItem.scrollIntoView({ behavior: "smooth", block: "center" });
21
-
21
+
22
22
  // Dispatch custom event for the collapsible menu to handle
23
23
  document.dispatchEvent(new CustomEvent('highlight-menu-item', {
24
24
  detail: { menuItem, headingId: heading.id }
@@ -40,10 +40,10 @@ function highlightMenuItems() {
40
40
  // Update last heading in view to the first one found in the current viewport
41
41
  lastHeadingInView = headingsInView[0];
42
42
  highlightMenuItem(lastHeadingInView);
43
- } else {
43
+ } else if (lastHeadingInView) {
44
44
  // No headings are currently in view
45
45
  // Highlight the last heading in view if it exists
46
- if (lastHeadingInView) highlightMenuItem(lastHeadingInView);
46
+ highlightMenuItem(lastHeadingInView);
47
47
  }
48
48
  }, options);
49
49
 
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @file This file adds functionality to display images in full-size on a web page when clicked. The functionality is implemented via a class added to the image element.
3
+ * @author Kor Dwarshuis
4
+ * @version 1.0.0
5
+ */
6
+
7
+
8
+ const imageFullSize = () => {
9
+ const imageFullSizeClass = 'image-full-page';
10
+
11
+ // All images get a click event listener via event delegation
12
+ const markdownElement = document.querySelector('#content');
13
+
14
+ function removeContainer() {
15
+ let container = document.querySelector('.image-container-full-page');
16
+ if (container) {
17
+ document.body.removeChild(container);
18
+ }
19
+ }
20
+
21
+ if (markdownElement) {
22
+ console.log("event listener added");
23
+
24
+ markdownElement.addEventListener('click', (event) => {
25
+ if (event.target.tagName === 'IMG') {
26
+
27
+ // To be implemented: also account for SVG, path, circle, rect
28
+ // if ((event.target.tagName === 'svg' || event.target.tagName === 'path' || event.target.tagName === 'circle' || event.target.tagName === 'rect') && event.target.closest('.markdown')) {
29
+
30
+ let image = event.target;
31
+
32
+ if (document.querySelector('.image-container-full-page') === null) {
33
+ // Add container if it doesn't exist
34
+
35
+ // Clone the image element
36
+ const clonedImage = image.cloneNode(true);
37
+
38
+ // Create a new div element with the class .full-page-image-container
39
+ const container = document.createElement('div');
40
+ container.classList.add('image-container');
41
+ container.classList.add('image-container-full-page');
42
+
43
+ // Add the cloned image to the new container div
44
+ container.appendChild(clonedImage);
45
+
46
+ // Append the new container div to the body
47
+ document.body.appendChild(container);
48
+
49
+ // Add event listener to the new container
50
+ container.addEventListener('click', function containerClickEvent() {
51
+ container.removeEventListener('click', containerClickEvent); // remove this click listener
52
+ removeContainer();
53
+ });
54
+
55
+ }
56
+
57
+ // Toggle the full size class on the original image
58
+ image.classList.toggle(imageFullSizeClass);
59
+ }
60
+ });
61
+
62
+ // Add keydown event listener to handle the ESC key
63
+ document.addEventListener('keydown', (event) => {
64
+ if (event.key === "Escape") {
65
+ removeContainer();
66
+ }
67
+ });
68
+
69
+ } else {
70
+ console.log("Element with class '.markdown' not found.");
71
+ }
72
+ };
73
+
74
+ document.addEventListener('DOMContentLoaded', () => {
75
+ imageFullSize();
76
+ });
@@ -1,9 +1,6 @@
1
1
 
2
2
  (function(){
3
3
 
4
- var markdown = window.markdownit();
5
-
6
-
7
4
  /* GitHub Issues */
8
5
 
9
6
  let source = specConfig.source;
@@ -19,7 +16,7 @@ var markdown = window.markdownit();
19
16
  repo_issue_list.innerHTML = issues.map(issue => {
20
17
  return `<li class="repo-issue">
21
18
  <detail-box>
22
- <section>${markdown.render(issue.body || '')}</section>
19
+ <section>${md.render(issue.body || '')}</section>
23
20
  <header class="repo-issue-title">
24
21
  <span class="repo-issue-number">${issue.number}</span>
25
22
  <span class="repo-issue-link">
@@ -34,7 +31,6 @@ var markdown = window.markdownit();
34
31
  })
35
32
  }
36
33
  }
37
- //${markdown.render(issue.body)}
38
34
 
39
35
  /* Mermaid Diagrams */
40
36
 
@@ -41,7 +41,7 @@ function insertTrefs(allXTrefs) { // Pass allXTrefs as a parameter
41
41
  const dt = termElement.closest('dt');
42
42
  if (dt) {
43
43
  const nextElement = dt.nextElementSibling;
44
- if (nextElement && nextElement.classList.contains('transcluded-xref-term') &&
44
+ if (nextElement?.classList.contains('transcluded-xref-term') &&
45
45
  nextElement.classList.contains('meta-info-content-wrapper')) {
46
46
  return; // Already processed
47
47
  }
@@ -134,7 +134,7 @@ function insertTrefs(allXTrefs) { // Pass allXTrefs as a parameter
134
134
  }
135
135
 
136
136
 
137
- if (allXTrefs && allXTrefs.xtrefs) {
137
+ if (allXTrefs?.xtrefs) {
138
138
  processTerms(allXTrefs);
139
139
  } else {
140
140
  console.error('allXTrefs is undefined or missing xtrefs property');
@@ -2,6 +2,9 @@
2
2
  * Displays a modal with the given content.
3
3
  *
4
4
  * @param {string} content - The HTML content to display inside the modal.
5
+ *
6
+ * Example usage:
7
+ * showModal('<h2>This is a Modal</h2><p>You can put any content here.</p>');
5
8
  */
6
9
  function showModal(content) {
7
10
  // Create the modal overlay
@@ -47,6 +50,3 @@ function showModal(content) {
47
50
  }
48
51
  }, { once: true });
49
52
  }
50
-
51
- // // Example usage:
52
- // showModal('<h2>This is a Modal</h2><p>You can put any content here.</p>');
@@ -14,6 +14,18 @@
14
14
  */
15
15
 
16
16
  function inPageSearch() {
17
+ // Check if the terms and definitions list exists
18
+ // If it doesn't exist, exit the function
19
+ // This prevents errors when the script is run on pages without the terms and definitions list
20
+ // and ensures that the script only runs when necessary
21
+ const termsListElement = document.querySelector(".terms-and-definitions-list");
22
+ const dtElements = termsListElement ? termsListElement.querySelectorAll("dt") : [];
23
+
24
+ if (dtElements.length === 0) {
25
+ return;
26
+ }
27
+
28
+
17
29
  /*****************/
18
30
  /* CONFIGURATION */
19
31
 
@@ -295,9 +307,9 @@ function inPageSearch() {
295
307
  */
296
308
  function hasHiddenAncestor(node) {
297
309
  while (node) {
298
- if (node.classList && node.classList.contains('hidden')) {
299
- return true;
300
- }
310
+ if (node?.classList?.contains('hidden')) {
311
+ return true;
312
+ }
301
313
  node = node.parentNode;
302
314
  }
303
315
  return false;