@qhealth-design-system/core 1.16.3 → 1.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +1 -10
  3. package/src/components/_global/css/admin/component.scss +19 -23
  4. package/src/components/_global/css/tags/component.scss +0 -4
  5. package/src/components/_global/html/scripts.html +9 -16
  6. package/src/components/_global/js/select_boxes/global.js +36 -0
  7. package/src/components/_template/html/component-page.html +25 -31
  8. package/src/components/a-z_listing/js/global.js +60 -48
  9. package/src/components/card_no_action/css/component.scss +128 -158
  10. package/src/components/prefooter/css/component.scss +62 -0
  11. package/src/components/prefooter/js/manifest.json +9 -0
  12. package/src/components/promo_panel/js/global.js +19 -18
  13. package/src/data/current.json +3 -15
  14. package/src/html/component-a-z_listing.html +13 -41
  15. package/src/html/component-abstract.html +536 -40
  16. package/src/html/component-accordion.html +537 -41
  17. package/src/html/component-banner.html +537 -40
  18. package/src/html/component-banner_advanced.html +14 -41
  19. package/src/html/component-banner_basic.html +13 -40
  20. package/src/html/component-banner_intermediate.html +14 -41
  21. package/src/html/component-basic_search.html +10 -26
  22. package/src/html/component-body.html +541 -52
  23. package/src/html/component-breadcrumbs.html +538 -43
  24. package/src/html/component-btn.html +471 -69
  25. package/src/html/component-callout.html +536 -40
  26. package/src/html/component-card_feature.html +691 -308
  27. package/src/html/component-card_multi_action.html +651 -217
  28. package/src/html/component-card_no_action.html +163 -289
  29. package/src/html/component-card_single_action.html +1251 -324
  30. package/src/html/component-code.html +13 -40
  31. package/src/html/component-file_upload.html +13 -41
  32. package/src/html/component-footer.html +537 -41
  33. package/src/html/component-forms.html +4 -5
  34. package/src/html/component-global-elements.html +720 -152
  35. package/src/html/component-global_alert.html +536 -41
  36. package/src/html/component-header.html +537 -42
  37. package/src/html/component-horizontal_rule.html +459 -65
  38. package/src/html/component-in_page_navigation.html +544 -48
  39. package/src/html/component-internal_navigation.html +537 -41
  40. package/src/html/component-left_hand_navigation.html +13 -41
  41. package/src/html/component-loading_spinner.html +13 -42
  42. package/src/html/component-main_navigation.html +537 -41
  43. package/src/html/component-mega_main_navigation.html +537 -42
  44. package/src/html/component-multi_column.html +536 -40
  45. package/src/html/component-overflow_menu.html +12 -35
  46. package/src/html/component-page_alert.html +536 -40
  47. package/src/html/component-page_footer_info.html +583 -0
  48. package/src/html/component-pagination.html +459 -65
  49. package/src/html/component-promo_panel.html +13 -43
  50. package/src/html/component-tab.html +13 -41
  51. package/src/html/component-tag_list.html +495 -77
  52. package/src/html/component-toggle_tip.html +2 -3
  53. package/src/html/component-tool_tip.html +2 -3
  54. package/src/html/component-video_player.html +13 -41
  55. package/src/html/components.html +306 -88
  56. package/src/html/home.html +1807 -628
  57. package/src/html/index.html +9 -22
  58. package/src/html/inner-with-nav.html +551 -137
  59. package/src/html/inner.html +570 -59
  60. package/src/index.js +1 -13
  61. package/src/styles/global.scss +4 -10
  62. package/src/components/_global/css/slick/component.scss +0 -25
  63. package/src/components/_global/js/forms/global.js +0 -335
  64. package/src/components/_global/js/slick/global.js +0 -153
  65. package/src/components/_global/js/user_location/global.js +0 -116
  66. package/src/components/data_table/css/component.scss +0 -832
  67. package/src/components/data_table/html/component.hbs +0 -20
  68. package/src/components/data_table/js/global.js +0 -387
  69. package/src/components/data_table/js/manifest.json +0 -112
  70. package/src/components/updated_date/css/component.scss +0 -24
  71. package/src/components/updated_date/js/manifest.json +0 -9
  72. package/src/components/widgets/css/component.scss +0 -130
  73. package/src/components/widgets/html/component.hbs +0 -8
  74. package/src/components/widgets/html/default.html +0 -3
  75. package/src/components/widgets/js/current.json +0 -471
  76. package/src/components/widgets/js/manifest.json +0 -9
  77. package/src/components/widgets/js/site.json +0 -350
  78. package/src/externals/dsComponentLoader.js +0 -410
  79. package/src/externals/fb-typeahead.bundle.min.js +0 -6
  80. package/src/externals/funnelback.autocompletion-2.6.0.js +0 -678
  81. package/src/html/component-data_table.html +0 -85
  82. package/src/html/component-updated_date.html +0 -88
  83. package/src/html/component-widgets.html +0 -90
  84. /package/src/components/{updated_date → prefooter}/html/component.hbs +0 -0
