@qhealth-design-system/core 1.22.2 → 1.23.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/.storybook/assets/image-position-demo-portrait.svg +54 -0
- package/.storybook/assets/image-position-demo.svg +55 -0
- package/.storybook/globals.js +9 -0
- package/.storybook/preview.js +8 -1
- package/CHANGELOG.md +2 -0
- package/README.md +0 -6
- package/package.json +13 -33
- package/src/assets/img/svg-icons.svg +154 -154
- package/src/component-loader.js +11 -2
- package/src/components/_global/css/admin/component.scss +1 -0
- package/src/components/_global/css/btn/component.scss +9 -0
- package/src/components/_global/css/img/image-position-utility-classes.scss +30 -0
- package/src/components/_global/css/img/image-ratio-utility-classes.scss +41 -0
- package/src/components/_global/css/img/images.scss +74 -5
- package/src/components/_global/css/modal/component.scss +1 -0
- package/src/components/_global/js/animate/global.js +272 -294
- package/src/components/_global/js/collapsible.js +3 -3
- package/src/components/_global/js/global.js +304 -316
- package/src/components/_global/js/legacyGlobal.js +63 -0
- package/src/components/_global/js/modal/global.js +218 -223
- package/src/components/_global/js/popover/controller.js +4 -4
- package/src/components/_global/js/tabs/global.js +264 -276
- package/src/components/a-z_listing/js/global.js +106 -92
- package/src/components/accordion/css/component.scss +24 -41
- package/src/components/accordion/html/component.hbs +23 -5
- package/src/components/accordion/js/global.js +5 -10
- package/src/components/basic_search/js/global.js +0 -7
- package/src/components/code/js/global.js +6 -12
- package/src/components/file_upload/js/global.js +1 -5
- package/src/components/internal_navigation/css/component.scss +2 -2
- package/src/components/internal_navigation/html/component.hbs +16 -1
- package/src/components/main_navigation/js/global.js +341 -335
- package/src/components/overflow_menu/css/component.scss +1 -0
- package/src/components/search_box/css/component.scss +0 -1
- package/src/components/tab/js/global.js +5 -10
- package/src/components/toggle_tip/js/global.js +0 -6
- package/src/components/tool_tip/js/global.js +0 -6
- package/src/components/video_player/css/component.scss +27 -9
- package/src/components/video_player/html/component.hbs +32 -6
- package/src/components/video_player/js/global.js +8 -1
- package/src/index.js +4 -0
- package/src/stories/Accordion/accordion.stories.js +1 -0
- package/src/stories/Banner/bannerContained.stories.js +123 -0
- package/src/stories/Flexbox/Flexbox.stories.js +316 -0
- package/src/stories/Image/Image.stories.js +182 -0
- package/src/stories/Templates/ContentPage.stories.js +101 -0
- package/src/stories/Templates/LandingPage.stories.js +193 -0
- package/src/stories/Templates/templateHelpers.js +102 -0
- package/src/stories/VideoPlayer/VideoPlayer.stories.js +16 -0
- package/src/styles/imports/utilities.scss +15 -25
- package/src/styles/imports/variables.scss +26 -0
- package/src/components/_global/html/head.html +0 -22
- package/src/components/_global/html/scripts.html +0 -28
- package/src/components/_global/js/_polyfills/global.js +0 -19
- package/src/components/_template/html/component-page.html +0 -75
- package/src/components/_template/js/global.js +0 -3
- package/src/components/accordion/html/accordion-group.html +0 -163
- package/src/components/accordion/html/default.html +0 -99
- package/src/components/banner_basic/js/global.js +0 -3
- package/src/components/loading_spinner/js/global.js +0 -3
- package/src/components/pagination/html/default.html +0 -39
- package/src/components/search_box/html/component.html +0 -26
- package/src/data/current.json +0 -400
- package/src/data/current_admin.json +0 -305
- package/src/data/model_component.js +0 -14
- package/src/data/site.json +0 -977
- package/src/externals/tinymce_classes.css +0 -62
- package/src/html/component-global-elements.html +0 -2857
- package/src/html/component-horizontal_rule.html +0 -647
- package/src/html/component-internal_navigation.html +0 -583
- package/src/html/component-left_hand_navigation.html +0 -57
- package/src/html/component-main_navigation.html +0 -583
- package/src/html/component-multi_column.html +0 -582
- package/src/html/components.html +0 -354
- package/src/html/home.html +0 -1898
- package/src/html/index.html +0 -129
- package/src/html/inner-with-nav.html +0 -605
- package/src/html/inner.html +0 -618
|
@@ -1,346 +1,334 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The main namespace for all QLDDS functions and variables
|
|
3
|
+
* @module _global
|
|
4
|
+
*/
|
|
3
5
|
|
|
6
|
+
const utils = {
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
8
|
+
* Add 'js' body class if JS is enabled on the page
|
|
9
|
+
*
|
|
10
|
+
* @memberof module:_global
|
|
7
11
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @memberof module:_global
|
|
14
|
-
*/
|
|
15
|
-
browserJS: function () {
|
|
16
|
-
document.querySelector("html").classList.remove("no-js");
|
|
17
|
-
document.querySelector("html").classList.add("js");
|
|
18
|
-
},
|
|
12
|
+
browserJS: function () {
|
|
13
|
+
document.querySelector("html").classList.remove("no-js");
|
|
14
|
+
document.querySelector("html").classList.add("js");
|
|
15
|
+
},
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
var callNow = immediate && !timeout;
|
|
45
|
-
clearTimeout(timeout);
|
|
46
|
-
timeout = setTimeout(later, wait);
|
|
47
|
-
if (callNow) func.apply(context, args);
|
|
17
|
+
/**
|
|
18
|
+
* Returns a function, that, as long as it continues to be invoked, will not
|
|
19
|
+
* be triggered. The function will be called after it stops being called for
|
|
20
|
+
* N milliseconds. If `immediate` is passed, trigger the function on the
|
|
21
|
+
* leading edge, instead of the trailing.
|
|
22
|
+
* https://davidwalsh.name/javascript-debounce-function
|
|
23
|
+
*
|
|
24
|
+
* @memberof module:_global
|
|
25
|
+
*
|
|
26
|
+
* @param {function} func
|
|
27
|
+
* @param {number} wait
|
|
28
|
+
* @param {boolean} immediate
|
|
29
|
+
*
|
|
30
|
+
* @returns {function}
|
|
31
|
+
*/
|
|
32
|
+
debounce: function (func, wait, immediate) {
|
|
33
|
+
var timeout;
|
|
34
|
+
return function () {
|
|
35
|
+
var context = this,
|
|
36
|
+
args = arguments;
|
|
37
|
+
var later = function () {
|
|
38
|
+
timeout = null;
|
|
39
|
+
if (!immediate) func.apply(context, args);
|
|
48
40
|
};
|
|
49
|
-
|
|
41
|
+
var callNow = immediate && !timeout;
|
|
42
|
+
clearTimeout(timeout);
|
|
43
|
+
timeout = setTimeout(later, wait);
|
|
44
|
+
if (callNow) func.apply(context, args);
|
|
45
|
+
};
|
|
46
|
+
},
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Convert nodeList to Array (for IE11)
|
|
50
|
+
*
|
|
51
|
+
* @memberof module:_global
|
|
52
|
+
*
|
|
53
|
+
* @param {*} node_list
|
|
54
|
+
*
|
|
55
|
+
* @returns {Node[]}
|
|
56
|
+
*/
|
|
57
|
+
listToArray: function (node_list) {
|
|
58
|
+
return Array.prototype.slice.call(node_list);
|
|
59
|
+
},
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
c_value = unescape(c_value.substring(c_start, c_end));
|
|
98
|
-
}
|
|
99
|
-
return c_value;
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* Set browser local storage
|
|
103
|
-
*
|
|
104
|
-
* @memberof module:_global
|
|
105
|
-
*
|
|
106
|
-
* @param {string} storage_key
|
|
107
|
-
* @param {string} storage_value
|
|
108
|
-
*/
|
|
109
|
-
setLocalStorage: function (storage_key, storage_value) {
|
|
110
|
-
if (typeof storage_value !== "string") {
|
|
111
|
-
storage_value = JSON.stringify(storage_value);
|
|
61
|
+
/**
|
|
62
|
+
* Set browser cookie
|
|
63
|
+
*
|
|
64
|
+
* @memberof module:_global
|
|
65
|
+
*
|
|
66
|
+
* @param {string} cookie_name
|
|
67
|
+
* @param {string} cookie_value
|
|
68
|
+
*/
|
|
69
|
+
setCookie: function (cookie_name, cookie_value) {
|
|
70
|
+
var cookie_entry =
|
|
71
|
+
cookie_name + "=" + encodeURIComponent(cookie_value) + ";";
|
|
72
|
+
document.cookie = cookie_entry + "; path=/;";
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Get browser cookie
|
|
76
|
+
*
|
|
77
|
+
* @memberof module:_global
|
|
78
|
+
*
|
|
79
|
+
* @param {string} cookie_name
|
|
80
|
+
*
|
|
81
|
+
* @returns {c_value}
|
|
82
|
+
*/
|
|
83
|
+
getCookie: function (cookie_name) {
|
|
84
|
+
var c_value = " " + document.cookie;
|
|
85
|
+
var c_start = c_value.indexOf(" " + cookie_name + "=");
|
|
86
|
+
if (c_start == -1) {
|
|
87
|
+
c_value = null;
|
|
88
|
+
} else {
|
|
89
|
+
c_start = c_value.indexOf("=", c_start) + 1;
|
|
90
|
+
var c_end = c_value.indexOf(";", c_start);
|
|
91
|
+
if (c_end == -1) {
|
|
92
|
+
c_end = c_value.length;
|
|
112
93
|
}
|
|
94
|
+
c_value = unescape(c_value.substring(c_start, c_end));
|
|
95
|
+
}
|
|
96
|
+
return c_value;
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* Set browser local storage
|
|
100
|
+
*
|
|
101
|
+
* @memberof module:_global
|
|
102
|
+
*
|
|
103
|
+
* @param {string} storage_key
|
|
104
|
+
* @param {string} storage_value
|
|
105
|
+
*/
|
|
106
|
+
setLocalStorage: function (storage_key, storage_value) {
|
|
107
|
+
if (typeof storage_value !== "string") {
|
|
108
|
+
storage_value = JSON.stringify(storage_value);
|
|
109
|
+
}
|
|
113
110
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
111
|
+
localStorage.setItem(storage_key, storage_value);
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* Get browser local storage from key
|
|
115
|
+
*
|
|
116
|
+
* @memberof module:_global
|
|
117
|
+
*
|
|
118
|
+
* @param {string} storage_key
|
|
119
|
+
*
|
|
120
|
+
* @returns {localStorage.getItem(storage_key)}
|
|
121
|
+
*/
|
|
122
|
+
getLocalStorage: function (storage_key) {
|
|
123
|
+
return localStorage.getItem(storage_key);
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Remove browser local storage item by key
|
|
127
|
+
*
|
|
128
|
+
* @memberof module:_global
|
|
129
|
+
*
|
|
130
|
+
* @param {string} storage_key
|
|
131
|
+
*/
|
|
132
|
+
removeLocalStorage: function (storage_key) {
|
|
133
|
+
localStorage.removeItem(storage_key);
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
* Determine the location of the user using HTML5 geolocation
|
|
137
|
+
*
|
|
138
|
+
* @memberof module:_global
|
|
139
|
+
*
|
|
140
|
+
* @param {Boolean} override
|
|
141
|
+
* @param {function} errorCallback
|
|
142
|
+
*/
|
|
143
|
+
geolocateUser: function (override, errorCallback) {
|
|
144
|
+
var userLocationStorage = utils.getLocalStorage("qld_user_location");
|
|
145
|
+
if (userLocationStorage !== null && !override) {
|
|
146
|
+
return JSON.parse(userLocationStorage);
|
|
147
|
+
}
|
|
151
148
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
149
|
+
if (navigator.geolocation) {
|
|
150
|
+
utils.setLoadingState(true);
|
|
151
|
+
navigator.geolocation.getCurrentPosition(
|
|
152
|
+
function (position) {
|
|
153
|
+
var location = {
|
|
154
|
+
latitude: position.coords.latitude,
|
|
155
|
+
longitude: position.coords.longitude,
|
|
156
|
+
isGeolocated: true,
|
|
157
|
+
location: "",
|
|
158
|
+
};
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
return false;
|
|
160
|
+
utils.setUserLocation(location);
|
|
161
|
+
utils.removeLocalStorage("deny-location");
|
|
162
|
+
return `${position.coords.latitude},${position.coords.longitude}`;
|
|
163
|
+
},
|
|
164
|
+
function (error) {
|
|
165
|
+
console.log(error);
|
|
166
|
+
utils.setLoadingState(false);
|
|
167
|
+
if (errorCallback) {
|
|
168
|
+
errorCallback();
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
},
|
|
172
|
+
{ timeout: 10000 },
|
|
173
|
+
);
|
|
174
|
+
} else {
|
|
175
|
+
console.log("Unable to locate");
|
|
176
|
+
if (errorCallback) {
|
|
177
|
+
errorCallback();
|
|
183
178
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* Set the user location, including the HHS
|
|
188
|
-
*
|
|
189
|
-
* @memberof module:_global
|
|
190
|
-
*
|
|
191
|
-
* @param {object} location
|
|
192
|
-
*/
|
|
193
|
-
setUserLocation: function (location, refresh = true) {
|
|
194
|
-
// If there is a site-wide HHS configured
|
|
195
|
-
var hhsDiv = document.getElementById("qld__hhs");
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
196
182
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Set the user location, including the HHS
|
|
185
|
+
*
|
|
186
|
+
* @memberof module:_global
|
|
187
|
+
*
|
|
188
|
+
* @param {object} location
|
|
189
|
+
*/
|
|
190
|
+
setUserLocation: function (location, refresh = true) {
|
|
191
|
+
// If there is a site-wide HHS configured
|
|
192
|
+
var hhsDiv = document.getElementById("qld__hhs");
|
|
206
193
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
194
|
+
if (hhsDiv !== null && typeof serviceFinderData !== "undefined") {
|
|
195
|
+
var hhsId = hhsDiv.getAttribute("data-hhs");
|
|
196
|
+
serviceFinderData
|
|
197
|
+
.collection("hhs")
|
|
198
|
+
.doc(hhsId)
|
|
199
|
+
.get()
|
|
200
|
+
.then((response) => {
|
|
201
|
+
location.hhs_id = hhsId;
|
|
202
|
+
location.hhs_name = response.name;
|
|
213
203
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
setUserLocationInStorage: function (newLocation, refresh) {
|
|
221
|
-
QLD.utils.setLocalStorage(
|
|
222
|
-
"qld_user_location",
|
|
223
|
-
JSON.stringify(newLocation),
|
|
224
|
-
);
|
|
204
|
+
utils.setUserLocationInStorage(location, refresh);
|
|
205
|
+
});
|
|
206
|
+
} else {
|
|
207
|
+
utils.setUserLocationInStorage(location, refresh);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
225
210
|
|
|
226
|
-
|
|
227
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Set the 'qld_user_location' cookie based on a provided location object
|
|
213
|
+
*
|
|
214
|
+
* @memberof module:_global
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
setUserLocationInStorage: function (newLocation, refresh) {
|
|
218
|
+
utils.setLocalStorage("qld_user_location", JSON.stringify(newLocation));
|
|
228
219
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}, 300);
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
/**
|
|
235
|
-
* Check the 'qld_user_location' cookie to determine
|
|
236
|
-
* whether the user is geolocated
|
|
237
|
-
*
|
|
238
|
-
* @memberof module:_global
|
|
239
|
-
*
|
|
240
|
-
* @return {boolean}
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
isGeolocated: function () {
|
|
244
|
-
var userLocationStorage = QLD.utils.getLocalStorage("qld_user_location");
|
|
245
|
-
var userLocationData = {};
|
|
220
|
+
if (refresh) {
|
|
221
|
+
utils.setLoadingState(true);
|
|
246
222
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
223
|
+
setTimeout(function () {
|
|
224
|
+
window.location.reload(false);
|
|
225
|
+
}, 300);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* Check the 'qld_user_location' cookie to determine
|
|
230
|
+
* whether the user is geolocated
|
|
231
|
+
*
|
|
232
|
+
* @memberof module:_global
|
|
233
|
+
*
|
|
234
|
+
* @return {boolean}
|
|
235
|
+
*
|
|
236
|
+
*/
|
|
237
|
+
isGeolocated: function () {
|
|
238
|
+
var userLocationStorage = utils.getLocalStorage("qld_user_location");
|
|
239
|
+
var userLocationData = {};
|
|
250
240
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
if (userLocationStorage !== null) {
|
|
242
|
+
userLocationData = JSON.parse(userLocationStorage);
|
|
243
|
+
}
|
|
254
244
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
* Set the loading state of the page. If 'true',
|
|
259
|
-
* this will show a loader animation overlay over
|
|
260
|
-
* the entire page. Use 'false' to remove this
|
|
261
|
-
* same animation
|
|
262
|
-
*
|
|
263
|
-
* @memberof module:_global
|
|
264
|
-
*
|
|
265
|
-
* @param {Boolean} isLoading
|
|
266
|
-
*/
|
|
267
|
-
setLoadingState: function (isLoading) {
|
|
268
|
-
var loader = document.querySelector(".loader");
|
|
245
|
+
if (Object.keys(userLocationData).length > 0) {
|
|
246
|
+
return userLocationData.isGeolocated;
|
|
247
|
+
}
|
|
269
248
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
249
|
+
return false;
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* Set the loading state of the page. If 'true',
|
|
253
|
+
* this will show a loader animation overlay over
|
|
254
|
+
* the entire page. Use 'false' to remove this
|
|
255
|
+
* same animation
|
|
256
|
+
*
|
|
257
|
+
* @memberof module:_global
|
|
258
|
+
*
|
|
259
|
+
* @param {Boolean} isLoading
|
|
260
|
+
*/
|
|
261
|
+
setLoadingState: function (isLoading) {
|
|
262
|
+
var loader = document.querySelector(".loader");
|
|
276
263
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Get Paramater from URL by name
|
|
285
|
-
*
|
|
286
|
-
* @memberof module:_global
|
|
287
|
-
*
|
|
288
|
-
* @param {*} name
|
|
289
|
-
*/
|
|
290
|
-
getParamaterByName: function (name) {
|
|
291
|
-
name = name.replace(/\[/g, "\\[").replace(/]/g, "\\]");
|
|
292
|
-
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
|
293
|
-
var regex = new RegExp(regexS);
|
|
294
|
-
var results = regex.exec(window.location.href);
|
|
295
|
-
if (results == null) return "";
|
|
296
|
-
else return decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
297
|
-
},
|
|
298
|
-
/**
|
|
299
|
-
* Update the href path for SVG icons, depending on the spritesheeet source (core vs health)
|
|
300
|
-
*
|
|
301
|
-
* @memberof module:_global
|
|
302
|
-
*
|
|
303
|
-
* String selector to that targets the "use" element within the SVG icon
|
|
304
|
-
* @param {string} selector
|
|
305
|
-
*/
|
|
306
|
-
updateSvgIconPath: function (selector) {
|
|
307
|
-
const ctaNavIcons = document.querySelectorAll(selector);
|
|
308
|
-
if (ctaNavIcons.length > 0) {
|
|
309
|
-
// Check each icon found
|
|
310
|
-
ctaNavIcons.forEach((icon) => {
|
|
311
|
-
const href = icon.getAttribute("href");
|
|
264
|
+
if (loader === null) {
|
|
265
|
+
loader = document.createElement("div");
|
|
266
|
+
loader.classList.add("loader");
|
|
267
|
+
var parentNode = document.querySelector(".main");
|
|
268
|
+
parentNode.insertBefore(loader, parentNode.firstChild);
|
|
269
|
+
}
|
|
312
270
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
271
|
+
if (isLoading) {
|
|
272
|
+
loader.parentNode.classList.add("loading");
|
|
273
|
+
} else {
|
|
274
|
+
document.querySelector(".loading").classList.remove("loading");
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Get Paramater from URL by name
|
|
279
|
+
*
|
|
280
|
+
* @memberof module:_global
|
|
281
|
+
*
|
|
282
|
+
* @param {*} name
|
|
283
|
+
*/
|
|
284
|
+
getParamaterByName: function (name) {
|
|
285
|
+
name = name.replace(/\[/g, "\\[").replace(/]/g, "\\]");
|
|
286
|
+
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
|
287
|
+
var regex = new RegExp(regexS);
|
|
288
|
+
var results = regex.exec(window.location.href);
|
|
289
|
+
if (results == null) return "";
|
|
290
|
+
else return decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
291
|
+
},
|
|
292
|
+
/**
|
|
293
|
+
* Update the href path for SVG icons, depending on the spritesheeet source (core vs health)
|
|
294
|
+
*
|
|
295
|
+
* @memberof module:_global
|
|
296
|
+
*
|
|
297
|
+
* String selector to that targets the "use" element within the SVG icon
|
|
298
|
+
* @param {string} selector
|
|
299
|
+
*/
|
|
300
|
+
updateSvgIconPath: function (selector) {
|
|
301
|
+
const ctaNavIcons = document.querySelectorAll(selector);
|
|
302
|
+
if (ctaNavIcons.length > 0) {
|
|
303
|
+
// Check each icon found
|
|
304
|
+
ctaNavIcons.forEach((icon) => {
|
|
305
|
+
const href = icon.getAttribute("href");
|
|
317
306
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
307
|
+
if (href) {
|
|
308
|
+
const splitArray = href.split("#");
|
|
309
|
+
let iconName = splitArray.pop();
|
|
310
|
+
let isHealthIcon = iconName.startsWith("extended_");
|
|
322
311
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
312
|
+
// Remove the "extended_" prefix from the iconName if it's a health icon
|
|
313
|
+
if (isHealthIcon) {
|
|
314
|
+
iconName = iconName.replace(/extended_/gi, "");
|
|
315
|
+
}
|
|
326
316
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
"QLD-icons",
|
|
331
|
-
"QLD-Health-icons",
|
|
332
|
-
);
|
|
333
|
-
}
|
|
317
|
+
// Recreate the href path for the SVG
|
|
318
|
+
splitArray.push(iconName);
|
|
319
|
+
let updatedHref = splitArray.join("#");
|
|
334
320
|
|
|
335
|
-
|
|
321
|
+
// Update the path to the health spreadsheet if required
|
|
322
|
+
if (isHealthIcon) {
|
|
323
|
+
updatedHref = updatedHref.replace("QLD-icons", "QLD-Health-icons");
|
|
336
324
|
}
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
};
|
|
341
325
|
|
|
342
|
-
|
|
343
|
-
|
|
326
|
+
icon.setAttribute("href", updatedHref);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
};
|
|
344
332
|
|
|
345
|
-
|
|
346
|
-
}
|
|
333
|
+
export default utils;
|
|
334
|
+
export { utils };
|