@pimaonline/pimaonline-themepack 2.1.9 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/README.md +25 -27
  2. package/dist/css/main.css +1 -1
  3. package/dist/css/routes.css +1 -3
  4. package/dist/css/themes/ajs/styles.css +1 -0
  5. package/dist/css/themes/business/styles.css +1 -0
  6. package/dist/css/themes/cad/styles.css +1 -0
  7. package/dist/css/themes/cards/styles.css +1 -1
  8. package/dist/css/themes/cda/styles.css +1 -0
  9. package/dist/css/themes/computer-information-systems/styles.css +1 -1
  10. package/dist/css/themes/culinary/styles.css +1 -1
  11. package/dist/css/themes/culinary/versions/black-marble.css +1 -1
  12. package/dist/css/themes/culinary/versions/stainless.css +1 -1
  13. package/dist/css/themes/culinary/versions/wood.css +1 -1
  14. package/dist/css/themes/dental/styles.css +1 -1
  15. package/dist/css/themes/ece/styles.css +1 -0
  16. package/dist/css/themes/fashion/styles.css +1 -1
  17. package/dist/css/themes/fitness/styles.css +1 -1
  18. package/dist/css/themes/geography/styles.css +1 -1
  19. package/dist/css/themes/geology/styles.css +1 -1
  20. package/dist/css/themes/health-it/styles.css +1 -1
  21. package/dist/css/themes/history/styles.css +1 -0
  22. package/dist/css/themes/hrs/styles.css +1 -0
  23. package/dist/css/themes/lang/styles.css +1 -0
  24. package/dist/css/themes/math/styles.css +1 -0
  25. package/dist/css/themes/music/styles.css +1 -1
  26. package/dist/css/themes/philosophy/styles.css +1 -1
  27. package/dist/css/themes/soc/styles.css +1 -0
  28. package/dist/css/themes/university/styles.css +1 -1
  29. package/dist/css/themes/vet/styles.css +1 -0
  30. package/dist/css/themes/welding/styles.css +1 -1
  31. package/dist/img/theme-images/history/hisribbonv-02.png +0 -0
  32. package/dist/img/theme-images/img/bouncingball.png +0 -0
  33. package/dist/img/theme-images/vet/bouncingball.jpg +0 -0
  34. package/dist/img/theme-images/vet/bouncingball.png +0 -0
  35. package/dist/js/scripts.js +266 -197
  36. package/dist/js/scripts2.js +32 -0
  37. package/dist/plugins/fancybox/jquery.fancybox.css +5 -5
  38. package/dist/plugins/flashcards/README.md +0 -0
  39. package/dist/plugins/flashcards/config.rb +0 -0
  40. package/dist/plugins/flashcards/css/style.css +5 -5
  41. package/dist/plugins/flashcards/index.html +0 -0
  42. package/dist/plugins/flashcards/js/flash_cards.min.js +0 -0
  43. package/dist/plugins/flashcards/js/plugins/jquery.cycle.js +0 -0
  44. package/dist/plugins/flashcards/js/vendor/jquery-1.7.2.js +0 -0
  45. package/dist/plugins/flashcards/js/vendor/jquery-1.7.2.min.js +0 -0
  46. package/dist/plugins/flashcards/js/vendor/modernizr-2.5.3.min.js +0 -0
  47. package/dist/plugins/flashcards/resources/fonts/flash_cards/flash_cards.eot +0 -0
  48. package/dist/plugins/flashcards/resources/fonts/flash_cards/flash_cards.svg +0 -0
  49. package/dist/plugins/flashcards/resources/fonts/flash_cards/flash_cards.ttf +0 -0
  50. package/dist/plugins/flashcards/resources/fonts/flash_cards/flash_cards.woff +0 -0
  51. package/dist/plugins/global-homepage-overrides/global-homepage-overrides.css +2 -2
  52. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-advising.png +0 -0
  53. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-counseling.png +0 -0
  54. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-research-help.png +0 -0
  55. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-tech-support.png +0 -0
  56. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-testing-center.png +0 -0
  57. package/dist/plugins/global-homepage-overrides/img/quicklinks-icons/ql-tutoring.png +0 -0
  58. package/package.json +6 -12
  59. package/dist/img/theme-images/culinary/concrete-light.png +0 -0