package/src/index.js CHANGED
@@ -2,16 +2,4 @@
2
2
  import "./styles/global.scss";
3
3
 
4
4
  // JS
5
- import $ from 'jquery';
6
-
7
-
8
- window.jQuery = window.$ = $;
9
- require('jquery-validation');
10
- require("slick-carousel");
11
- require( 'datatables.net' );
12
- require('prismjs');
13
-
14
- import Bloodhound from 'corejs-typeahead/dist/bloodhound.js';
15
- window.Bloodhound = Bloodhound;
16
- require('corejs-typeahead/dist/typeahead.jquery.js');
17
- require('./externals/funnelback.autocompletion-2.6.0.js');
5
+ require("prismjs");
@@ -10,12 +10,7 @@
10
10
 
11
11
  // Libraries
12
12
 
13
- @import "~slick-carousel/slick/slick.css";
14
- @import "~slick-carousel/slick/slick-theme.css";
15
- @import '~highlight.js/styles/github.css';
16
- @import '~datatables.net-dt/css/jquery.dataTables.css';
17
-
18
-
13
+ @import "~highlight.js/styles/github.css";
19
14
 
20
15
  // Box size all the things
21
16
  // https://squizmap.squiz.net/imp-bp/6400
@@ -101,11 +96,11 @@ a[href^="mailto:"] {
101
96
  overflow-wrap: break-word;
102
97
  }
103
98
 
