@pimaonline/pimaonline-themepack 3.10.12 → 3.10.13
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/dist/js/scripts2.js +56 -44
- package/package.json +1 -1
package/dist/js/scripts2.js
CHANGED
@@ -36,8 +36,7 @@ const addAria = () => {
|
|
36
36
|
if (contentWrapper) {
|
37
37
|
contentWrapper.setAttribute("role", "main");
|
38
38
|
} else if (!contentWrapper) {
|
39
|
-
console.
|
40
|
-
return;
|
39
|
+
console.log("Document error: does not contain #content-wrapper.");
|
41
40
|
}
|
42
41
|
if (secondColumn) {
|
43
42
|
secondColumn.setAttribute("role", "region");
|
@@ -61,11 +60,9 @@ const addGrid = () => {
|
|
61
60
|
} else if (contentWrapper && !secondColumn && !thirdColumn && !columnWidget && !videoWrapper) {
|
62
61
|
courseBody.id = "one-column";
|
63
62
|
} else if (contentWrapper && !secondColumn && (thirdColumn || columnWidget)) {
|
64
|
-
console.
|
65
|
-
return;
|
63
|
+
console.log("Document error: <body> is missing id because #second-column doesn't exist.");
|
66
64
|
} else {
|
67
|
-
console.
|
68
|
-
return;
|
65
|
+
console.log("Document error: unable to determine the page layout for setting <body> id.");
|
69
66
|
}
|
70
67
|
|
71
68
|
const topLevelElements = document.body.children;
|
@@ -92,8 +89,7 @@ const addGrid = () => {
|
|
92
89
|
}
|
93
90
|
|
94
91
|
if (foundNestedElement) {
|
95
|
-
console.
|
96
|
-
return;
|
92
|
+
console.log("Document error: Additional content outside #content-wrapper, #second-column, #third-column, or footer.");
|
97
93
|
}
|
98
94
|
};
|
99
95
|
addGrid();
|
@@ -108,11 +104,10 @@ const addMediaContainersAria = () => {
|
|
108
104
|
|
109
105
|
// Check if media container items are present
|
110
106
|
if (!iframe) {
|
111
|
-
console.
|
112
|
-
return;
|
107
|
+
console.log("Document error: no iframe found for media container");
|
113
108
|
}
|
114
109
|
if (!mediaObject) {
|
115
|
-
console.
|
110
|
+
console.log("Document error: no media object found for media container");
|
116
111
|
}
|
117
112
|
|
118
113
|
// If element DOES NOT have "aria-describedby" && it DOES have a sibling element.
|
@@ -133,8 +128,7 @@ iconClasses.forEach(icon => {
|
|
133
128
|
const metaTagRef = docHead.querySelector("meta[name='viewport']");
|
134
129
|
//Check if viewport meta tag exists
|
135
130
|
if (!metaTagRef) {
|
136
|
-
console.
|
137
|
-
return;
|
131
|
+
console.log("Document error: could not find viewport meta tag");
|
138
132
|
}
|
139
133
|
|
140
134
|
const iconCDN = document.createElement("link");
|
@@ -149,8 +143,7 @@ iconClasses.forEach(icon => {
|
|
149
143
|
const checkGalleryWrapperParent = () => {
|
150
144
|
galleryWrappers.forEach((galleryWrapper) => {
|
151
145
|
if (!galleryWrapper.parentNode.classList.contains("image-gallery")) {
|
152
|
-
console.
|
153
|
-
return;
|
146
|
+
console.log(`Document error: parent of .gallery-wrapper does not have the .image-gallery class.`);
|
154
147
|
}
|
155
148
|
});
|
156
149
|
};
|
@@ -160,8 +153,7 @@ checkGalleryWrapperParent();
|
|
160
153
|
const checkImageBoxParent = () => {
|
161
154
|
imgBoxes.forEach((imgBox) => {
|
162
155
|
if (!imgBox.parentNode.classList.contains("gallery-wrapper")) {
|
163
|
-
console.
|
164
|
-
return;
|
156
|
+
console.log(`Document error: parent of .image-box does not have the .gallery-wrapper class.`);
|
165
157
|
}
|
166
158
|
});
|
167
159
|
};
|
@@ -173,8 +165,7 @@ const checkGalleryWrapperChildren = () => {
|
|
173
165
|
let directChildren = Array.from(galleryWrapper.children).every(child => child.classList.contains("image-box"));
|
174
166
|
|
175
167
|
if (!directChildren) {
|
176
|
-
console.
|
177
|
-
return;
|
168
|
+
console.log(`Document error: not all direct children of .gallery-wrapper have the .image-box class.`);
|
178
169
|
}
|
179
170
|
});
|
180
171
|
};
|
@@ -276,19 +267,16 @@ const callTabsWidget = () => {
|
|
276
267
|
|
277
268
|
//Check that there are more than just one tab
|
278
269
|
if (tabInputs.length < 2 || tabLabels.length < 2 || tabDivs.length < 2) {
|
279
|
-
console.
|
280
|
-
return;
|
270
|
+
console.log("Document error: please add more than just one tab for tabs widget");
|
281
271
|
}
|
282
272
|
|
283
273
|
// Check amount of tab elements present
|
284
274
|
if (tabInputs.length < tabLabels.length || tabInputs.length < tabDivs.length) {
|
285
|
-
console.
|
286
|
-
return;
|
275
|
+
console.log("Document error: missing tab input(s) in tab widget");
|
287
276
|
}
|
288
277
|
|
289
278
|
if (tabLabels.length < tabInputs.length || tabLabels.length < tabDivs.length) {
|
290
|
-
console.
|
291
|
-
return;
|
279
|
+
console.log("Document error: missing tab label(s) in tab widget");
|
292
280
|
}
|
293
281
|
|
294
282
|
let groupNum = index + 1;
|
@@ -303,18 +291,15 @@ const callTabsWidget = () => {
|
|
303
291
|
|
304
292
|
// Check on present variables
|
305
293
|
if (tabInputs == null) {
|
306
|
-
console.
|
307
|
-
return;
|
294
|
+
console.log("Document error: no inputs found for tabs widget");
|
308
295
|
}
|
309
296
|
|
310
297
|
if (tabLabels == null) {
|
311
|
-
console.
|
312
|
-
return;
|
298
|
+
console.log("Document error: no labels found for tabs widget");
|
313
299
|
}
|
314
300
|
|
315
301
|
if (tabInputs == null) {
|
316
|
-
console.
|
317
|
-
return;
|
302
|
+
console.log("Document error: no divs (tab panels) found for tabs widget");
|
318
303
|
}
|
319
304
|
|
320
305
|
//Add class, id, name, and aria-described by for inputs
|
@@ -396,17 +381,15 @@ const callVocabList = () => {
|
|
396
381
|
|
397
382
|
// Check for terms and definitions in the vocab list
|
398
383
|
if (terms < 1) {
|
399
|
-
console.
|
400
|
-
return;
|
384
|
+
console.log("Document error: no terms found in vocab list");
|
401
385
|
}
|
402
386
|
|
403
387
|
if (definitions < 1) {
|
404
|
-
console.
|
405
|
-
return;
|
388
|
+
console.log("Document error: no definitions found in vocab list");
|
406
389
|
}
|
407
390
|
|
408
391
|
if (terms > definitions) {
|
409
|
-
console.
|
392
|
+
console.log("Document error: more terms than definitions in vocab list")
|
410
393
|
}
|
411
394
|
|
412
395
|
// If there are more than 2 terms and 2 definitions, then check for a button
|
@@ -612,15 +595,16 @@ if (lockedContent) {
|
|
612
595
|
// Go through each show/hide button and add click listener
|
613
596
|
contentUnlockBtns.forEach((button, index) => {
|
614
597
|
|
598
|
+
button.tabIndex = 0;
|
599
|
+
|
615
600
|
button.addEventListener("click", function () {
|
616
|
-
|
601
|
+
let keyNum = lockedContent[index].getAttribute("data-key");
|
617
602
|
|
618
603
|
// Add alert to ensure the user confirms the action to unlock the content
|
619
|
-
|
604
|
+
let confirmed = window.confirm(`Please confirm: ${unlockContent[index]}`)
|
620
605
|
|
621
606
|
if (confirmed) {
|
622
607
|
|
623
|
-
|
624
608
|
// Toggle the key status
|
625
609
|
contentLockData[courseNumber].keys[keyNum] = !contentLockData[courseNumber].keys[keyNum];
|
626
610
|
|
@@ -641,8 +625,38 @@ if (lockedContent) {
|
|
641
625
|
}
|
642
626
|
});
|
643
627
|
|
628
|
+
button.addEventListener("keydown", function (e) {
|
629
|
+
if (e.key == "Enter") {
|
630
|
+
let keyNum = lockedContent[index].getAttribute("data-key");
|
631
|
+
|
632
|
+
// Add alert to ensure the user confirms the action to unlock the content
|
633
|
+
let confirmed = window.confirm(`Please confirm: ${unlockContent[index]}`)
|
634
|
+
|
635
|
+
if (confirmed) {
|
636
|
+
|
637
|
+
// Toggle the key status
|
638
|
+
contentLockData[courseNumber].keys[keyNum] = !contentLockData[courseNumber].keys[keyNum];
|
639
|
+
|
640
|
+
// Toggle classes based on key status
|
641
|
+
if (contentLockData[courseNumber].keys[keyNum]) {
|
642
|
+
lockedContent[index].classList.add("open");
|
643
|
+
contentLockInstructions[index].classList.add("complete");
|
644
|
+
} else {
|
645
|
+
lockedContent[index].classList.remove("open");
|
646
|
+
contentLockInstructions[index].classList.remove("complete");
|
647
|
+
}
|
648
|
+
|
649
|
+
// Save the updated contentLockData object to local storage
|
650
|
+
localStorage.setItem("contentLockData", JSON.stringify(contentLockData));
|
651
|
+
|
652
|
+
// Update the hidden content based on the key status
|
653
|
+
checkHiddenContent(courseNumber);
|
654
|
+
}
|
655
|
+
}
|
656
|
+
});
|
657
|
+
|
644
658
|
// Apply initial classes based on key status
|
645
|
-
|
659
|
+
let keyNum = lockedContent[index].getAttribute("data-key");
|
646
660
|
|
647
661
|
// Make sure contentLockData[courseNumber] is initialized
|
648
662
|
if (!contentLockData[courseNumber]) {
|
@@ -704,13 +718,11 @@ function callFlipCardWidget() {
|
|
704
718
|
|
705
719
|
// Check to ensure each card has the .flip-card class
|
706
720
|
if (numOfCardsInGroup !== flipCard.length) {
|
707
|
-
console.
|
708
|
-
return; // Stop execution if there's an error
|
721
|
+
console.log("Document error: missing .flip-card class for flip card widget");
|
709
722
|
}
|
710
723
|
// Check to ensure each card has the .inner-card class
|
711
724
|
if (numOfCardsInGroup !== innerFlipCard.length) {
|
712
|
-
console.
|
713
|
-
return; // Stop execution if there's an error
|
725
|
+
console.log("Document error: missing .inner-card class for flip card widget");
|
714
726
|
}
|
715
727
|
|
716
728
|
flipCard.forEach((card) => {
|
package/package.json
CHANGED