@@ -1,80 +1,94 @@
1
1
  /// @description Main JS file for PimaOnline Themepack
2
2
  /// @dependencies jQuery 3.3.1 or later
3
3
 
4
- window.addEventListener("DOMContentLoaded", function () {
5
-
4
+ window.addEventListener("DOMContentLoaded", () => {
5
+
6
+ const courseBody = document.querySelector("body");
7
+ const contentWrapper = document.querySelector("#content-wrapper");
8
+ const secondColumn = document.querySelector("#second-column");
9
+ const thirdColumn = document.querySelector("#third-column");
10
+ const columnWidget = document.querySelector("#column-widget");
11
+ const videoWrapper = document.querySelector("#video-wrapper");
12
+ const rolePres = document.querySelectorAll('[role="presentation"]');
13
+ const imageGallery = document.querySelector(".image-gallery");
14
+ const vocabListWidget = document.querySelector("dl.vocab-list");
15
+ const vocabTerms = document.querySelectorAll("dl.vocab-list dt");
16
+ const vocabDefs = document.querySelectorAll("dl.vocab-list dd");
17
+ const vocabCloseBtns = document.querySelectorAll("dl.vocab-list button");
18
+ const vocabLists = document.querySelectorAll("dl[class^='vocab-list']");
19
+ const mediaContainers = document.querySelectorAll(".media-container");
20
+ const tabsWidgets = document.querySelectorAll(".tabs");
21
+
6
22
  // Grid
7
- if (document.getElementById("second-column") && document.getElementById("third-column")) {
8
- document.getElementsByTagName("body")[0].id = "three-column";
9
-
10
- } else if (document.getElementById("second-column") && !document.getElementById("column-widget")) {
11
- document.getElementsByTagName("body")[0].id = "two-column";
12
-
13
- } else if (document.getElementById("column-widget")) {
14
- document.getElementsByTagName("body")[0].id = "two-col-widget";
15
-
16
- } else if (document.getElementById("video-wrapper")) {
17
- document.getElementsByTagName("body")[0].id = "video-grid";
18
-
19
- } else {
20
- document.getElementsByTagName("body")[0].id = "one-column";
21
- }
22
-
23
+ const addGrid = () => {
24
+ if (secondColumn && thirdColumn) {
25
+ courseBody.id = "three-column";
26
+ } else if (secondColumn && !columnWidget) {
27
+ courseBody.id = "two-column";
28
+ } else if (columnWidget) {
29
+ courseBody.id = "two-col-widget";
30
+ } else if (videoWrapper) {
31
+ courseBody.id = "video-grid";
32
+ } else {
33
+ courseBody.id = "one-column";
34
+ }
35
+ };
36
+ addGrid();
37
+
23
38
  // JS to add role and aria-label to content-wrapper, second-column, and third-column
24
- let cwAttrib = document.querySelector("#content-wrapper");
25
- cwAttrib.setAttribute("role", "main");
26
-
27
- if (document.querySelector("#second-column")) {
28
- let scAttrib = document.querySelector("#second-column");
29
- scAttrib.setAttribute("role", "region");
30
- scAttrib.setAttribute("aria-label", "second column");
31
- }
32
-
33
- if (document.querySelector("#third-column")) {
34
- let tcAttrib = document.querySelector("#third-column");
35
- tcAttrib.setAttribute("role", "region");
36
- tcAttrib.setAttribute("aria-label", "third column");
37
- }
38
-
39
- // Remove role="presentation" attr
40
- if (document.querySelectorAll('[role="presentation"]')) {
41
- let rolePres = document.querySelectorAll('[role="presentation"]');
42
- rolePres.forEach((roleElem) => roleElem.removeAttribute("role"));
43
- }
44
-
39
+ const addAria = () => {
40
+ contentWrapper.setAttribute("role", "main");
41
+ if (secondColumn) {
42
+ secondColumn.setAttribute("role", "region");
43
+ secondColumn.setAttribute("aria-label", "Second column");
44
+ }
45
+ if (thirdColumn) {
46
+ thirdColumn.setAttribute("role", "region");
47
+ thirdColumn.setAttribute("aria-label", "Third column");
48
+ }
49
+ };
50
+ addAria();
51
+
52
+ // Clean up HTML
53
+ const cleanMarkup = () => {
54
+ // Remove role="presentation" attr from any element that has it
55
+ if (rolePres) {
56
+ rolePres.forEach((roleElem) => roleElem.removeAttribute("role"));
57
+ }
58
+ // Set functino to remove atrributes from elements
59
+ const discardAttributes = (element, ...attributes) => {
60
+ attributes.forEach((attribute) => element.removeAttribute(attribute));
61
+ }
62
+ // Remove attributes from tables
63
+ const tableElems = document.querySelectorAll("table, thead, tbody, tr, th, td");
64
+ tableElems.forEach((elem) => {
65
+ discardAttributes(elem, "cellspacing", "cellpadding", "width", "style");
66
+ });
67
+ };
68
+ cleanMarkup();
69
+
45
70
  // Helper JS for Responsive Tables
46
- function initResponsiveTables() {
47
- var tables = document.querySelectorAll(".display, .display-lg")
48
-
49
- for (var t = 0; t < tables.length; t++) {
50
-
51
- var headertext = [],
52
- headers = tables[t].querySelectorAll(".display table th, table.display th, .display-lg table th, table.display-lg th"),
53
- tablebody = tables[t].querySelector(".display table tbody, table.display tbody, .display-lg table tbody, table.display-lg tbody");
54
-
55
- for (var i = 0; i < headers.length; i++) {
56
- var current = headers[i];
71
+ const initResponsiveTables = () => {
72
+ const tables = document.querySelectorAll(".display, .display-lg")
73
+ for (let table = 0; table < tables.length; table++) {
74
+ let headertext = [],
75
+ headers = tables[table].querySelectorAll(".display table th, table.display th, .display-lg table th, table.display-lg th"),
76
+ tablebody = tables[table].querySelector(".display table tbody, table.display tbody, .display-lg table tbody, table.display-lg tbody");
77
+ for (let header = 0; header < headers.length; header++) {
78
+ let current = headers[header];
57
79
  headertext.push(current.textContent.replace(/\r?\n|\r/, ""));
58
80
  }
59
- for (var y = 0, row; row = tablebody.rows[y]; y++) {
60
- for (var j = 0, col; col = row.cells[j]; j++) {
81
+ for (let y = 0, row; row = tablebody.rows[y]; y++) {
82
+ for (let j = 0, col; col = row.cells[j]; j++) {
61
83
  col.setAttribute("data-th", headertext[j]);
62
84
  }
63
85
  }
64
86
  }
65
87
  }
66
88
  initResponsiveTables();
67
-
68
- // Remove inline CSS from tables
69
- const discardAttributes = (element, ...attributes) =>
70
- attributes.forEach((attribute) => element.removeAttribute(attribute));
71
-
72
- document.querySelectorAll("table, thead, tbody, tr, th, td").forEach((elem) => {
73
- // Function parameters: discardAttributes(element, attribute1, attribute2, attribute3, ...)
74
- discardAttributes(elem, "cellspacing", "cellpadding", "width", "style");
75
- });
76
-
77
- // Append scripts-async.js to DOM
89
+
90
+ // This is called by anchor links via onlick="" in the HTML
91
+ // Added because default anchor links don't work on all browsers using D2L
78
92
  const addScript = (script) => {
79
93
  let newScript = document.createElement("script");
80
94
  newScript.setAttribute("src", script);
@@ -83,159 +97,203 @@ window.addEventListener("DOMContentLoaded", function () {
83
97
  }
84
98
 
85
99
  if(document.querySelector("[onclick]")) {
86
- addScript("https://d2l.pima.edu/shared/webdev/course-files/js/jumpTo.js");
100
+ addScript("https://cdn.jsdelivr.net/npm/@pimaonline/pimaonline-themepack/dist/js/jumpTo.js");
87
101
  }
88
-
102
+
89
103
  // Image gallery
90
- if(document.querySelector(".image-gallery")) {
91
- const modalBox = document.querySelector('.modal-box'),
92
- overlay = document.querySelector('.gallery-overlay'),
93
- imgBoxes = document.querySelectorAll('.image-box'),
94
- modalImg = document.querySelector('.modal-box--image img'),
95
- closeImg = document.querySelector('.close-img');
96
-
97
-
98
- for (let imgBox = 0; imgBox < imgBoxes.length; imgBox++) {
99
- imgBoxes[imgBox].onclick = function () {
100
- modalBox.classList.remove('invisible');
101
-
102
- let imgSrc = this.querySelector('img').src;
103
-
104
- modalImg.src = imgSrc;
105
- }
106
- }
107
-
108
- overlay.onclick = function () {
109
- modalBox.classList.add('invisible');
104
+ const callImageGallery = () => {
105
+ // Create link element with font-awesome cdn and append it to the <head>
106
+ const docHead = document.querySelector("head");
107
+ const fontAwesomeCdn = document.createElement("link");
108
+ fontAwesomeCdn.setAttribute("rel", "stylesheet");
109
+ fontAwesomeCdn.setAttribute("href", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css");
110
+ docHead.appendChild(fontAwesomeCdn);
111
+ // Begin image gallery
112
+ const imgGalleries = document.querySelectorAll(".image-gallery"),
113
+ imgBoxes = document.querySelectorAll(".image-box"),
114
+ modalBoxContent = `<div class="modal-box invisible">
115
+ <div class="gallery-overlay"></div>
116
+ <figure class="modal-box--image"><i class="fa-solid fa-x close-img"></i> <img src="#" alt="image here" /><figcaption class="img-caption"></figcaption></figure>
117
+ </div>
118
+ <button class="hide-gallery">Hide</button>`;
119
+
120
+ // createModalBox.innerHTML = modalBoxContent;
121
+ for (let imgGallery = 0; imgGallery < imgGalleries.length; imgGallery++) {
122
+ imgGalleries[imgGallery].insertAdjacentHTML("afterbegin", modalBoxContent);
110
123
  }
111
-
112
- window.onkeydown = function (esc) {
113
- if (esc.keyCode === 27) {
114
- modalBox.classList.add('invisible');
124
+
125
+ if (document.querySelector(".modal-box")) {
126
+ const overlay = document.querySelector(".gallery-overlay"),
127
+ modalBox = document.querySelector(".modal-box"),
128
+ modalImg = document.querySelector(".modal-box--image img"),
129
+ modalCaption = document.querySelector(".img-caption"),
130
+ closeImg = document.querySelector(".close-img");
131
+
132
+ for (let imgBox = 0; imgBox < imgBoxes.length; imgBox++) {
133
+ imgBoxes[imgBox].onclick = function () {
134
+ modalBox.classList.remove("invisible");
135
+ let imgSrc = this.querySelector("img").src;
136
+ modalImg.src = imgSrc;
137
+ let imgCaption = this.querySelector("img").alt;
138
+ modalCaption.innerHTML = imgCaption;
139
+ }
115
140
  }
116
- }
117
-
118
- closeImg.onclick = function () {
119
- modalBox.classList.add("invisible");
120
- }
121
-
122
- const hideGallery = document.querySelector(".hide-gallery"),
123
- galleryWrapper = document.querySelector(".gallery-wrapper");
124
-
125
- hideGallery.addEventListener("click", () => {
126
- galleryWrapper.classList.toggle("invisible");
127
- });
141
+ overlay.onclick = () => {
142
+ modalBox.classList.add("invisible");
143
+ }
144
+ window.onkeydown = (esc) => {
145
+ if (esc.keyCode === 27) {
146
+ modalBox.classList.add("invisible");
147
+ }
148
+ }
149
+ closeImg.onclick = () => {
150
+ modalBox.classList.add("invisible");
151
+ }
152
+ const hideGalleries = document.querySelectorAll(".hide-gallery");
153
+ for (let hideGallery = 0; hideGallery < hideGalleries.length; hideGallery++) {
154
+ hideGalleries[hideGallery].addEventListener("click", () => {
155
+ hideGalleries[hideGallery].nextElementSibling.classList.toggle("invisible");
156
+ if (hideGalleries[hideGallery].innerHTML === "Hide") {
157
+ hideGalleries[hideGallery].innerHTML = "Show";
158
+ } else {
159
+ hideGalleries[hideGallery].innerHTML = "Hide";
160
+ }
161
+ });
162
+ }
163
+ };
164
+ }
165
+ if (imageGallery) {
166
+ callImageGallery();
128
167
  }
129
-
130
- // Vocab list widget
131
- const vocabListWidget = document.querySelector("dl.vocab-list");
132
- const vocabTerms = document.querySelectorAll("dl.vocab-list dt");
133
- const vocabDefs = document.querySelectorAll("dl.vocab-list dd");
134
168
 
135
- if (vocabListWidget) {
136
- const vocabCloseBtn = document.querySelector("dl.vocab-list button");
137
-
138
- vocabCloseBtn.addEventListener("click", function() {
139
- for (let def = 0; def < vocabDefs.length; def++) {
140
- vocabDefs[def].removeAttribute("style");
141
- }
142
-
143
- for (let term = 0; term < vocabTerms.length; term++) {
144
- vocabTerms[term].removeAttribute("class");
169
+ // Vocab list widget
170
+ const callVocabList = () => {
171
+ if (vocabCloseBtns) {
172
+ for(let btn = 0; btn < vocabCloseBtns.length; btn++) {
173
+ vocabCloseBtns[btn].addEventListener("click", () => {
174
+ for(let node = 0; node < vocabLists[btn].children.length;node++) {
175
+ if(vocabLists[btn].children[node].tagName == "DD") {
176
+ vocabLists[btn].children[node].removeAttribute("style");
177
+ }
178
+ if(vocabLists[btn].children[node].tagName == "DT") {
179
+ vocabLists[btn].children[node].removeAttribute("class");
180
+ }
181
+ }});
145
182
  }
146
- });
147
-
183
+ }
148
184
  for (let activeTerm = 0; activeTerm < vocabTerms.length; activeTerm++) {
149
185
  vocabTerms[activeTerm].addEventListener("click", function() {
150
186
  this.classList.toggle("active");
187
+ let termPanel = this.nextElementSibling;
188
+ if (termPanel.style.display === "block") { termPanel.removeAttribute("style"); }
189
+ else { termPanel.style.display = "block"; }
190
+ });
151
191
 
192
+ vocabTerms[activeTerm].addEventListener("keydown", function(e) {
193
+ if(e.key === "Enter") {
194
+ this.classList.toggle("active");
152
195
  let termPanel = this.nextElementSibling;
153
196
  if (termPanel.style.display === "block") { termPanel.removeAttribute("style"); }
154
197
  else { termPanel.style.display = "block"; }
198
+ }
155
199
  });
156
200
  }
157
201
  }
158
-
159
- //Tabs Widget
160
- const tabsWidgets = document.querySelectorAll(".tabs");
161
-
162
- const callTabsWidget = () => {
163
-
164
- let tabsWidgetsNum = 0;
165
-
166
- tabsWidgets.forEach((tab,index) => {
167
- let tabInputs = tab.querySelectorAll("input")
168
- let tabLabels = tab.querySelectorAll("label")
169
- let tabDivs = tab.querySelectorAll("div")
170
-
171
- let groupNum = index + 1;
172
-
173
- //Add region and aria-label to parent div
174
- tab.setAttribute("role", "region");
175
- tab.setAttribute("aria-label", `tab group ${groupNum}`)
176
-
177
- for(tabIndex = 0; tabIndex < tabInputs.length; tabIndex++) {
178
-
179
- let tabNum = tabsWidgetsNum + 1;
180
-
181
- //Add class, id, name, and aria-described by for inputs
182
- tabInputs[tabIndex].classList.add("tab-input");
183
- tabInputs[tabIndex].setAttribute("type", "radio")
184
- tabInputs[tabIndex].setAttribute("id", `tab${tabNum}`);
185
- tabInputs[tabIndex].setAttribute("name", `hint-group-${groupNum}` )
186
- tabInputs[tabIndex].setAttribute("aria-describedby", `tabHeading${tabNum}`)
187
- //Add class and for for labels
188
- tabLabels[tabIndex].classList.add("tab-header");
189
- tabLabels[tabIndex].setAttribute("for", `tab${tabNum}`)
190
- //Add class, tabindex, and id for divs
191
- tabDivs[tabIndex].classList.add("tab-panel")
192
- tabDivs[tabIndex].setAttribute("tabindex", 0)
193
- tabDivs[tabIndex].setAttribute("id", `tabHeading${tabNum}`)
194
- //Add attributes for hide tab
195
- if(tabIndex + 1 == tabInputs.length) {
196
- tabLabels[tabIndex].classList.add("hide-tab")
197
- tabInputs[tabIndex].checked = true;
198
- tabDivs[tabIndex].classList.add("hide-panel")
202
+ if (vocabListWidget) {callVocabList();}
203
+
204
+ //
205
+ const addMediaContainersAria = () => {
206
+ mediaContainers.forEach((eachContainer, index) => {
207
+ // loopID: find the current index value, convert it to its letter equivalent, then convert to lowercase
208
+ let loopId = String.fromCharCode(index + 65).toLowerCase();
209
+ let mediaObject = eachContainer.querySelector(".media-object");
210
+ let iframe = mediaObject.firstElementChild;
211
+ let mediaInfo = mediaObject.nextElementSibling;
212
+
213
+ // If element DOES NOT have "aria-describedby" && it DOES have a sibling element.
214
+ if (!iframe.hasAttribute("aria-describedby") && mediaInfo != null) {
215
+ iframe.setAttribute("aria-describedby", `${loopId}`);
216
+ mediaInfo.id = `${[loopId]}`;
217
+ }
218
+ });
219
+ }
220
+ if (mediaContainers) {addMediaContainersAria();}
221
+
222
+ //Tabs Widget
223
+ const callTabsWidget = () => {
224
+
225
+ let tabsWidgetsNum = 0;
226
+
227
+ tabsWidgets.forEach((tab,index) => {
228
+ let tabInputs = tab.querySelectorAll("input")
229
+ let tabLabels = tab.querySelectorAll("label")
230
+ let tabDivs = tab.querySelectorAll("div")
231
+
232
+ let groupNum = index + 1;
233
+
234
+ //Add region and aria-label to parent div
235
+ tab.setAttribute("role", "region");
236
+ tab.setAttribute("aria-label", `tab group ${groupNum}`)
237
+
238
+ for(tabIndex = 0; tabIndex < tabInputs.length; tabIndex++) {
239
+
240
+ let tabNum = tabsWidgetsNum + 1;
241
+
242
+ //Add class, id, name, and aria-described by for inputs
243
+ tabInputs[tabIndex].classList.add("tab-input");
244
+ tabInputs[tabIndex].setAttribute("type", "radio")
245
+ tabInputs[tabIndex].setAttribute("id", `tab${tabNum}`);
246
+ tabInputs[tabIndex].setAttribute("name", `hint-group-${groupNum}` )
247
+ tabInputs[tabIndex].setAttribute("aria-describedby", `tabHeading${tabNum}`)
248
+ //Add class and for for labels
249
+ tabLabels[tabIndex].classList.add("tab-header");
250
+ tabLabels[tabIndex].setAttribute("for", `tab${tabNum}`)
251
+ //Add class, tabindex, and id for divs
252
+ tabDivs[tabIndex].classList.add("tab-panel")
253
+ tabDivs[tabIndex].setAttribute("tabindex", 0)
254
+ tabDivs[tabIndex].setAttribute("id", `tabHeading${tabNum}`)
255
+ //Add attributes for hide tab
256
+ if(tabIndex + 1 == tabInputs.length) {
257
+ tabLabels[tabIndex].classList.add("hide-tab")
258
+ tabInputs[tabIndex].checked = true;
259
+ tabDivs[tabIndex].classList.add("hide-panel")
260
+ }
261
+ tabsWidgetsNum++;
199
262
  }
200
- tabsWidgetsNum++;
263
+ })
264
+ }
265
+ if (tabsWidgets) {callTabsWidget();}
266
+
267
+ // Toggle footnotes
268
+ const toggleBtns = document.querySelectorAll(".toggle-btn, .toggle-footnotes");
269
+
270
+ if (document.querySelector(".toggle-btn") || document.querySelector(".toggle-footnotes")) {
271
+ for (let toggleBtn = 0; toggleBtn < toggleBtns.length; toggleBtn++) {
272
+ // Add tabindex
273
+ toggleBtns[toggleBtn].setAttribute("tabindex", "0");
274
+
275
+ // Show/hide on click
276
+ toggleBtns[toggleBtn].addEventListener("click", () => {
277
+ toggleBtns[toggleBtn].nextElementSibling.classList.toggle("show");
278
+ })
279
+
280
+ // Show/hide on enter for users who use tab
281
+ toggleBtns[toggleBtn].addEventListener("keydown", (enter) => {
282
+ if (enter.keyCode === 13) {
283
+ toggleBtns[toggleBtn].nextElementSibling.classList.toggle("show");
284
+ }
285
+ })
201
286
  }
202
- })
203
- }
204
- if (tabsWidgets) {callTabsWidget();}
205
-
206
- // Show/Hide Toggle Button for Accordion
207
- $('.toggle-btn').on('click', function () {
208
- $(this).next().slideToggle(200);
209
- });
210
-
211
- // Show/Hide for Footnotes and Footer
212
- $('.toggle-footnotes').on('click', function () {
213
- $(this).next().slideToggle(200);
214
- $(this).text($(this).text() == '[Hide Footnotes]' ? '[Show Footnotes]' : '[Hide Footnotes]');
215
- });
287
+ }
216
288
 
289
+ // Call function with jQuery scripts
290
+ const callJquery = () => {
217
291
  // Toggle Button's Arrow Right Points Down on Click
218
292
  $('.arrow-right').on('click', function () {
219
293
  $(this).toggleClass('arrow-down');
220
294
  });
221
-
222
- // Fancybox
223
- if (document.querySelector(".fancybox")) {
224
- $("[data-fancybox]").fancybox({
225
- idleTime: false,
226
- topRatio: 0.1,
227
- helpers: {
228
- title: {
229
- type: 'inside'
230
- },
231
- }
232
- });
233
- }
234
-
235
- /*------WIDGET SCRIPTS------ */
236
- /* TOOLTIP ------ */
237
- // Allows Screen readers to toggle a tooltip on click and to say if the tooltip is collapsed or expanded.
238
-
295
+ // TOOLTIP
296
+ // Allows Screen readers to toggle a tooltip on click and to say if the tooltip is collapsed or expanded.
239
297
  $(".tooltip").click(function () {
240
298
  $(this).children(".tip-hover").toggle();
241
299
  if ($(this).children(".tip-hover").is(':visible')) {
@@ -246,13 +304,24 @@ if (tabsWidgets) {callTabsWidget();}
246
304
  $(this).addClass('hidden');
247
305
  }
248
306
  });
249
-
250
- var start = 999;
251
-
307
+ let start = 999;
252
308
  $('.tooltip').each(function (i) {
253
309
  $(this).css('z-index', start--);
254
310
  });
255
-
256
311
  $(".tooltip .video-container").parent().css("width", "450px");
312
+ }
313
+ callJquery();
257
314
 
258
- }); // end Document-ready
315
+ // Fancybox
316
+ if (document.querySelector(".fancybox")) {
317
+ $("[data-fancybox]").fancybox({
318
+ idleTime: false,
319
+ topRatio: 0.1,
320
+ helpers: {
321
+ title: {
322
+ type: 'inside'
323
+ },
324
+ }
325
+ });
326
+ }
327
+ });
@@ -128,6 +128,18 @@ const callImageGallery = () => {
128
128
  let imgCaption = this.querySelector("img").alt;
129
129
  modalCaption.innerHTML = imgCaption;
130
130
  }
131
+
132
+ // Make images tab-able
133
+ imgBoxes[imgBox].setAttribute("tabindex", "0");
134
+ imgBoxes[imgBox].addEventListener("keydown", function (enter) {
135
+ if (enter.key === "Enter") {
136
+ modalBox.classList.remove("invisible");
137
+ let imgSrc = this.querySelector("img").src;
138
+ modalImg.src = imgSrc;
139
+ let imgCaption = this.querySelector("img").alt;
140
+ modalCaption.innerHTML = imgCaption;
141
+ }
142
+ })
131
143
  }
132
144
  overlay.onclick = () => {
133
145
  modalBox.classList.add("invisible");
@@ -137,6 +149,7 @@ const callImageGallery = () => {
137
149
  modalBox.classList.add("invisible");
138
150
  }
139
151
  }
152
+
140
153
  closeImg.onclick = () => {
141
154
  modalBox.classList.add("invisible");
142
155
  }
@@ -277,6 +290,25 @@ if (document.querySelector(".toggle-btn") || document.querySelector(".toggle-foo
277
290
  }
278
291
  }
279
292
 
293
+ // Animated border for HRS theme
294
+ const hrsBorders = document.querySelectorAll(".hrs-border");
295
+
296
+ if(hrsBorders) {
297
+ for (let hrsBorder = 0; hrsBorder < hrsBorders.length; hrsBorder++) {
298
+ const callAnimateBorder = new IntersectionObserver(entries => {
299
+ // Loop over the entries
300
+ entries.forEach(entry => {
301
+ // If the element is visible
302
+ if (entry.isIntersecting) {
303
+ // Add the animation class
304
+ entry.target.classList.add('animate-border');
305
+ }
306
+ });
307
+ });
308
+ callAnimateBorder.observe(hrsBorders[hrsBorder]);
309
+ }
310
+ };
311
+
280
312
  // Call function with jQuery scripts
281
313
  const callJquery = () => {
282
314
  // Toggle Button's Arrow Right Points Down on Click
@@ -41,9 +41,9 @@
41
41
  }
42
42
 
43
43
  .fancybox-opened .fancybox-skin {
44
- -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
45
- -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
46
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
44
+ -webkit-box-shadow: 0 10px 25px rgba(13, 13, 13, 0.5);
45
+ -moz-box-shadow: 0 10px 25px rgba(13, 13, 13, 0.5);
46
+ box-shadow: 0 10px 25px rgba(13, 13, 13, 0.5);
47
47
  }
48
48
 
49
49
  .fancybox-outer, .fancybox-inner {
@@ -227,7 +227,7 @@
227
227
  margin-right: -100%;
228
228
  padding: 2px 20px;
229
229
  background: transparent; /* Fallback for web browsers that doesn't support RGBa */
230
- background: rgba(0, 0, 0, 0.8);
230
+ background: rgba(13, 13, 13, 0.8);
231
231
  -webkit-border-radius: 15px;
232
232
  -moz-border-radius: 15px;
233
233
  border-radius: 15px;
@@ -255,7 +255,7 @@
255
255
  color: #fff;
256
256
  padding: 10px;
257
257
  background: #000;
258
- background: rgba(0, 0, 0, .8);
258
+ background: rgba(13, 13, 13, .8);
259
259
  }
260
260
 
261
261
  /*Retina graphics!*/
File without changes
File without changes
@@ -51,7 +51,7 @@
51
51
  background-color: #fff;
52
52
  background-size: 500px 30px;
53
53
  background-position: 50%;
54
- border: 1px solid rgba(0, 0, 0, .2);
54
+ border: 1px solid rgba(13, 13, 13, .2);
55
55
  height: inherit;
56
56
  position: absolute;
57
57
  -webkit-transition: all 0.4s ease-in-out;
@@ -62,9 +62,9 @@
62
62
  width: inherit;
63
63
  }
64
64
  .current .side_one, .current.flip .side_two {
65
- -webkit-box-shadow: 1px 1px 4px -1px rgba(0, 0, 0, 0.3);
66
- -moz-box-shadow: 1px 1px 4px -1px rgba(0, 0, 0, 0.3);
67
- box-shadow: 1px 1px 4px -1px rgba(0, 0, 0, 0.3);
65
+ -webkit-box-shadow: 1px 1px 4px -1px rgba(13, 13, 13, 0.3);
66
+ -moz-box-shadow: 1px 1px 4px -1px rgba(13, 13, 13, 0.3);
67
+ box-shadow: 1px 1px 4px -1px rgba(13, 13, 13, 0.3);
68
68
  }
69
69
  .current.flip .side_one {
70
70
  -webkit-box-shadow: none;
@@ -146,7 +146,7 @@
146
146
  width: 1px;
147
147
  }
148
148
  #keyboard_shortcuts {
149
- background: rgba(0, 0, 0, 1);
149
+ background: rgba(13, 13, 13, 1);
150
150
  bottom: 0;
151
151
  display: none;
152
152
  left: 0;
File without changes
File without changes
File without changes