104
- .qld__body fieldset, fieldset {
105
- padding:0;
99
+ .qld__body fieldset,
100
+ fieldset {
101
+ padding: 0;
106
102
  }
107
103
 
108
-
109
104
  // IE10 Metro responsive
110
105
  // Required for Windows 8 Metro split-screen snapping with IE10
111
106
  // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/
@@ -119,7 +114,6 @@ a[href^="mailto:"] {
119
114
  margin: 0.5cm;
120
115
  }
121
116
 
122
-
123
117
  /*
124
118
  --------------------
125
119
  Components
@@ -1,25 +0,0 @@
1
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------
2
- // Slick Slider
3
- //--------------------------------------------------------------------------------------------------------------------------------------------------------------
4
-
5
- .slick-slider{
6
- .slick-track{
7
- display: flex !important;
8
- }
9
-
10
- .slick-slide{
11
- height: inherit;
12
-
13
- > div{
14
- height: 100%;
15
- }
16
-
17
- li{
18
- height: 100%;
19
- }
20
- .qld__card{
21
- height: 100%;
22
- }
23
- }
24
-
25
- }
@@ -1,335 +0,0 @@
1
- (function () {
2
- "use strict";
3
-
4
- var forms = {};
5
-
6
- forms.init = function () {
7
- $.validator.addMethod("nospaces", function (value, element) {
8
- return this.optional(element) || value.indexOf(" ") === -1;
9
- });
10
-
11
- $.validator.addMethod("postcode", function (value, element) {
12
- return this.optional(element) || (!isNaN(value) && value.length === 4);
13
- });
14
-
15
- $(".qld__form--validate").each(function () {
16
- var $form = $(this);
17
-
18
- // Validate form
19
- $form.validate({
20
- // Error properties
21
- errorElement: "p",
22
- errorClass: "qld__input--error",
23
- errorAttribute: "tabindex=”0″",
24
-
25
- // Place error appropriately in DOM
26
- errorPlacement: function (error, element) {
27
- if (element.closest(".sq-form-question-answer").length > 0) {
28
- var errorPlacement = element.closest(".sq-form-question-answer").parent();
29
- var errorID = "#" + error[0].id.replace(/(:|\.|\[|\]|,|=|@)/g, "\\$1");
30
- error.attr("tabindex", "0");
31
- if (errorPlacement.find(errorID).length === 0) {
32
- if (element.closest(".qld__form-file-wrapper").length > 0) {
33
- element.closest(".qld__form-file-wrapper").before(error);
34
- } else {
35
- error.prependTo(errorPlacement);
36
- }
37
- }
38
- error.focus();
39
- } else if (element.closest(".qld__form-group").length > 0) {
40
- error.attr("tabindex", "0");
41
- error.prependTo(element.closest(".qld__form-group"));
42
- error.focus();
43
- }
44
- },
45
-
46
- // Set valid class
47
- validClass: "qld__input--valid",
48
-
49
- // Check validation on focus out
50
- onfocusout: function (element) {
51
- $(element).valid();
52
- },
53
-
54
- // Check validation on click
55
- onclick: function (element) {
56
- if (element.type === "radio" || element.type === "checkbox") {
57
- $(element).valid();
58
- }
59
- },
60
-
61
- // Highlight invalid
62
- highlight: function (element, errorClass, validClass) {
63
- if (element.type === "radio" || element.type === "checkbox") {
64
- this.findByName(element.name).addClass(errorClass).removeClass(validClass);
65
- } else if (element.type === "file" && element.classList.contains("qld__file-input")) {
66
- $(element).closest(".qld__form-file-dropzone").addClass(errorClass).removeClass(validClass);
67
- } else {
68
- $(element).addClass(errorClass).removeClass(validClass);
69
- }
70
- },
71
-
72
- // Highlight valid
73
- unhighlight: function (element, errorClass, validClass) {
74
- if (element.type === "radio" || element.type === "checkbox") {
75
- if (this.findByName(element.name).is(":checked") || this.findByName(element.name).is(":selected")) {
76
- this.findByName(element.name).removeClass(errorClass).addClass(validClass);
77
- }
78
- } else if (element.type === "file" && element.classList.contains("qld__file-input")) {
79
- $(element).closest(".qld__form-file-dropzone").removeClass(errorClass).addClass(validClass);
80
- } else {
81
- if ($(element).val().length > 0) {
82
- $(element).removeClass(errorClass).addClass(validClass);
83
- }
84
- }
85
- },
86
- });
87
-
88
- // Add custom rules if they exist
89
- if (typeof addCustomRules !== "undefined") {
90
- addCustomRules();
91
- }
92
-
93
- // Add required labels to fields
94
- updateRequiredLabels($form);
95
- $form.on("change", function () {
96
- updateRequiredLabels($(this));
97
- });
98
- // Add aria tag to helper text
99
- updateHelperText($form);
100
-
101
- //Add data auto complete to date field ---Matrix bug fix---
102
- dobFieldAutocomplete($form);
103
-
104
- // Validate select fields when option is selected
105
- $form.find("select").on("change", function () {
106
- console.log("select change");
107
- $(this).valid();
108
- });
109
- });
110
-
111
- $("form").each(function () {
112
- var $form = $(this);
113
- linkHintText($form);
114
- });
115
-
116
- $("[data-displayif-show]").each(function () {
117
- displayCheck($(this));
118
- });
119
-
120
- document.querySelectorAll("select").forEach((select) => {
121
- // First check that the select is not already wrapped
122
- if (select.closest(".qld__select")) {
123
- return;
124
- }
125
-
126
- // Create wrapper div
127
- const wrapper = document.createElement("div");
128
- wrapper.classList.add("qld__select");
129
-
130
- // Matrix specific - add error class to wrapper if the field has an error
131
- if (select.closest(".sq-form-question-error")) {
132
- wrapper.classList.add("qld__select-error");
133
- }
134
-
135
- // Insert wrapper BEFORE the select
136
- select.parentNode.insertBefore(wrapper, select);
137
-
138
- // Move the select into the wrapper
139
- wrapper.appendChild(select);
140
- });
141
- };
142
-
143
- // Make forms available to public
144
- QLD.forms = forms;
145
-
146
- document.addEventListener("DOMContentLoaded", function (event) {
147
- QLD.forms.init();
148
- });
149
-
150
- function updateRequiredLabels($form) {
151
- var $requiredFields = $form.find("[required]");
152
-
153
- $requiredFields.each(function () {
154
- var $field = $(this);
155
- var $question = $field.closest(".sq-form-question");
156
-
157
- if ($question.length > 0) {
158
- var $requiredLabel = $question.find(".sq-form-required-field");
159
-
160
- if ($requiredLabel.length === 0) {
161
- var $title = $question.find(".sq-form-question-title");
162
- $title.append(' <abbr class="sq-form-required-field" title="required">*</abbr>');
163
- }
164
- }
165
- });
166
- }
167
- function updateHelperText($form) {
168
- var $allFields = $form.find("input:not([type=hidden])");
169
-
170
- $allFields.each(function () {
171
- var currentField = $(this);
172
- var currentID = $(this).attr("id");
173
-
174
- if (currentField.parents(".sq-form-question-answer").siblings(".sq-form-question-note").length) {
175
- currentField.attr("aria-describedby", currentID + "_description");
176
- currentField
177
- .parents(".sq-form-question-answer")
178
- .siblings(".sq-form-question-note")
179
- .attr("id", currentID + "_description");
180
- }
181
- });
182
- }
183
-
184
- function dobFieldAutocomplete($form) {
185
- var $dateFieldWrapper = $form.find(".sq-form-question-datetime");
186
-
187
- if ($dateFieldWrapper.length) {
188
- var $dateFieldWrapperId = $form.find(".sq-form-question-datetime").attr("id");
189
- var $dateFieldLegend = $dateFieldWrapper.find("legend");
190
- var $dateFieldLegendId = $dateFieldWrapperId.replace(/(wrapper)/g, "legend");
191
- var $dateField = $dateFieldWrapper.find("input:not([type=hidden])");
192
-
193
- var $dateHelperTextId = $dateFieldWrapper.find("em.sq-form-question-note").attr("id");
194
-
195
- $dateFieldLegend.attr("id", $dateFieldLegendId);
196
- $dateFieldLegend.attr("aria-labeledby", $dateFieldLegendId + " " + $dateHelperTextId);
197
-
198
- if ($dateFieldWrapper.find(".sq-form-question-title").text().toLowerCase().indexOf("birth") >= 0) {
199
- $dateField.each(function () {
200
- var currentField = $(this);
201
- var currentID = $(this).attr("id");
202
- if (currentID.toLowerCase().indexOf("value_d") >= 0) {
203
- currentField.attr("autocomplete", "bday-day");
204
- } else if (currentID.toLowerCase().indexOf("value_m") >= 0) {
205
- currentField.attr("autocomplete", "bday-month");
206
- } else if (currentID.toLowerCase().indexOf("value_y") >= 0) {
207
- currentField.attr("autocomplete", "bday-year");
208
- }
209
- });
210
- }
211
- }
212
- }
213
-
214
- function displayCheck(field) {
215
- var show_hide = field[0].dataset.displayifShow;
216
- var logic_operator = field[0].dataset.displayifOperator;
217
- var rules = field[0].dataset.displayifRule.replaceAll("}{", "},{");
218
- rules = JSON.parse(rules);
219
- var rulesPassed = 0;
220
- var ruleCount = rules.length;
221
-
222
- for (var j = 0; j < ruleCount; j++) {
223
- var rule = rules[j];
224
- var fieldName = rule.field;
225
- var operator = rule.operator;
226
- var ruleValue = rule.value;
227
-
228
- var dependantOnField = $("#" + fieldName);
229
- var fieldValue = dependantOnField.val();
230
-
231
- if (fieldName.indexOf(":") !== -1) {
232
- dependantOnField = $(`[name="${fieldName}"]`);
233
- fieldValue = $(`[name="${fieldName}"]:checked`).val();
234
- }
235
-
236
- dependantOnField.on("change", function () {
237
- displayCheck(field);
238
- });
239
-
240
- if (dependantOnField.is(`input[type="checkbox"]`)) {
241
- if (!dependantOnField.is(":checked")) {
242
- fieldValue = "";
243
- }
244
- }
245
-
246
- if (operator == "equals") {
247
- if (fieldValue == ruleValue) {
248
- rulesPassed++;
249
- }
250
- } else if (operator == "less_than") {
251
- var dependantNumber = Number(fieldValue);
252
- var valueNumber = Number(ruleValue);
253
- if (!Number.isNaN(dependantNumber) && !Number.isNaN(valueNumber)) {
254
- if (dependantNumber < valueNumber) {
255
- rulesPassed++;
256
- }
257
- }
258
- } else if (operator == "greater_than") {
259
- var dependantNumber = Number(fieldValue);
260
- var valueNumber = Number(ruleValue);
261
- if (!Number.isNaN(dependantNumber) && !Number.isNaN(valueNumber)) {
262
- if (dependantNumber > valueNumber) {
263
- rulesPassed++;
264
- }
265
- }
266
- } else if (operator == "contains") {
267
- if (fieldValue.indexOf(ruleValue) !== -1) {
268
- rulesPassed++;
269
- }
270
- }
271
- }
272
-
273
- // For 'AND', check that all rules have passed
274
- if (logic_operator === "AND") {
275
- if (rulesPassed === ruleCount) {
276
- showHideField($(field).closest(".sq-form-question"), show_hide);
277
- } else {
278
- showHideField($(field).closest(".sq-form-question"), !show_hide);
279
- }
280
-
281
- // For 'OR', check that at least 1 rule has passed
282
- } else if (logic_operator === "OR") {
283
- if (rulesPassed > 0) {
284
- showHideField($(field).closest(".sq-form-question"), show_hide);
285
- } else {
286
- showHideField($(field).closest(".sq-form-question"), !show_hide);
287
- }
288
- }
289
- }
290
-
291
- function showHideField(field, show_hide) {
292
- if (show_hide) {
293
- $(field).removeClass("hidden");
294
- } else {
295
- $(field).addClass("hidden");
296
- }
297
- }
298
-
299
- function linkHintText($form) {
300
- var $allFields = $form.find(".sq-form-question-answer");
301
-
302
- // Check if any fields are found before proceeding
303
- if ($allFields.length === 0) {
304
- return; // Exit early if no fields are found
305
- }
306
-
307
- $allFields.each(function () {
308
- var $field = $(this);
309
-
310
- // Get the direct child input/textarea/select element
311
- var $inputElement = $field.find("input, textarea, select").first();
312
-
313
- if ($inputElement.length) {
314
- // Get the ID of the input element
315
- var inputId = $inputElement.attr("id");
316
-
317
- if (inputId) {
318
- // Find the sibling <em> element in the parent .sq-form-question
319
- var $hintElement = $field.closest(".sq-form-question").find("em").first();
320
-
321
- if ($hintElement.length) {
322
- // Create a unique ID for the <em> element
323
- var hintId = inputId + "_hint";
324
-
325
- // Apply the unique ID to the <em> element
326
- $hintElement.attr("id", hintId);
327
-
328
- // Add the 'aria-describedby' attribute to the input element
329
- $inputElement.attr("aria-describedby", hintId);
330
- }
331
- }
332
- }
333
- });
334
- }
335
- })();
@@ -1,153 +0,0 @@
1
-
2
- (function(QLD) {
3
- "use strict";
4
-
5
- /**
6
- * @module carouselSlick
7
- */
8
- var carouselSlick = {};
9
-
10
- /**
11
- * Initialise the location finder
12
- *
13
- * @memberof module:carouselSlick
14
- */
15
- carouselSlick.init = function() {
16
- var $slick = $(`[data-action="slick-slider"]`);
17
-
18
- var breakpoint = {
19
- "Lg": 991,
20
- "Md": 698,
21
- "Sm": 399
22
- };
23
- var slickSettingsMobileOnly = {
24
- slidesToShow: 1.3,
25
- slidesToScroll: 1,
26
- mobileFirst: true,
27
- infinite: false,
28
- centerMode: false,
29
- arrows: true,
30
- prevArrow: '<button class="qld__slick-prev"><span class="fa fa-angle-left"></span><span class="sr-only">Prev</span></button>',
31
- nextArrow: '<button class="qld__slick-next"><span class="fa fa-angle-right"></span><span class="sr-only">Next</span></button>',
32
- responsive: [
33
- {
34
- breakpoint: breakpoint.Md,
35
- settings: 'unslick'
36
- }
37
- ]
38
- };
39
-
40
- var slickSettingsThree = {
41
- slidesToShow: 1.4,
42
- slidesToScroll: 1,
43
- mobileFirst: true,
44
- infinite: false,
45
- centerMode: false,
46
- arrows: true,
47
- dots: false,
48
- appendArrows: '',
49
- appendArrows: '',
50
- prevArrow: '<button class="qld__slick-prev"><span class="fa fa-angle-left"></span><span class="sr-only">Prev</span></button>',
51
- nextArrow: '<button class="qld__slick-next"><span class="fa fa-angle-right"></span><span class="sr-only">Next</span></button>',
52
- responsive: [
53
- {
54
- breakpoint: breakpoint.Lg,
55
- settings: {
56
- slidesToShow: 3,
57
- slidesToScroll: 3
58
- }
59
- },
60
- {
61
- breakpoint: breakpoint.Md,
62
- settings: {
63
- slidesToShow: 2,
64
- slidesToScroll: 2
65
- }
66
- }
67
- ]
68
- }
69
-
70
- var slickSettingsFour = {
71
- slidesToShow: 1.4,
72
- slidesToScroll: 1,
73
- mobileFirst: true,
74
- infinite: false,
75
- centerMode: false,
76
- arrows: true,
77
- dots: false,
78
- appendArrows: '',
79
- appendDots: '',
80
- prevArrow: '<button class="qld__slick-prev"><span class="fa fa-angle-left"></span><span class="sr-only">Prev</span></button>',
81
- nextArrow: '<button class="qld__slick-next"><span class="fa fa-angle-right"></span><span class="sr-only">Next</span></button>',
82
- responsive: [
83
- {
84
- breakpoint: breakpoint.Lg,
85
- settings: {
86
- dots: true,
87
- slidesToShow: 4,
88
- slidesToScroll: 4
89
- }
90
- },
91
- {
92
- breakpoint: breakpoint.Md,
93
- settings: {
94
- slidesToShow: 2,
95
- slidesToScroll: 2
96
- }
97
- }
98
- ]
99
- }
100
-
101
- if($slick.length) {
102
- $slick.each(function() {
103
- var $this = $(this);
104
- if ($this.attr('data-type') == 'mobile-only' && $this.children('li').length > 1) {
105
- slickSettingsMobileOnly.appendArrows = $this.next().find('.qld__slick-controls');
106
- $this.slick(slickSettingsMobileOnly);
107
- } else if ($this.attr('data-type') == 'one'){
108
- slickSettingsMobileOnly.appendArrows = $this.next().find('.qld__slick-controls');
109
- slickSettingsMobileOnly.appendDots = $this.next().find('.qld__slick-controls');
110
- $this.slick(slickSettingsMobileOnly);
111
- }
112
- else if ($this.attr('data-type') == 'two'){
113
- slickSettingsMobileOnly.appendArrows = $this.next().find('.qld__slick-controls');
114
- slickSettingsMobileOnly.appendDots = $this.next().find('.qld__slick-controls');
115
- $this.slick(slickSettingsMobileOnly);
116
- }
117
- else if ($this.attr('data-type') == 'four'){
118
- slickSettingsFour.appendArrows = $this.next().find('.qld__slick-controls');
119
- slickSettingsFour.appendDots = $this.next().find('.qld__slick-controls');
120
- $this.slick(slickSettingsFour);
121
- } else if ($this.attr('data-type') == 'three'){
122
- slickSettingsThree.appendArrows = $this.next().find('.qld__slick-controls');
123
- slickSettingsThree.appendDots = $this.next().find('.qld__slick-controls');
124
- $this.slick(slickSettingsThree);
125
- }
126
- });
127
-
128
- $(window).on("resize", function () {
129
- if ($(window).width() > breakpoint.Md) {
130
- return;
131
- }
132
-
133
- $slick.each(function() {
134
- var $this = $(this);
135
-
136
- if (!$this.hasClass("slick-initialized") && $this.attr('data-type') == 'mobile-only' && $this.children('li').length > 1) {
137
- $this.slick(slickSettingsMobileOnly);
138
- }
139
- });
140
- });
141
- }
142
- }
143
-
144
- var QLD = QLD ? QLD : {};
145
- QLD.carouselSlick = carouselSlick;
146
- window.QLD = QLD;
147
-
148
- document.addEventListener("DOMContentLoaded", function(event) {
149
- if ($(`[data-action="slick-slider"]`).length > 0) {
150
- QLD.carouselSlick.init();
151
- }
152
- });
153
- }(window.QLD));
@@ -1,116 +0,0 @@
1
-
2
- (function(QLD) {
3
- "use strict";
4
-
5
- /**
6
- * @module userLocationFinder
7
- */
8
- var userLocationFinder = {};
9
-
10
- /**
11
- * Initialise the location finder
12
- *
13
- * @memberof module:userLocationFinder
14
- */
15
- userLocationFinder.init = function() {
16
-
17
-
18
- // Need to move this stuff into a central location as it's also used for BSQ location finder
19
- var $ = require('jquery');
20
- var ausPostUrl = typeof site !== 'undefined' ? site.metadata.ausPostUrl.value : ``;
21
- var Bloodhound = require('corejs-typeahead/dist/bloodhound.js');
22
- var datumLocationData;
23
- require('corejs-typeahead/dist/typeahead.jquery.js');
24
-
25
- console.log(ausPostUrl);
26
-
27
- var addressPacket = new Bloodhound({
28
- datumTokenizer: function(d) {
29
- var locationTokens = Bloodhound.tokenizers.whitespace(d.location);
30
- var postcodeTokens = Bloodhound.tokenizers.whitespace(d.postcode);
31
-
32
- return locationTokens.concat(postcodeTokens);
33
- },
34
- queryTokenizer: Bloodhound.tokenizers.whitespace,
35
- limit: 20,
36
- remote: {
37
- url: ausPostUrl,
38
- prepare: function (query, settings) {
39
- settings.url = encodeURI(settings.url + '?query=' + query);
40
- return settings;
41
- }
42
- }
43
- });
44
-
45
-
46
- var $updateLocationInput = $(".qld__update-location-input");
47
-
48
- $updateLocationInput.typeahead('destroy');
49
-
50
- $updateLocationInput.typeahead(null, {
51
- name: 'addresses',
52
- minLength: 3,
53
- display: 'location',
54
- limit: 10,
55
- source: addressPacket,
56
- templates: {
57
- suggestion: function(data) {
58
- return `<p><strong>${data.location}</strong>, ${data.postcode}</p>`;
59
- }
60
- }
61
- }).on('typeahead:select', function (obj, datum, name) {
62
- if(datum.latitude && datum.longitude) {
63
- datumLocationData = datum;
64
- }
65
- });
66
-
67
- $(document).on('click', '[data-action="set-location"]', function(e) {
68
- let $this = $(this);
69
- let $form = $this.closest('form');
70
-
71
- if($form[0].checkValidity()) {
72
- e.preventDefault();
73
-
74
- if(datumLocationData) {
75
- var location = {
76
- "latitude": datumLocationData.latitude,
77
- "longitude": datumLocationData.longitude,
78
- "isGeolocated": false,
79
- "location": datumLocationData.location
80
- }
81
- QLD.utils.setUserLocation(location);
82
- } else {
83
- console.log('Location not found in search field.');
84
- }
85
- } else {
86
- $form[0].reportValidity();
87
- }
88
- });
89
-
90
- var $setCurrentLocationBtn = $('[data-action="set-current-location"]');
91
-
92
- if($setCurrentLocationBtn.length > 0) {
93
- if(QLD.utils.isGeolocated()) {
94
- $setCurrentLocationBtn.addClass('active').attr('disabled', true);
95
- }
96
-
97
- $setCurrentLocationBtn.on('click', function() {
98
- var errorCallback = function() {
99
- $setCurrentLocationBtn.replaceWith('<p class="qld__input--error">Unable to locate</p>');
100
- }
101
- QLD.utils.geolocateUser(true, errorCallback);
102
- });
103
- }
104
- }
105
-
106
- var QLD = QLD ? QLD : {};
107
- QLD.userLocationFinder = userLocationFinder;
108
- window.QLD = QLD;
109
-
110
- document.addEventListener("DOMContentLoaded", function(event) {
111
- if ($(".qld__update-location-input").length > 0) {
112
- QLD.userLocationFinder.init();
113
- }
114
- });
115
-
116
- }(window.QLD));