@iamproperty/components 3.0.0 → 3.2.0
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/README.md +141 -16
- package/assets/.DS_Store +0 -0
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/email.min.css +1 -1
- package/assets/css/email.min.css.map +1 -1
- package/assets/css/error.min.css +1 -1
- package/assets/css/error.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/favicons/manifest.json +31 -31
- package/assets/js/main.js +57 -57
- package/assets/js/modules/accordion.js +32 -32
- package/assets/js/modules/alert.js +56 -56
- package/assets/js/modules/carousel.js +101 -101
- package/assets/js/modules/chart.js +218 -218
- package/assets/js/modules/drawer.js +15 -15
- package/assets/js/modules/file-upload.js +48 -0
- package/assets/js/modules/form.js +168 -159
- package/assets/js/modules/helpers.js +119 -119
- package/assets/js/modules/modal.js +89 -89
- package/assets/js/modules/nav.js +28 -28
- package/assets/js/modules/orderablelist.js +122 -0
- package/assets/js/modules/table.js +585 -585
- package/assets/js/modules/testimonial.js +82 -82
- package/assets/js/modules/youtubevideo.js +145 -145
- package/assets/js/scripts.bundle.js +256 -242
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +2 -2
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/sass/_components.scss +14 -14
- package/assets/sass/_corefiles.scss +40 -40
- package/assets/sass/_fonts.scss +16 -16
- package/assets/sass/_forms.scss +9 -9
- package/assets/sass/_func.scss +12 -12
- package/assets/sass/_functions/functions.scss +141 -141
- package/assets/sass/_functions/mixins.scss +170 -170
- package/assets/sass/_functions/utilities.scss +143 -250
- package/assets/sass/_functions/variables.scss +467 -467
- package/assets/sass/_print.scss +61 -61
- package/assets/sass/_tests/colours.spec.scss +44 -44
- package/assets/sass/_tests/func.spec.scss +232 -232
- package/assets/sass/_tests/mixins.spec.scss +194 -194
- package/assets/sass/_tests/sass.spec.js +9 -9
- package/assets/sass/_tests/typography.spec.scss +35 -35
- package/assets/sass/components/accordion.scss +197 -197
- package/assets/sass/components/alert.scss +98 -98
- package/assets/sass/components/cardDeck.scss +107 -107
- package/assets/sass/components/carousel.scss +234 -234
- package/assets/sass/components/charts.scss +569 -569
- package/assets/sass/components/drawer.scss +46 -46
- package/assets/sass/components/header.scss +63 -63
- package/assets/sass/components/modal.scss +136 -136
- package/assets/sass/components/nav.scss +960 -918
- package/assets/sass/components/property-searchbar.scss +143 -143
- package/assets/sass/components/snapshot.scss +70 -70
- package/assets/sass/components/stepper.scss +164 -164
- package/assets/sass/components/tabs.scss +87 -87
- package/assets/sass/components/testimonial.scss +132 -132
- package/assets/sass/components/timeline.scss +95 -95
- package/assets/sass/core.scss +6 -6
- package/assets/sass/elements/buttons.scss +251 -209
- package/assets/sass/elements/card.scss +289 -177
- package/assets/sass/elements/container.scss +236 -225
- package/assets/sass/elements/forms.scss +262 -194
- package/assets/sass/elements/links.scss +97 -96
- package/assets/sass/elements/lists.scss +159 -112
- package/assets/sass/elements/panel.scss +161 -161
- package/assets/sass/elements/tables.scss +290 -290
- package/assets/sass/elements/tooltips.scss +84 -84
- package/assets/sass/elements/type.scss +136 -136
- package/assets/sass/email.scss +65 -65
- package/assets/sass/error.scss +4 -4
- package/assets/sass/foundations/brand.scss +76 -72
- package/assets/sass/foundations/circles.scss +74 -74
- package/assets/sass/foundations/icons.scss +80 -72
- package/assets/sass/foundations/media.scss +50 -50
- package/assets/sass/foundations/reboot.scss +130 -130
- package/assets/sass/foundations/root.scss +125 -106
- package/assets/sass/main.scss +7 -7
- package/assets/svg/icons.svg +598 -598
- package/assets/svg/logo.svg +49 -43
- package/assets/ts/main.js +56 -56
- package/assets/ts/main.ts +68 -68
- package/assets/ts/modules/accordion.js +32 -32
- package/assets/ts/modules/accordion.ts +43 -43
- package/dist/components.es.js +393 -379
- package/dist/components.umd.js +16 -16
- package/dist/style.css +1 -1
- package/package.json +96 -108
- package/src/.DS_Store +0 -0
- package/src/components/Accordion/Accordion.screenshot.vue +57 -57
- package/src/components/Accordion/Accordion.spec.js +63 -63
- package/src/components/Accordion/Accordion.vue +22 -22
- package/src/components/Accordion/AccordionItem.vue +52 -52
- package/src/components/Accordion/README.md +34 -34
- package/src/components/Alert/Alert.spec.js +49 -49
- package/src/components/Alert/Alert.vue +39 -39
- package/src/components/Alert/README.md +28 -28
- package/src/components/Banner/Banner.spec.js +28 -28
- package/src/components/Banner/Banner.vue +38 -38
- package/src/components/Banner/README.md +23 -23
- package/src/components/CardDeck/CardDeck.spec.js +99 -99
- package/src/components/CardDeck/CardDeck.vue +77 -77
- package/src/components/CardDeck/README.md +24 -24
- package/src/components/Carousel/Carousel.spec.js +45 -45
- package/src/components/Carousel/Carousel.vue +85 -85
- package/src/components/Carousel/README.md +19 -19
- package/src/components/Chart/Chart.spec.js +201 -201
- package/src/components/Chart/Chart.vue +88 -88
- package/src/components/Chart/README.md +17 -17
- package/src/components/Drawer/Drawer.vue +53 -53
- package/src/components/Drawer/README.md +22 -22
- package/src/components/Header/Header.spec.js +33 -33
- package/src/components/Header/Header.vue +38 -38
- package/src/components/Header/README.md +27 -27
- package/src/components/Modal/Modal.spec.js +22 -22
- package/src/components/Modal/Modal.vue +43 -43
- package/src/components/Modal/README.md +19 -19
- package/src/components/Nav/Nav.spec.js +35 -35
- package/src/components/Nav/Nav.vue +215 -215
- package/src/components/Nav/README.md +22 -22
- package/src/components/NoteFeed/NoteFeed.vue +79 -79
- package/src/components/NoteFeed/README.md +16 -16
- package/src/components/PropertySearchbar/PropertySearchbar.vue +204 -204
- package/src/components/PropertySearchbar/README.md +25 -25
- package/src/components/Snapshot/README.md +20 -20
- package/src/components/Snapshot/Snapshot.vue +32 -32
- package/src/components/Stepper/README.md +32 -32
- package/src/components/Stepper/Step.vue +28 -28
- package/src/components/Stepper/Stepper.spec.js +99 -99
- package/src/components/Stepper/Stepper.vue +33 -33
- package/src/components/Tabs/README.md +27 -27
- package/src/components/Tabs/Tab.vue +32 -32
- package/src/components/Tabs/Tabs.vue +77 -77
- package/src/components/Testimonial/README.md +25 -25
- package/src/components/Testimonial/Testimonial.spec.js +57 -57
- package/src/components/Testimonial/Testimonial.vue +60 -60
- package/src/components/Timeline/README.md +18 -18
- package/src/components/Timeline/Timeline.spec.js +17 -17
- package/src/components/Timeline/Timeline.vue +24 -24
- package/src/elements/Card/Card.vue +122 -113
- package/src/elements/Card/README.md +24 -24
- package/src/elements/FileUploads/FileUploads.vue +48 -48
- package/src/elements/FileUploads/README.md +24 -24
- package/src/elements/Input/Input.vue +272 -268
- package/src/elements/Input/README.md +19 -19
- package/src/elements/Table/README.md +62 -62
- package/src/elements/Table/Table.spec.js +90 -90
- package/src/elements/Table/Table.vue +129 -129
- package/src/foundations/Icon/Icon.spec.js +24 -24
- package/src/foundations/Icon/Icon.vue +24 -24
- package/src/foundations/Icon/README.md +11 -11
- package/src/foundations/Logo/Logo.spec.js +56 -56
- package/src/foundations/Logo/Logo.vue +39 -39
- package/src/foundations/Logo/README.md +20 -20
- package/src/foundations/YoutubeVideo/README.md +11 -11
- package/src/foundations/YoutubeVideo/YoutubeVideo.vue +24 -24
- package/src/helpers/strings.js +12 -12
- package/src/index.js +27 -27
- package/src/vue-shim.d.ts +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Bootstrap v3.
|
|
2
|
+
* Bootstrap v3.2.0
|
|
3
3
|
* Copyright 2011-2022 [object Object]
|
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
5
|
*/
|
|
@@ -8,29 +8,27 @@
|
|
|
8
8
|
factory();
|
|
9
9
|
})((function () { 'use strict';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Global helper functions to help maintain and enhance framework elements.
|
|
13
|
-
* @module Helpers
|
|
11
|
+
/**
|
|
12
|
+
* Global helper functions to help maintain and enhance framework elements.
|
|
13
|
+
* @module Helpers
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Add global classes used by the CSS and later JavaScript.
|
|
18
|
-
* @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
|
|
16
|
+
/**
|
|
17
|
+
* Add global classes used by the CSS and later JavaScript.
|
|
18
|
+
* @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
|
|
19
19
|
*/
|
|
20
20
|
var addBodyClasses = body => {
|
|
21
21
|
body.classList.add("js-enabled");
|
|
22
|
-
|
|
23
22
|
if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
|
|
24
23
|
body.classList.add("ie");
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
return null;
|
|
28
26
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Add global events.
|
|
31
|
-
* @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
|
|
32
|
-
*/
|
|
33
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Add global events.
|
|
30
|
+
* @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
|
|
31
|
+
*/
|
|
34
32
|
var addGlobalEvents = body => {
|
|
35
33
|
window.addEventListener('hashchange', function () {
|
|
36
34
|
var hash = location.hash.replace('#', '');
|
|
@@ -40,11 +38,11 @@
|
|
|
40
38
|
}, false);
|
|
41
39
|
return null;
|
|
42
40
|
};
|
|
43
|
-
/**
|
|
44
|
-
* Check if an element contains certain elements that needs enhancing with the JavaScript helpers, it is recommended to do this on the page body after the dom is loaded. Elements that are loaded via ajax should also run this function.
|
|
45
|
-
* @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
|
|
46
|
-
*/
|
|
47
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Check if an element contains certain elements that needs enhancing with the JavaScript helpers, it is recommended to do this on the page body after the dom is loaded. Elements that are loaded via ajax should also run this function.
|
|
44
|
+
* @param {HTMLElement} element Dom element, this doesn't have to be the body but it is recommended.
|
|
45
|
+
*/
|
|
48
46
|
var checkElements = element => {
|
|
49
47
|
// Tables
|
|
50
48
|
Array.from(element.querySelectorAll('table')).forEach((table, index) => {
|
|
@@ -52,22 +50,22 @@
|
|
|
52
50
|
tableWrap(table);
|
|
53
51
|
});
|
|
54
52
|
};
|
|
55
|
-
/**
|
|
56
|
-
* Wrap tables with a table wrapper div to help maintain its responsive design.
|
|
57
|
-
* @param {HTMLElement} table Dom table element
|
|
58
|
-
*/
|
|
59
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Wrap tables with a table wrapper div to help maintain its responsive design.
|
|
56
|
+
* @param {HTMLElement} table Dom table element
|
|
57
|
+
*/
|
|
60
58
|
var tableWrap = table => {
|
|
61
59
|
if (!table.parentNode.classList.contains('table__wrapper')) {
|
|
62
60
|
var tableHTML = table.outerHTML;
|
|
63
61
|
table.outerHTML = "<div class=\"table__wrapper\">".concat(tableHTML, "</div>");
|
|
64
62
|
}
|
|
65
63
|
};
|
|
66
|
-
/**
|
|
67
|
-
* Creates data attributes to be used by the CSS for mobile views.
|
|
68
|
-
* @param {HTMLElement} table Dom table element
|
|
69
|
-
*/
|
|
70
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Creates data attributes to be used by the CSS for mobile views.
|
|
67
|
+
* @param {HTMLElement} table Dom table element
|
|
68
|
+
*/
|
|
71
69
|
var tableStacked = table => {
|
|
72
70
|
var colHeadings = Array.from(table.querySelectorAll('thead th'));
|
|
73
71
|
var colRows = Array.from(table.querySelectorAll('tbody tr'));
|
|
@@ -75,7 +73,6 @@
|
|
|
75
73
|
var cells = Array.from(row.querySelectorAll('th, td'));
|
|
76
74
|
cells.forEach((cell, cellIndex) => {
|
|
77
75
|
var heading = colHeadings[cellIndex];
|
|
78
|
-
|
|
79
76
|
if (typeof heading != "undefined") {
|
|
80
77
|
var tempDiv = document.createElement("div");
|
|
81
78
|
tempDiv.innerHTML = heading.innerHTML;
|
|
@@ -87,10 +84,11 @@
|
|
|
87
84
|
};
|
|
88
85
|
var isNumeric = function isNumeric(str) {
|
|
89
86
|
if (typeof str != "string") return false; // we only process strings!
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
return !isNaN(str) &&
|
|
88
|
+
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...
|
|
92
89
|
!isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
|
|
93
90
|
};
|
|
91
|
+
|
|
94
92
|
var zeroPad = (num, places) => String(num).padStart(places, '0');
|
|
95
93
|
|
|
96
94
|
var navbar = element => {
|
|
@@ -102,7 +100,6 @@
|
|
|
102
100
|
if (window.matchMedia('(min-width: 62em)').matches) detail.removeAttribute('open');
|
|
103
101
|
}, false);
|
|
104
102
|
});
|
|
105
|
-
|
|
106
103
|
if ('IntersectionObserver' in window) {
|
|
107
104
|
var observer = new IntersectionObserver(_ref => {
|
|
108
105
|
var [e] = _ref;
|
|
@@ -123,10 +120,10 @@
|
|
|
123
120
|
var filteredEvent = new Event('filtered');
|
|
124
121
|
var reorderedEvent = new Event('reordered');
|
|
125
122
|
var randID = 'table_' + Math.random().toString(36).substr(2, 9); // Random to make sure IDs created are unique
|
|
126
|
-
|
|
127
123
|
var draggedRow;
|
|
128
|
-
tableElement.setAttribute('id', randID);
|
|
124
|
+
tableElement.setAttribute('id', randID);
|
|
129
125
|
|
|
126
|
+
// #region Sortable
|
|
130
127
|
var sortTable = function sortTable(sortBy, sort) {
|
|
131
128
|
// Create an array from the table rows, the index created is then used to sort the array
|
|
132
129
|
var tableArr = [];
|
|
@@ -138,37 +135,45 @@
|
|
|
138
135
|
row: tableRow
|
|
139
136
|
};
|
|
140
137
|
tableArr.push(dataRow);
|
|
141
|
-
});
|
|
138
|
+
});
|
|
142
139
|
|
|
143
|
-
|
|
140
|
+
// Sort array
|
|
141
|
+
tableArr.sort((a, b) => a.index > b.index ? 1 : -1);
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
// Reverse if descending
|
|
144
|
+
if (sort == "descending") tableArr = tableArr.reverse();
|
|
146
145
|
|
|
146
|
+
// Create a string to return and populate the tbody
|
|
147
147
|
var strTbody = '';
|
|
148
148
|
tableArr.forEach((tableRow, index) => {
|
|
149
149
|
strTbody += tableRow.row.outerHTML;
|
|
150
150
|
});
|
|
151
|
-
tbody.innerHTML = strTbody;
|
|
151
|
+
tbody.innerHTML = strTbody;
|
|
152
152
|
|
|
153
|
+
// Dispatch the sortable event
|
|
153
154
|
tableElement.dispatchEvent(sortedEvent);
|
|
154
|
-
};
|
|
155
|
-
|
|
155
|
+
};
|
|
156
156
|
|
|
157
|
+
// Declare event handlers
|
|
157
158
|
tableElement.addEventListener('click', function (e) {
|
|
158
159
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
159
160
|
if (target.matches('[data-sortable]')) {
|
|
160
161
|
// Get current sort order
|
|
161
|
-
var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending";
|
|
162
|
+
var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending";
|
|
162
163
|
|
|
164
|
+
// unset sort attributes
|
|
163
165
|
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
|
|
164
166
|
col.setAttribute('aria-sort', 'none');
|
|
165
|
-
});
|
|
167
|
+
});
|
|
166
168
|
|
|
167
|
-
|
|
169
|
+
// Set the sort order attribute
|
|
170
|
+
target.setAttribute('aria-sort', sort);
|
|
168
171
|
|
|
172
|
+
// Save the sort options on the table element so that it can be re-sorted later
|
|
169
173
|
tableElement.setAttribute('data-sort', sort);
|
|
170
|
-
tableElement.setAttribute('data-sortBy', target.textContent);
|
|
174
|
+
tableElement.setAttribute('data-sortBy', target.textContent);
|
|
171
175
|
|
|
176
|
+
// Sort the table
|
|
172
177
|
sortTable(target.textContent, sort);
|
|
173
178
|
Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach((tableRow, index) => {
|
|
174
179
|
tableRow.removeAttribute('draggable');
|
|
@@ -176,8 +181,9 @@
|
|
|
176
181
|
break;
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
|
-
}, false);
|
|
184
|
+
}, false);
|
|
180
185
|
|
|
186
|
+
// On page load check if the table should be pre-sorted, if so trigger a click
|
|
181
187
|
if (tableElement.getAttribute('data-sortBy')) {
|
|
182
188
|
var sort = tableElement.getAttribute('data-sort') == "ascending" ? "descending" : "ascending";
|
|
183
189
|
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
|
|
@@ -186,36 +192,39 @@
|
|
|
186
192
|
col.click();
|
|
187
193
|
}
|
|
188
194
|
});
|
|
189
|
-
}
|
|
190
|
-
// #region Filters
|
|
195
|
+
}
|
|
191
196
|
|
|
197
|
+
// #endregion Sortable
|
|
192
198
|
|
|
199
|
+
// #region Filters
|
|
193
200
|
var createFilterForm = function createFilterForm(count) {
|
|
194
201
|
// Create wrapper div
|
|
195
202
|
var form = document.createElement("div");
|
|
196
203
|
form.classList.add('table__filters');
|
|
197
204
|
form.classList.add('row');
|
|
198
205
|
form.classList.add('pt-1');
|
|
199
|
-
form.classList.add('pb-3');
|
|
206
|
+
form.classList.add('pb-3');
|
|
200
207
|
|
|
201
|
-
|
|
208
|
+
// Create the filter options array
|
|
209
|
+
var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]'));
|
|
202
210
|
|
|
211
|
+
// Populate a list of searchable terms from the cells of the columns that could be used as a filter
|
|
203
212
|
var searchableTerms = {};
|
|
204
213
|
filterColumns.forEach((columnHeading, index) => {
|
|
205
214
|
Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach((label, index) => {
|
|
206
215
|
searchableTerms[label.textContent] = label.textContent;
|
|
207
216
|
});
|
|
208
|
-
});
|
|
217
|
+
});
|
|
209
218
|
|
|
219
|
+
// Create the form
|
|
210
220
|
var filterTitle = filterColumns.length == 1 ? "Filter by " + filterColumns[0].textContent : "Filter"; // Update title if only one filter is chosen
|
|
211
|
-
|
|
212
221
|
var checkboxClass = filterColumns.length == 1 ? "d-none" : "d-sm-flex"; // Hide controls when only one filter is chosen
|
|
213
222
|
|
|
214
|
-
form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>");
|
|
223
|
+
form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>");
|
|
215
224
|
|
|
225
|
+
// Add before the actual table
|
|
216
226
|
tableElement.prepend(form);
|
|
217
227
|
};
|
|
218
|
-
|
|
219
228
|
var filterTable = function filterTable(searchTerm) {
|
|
220
229
|
// Create an array of rows that match the search term
|
|
221
230
|
var tableArr = [];
|
|
@@ -224,48 +233,53 @@
|
|
|
224
233
|
var rowSearchString = '';
|
|
225
234
|
Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
|
|
226
235
|
rowSearchString += tableRow.querySelector('td[data-label="' + label.textContent + '"]').textContent + ' | ';
|
|
227
|
-
});
|
|
236
|
+
});
|
|
228
237
|
|
|
238
|
+
// Check if the table row search string contains the search term
|
|
229
239
|
if (rowSearchString.indexOf(searchTerm) >= 0) {
|
|
230
240
|
var dataRow = {
|
|
231
241
|
row: tableRow
|
|
232
242
|
};
|
|
233
243
|
tableArr.push(dataRow);
|
|
234
244
|
}
|
|
235
|
-
});
|
|
245
|
+
});
|
|
236
246
|
|
|
247
|
+
// Create a string to return and populate the tbody
|
|
237
248
|
var strTbody = '';
|
|
238
249
|
tableArr.forEach((tableRow, index) => {
|
|
239
250
|
strTbody += tableRow.row.outerHTML;
|
|
240
251
|
});
|
|
241
|
-
tbody.innerHTML = strTbody;
|
|
252
|
+
tbody.innerHTML = strTbody;
|
|
242
253
|
|
|
254
|
+
// Dispatch the filter event.
|
|
243
255
|
tableElement.dispatchEvent(filteredEvent);
|
|
244
256
|
};
|
|
245
|
-
|
|
246
257
|
var createFilterList = function createFilterList() {
|
|
247
258
|
// Check which options are checked
|
|
248
259
|
var filterOptions = [];
|
|
249
260
|
Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
|
|
250
261
|
filterOptions.push(label.textContent);
|
|
251
|
-
});
|
|
262
|
+
});
|
|
252
263
|
|
|
264
|
+
// Build up the list of searchable terms
|
|
253
265
|
var searchableTerms = [];
|
|
254
266
|
filterOptions.forEach((option, index) => {
|
|
255
267
|
Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach((label, index) => {
|
|
256
268
|
searchableTerms[label.textContent] = label.textContent;
|
|
257
269
|
});
|
|
258
|
-
});
|
|
270
|
+
});
|
|
259
271
|
|
|
272
|
+
// Rebuild the list
|
|
260
273
|
var dataList = tableElement.querySelector('datalist');
|
|
261
274
|
dataList.innerHTML = Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join("");
|
|
262
|
-
};
|
|
263
|
-
|
|
275
|
+
};
|
|
264
276
|
|
|
277
|
+
// On page load check if filters are needed
|
|
265
278
|
if (Array.from(tableElement.querySelectorAll('[data-filterable]')).length) {
|
|
266
279
|
// Create the filter options
|
|
267
|
-
createFilterForm(tableElement, Array.from(tableElement.querySelectorAll('[data-filterable]')).length);
|
|
280
|
+
createFilterForm(tableElement, Array.from(tableElement.querySelectorAll('[data-filterable]')).length);
|
|
268
281
|
|
|
282
|
+
// Add event handlers for the filter options
|
|
269
283
|
tableElement.addEventListener('keyup', function (e) {
|
|
270
284
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
271
285
|
if (target.matches('input[type="search"]')) {
|
|
@@ -291,31 +305,28 @@
|
|
|
291
305
|
}
|
|
292
306
|
}
|
|
293
307
|
});
|
|
294
|
-
}
|
|
295
|
-
// #
|
|
296
|
-
|
|
308
|
+
}
|
|
309
|
+
// #endregion Filters
|
|
297
310
|
|
|
311
|
+
// #region Pagination
|
|
298
312
|
var paginateRows = function paginateRows(show, page) {
|
|
299
313
|
// Create some inline CSS to control what is viewed on the table, unline the filters we are just hiding the rable rows not removing them from the DOM.
|
|
300
314
|
var style = document.getElementById(randID + '_style');
|
|
301
|
-
|
|
302
315
|
if (style == null) {
|
|
303
316
|
style = document.createElement("style");
|
|
304
317
|
style.setAttribute('id', randID + '_style');
|
|
305
318
|
}
|
|
306
|
-
|
|
307
319
|
var startShowing = show * (page - 1) + 1;
|
|
308
320
|
var stopShowing = show * page;
|
|
309
321
|
style.innerHTML = "\n #".concat(randID, " tbody tr {\n display: none;\n }\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: block;\n }\n @media screen and (min-width: 36em) {\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, "),\n #").concat(randID, " tbody tr:nth-child(").concat(startShowing, ") ~ tr{\n display: table-row;\n }\n }\n #").concat(randID, " tbody tr:nth-child(").concat(stopShowing, ") ~ tr{\n display: none;\n }\n ");
|
|
310
322
|
tableElement.append(style);
|
|
311
|
-
};
|
|
312
|
-
|
|
323
|
+
};
|
|
313
324
|
|
|
325
|
+
// On page load check if the table should be paginated
|
|
314
326
|
if (tableElement.getAttribute('data-show')) {
|
|
315
327
|
var show = parseInt(tableElement.getAttribute('data-show'));
|
|
316
328
|
var page = parseInt(tableElement.getAttribute('data-page')) ? parseInt(tableElement.getAttribute('data-page')) : 1;
|
|
317
329
|
var totalRows = tableElement.querySelectorAll('tbody tr').length;
|
|
318
|
-
|
|
319
330
|
if (show < totalRows) {
|
|
320
331
|
paginateRows(show, page);
|
|
321
332
|
createPaginationForm(randID, tableElement, show, page, totalRows);
|
|
@@ -346,18 +357,18 @@
|
|
|
346
357
|
}
|
|
347
358
|
});
|
|
348
359
|
}
|
|
349
|
-
}
|
|
360
|
+
}
|
|
361
|
+
// #endregion Pagination
|
|
362
|
+
|
|
350
363
|
// #region Reorderable
|
|
351
364
|
// Set the row thats being dragged and copy the row
|
|
352
|
-
|
|
353
|
-
|
|
354
365
|
function setDraggedRow(e) {
|
|
355
366
|
e.dataTransfer.setData("text/plain", e.target.id);
|
|
356
367
|
draggedRow = e.target;
|
|
357
368
|
e.target.classList.add('tr--dragging');
|
|
358
|
-
}
|
|
359
|
-
|
|
369
|
+
}
|
|
360
370
|
|
|
371
|
+
// Create the order column and event handler for rows
|
|
361
372
|
var setReorderRows = function setReorderRows() {
|
|
362
373
|
Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
|
|
363
374
|
// Create column if not already created
|
|
@@ -366,16 +377,15 @@
|
|
|
366
377
|
orderColumn.innerHTML = index + 1;
|
|
367
378
|
orderColumn.setAttribute('data-label', 'Order');
|
|
368
379
|
tableRow.prepend(orderColumn);
|
|
369
|
-
}
|
|
370
|
-
|
|
380
|
+
}
|
|
371
381
|
|
|
382
|
+
// Make draggable
|
|
372
383
|
tableRow.setAttribute('id', randID + '_row_' + (index + 1));
|
|
373
384
|
tableRow.setAttribute('data-order', index + 1);
|
|
374
385
|
tableRow.setAttribute('draggable', 'true');
|
|
375
386
|
tableRow.addEventListener("dragstart", setDraggedRow);
|
|
376
387
|
});
|
|
377
388
|
};
|
|
378
|
-
|
|
379
389
|
if (tableElement.getAttribute('data-reorder') && tableElement.getAttribute('data-reorder') != "false") {
|
|
380
390
|
// Add column heading
|
|
381
391
|
var orderHeading = document.createElement('th');
|
|
@@ -383,19 +393,22 @@
|
|
|
383
393
|
orderHeading.title = 'Click here to enable re-ordering via drag and drop';
|
|
384
394
|
orderHeading.classList.add('table-order-reset');
|
|
385
395
|
thead.querySelector('tr').prepend(orderHeading);
|
|
386
|
-
setReorderRows();
|
|
396
|
+
setReorderRows();
|
|
387
397
|
|
|
398
|
+
// Reset order button
|
|
388
399
|
tableElement.addEventListener('click', function (e) {
|
|
389
400
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
390
401
|
if (target.matches('.table-order-reset')) {
|
|
391
402
|
// unset sort attributes
|
|
392
403
|
Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
|
|
393
404
|
col.setAttribute('aria-sort', 'none');
|
|
394
|
-
});
|
|
405
|
+
});
|
|
395
406
|
|
|
407
|
+
// Save the sort options on the table element so that it can be re-sorted later
|
|
396
408
|
tableElement.removeAttribute('data-sort');
|
|
397
|
-
tableElement.removeAttribute('data-sortBy');
|
|
409
|
+
tableElement.removeAttribute('data-sortBy');
|
|
398
410
|
|
|
411
|
+
// Sort the table
|
|
399
412
|
sortTable('Order', 'ascending');
|
|
400
413
|
Array.from(tableElement.querySelectorAll('tbody tr')).forEach((tableRow, index) => {
|
|
401
414
|
tableRow.setAttribute('draggable', 'true');
|
|
@@ -412,7 +425,6 @@
|
|
|
412
425
|
// prevent default to allow drop
|
|
413
426
|
e.preventDefault();
|
|
414
427
|
e.dataTransfer.dropEffect = "move";
|
|
415
|
-
|
|
416
428
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
417
429
|
if (target.matches('[data-reorder] tbody tr')) {
|
|
418
430
|
target.classList.add('tr--dropable');
|
|
@@ -422,7 +434,6 @@
|
|
|
422
434
|
document.addEventListener("dragleave", function (e) {
|
|
423
435
|
// prevent default to allow drop
|
|
424
436
|
e.preventDefault();
|
|
425
|
-
|
|
426
437
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
427
438
|
if (target.matches('[data-reorder] tbody tr')) {
|
|
428
439
|
target.classList.remove('tr--dropable');
|
|
@@ -431,13 +442,13 @@
|
|
|
431
442
|
}, false);
|
|
432
443
|
document.addEventListener("drop", function (e) {
|
|
433
444
|
e.preventDefault();
|
|
434
|
-
|
|
435
445
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
436
446
|
if (target.matches('[data-reorder] tbody tr')) {
|
|
437
447
|
if (target.parentNode != null && draggedRow.parentNode != null && target != draggedRow) {
|
|
438
448
|
draggedRow.parentNode.removeChild(draggedRow);
|
|
439
|
-
if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling);
|
|
449
|
+
if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling);
|
|
440
450
|
|
|
451
|
+
// Re label the rows
|
|
441
452
|
Array.from(tbody.querySelectorAll('tr')).forEach((tableRowOrder, index) => {
|
|
442
453
|
tableRowOrder.classList.remove('tr--dragging');
|
|
443
454
|
tableRowOrder.classList.remove('tr--dropable');
|
|
@@ -446,32 +457,27 @@
|
|
|
446
457
|
});
|
|
447
458
|
tableElement.dispatchEvent(reorderedEvent);
|
|
448
459
|
}
|
|
449
|
-
|
|
450
460
|
break;
|
|
451
461
|
}
|
|
452
462
|
}
|
|
453
463
|
}, false);
|
|
454
|
-
}
|
|
455
|
-
//
|
|
456
|
-
|
|
464
|
+
}
|
|
465
|
+
// #endregion Reorderable
|
|
457
466
|
|
|
467
|
+
// Watch for the filterable event and re-sort the tbody
|
|
458
468
|
tableElement.addEventListener('filtered', function (e) {
|
|
459
469
|
if (tableElement.getAttribute('data-sortBy') && tableElement.getAttribute('data-sort')) sortTable(tableElement.getAttribute('data-sortBy'), tableElement.getAttribute('data-sort'));
|
|
460
|
-
|
|
461
470
|
if (tableElement.getAttribute('data-show')) {
|
|
462
471
|
var _show = parseInt(tableElement.getAttribute('data-show'));
|
|
463
|
-
|
|
464
472
|
var _totalRows = tableElement.querySelectorAll('tbody tr').length;
|
|
465
473
|
var tablePagination = tableElement.querySelector('.table__pagination');
|
|
466
474
|
if (tablePagination != null) tablePagination.remove();
|
|
467
|
-
|
|
468
475
|
if (_show < _totalRows) {
|
|
469
476
|
paginateRows(_show, 1);
|
|
470
477
|
createPaginationForm(randID, tableElement, _show, 1, _totalRows);
|
|
471
478
|
createPaginationButttons(randID, tableElement, _show, 1, _totalRows);
|
|
472
479
|
}
|
|
473
480
|
}
|
|
474
|
-
|
|
475
481
|
if (tableElement.getAttribute('data-reorder')) {
|
|
476
482
|
setReorderRows();
|
|
477
483
|
}
|
|
@@ -491,90 +497,89 @@
|
|
|
491
497
|
table(newTable);
|
|
492
498
|
}, false);
|
|
493
499
|
}
|
|
494
|
-
|
|
495
500
|
var createPaginationForm = function createPaginationForm(randID, tableElement, show, page, totalRows) {
|
|
496
501
|
var form = document.createElement("div");
|
|
497
502
|
form.classList.add('table__pagination');
|
|
498
503
|
form.classList.add('row');
|
|
499
504
|
form.classList.add('pt-3');
|
|
500
|
-
form.classList.add('pb-3');
|
|
505
|
+
form.classList.add('pb-3');
|
|
501
506
|
|
|
502
|
-
|
|
507
|
+
// Create the form and create a container div to hold the pagination buttons
|
|
508
|
+
form.innerHTML = "<div class=\"col mw-fit-content mb-3\">\n<div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_showing\" class=\"form-label\">Showing:</label>\n <input type=\"number\" name=\"").concat(randID, "_showing\" id=\"").concat(randID, "_showing\" class=\"form-control form-control-sm showing-input-field\" placeholder=\"\" list=\"").concat(randID, "_pagination\" value=\"").concat(show, "\" min=\"1\" max=\"").concat(totalRows, "\" />\n</div>\n<datalist id=\"").concat(randID, "_pagination\">\n<option value=\"5\">5</option>\n").concat(totalRows > 10 ? "<option value=\"10\">10</option>" : '', "\n").concat(totalRows > 20 ? "<option value=\"20\">20</option>" : '', "\n<option value=\"").concat(totalRows, "\">").concat(totalRows, "</option>\n</datalist>\n</div>\n<div class=\"col mw-fit-content me-auto d-flex align-items-center mb-3\"><span class=\"label\">per page</span></div>\n<div class=\"col mw-fit-content d-sm-flex justify-content-end align-items-center\" id=\"").concat(randID, "_paginationBtns\"></div>");
|
|
503
509
|
|
|
510
|
+
// Add after the actual table
|
|
504
511
|
tableElement.append(form);
|
|
505
512
|
};
|
|
506
513
|
var createPaginationButttons = function createPaginationButttons(randID, tableElement, show, page, totalRows) {
|
|
507
514
|
var paginationButtonsWrapper = document.getElementById(randID + '_paginationBtns');
|
|
508
515
|
if (paginationButtonsWrapper == null) return false;
|
|
509
516
|
var numberPages = Math.ceil(totalRows / show);
|
|
510
|
-
|
|
511
517
|
if (numberPages == 1) {
|
|
512
518
|
// Remore the buttons or dont display any if we dont need them
|
|
513
519
|
paginationButtonsWrapper.innerHTML = '';
|
|
514
520
|
} else if (numberPages < 5) {
|
|
515
521
|
// If less than 5 pages (which fits comfortably on mobile) we display buttons
|
|
516
|
-
var strButtons = '';
|
|
517
522
|
|
|
523
|
+
var strButtons = '';
|
|
518
524
|
for (var i = 1; i <= numberPages; i++) {
|
|
519
525
|
if (i == page) strButtons += "<li class=\"page-item active\" aria-current=\"page\"><span class=\"page-link\">".concat(i, "</span></li>");else strButtons += "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(i, "\">").concat(i, "</button></li>");
|
|
520
526
|
}
|
|
521
|
-
|
|
522
527
|
paginationButtonsWrapper.innerHTML = "<span class=\"pe-2 mb-3\">Page: </span><ul class=\"pagination mb-3\">\n ".concat(page == 1 ? "<li class=\"page-item disabled\"><span class=\"page-link\">Previous</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) - 1, "\">Previous</button></li>"), "\n ").concat(strButtons, "\n ").concat(page == numberPages ? "<li class=\"page-item disabled\"><span class=\"page-link\">Next</span></li>" : "<li class=\"page-item\"><button class=\"page-link\" data-page=\"".concat(parseInt(page) + 1, "\">Next</button></li>"), "\n </ul>");
|
|
523
528
|
} else {
|
|
524
529
|
// If more than 5 lets show a select field instead so that we dont have loads and loads of buttons
|
|
525
|
-
var strOptions = '';
|
|
526
530
|
|
|
531
|
+
var strOptions = '';
|
|
527
532
|
for (var _i = 1; _i <= numberPages; _i++) {
|
|
528
533
|
if (_i == page) strOptions += "<option value=\"".concat(_i, "\" selected>Page ").concat(_i, "</option>");else strOptions += "<option value=\"".concat(_i, "\">Page ").concat(_i, "</option>");
|
|
529
534
|
}
|
|
530
|
-
|
|
531
535
|
paginationButtonsWrapper.innerHTML = "\n<div class=\"form-control__wrapper page-number mb-2\">\n<select class=\"form-select\">\n".concat(strOptions, "\n</select>\n</div>\n ");
|
|
532
536
|
}
|
|
533
537
|
};
|
|
534
538
|
|
|
535
|
-
function accordion(accordionElement) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
539
|
+
function accordion(accordionElement) {
|
|
540
|
+
// Fetch all the details element.
|
|
541
|
+
if (!accordionElement.classList.contains('accordion--keep-open')) {
|
|
542
|
+
var details = accordionElement.querySelectorAll(":scope > details");
|
|
543
|
+
// Add the onclick listeners.
|
|
544
|
+
details.forEach(targetDetail => {
|
|
545
|
+
targetDetail.addEventListener("click", () => {
|
|
546
|
+
// Close all the details that are not targetDetail.
|
|
547
|
+
details.forEach(detail => {
|
|
548
|
+
if (detail !== targetDetail) {
|
|
549
|
+
detail.removeAttribute("open");
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
if (window.location.hash && document.querySelector(window.location.hash + ':not([open]) summary')) {
|
|
556
|
+
var detail = document.querySelector(window.location.hash + ' summary');
|
|
557
|
+
if (detail instanceof HTMLElement) {
|
|
558
|
+
detail.click();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
window.addEventListener('hashchange', function () {
|
|
562
|
+
if (window.location.hash && document.querySelector(window.location.hash + ' summary')) {
|
|
563
|
+
var _detail = document.querySelector(window.location.hash + ' summary');
|
|
564
|
+
if (_detail instanceof HTMLElement) {
|
|
565
|
+
_detail.click();
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
});
|
|
565
569
|
}
|
|
566
570
|
|
|
567
571
|
function testimonial(testimonialElement) {
|
|
568
572
|
var scrollTimeout;
|
|
569
573
|
var imagesCarousel = testimonialElement.querySelector('.testimonial__images');
|
|
570
|
-
var itemCount = imagesCarousel.querySelectorAll('img').length;
|
|
574
|
+
var itemCount = imagesCarousel.querySelectorAll('img').length;
|
|
571
575
|
|
|
576
|
+
// If we only have 1 item lets not bother doing anything else
|
|
572
577
|
if (itemCount == 1) {
|
|
573
578
|
return false;
|
|
574
579
|
}
|
|
580
|
+
testimonialElement.classList.add('testimonial--multi');
|
|
575
581
|
|
|
576
|
-
|
|
577
|
-
|
|
582
|
+
// Set where the buttons go to
|
|
578
583
|
var setButtons = function setButtons(scrollTo) {
|
|
579
584
|
var nextButton = testimonialElement.querySelector('.btn-next');
|
|
580
585
|
var prevButton = testimonialElement.querySelector('.btn-prev');
|
|
@@ -583,9 +588,9 @@
|
|
|
583
588
|
nextButton.removeAttribute('disabled');
|
|
584
589
|
prevButton.removeAttribute('disabled');
|
|
585
590
|
if (scrollTo == 1) prevButton.setAttribute('disabled', true);else if (scrollTo == itemCount) nextButton.setAttribute('disabled', true);
|
|
586
|
-
};
|
|
587
|
-
|
|
591
|
+
};
|
|
588
592
|
|
|
593
|
+
// On scroll we need to make sure the buttons get corrected and the next testimonial is shown
|
|
589
594
|
imagesCarousel.addEventListener('scroll', function (e) {
|
|
590
595
|
clearTimeout(scrollTimeout);
|
|
591
596
|
scrollTimeout = setTimeout(function () {
|
|
@@ -593,14 +598,16 @@
|
|
|
593
598
|
var scrollHeight = imagesCarousel.scrollHeight;
|
|
594
599
|
var scrollLeft = imagesCarousel.scrollLeft;
|
|
595
600
|
var scrollDown = imagesCarousel.scrollTop;
|
|
596
|
-
var scrollTo = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
|
|
601
|
+
var scrollTo = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
|
|
597
602
|
|
|
603
|
+
// Change in scroll direction
|
|
598
604
|
if (scrollLeft == 0 && scrollDown != 0) scrollTo = Math.round(scrollDown / scrollHeight * itemCount) + 1;
|
|
599
605
|
testimonialElement.setAttribute('data-show', scrollTo);
|
|
600
606
|
setButtons(scrollTo);
|
|
601
607
|
}, 300);
|
|
602
|
-
}, false);
|
|
608
|
+
}, false);
|
|
603
609
|
|
|
610
|
+
// when the buttons are used we need to make sure the carousel scrolls to the correct place
|
|
604
611
|
testimonialElement.addEventListener('click', function (e) {
|
|
605
612
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
606
613
|
if (target.matches('[data-go]')) {
|
|
@@ -609,8 +616,9 @@
|
|
|
609
616
|
var scrollLeft = 0;
|
|
610
617
|
var scrollWidth = imagesCarousel.scrollWidth;
|
|
611
618
|
var scrollHeight = imagesCarousel.scrollHeight;
|
|
612
|
-
if (scrollWidth > scrollHeight) scrollLeft = Math.floor(scrollWidth * ((scrollTo - 1) / itemCount));else scrollDown = Math.floor(scrollHeight * ((scrollTo - 1) / itemCount));
|
|
619
|
+
if (scrollWidth > scrollHeight) scrollLeft = Math.floor(scrollWidth * ((scrollTo - 1) / itemCount));else scrollDown = Math.floor(scrollHeight * ((scrollTo - 1) / itemCount));
|
|
613
620
|
|
|
621
|
+
// Trigger the scroll
|
|
614
622
|
imagesCarousel.scroll({
|
|
615
623
|
top: scrollDown,
|
|
616
624
|
left: scrollLeft,
|
|
@@ -629,8 +637,9 @@
|
|
|
629
637
|
carouselElement.getAttribute('data-cols');
|
|
630
638
|
var smCols = carouselElement.getAttribute('data-sm-cols');
|
|
631
639
|
var mdCols = carouselElement.getAttribute('data-md-cols');
|
|
632
|
-
carouselElement.querySelector('.carousel__controls a').classList.add('active');
|
|
640
|
+
carouselElement.querySelector('.carousel__controls a').classList.add('active');
|
|
633
641
|
|
|
642
|
+
// On scroll we need to make sure the buttons get corrected and the next testimonial is shown
|
|
634
643
|
carouselInner.addEventListener('scroll', function (e) {
|
|
635
644
|
clearTimeout(scrollTimeout);
|
|
636
645
|
scrollTimeout = setTimeout(function () {
|
|
@@ -642,14 +651,17 @@
|
|
|
642
651
|
Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
|
|
643
652
|
link.classList.remove('active');
|
|
644
653
|
});
|
|
645
|
-
carouselElement.querySelector('.control-' + targetSlide).classList.add('active');
|
|
654
|
+
carouselElement.querySelector('.control-' + targetSlide).classList.add('active');
|
|
646
655
|
|
|
647
|
-
|
|
656
|
+
// Disable the previous button
|
|
657
|
+
if (targetSlide == 1) carouselElement.querySelector('.btn-prev').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-prev').removeAttribute('disabled');
|
|
648
658
|
|
|
659
|
+
// Disable the next button if the last item is in view
|
|
649
660
|
if (carouselInner.scrollLeft + scrollArea > lastItemOffset) carouselElement.querySelector('.btn-next').setAttribute('disabled', 'disabled');else carouselElement.querySelector('.btn-next').removeAttribute('disabled');
|
|
650
661
|
}, 100);
|
|
651
|
-
}, false);
|
|
662
|
+
}, false);
|
|
652
663
|
|
|
664
|
+
// when the buttons are used we need to make sure the carousel scrolls to the correct place
|
|
653
665
|
carouselElement.addEventListener('click', function (e) {
|
|
654
666
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
655
667
|
if (target.matches('.carousel__controls a')) {
|
|
@@ -681,8 +693,9 @@
|
|
|
681
693
|
break;
|
|
682
694
|
}
|
|
683
695
|
}
|
|
684
|
-
}, false);
|
|
696
|
+
}, false);
|
|
685
697
|
|
|
698
|
+
// Add responsive hide button classes
|
|
686
699
|
if (itemCount == 1) carouselElement.classList.add('hide-btns');
|
|
687
700
|
if (smCols >= itemCount) carouselElement.classList.add('hide-sm-btns');
|
|
688
701
|
if (mdCols >= itemCount) carouselElement.classList.add('hide-md-btns');
|
|
@@ -693,15 +706,17 @@
|
|
|
693
706
|
function inputRange(inputWrapper) {
|
|
694
707
|
inputWrapper.addEventListener('change', function (e) {
|
|
695
708
|
var min = parseInt(inputWrapper.querySelector('[data-min] select,[data-min] input').value);
|
|
696
|
-
var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value);
|
|
709
|
+
var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value);
|
|
697
710
|
|
|
711
|
+
// Set attributes for input fields
|
|
698
712
|
Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach((input, index) => {
|
|
699
713
|
input.setAttribute('max', max);
|
|
700
714
|
});
|
|
701
715
|
Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach((input, index) => {
|
|
702
716
|
input.setAttribute('min', min);
|
|
703
|
-
});
|
|
717
|
+
});
|
|
704
718
|
|
|
719
|
+
// Hide select options if they are higher or lower than the min and max values
|
|
705
720
|
Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach((option, index) => {
|
|
706
721
|
if (parseInt(option.getAttribute('value')) > max) option.classList.add('d-none');else option.classList.remove('d-none');
|
|
707
722
|
});
|
|
@@ -710,16 +725,19 @@
|
|
|
710
725
|
});
|
|
711
726
|
}, false);
|
|
712
727
|
}
|
|
713
|
-
|
|
714
728
|
function inputRedirect(inputWrapper) {
|
|
715
729
|
inputWrapper.addEventListener('change', function (e) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
730
|
+
if (inputWrapper.matches('[data-value-if]')) {
|
|
731
|
+
var url = inputWrapper.getAttribute('data-redirect');
|
|
732
|
+
var desiredValue = inputWrapper.getAttribute('data-value-if');
|
|
733
|
+
if (inputWrapper.value == desiredValue) document.location.href = url;
|
|
734
|
+
} else {
|
|
735
|
+
if (typeof inputWrapper.value != "undefined") document.location.href = inputWrapper.value;
|
|
736
|
+
}
|
|
719
737
|
}, false);
|
|
720
|
-
}
|
|
721
|
-
|
|
738
|
+
}
|
|
722
739
|
|
|
740
|
+
//
|
|
723
741
|
function multipleFileUploads(wrapper) {
|
|
724
742
|
var fileTenplate = wrapper.querySelector('.row');
|
|
725
743
|
var clone = fileTenplate.cloneNode(true);
|
|
@@ -728,14 +746,15 @@
|
|
|
728
746
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
729
747
|
if (target.matches('[data-add]')) {
|
|
730
748
|
// Add a new row upload file input fields
|
|
749
|
+
|
|
731
750
|
var tempClone = clone.cloneNode(true);
|
|
732
751
|
wrapper.insertBefore(tempClone, target);
|
|
733
752
|
if (addButton.matches('[data-maxfiles]') && Array.from(wrapper.querySelectorAll(':scope > .row')).length >= addButton.dataset.maxfiles) addButton.setAttribute('disabled', 'disabled');
|
|
734
753
|
break;
|
|
735
754
|
}
|
|
736
|
-
|
|
737
755
|
if (target.matches('[data-delete]')) {
|
|
738
756
|
// Delete the current row
|
|
757
|
+
|
|
739
758
|
var row = target.closest('.row');
|
|
740
759
|
row.remove();
|
|
741
760
|
if (addButton.matches('[data-maxfiles]') && Array.from(wrapper.querySelectorAll(':scope > .row')).length < addButton.dataset.maxfiles) addButton.removeAttribute('disabled');
|
|
@@ -743,36 +762,36 @@
|
|
|
743
762
|
}
|
|
744
763
|
}
|
|
745
764
|
}, false);
|
|
746
|
-
}
|
|
747
|
-
|
|
765
|
+
}
|
|
748
766
|
|
|
767
|
+
// Acts as an overall initialise function to trigger other functions.
|
|
749
768
|
function form(formElement) {
|
|
750
769
|
// Check for input range groups
|
|
751
770
|
Array.from(formElement.querySelectorAll('[data-input-range]')).forEach((arrayElement, index) => {
|
|
752
771
|
inputRange(arrayElement);
|
|
753
772
|
});
|
|
754
|
-
Array.from(formElement.querySelectorAll('[data-redirect]
|
|
773
|
+
Array.from(formElement.querySelectorAll('[data-redirect]')).forEach((arrayElement, index) => {
|
|
755
774
|
inputRedirect(arrayElement);
|
|
756
775
|
});
|
|
757
776
|
Array.from(formElement.querySelectorAll('.multiple-file-uploads')).forEach((arrayElement, index) => {
|
|
758
777
|
multipleFileUploads(arrayElement);
|
|
759
|
-
});
|
|
778
|
+
});
|
|
760
779
|
|
|
780
|
+
// Check the file size of a file when uploaded in case it exceeds the max file size set
|
|
761
781
|
formElement.addEventListener('change', function (e) {
|
|
762
782
|
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
763
783
|
if (target.matches('[type="file"][data-filesize]') && target.files && target.files[0]) {
|
|
764
784
|
var maxAllowedSize = target.dataset.filesize;
|
|
765
|
-
|
|
766
785
|
if (target.files[0].size > maxAllowedSize) {
|
|
767
786
|
target.value = '';
|
|
768
787
|
alert('File too large');
|
|
769
788
|
}
|
|
770
|
-
|
|
771
789
|
break;
|
|
772
790
|
}
|
|
773
791
|
}
|
|
774
|
-
}, false);
|
|
792
|
+
}, false);
|
|
775
793
|
|
|
794
|
+
// When a form is updated we may want to update some of the existing input fields; setting active fields when some data is selected.
|
|
776
795
|
formElement.addEventListener('change', function (e) {
|
|
777
796
|
// Remove disabled attribute when a pre-selected input field equals a certain value
|
|
778
797
|
Array.from(formElement.querySelectorAll('select[data-activeif][data-equals],input[data-activeif][data-equals]')).forEach((arrayElement, index) => {
|
|
@@ -780,15 +799,15 @@
|
|
|
780
799
|
var selector = arrayElement.dataset.activeif;
|
|
781
800
|
var value = arrayElement.dataset.equals;
|
|
782
801
|
var testElement = group.querySelector("select[data-id=\"".concat(selector, "\"],input[data-id=\"").concat(selector, "\"]"));
|
|
783
|
-
|
|
784
802
|
if (testElement.value == value) {
|
|
785
803
|
arrayElement.removeAttribute('disabled');
|
|
786
804
|
} else {
|
|
787
805
|
arrayElement.setAttribute('disabled', 'disabled');
|
|
788
806
|
arrayElement.value = '';
|
|
789
807
|
}
|
|
790
|
-
});
|
|
808
|
+
});
|
|
791
809
|
|
|
810
|
+
// Show this input wrapper when a pre-selected input field equals a certain value
|
|
792
811
|
Array.from(formElement.querySelectorAll('.form-control__wrapper[data-displayif][data-equals]')).forEach((arrayElement, index) => {
|
|
793
812
|
var group = arrayElement.closest('[data-group]') ? arrayElement.closest('[data-group]') : formElement;
|
|
794
813
|
var selector = arrayElement.dataset.activeif;
|
|
@@ -799,14 +818,15 @@
|
|
|
799
818
|
}, false);
|
|
800
819
|
}
|
|
801
820
|
|
|
802
|
-
/**
|
|
803
|
-
* Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
|
|
821
|
+
/**
|
|
822
|
+
* Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
|
|
804
823
|
*/
|
|
805
824
|
class youtubeVideo {
|
|
806
825
|
/** @param {Element} embed dom element */
|
|
807
826
|
constructor(embed) {
|
|
808
|
-
var createEmbed = this.createEmbed;
|
|
827
|
+
var createEmbed = this.createEmbed;
|
|
809
828
|
|
|
829
|
+
// If the scripts is already loaded then lets just create the embed
|
|
810
830
|
if (document.body.classList.contains('youtubeLoaded')) {
|
|
811
831
|
embed.addEventListener('click', function (e) {
|
|
812
832
|
// loop parent nodes from the target to the delegation node
|
|
@@ -822,17 +842,15 @@
|
|
|
822
842
|
this.loadScripts(embed, this.createEmbed);
|
|
823
843
|
}
|
|
824
844
|
}
|
|
825
|
-
/**
|
|
826
|
-
* Load the YouTube scripts before trying to create the embed
|
|
827
|
-
* @param {HTMLElement} embed dom element
|
|
828
|
-
* @param {Function} createEmbed function to create the embed after script loaded.
|
|
829
|
-
*/
|
|
830
|
-
|
|
831
845
|
|
|
846
|
+
/**
|
|
847
|
+
* Load the YouTube scripts before trying to create the embed
|
|
848
|
+
* @param {HTMLElement} embed dom element
|
|
849
|
+
* @param {Function} createEmbed function to create the embed after script loaded.
|
|
850
|
+
*/
|
|
832
851
|
loadScripts(embed, createEmbed) {
|
|
833
852
|
return new Promise((resolve, reject) => {
|
|
834
853
|
var image = new Image();
|
|
835
|
-
|
|
836
854
|
image.onload = function () {
|
|
837
855
|
// This code loads the IFrame Player API code asynchronously.
|
|
838
856
|
var tag = document.createElement('script');
|
|
@@ -840,8 +858,9 @@
|
|
|
840
858
|
var firstScriptTag = document.getElementsByTagName('script')[0];
|
|
841
859
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
|
842
860
|
document.body.classList.add('youtubeLoaded');
|
|
843
|
-
resolve(true);
|
|
861
|
+
resolve(true);
|
|
844
862
|
|
|
863
|
+
// script has loaded, you can now use it safely
|
|
845
864
|
tag.onload = () => {
|
|
846
865
|
embed.addEventListener('click', function (e) {
|
|
847
866
|
// loop parent nodes from the target to the delegation node
|
|
@@ -855,33 +874,31 @@
|
|
|
855
874
|
}, false);
|
|
856
875
|
};
|
|
857
876
|
};
|
|
858
|
-
|
|
859
877
|
image.onerror = function () {
|
|
860
878
|
reject(false);
|
|
861
879
|
};
|
|
862
|
-
|
|
863
880
|
image.src = "https://youtube.com/favicon.ico";
|
|
864
881
|
});
|
|
865
882
|
}
|
|
866
|
-
/**
|
|
867
|
-
* Create the YouTube embed after the user has clicked on it.
|
|
868
|
-
* @param {HTMLElement} embed dom element
|
|
869
|
-
*/
|
|
870
|
-
|
|
871
883
|
|
|
884
|
+
/**
|
|
885
|
+
* Create the YouTube embed after the user has clicked on it.
|
|
886
|
+
* @param {HTMLElement} embed dom element
|
|
887
|
+
*/
|
|
872
888
|
createEmbed(embed, target) {
|
|
873
889
|
// If there is more than one video lets make sure there is only one playing at a time.
|
|
874
890
|
if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
|
|
875
891
|
var video_id = target.getAttribute('data-id');
|
|
876
|
-
var link_id = target.getAttribute('id');
|
|
892
|
+
var link_id = target.getAttribute('id');
|
|
877
893
|
|
|
894
|
+
// create an id to pass t the script if one isn't present
|
|
878
895
|
if (typeof link_id == 'undefined' || link_id == null) {
|
|
879
896
|
var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
|
|
880
897
|
link_id = randLetter + Date.now();
|
|
881
898
|
target.setAttribute('id', link_id);
|
|
882
|
-
}
|
|
883
|
-
|
|
899
|
+
}
|
|
884
900
|
|
|
901
|
+
// This function creates an <iframe> (and YouTube player) after the API code downloads.
|
|
885
902
|
function onYouTubeIframeAPIReady() {
|
|
886
903
|
window.player = new YT.Player(link_id, {
|
|
887
904
|
height: '100%',
|
|
@@ -899,18 +916,17 @@
|
|
|
899
916
|
}
|
|
900
917
|
});
|
|
901
918
|
}
|
|
919
|
+
onYouTubeIframeAPIReady();
|
|
902
920
|
|
|
903
|
-
|
|
904
|
-
|
|
921
|
+
// The API will call this function when the video player is ready.
|
|
905
922
|
function onPlayerReady(event) {
|
|
906
923
|
// Play the video straight away
|
|
907
924
|
event.target.playVideo();
|
|
908
|
-
}
|
|
909
|
-
// The function indicates that when playing a video (state=1)
|
|
910
|
-
|
|
925
|
+
}
|
|
911
926
|
|
|
927
|
+
// The API calls this function when the player's state changes.
|
|
928
|
+
// The function indicates that when playing a video (state=1)
|
|
912
929
|
var done = false;
|
|
913
|
-
|
|
914
930
|
function onPlayerStateChange(event) {
|
|
915
931
|
if (event.data == YT.PlayerState.PLAYING && !done) {
|
|
916
932
|
var link = document.getElementById(link_id);
|
|
@@ -919,7 +935,6 @@
|
|
|
919
935
|
}
|
|
920
936
|
}
|
|
921
937
|
}
|
|
922
|
-
|
|
923
938
|
}
|
|
924
939
|
|
|
925
940
|
var modal = element => {
|
|
@@ -927,17 +942,17 @@
|
|
|
927
942
|
var firstLink = links[0];
|
|
928
943
|
var lastLink = links[links.length - 1];
|
|
929
944
|
var modalID = element.getAttribute('id');
|
|
930
|
-
|
|
931
945
|
var closeModal = function closeModal() {
|
|
932
946
|
var button = document.querySelector('[href="' + window.location.hash + '"]');
|
|
933
947
|
button.focus();
|
|
934
948
|
window.location.hash = "close";
|
|
935
|
-
history.replaceState("", document.title, window.location.pathname + window.location.search);
|
|
949
|
+
history.replaceState("", document.title, window.location.pathname + window.location.search);
|
|
936
950
|
|
|
951
|
+
// If there is more than one video lets make sure there is only one playing at a time.
|
|
937
952
|
if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
|
|
938
|
-
};
|
|
939
|
-
|
|
953
|
+
};
|
|
940
954
|
|
|
955
|
+
// Trap the tab focus inside
|
|
941
956
|
element.addEventListener('keydown', function (e) {
|
|
942
957
|
if (e.key === "Tab" && e.shiftKey && document.activeElement == firstLink) {
|
|
943
958
|
e.preventDefault();
|
|
@@ -946,8 +961,9 @@
|
|
|
946
961
|
e.preventDefault();
|
|
947
962
|
firstLink.focus();
|
|
948
963
|
}
|
|
949
|
-
});
|
|
964
|
+
});
|
|
950
965
|
|
|
966
|
+
// ESC will close the open modal
|
|
951
967
|
document.addEventListener("keydown", function (e) {
|
|
952
968
|
if (e.key === "Escape" && document.querySelector('.modal:target')) closeModal();
|
|
953
969
|
});
|
|
@@ -958,7 +974,8 @@
|
|
|
958
974
|
e.preventDefault();
|
|
959
975
|
closeModal();
|
|
960
976
|
break;
|
|
961
|
-
}
|
|
977
|
+
}
|
|
978
|
+
// Dock the modal to the right or left to make the content behind readable
|
|
962
979
|
else if (target.matches('.modal__dock--right')) {
|
|
963
980
|
e.preventDefault();
|
|
964
981
|
if (!element.classList.contains('modal--left')) element.classList.add('modal--right');
|
|
@@ -972,68 +989,65 @@
|
|
|
972
989
|
}
|
|
973
990
|
}
|
|
974
991
|
});
|
|
975
|
-
|
|
976
992
|
function locationHashChanged() {
|
|
977
993
|
if (location.hash === '#' + modalID) {
|
|
978
994
|
console.log("Modal is now open");
|
|
979
995
|
var videoButton = document.querySelector('.modal:target .modal__inner > .youtube-embed:first-child:last-child a');
|
|
980
996
|
console.log(videoButton);
|
|
981
|
-
|
|
982
997
|
if (videoButton) {
|
|
983
998
|
videoButton.click();
|
|
984
999
|
}
|
|
985
1000
|
}
|
|
986
1001
|
}
|
|
987
|
-
|
|
988
1002
|
window.onhashchange = locationHashChanged;
|
|
989
1003
|
};
|
|
990
1004
|
|
|
991
|
-
// @ts-nocheck
|
|
992
|
-
// Attach classes to dom elements
|
|
993
|
-
document.addEventListener("DOMContentLoaded", function () {
|
|
994
|
-
addBodyClasses(document.body);
|
|
995
|
-
addGlobalEvents();
|
|
996
|
-
checkElements(document.body);
|
|
997
|
-
console.log('test.js');
|
|
998
|
-
// ANav
|
|
999
|
-
Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement) {
|
|
1000
|
-
navbar(arrayElement);
|
|
1001
|
-
});
|
|
1002
|
-
// Advanced tables
|
|
1003
|
-
Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement) {
|
|
1004
|
-
table(arrayElement);
|
|
1005
|
-
});
|
|
1006
|
-
// Accordions
|
|
1007
|
-
Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement) {
|
|
1008
|
-
accordion(arrayElement);
|
|
1009
|
-
});
|
|
1010
|
-
// Testimonial
|
|
1011
|
-
Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement) {
|
|
1012
|
-
testimonial(arrayElement);
|
|
1013
|
-
});
|
|
1014
|
-
// Carousel
|
|
1015
|
-
Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement) {
|
|
1016
|
-
carousel(arrayElement);
|
|
1017
|
-
});
|
|
1018
|
-
// Form
|
|
1019
|
-
Array.from(document.querySelectorAll('form')).forEach(function (arrayElement) {
|
|
1020
|
-
form(arrayElement);
|
|
1021
|
-
});
|
|
1022
|
-
// Modal
|
|
1023
|
-
Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement) {
|
|
1024
|
-
modal(arrayElement);
|
|
1025
|
-
});
|
|
1026
|
-
// YouTube videos
|
|
1027
|
-
Array.from(document.querySelectorAll('.youtube-embed')).forEach(function (arrayElement) {
|
|
1028
|
-
new youtubeVideo(arrayElement);
|
|
1029
|
-
});
|
|
1030
|
-
window.addEventListener('hashchange', function () {
|
|
1031
|
-
var hash = location.hash.replace('#', '');
|
|
1032
|
-
var label = document.querySelector("label[for=\"".concat(hash, "\"]"));
|
|
1033
|
-
if (label instanceof HTMLElement) {
|
|
1034
|
-
label.click();
|
|
1035
|
-
}
|
|
1036
|
-
}, false);
|
|
1005
|
+
// @ts-nocheck
|
|
1006
|
+
// Attach classes to dom elements
|
|
1007
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
1008
|
+
addBodyClasses(document.body);
|
|
1009
|
+
addGlobalEvents();
|
|
1010
|
+
checkElements(document.body);
|
|
1011
|
+
console.log('test.js');
|
|
1012
|
+
// ANav
|
|
1013
|
+
Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement) {
|
|
1014
|
+
navbar(arrayElement);
|
|
1015
|
+
});
|
|
1016
|
+
// Advanced tables
|
|
1017
|
+
Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement) {
|
|
1018
|
+
table(arrayElement);
|
|
1019
|
+
});
|
|
1020
|
+
// Accordions
|
|
1021
|
+
Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement) {
|
|
1022
|
+
accordion(arrayElement);
|
|
1023
|
+
});
|
|
1024
|
+
// Testimonial
|
|
1025
|
+
Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement) {
|
|
1026
|
+
testimonial(arrayElement);
|
|
1027
|
+
});
|
|
1028
|
+
// Carousel
|
|
1029
|
+
Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement) {
|
|
1030
|
+
carousel(arrayElement);
|
|
1031
|
+
});
|
|
1032
|
+
// Form
|
|
1033
|
+
Array.from(document.querySelectorAll('form')).forEach(function (arrayElement) {
|
|
1034
|
+
form(arrayElement);
|
|
1035
|
+
});
|
|
1036
|
+
// Modal
|
|
1037
|
+
Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement) {
|
|
1038
|
+
modal(arrayElement);
|
|
1039
|
+
});
|
|
1040
|
+
// YouTube videos
|
|
1041
|
+
Array.from(document.querySelectorAll('.youtube-embed')).forEach(function (arrayElement) {
|
|
1042
|
+
new youtubeVideo(arrayElement);
|
|
1043
|
+
});
|
|
1044
|
+
window.addEventListener('hashchange', function () {
|
|
1045
|
+
var hash = location.hash.replace('#', '');
|
|
1046
|
+
var label = document.querySelector("label[for=\"".concat(hash, "\"]"));
|
|
1047
|
+
if (label instanceof HTMLElement) {
|
|
1048
|
+
label.click();
|
|
1049
|
+
}
|
|
1050
|
+
}, false);
|
|
1037
1051
|
});
|
|
1038
1052
|
|
|
1039
1053
|
}));
|