1
|
|
View Code Duplication |
/******/ (function(modules) { // webpackBootstrap |
|
|
|
|
2
|
|
|
/******/ // The module cache |
3
|
|
|
/******/ var installedModules = {}; |
4
|
|
|
/******/ |
5
|
|
|
/******/ // The require function |
6
|
|
|
/******/ function __webpack_require__(moduleId) { |
7
|
|
|
/******/ |
8
|
|
|
/******/ // Check if module is in cache |
9
|
|
|
/******/ if(installedModules[moduleId]) { |
10
|
|
|
/******/ return installedModules[moduleId].exports; |
11
|
|
|
/******/ } |
12
|
|
|
/******/ // Create a new module (and put it into the cache) |
13
|
|
|
/******/ var module = installedModules[moduleId] = { |
14
|
|
|
/******/ i: moduleId, |
15
|
|
|
/******/ l: false, |
16
|
|
|
/******/ exports: {} |
17
|
|
|
/******/ }; |
18
|
|
|
/******/ |
19
|
|
|
/******/ // Execute the module function |
20
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
21
|
|
|
/******/ |
22
|
|
|
/******/ // Flag the module as loaded |
23
|
|
|
/******/ module.l = true; |
24
|
|
|
/******/ |
25
|
|
|
/******/ // Return the exports of the module |
26
|
|
|
/******/ return module.exports; |
27
|
|
|
/******/ } |
28
|
|
|
/******/ |
29
|
|
|
/******/ |
30
|
|
|
/******/ // expose the modules object (__webpack_modules__) |
31
|
|
|
/******/ __webpack_require__.m = modules; |
32
|
|
|
/******/ |
33
|
|
|
/******/ // expose the module cache |
34
|
|
|
/******/ __webpack_require__.c = installedModules; |
35
|
|
|
/******/ |
36
|
|
|
/******/ // define getter function for harmony exports |
37
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) { |
38
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) { |
39
|
|
|
/******/ Object.defineProperty(exports, name, { |
40
|
|
|
/******/ configurable: false, |
41
|
|
|
/******/ enumerable: true, |
42
|
|
|
/******/ get: getter |
43
|
|
|
/******/ }); |
44
|
|
|
/******/ } |
45
|
|
|
/******/ }; |
46
|
|
|
/******/ |
47
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules |
48
|
|
|
/******/ __webpack_require__.n = function(module) { |
49
|
|
|
/******/ var getter = module && module.__esModule ? |
50
|
|
|
/******/ function getDefault() { return module['default']; } : |
51
|
|
|
/******/ function getModuleExports() { return module; }; |
52
|
|
|
/******/ __webpack_require__.d(getter, 'a', getter); |
53
|
|
|
/******/ return getter; |
54
|
|
|
/******/ }; |
55
|
|
|
/******/ |
56
|
|
|
/******/ // Object.prototype.hasOwnProperty.call |
57
|
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
58
|
|
|
/******/ |
59
|
|
|
/******/ // __webpack_public_path__ |
60
|
|
|
/******/ __webpack_require__.p = "/"; |
61
|
|
|
/******/ |
62
|
|
|
/******/ // Load entry module and return exports |
63
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = 2); |
64
|
|
|
/******/ }) |
65
|
|
|
/************************************************************************/ |
66
|
|
|
/******/ ({ |
67
|
|
|
|
68
|
|
|
/***/ "./resources/assets/js/autocomplete.js": |
69
|
|
View Code Duplication |
/***/ (function(module, exports) { |
|
|
|
|
70
|
|
|
|
71
|
|
|
$(document).ready(function () { |
72
|
|
|
|
73
|
|
|
/* |
74
|
|
|
* jQuery accessible and keyboard-enhanced autocomplete list |
75
|
|
|
* @version v1.6.0 |
76
|
|
|
* Website: https://a11y.nicolas-hoffmann.net/autocomplet-list/ |
77
|
|
|
* License MIT: https://github.com/nico3333fr/jquery-accessible-autocomplete-list-aria/blob/master/LICENSE |
78
|
|
|
*/ |
79
|
|
|
// loading combobox ------------------------------------------------------------------------------------------------------------ |
80
|
|
|
// init |
81
|
|
|
var $js_combobox = $('.js-combobox'), |
82
|
|
|
$body = $('body'), |
83
|
|
|
|
84
|
|
|
// default_text_help = 'Use tabulation (or down) key to access and browse suggestions after input. Confirm your choice with enter key, or esc key to close suggestions box.', |
85
|
|
|
default_text_help = '', |
86
|
|
|
default_class_for_invisible_text = 'invisible', |
87
|
|
|
suggestion_single = 'There is ', |
88
|
|
|
suggestion_plural = 'There are ', |
89
|
|
|
suggestion_word = 'suggestion', |
90
|
|
|
suggestion_word_plural = 'suggestions', |
91
|
|
|
button_clear_title = 'clear this field', |
92
|
|
|
button_clear_text = 'X', |
93
|
|
|
case_sensitive = 'no', |
94
|
|
|
min_length = 0, |
95
|
|
|
limit_number_suggestions = 666, |
96
|
|
|
search_option = 'beginning', |
97
|
|
|
// or 'containing' |
98
|
|
|
see_more_text = 'See more results…', |
99
|
|
|
tablo_suggestions = []; |
100
|
|
|
|
101
|
|
|
function do_see_more_option() { |
102
|
|
|
var $output_content = $('#js-codeit'); |
103
|
|
|
$output_content.html('You have to code a function or a redirection to display more results ;)'); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
if ($js_combobox.length) { |
107
|
|
|
// if there are at least one :) |
108
|
|
|
|
109
|
|
|
// init |
110
|
|
|
$js_combobox.each(function (index_combo) { |
111
|
|
|
var $this = $(this), |
112
|
|
|
$this_id = $this.attr('id'), |
113
|
|
|
$label_this = $('label[for="' + $this_id + '"]'), |
114
|
|
|
index_lisible = index_combo + 1, |
115
|
|
|
options = $this.data(), |
116
|
|
|
$combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass + '-' : '', |
117
|
|
|
$combobox_help_text = typeof options.comboboxHelpText !== 'undefined' ? options.comboboxHelpText : default_text_help, |
118
|
|
|
$list_suggestions = $('#' + $this.attr('list')), |
119
|
|
|
$combobox_button_title = typeof options.comboboxButtonTitle !== 'undefined' ? options.comboboxButtonTitle : button_clear_title, |
120
|
|
|
$combobox_button_text = typeof options.comboboxButtonText !== 'undefined' ? options.comboboxButtonText : button_clear_text, |
121
|
|
|
$combobox_case_sensitive = typeof options.comboboxCaseSensitive !== 'undefined' ? options.comboboxCaseSensitive : case_sensitive, |
122
|
|
|
tablo_temp_suggestions = []; |
123
|
|
|
|
124
|
|
|
// input |
125
|
|
|
$this.attr({ |
126
|
|
|
'data-number': index_lisible, |
127
|
|
|
'autocorrect': 'off', |
128
|
|
|
'autocapitalize': 'off', |
129
|
|
|
'spellcheck': 'false', |
130
|
|
|
'autocomplete': 'off', |
131
|
|
|
'aria-describedby': $combobox_prefix_class + 'help-text' + index_lisible, |
132
|
|
|
'aria-autocomplete': 'list', |
133
|
|
|
'data-lastval': '', |
134
|
|
|
'aria-owns': $combobox_prefix_class + 'suggest_' + index_lisible |
135
|
|
|
}); |
136
|
|
|
// stock into tables |
137
|
|
|
$list_suggestions.find('option').each(function (index_option, index_element) { |
138
|
|
|
tablo_temp_suggestions.push(index_element.value); |
139
|
|
|
}); |
140
|
|
|
if ($combobox_case_sensitive === 'no') { |
141
|
|
|
// order case tablo_temp_suggestions |
142
|
|
|
tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort(function (a, b) { |
143
|
|
|
a = a.toLowerCase(); |
144
|
|
|
b = b.toLowerCase(); |
145
|
|
|
if (a == b) { |
146
|
|
|
return 0; |
147
|
|
|
} |
148
|
|
|
if (a > b) { |
149
|
|
|
return 1; |
150
|
|
|
} |
151
|
|
|
return -1; |
152
|
|
|
}); |
153
|
|
|
} else { |
154
|
|
|
tablo_suggestions[index_lisible] = tablo_temp_suggestions.sort(); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
// wrap into a container |
158
|
|
|
$this.wrap('<div class="' + $combobox_prefix_class + 'container js-container" data-combobox-prefix-class="' + $combobox_prefix_class + '"></div>'); |
159
|
|
|
|
160
|
|
|
var $combobox_container = $this.parent(); |
161
|
|
|
|
162
|
|
|
// custom datalist/listbox linked to input |
163
|
|
|
$combobox_container.append('<div id="' + $combobox_prefix_class + 'suggest_' + index_lisible + '" class="js-suggest ' + $combobox_prefix_class + 'suggestions"><div role="listbox"></div></div>'); |
164
|
|
|
$list_suggestions.remove(); |
165
|
|
|
|
166
|
|
|
// status zone |
167
|
|
|
// $combobox_container.prepend('<div id="' + $combobox_prefix_class + 'suggestion-text' + index_lisible + '" class="js-suggestion-text ' + $combobox_prefix_class + 'suggestion-text ' + default_class_for_invisible_text + '" aria-live="assertive"></div>'); |
168
|
|
|
|
169
|
|
|
// help text |
170
|
|
|
$combobox_container.prepend('<span id="' + $combobox_prefix_class + 'help-text' + index_lisible + '" class="' + $combobox_prefix_class + 'help-text ' + default_class_for_invisible_text + '">' + $combobox_help_text + '</span>'); |
171
|
|
|
|
172
|
|
|
// label id |
173
|
|
|
$label_this.attr('id', 'label-id-' + $this_id); |
174
|
|
|
|
175
|
|
|
// button clear |
176
|
|
|
$this.after('<button class="js-clear-button ' + $combobox_prefix_class + 'clear-button" aria-label="' + $combobox_button_title + '" title="' + $combobox_button_title + '" aria-describedby="label-id-' + $this_id + '" type="button">' + $combobox_button_text + '</button>'); |
177
|
|
|
}); |
178
|
|
|
|
179
|
|
|
// listeners |
180
|
|
|
// keydown on field |
181
|
|
|
$body.on('keyup', '.js-combobox', function (event) { |
182
|
|
|
var $this = $(this), |
183
|
|
|
options_combo = $this.data(), |
184
|
|
|
$container = $this.parent(), |
185
|
|
|
$form = $container.parents('form'), |
186
|
|
|
options = $container.data(), |
187
|
|
|
$combobox_prefix_class = typeof options.comboboxPrefixClass !== 'undefined' ? options.comboboxPrefixClass : '', |
188
|
|
|
// no "-"" because already generated |
189
|
|
|
$suggestions = $container.find('.js-suggest div'), |
190
|
|
|
|
191
|
|
|
//$suggestion_list = $suggestions.find('.js-suggestion'), |
192
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
193
|
|
|
$combobox_suggestion_single = typeof options_combo.suggestionSingle !== 'undefined' ? options_combo.suggestionSingle : suggestion_single, |
194
|
|
|
$combobox_suggestion_plural = typeof options_combo.suggestionPlural !== 'undefined' ? options_combo.suggestionPlural : suggestion_plural, |
195
|
|
|
$combobox_suggestion_word = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWord : suggestion_word, |
196
|
|
|
$combobox_suggestion_word_plural = typeof options_combo.suggestionWord !== 'undefined' ? options_combo.suggestionWordPlural : suggestion_word_plural, |
197
|
|
|
combobox_min_length = typeof options_combo.comboboxMinLength !== 'undefined' ? Math.abs(options_combo.comboboxMinLength) : min_length, |
198
|
|
|
$combobox_case_sensitive = typeof options_combo.comboboxCaseSensitive !== 'undefined' ? options_combo.comboboxCaseSensitive : case_sensitive, |
199
|
|
|
combobox_limit_number_suggestions = typeof options_combo.comboboxLimitNumberSuggestions !== 'undefined' ? Math.abs(options_combo.comboboxLimitNumberSuggestions) : limit_number_suggestions, |
200
|
|
|
$combobox_search_option = typeof options_combo.comboboxSearchOption !== 'undefined' ? options_combo.comboboxSearchOption : search_option, |
201
|
|
|
$combobox_see_more_text = typeof options_combo.comboboxSeeMoreText !== 'undefined' ? options_combo.comboboxSeeMoreText : see_more_text, |
202
|
|
|
index_table = $this.attr('data-number'), |
203
|
|
|
value_to_search = $this.val(), |
204
|
|
|
text_number_suggestions = ''; |
205
|
|
|
|
206
|
|
|
if (event.keyCode === 13) { |
207
|
|
|
$form.submit(); |
208
|
|
|
} else { |
209
|
|
|
|
210
|
|
|
if (event.keyCode !== 27) { |
211
|
|
|
// No Escape |
212
|
|
|
|
213
|
|
|
$this.attr('data-lastval', value_to_search); |
214
|
|
|
// search for text suggestion in the array tablo_suggestions[index_table] |
215
|
|
|
var size_tablo = tablo_suggestions[index_table].length, |
216
|
|
|
i = 0, |
217
|
|
|
counter = 0; |
218
|
|
|
|
219
|
|
|
$suggestions.empty(); |
220
|
|
|
|
221
|
|
|
if (value_to_search != '' && value_to_search.length >= combobox_min_length) { |
222
|
|
|
while (i < size_tablo) { |
223
|
|
|
if (counter < combobox_limit_number_suggestions) { |
224
|
|
|
if ($combobox_search_option === 'containing' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].indexOf(value_to_search) >= 0 || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].toUpperCase().indexOf(value_to_search.toUpperCase()) >= 0) || $combobox_search_option === 'beginning' && ($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].substring(0, value_to_search.length) === value_to_search || $combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].substring(0, value_to_search.length).toUpperCase() === value_to_search.toUpperCase())) { |
225
|
|
|
$suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + tablo_suggestions[index_table][i] + '</div>'); |
226
|
|
|
counter++; |
227
|
|
|
} |
228
|
|
|
} |
229
|
|
|
i++; |
230
|
|
|
} |
231
|
|
|
if (counter >= combobox_limit_number_suggestions) { |
232
|
|
|
$suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion js-seemore ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + $combobox_see_more_text + '</div>'); |
233
|
|
|
counter++; |
234
|
|
|
} |
235
|
|
|
// update number of suggestions |
236
|
|
|
if (counter > 1) { |
237
|
|
|
text_number_suggestions = $combobox_suggestion_plural + counter + ' ' + $combobox_suggestion_word_plural + '.'; |
238
|
|
|
} |
239
|
|
|
if (counter === 1) { |
240
|
|
|
text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.'; |
241
|
|
|
} |
242
|
|
|
if (counter === 0) { |
243
|
|
|
text_number_suggestions = $combobox_suggestion_single + counter + ' ' + $combobox_suggestion_word + '.'; |
244
|
|
|
} |
245
|
|
|
if (counter >= 0) { |
246
|
|
|
var text_number_suggestions_default = $suggestions_text.text(); |
247
|
|
|
if (text_number_suggestions != text_number_suggestions_default) { |
248
|
|
|
// @Goestu trick to make it work on all AT |
249
|
|
|
var suggestions_to_add = $("<p>").text(text_number_suggestions); |
250
|
|
|
$suggestions_text.attr('aria-live', 'polite'); |
251
|
|
|
$suggestions_text.empty(); |
252
|
|
|
$suggestions_text.append(suggestions_to_add); |
253
|
|
|
} |
254
|
|
|
} |
255
|
|
|
} |
256
|
|
|
} |
257
|
|
|
} |
258
|
|
|
}).on('click', function (event) { |
259
|
|
|
var $target = $(event.target), |
260
|
|
|
$suggestions_text = $('.js-suggestion-text:not(:empty)'), |
261
|
|
|
// if a suggestion text is not empty => suggestion opened somewhere |
262
|
|
|
$container = $suggestions_text.parents('.js-container'), |
263
|
|
|
$input_text = $container.find('.js-combobox'), |
264
|
|
|
$suggestions = $container.find('.js-suggest div'); |
265
|
|
|
|
266
|
|
|
// if click outside => close opened suggestions |
267
|
|
|
if (!$target.is('.js-suggestion') && !$target.is('.js-combobox') && $suggestions_text.length) { |
268
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
269
|
|
|
$suggestions.empty(); |
270
|
|
|
$suggestions_text.empty(); |
271
|
|
|
} |
272
|
|
|
}) |
273
|
|
|
// tab + down management for autocomplete (when list of suggestion) |
274
|
|
|
.on('keydown', '.js-combobox', function (event) { |
275
|
|
|
var $this = $(this), |
276
|
|
|
$container = $this.parent(), |
277
|
|
|
$input_text = $container.find('.js-combobox'), |
278
|
|
|
$suggestions = $container.find('.js-suggest div'), |
279
|
|
|
$suggestion_list = $suggestions.find('.js-suggestion'), |
280
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
281
|
|
|
$autorise_tab_options = typeof $this.attr('data-combobox-notab-options') !== 'undefined' ? false : true, |
282
|
|
|
$first_suggestion = $suggestion_list.first(); |
283
|
|
|
|
284
|
|
|
if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) { |
285
|
|
|
// tab (if authorised) or bottom |
286
|
|
|
// See if there are suggestions, and yes => focus on first one |
287
|
|
|
if ($suggestion_list.length) { |
288
|
|
|
$input_text.val($first_suggestion.html()); |
289
|
|
|
$suggestion_list.first().focus(); |
290
|
|
|
event.preventDefault(); |
291
|
|
|
} |
292
|
|
|
} |
293
|
|
|
if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) { |
294
|
|
|
// esc or (tab/shift tab + notab option) = close |
295
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
296
|
|
|
$suggestions.empty(); |
297
|
|
|
$suggestions_text.empty(); |
298
|
|
|
if (event.keyCode == 27) { |
299
|
|
|
// Esc prevented only, tab can go :) |
300
|
|
|
event.preventDefault(); |
301
|
|
|
setTimeout(function () { |
302
|
|
|
$input_text.focus(); |
303
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
304
|
|
|
} |
305
|
|
|
} |
306
|
|
|
}) |
307
|
|
|
// tab + down management in list of suggestions |
308
|
|
|
.on('keydown', '.js-suggestion', function (event) { |
309
|
|
|
var $this = $(this), |
310
|
|
|
$container = $this.parents('.js-container'), |
311
|
|
|
$input_text = $container.find('.js-combobox'), |
312
|
|
|
$autorise_tab_options = typeof $input_text.attr('data-combobox-notab-options') !== 'undefined' ? false : true, |
313
|
|
|
$suggestions = $container.find('.js-suggest div'), |
314
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'), |
315
|
|
|
$next_suggestion = $this.next(), |
316
|
|
|
$previous_suggestion = $this.prev(); |
317
|
|
|
|
318
|
|
|
if (event.keyCode == 27 || $autorise_tab_options === false && event.keyCode == 9) { |
319
|
|
|
// esc or (tab/shift tab + notab option) = close |
320
|
|
|
if (event.keyCode == 27) { |
321
|
|
|
// Esc prevented only, tab can go :) |
322
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
323
|
|
|
$suggestions.empty(); |
324
|
|
|
$suggestions_text.empty(); |
325
|
|
|
setTimeout(function () { |
326
|
|
|
$input_text.focus(); |
327
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
328
|
|
|
event.preventDefault(); |
329
|
|
|
} |
330
|
|
|
if ($autorise_tab_options === false && event.keyCode == 9) { |
331
|
|
|
$suggestions.empty(); |
332
|
|
|
$suggestions_text.empty(); |
333
|
|
|
$input_text.focus(); |
334
|
|
|
} |
335
|
|
|
} |
336
|
|
|
if (event.keyCode == 13 || event.keyCode == 32) { |
337
|
|
|
// Enter or space |
338
|
|
|
if ($this.hasClass('js-seemore')) { |
339
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
340
|
|
|
$suggestions.empty(); |
341
|
|
|
$suggestions_text.empty(); |
342
|
|
|
setTimeout(function () { |
343
|
|
|
$input_text.focus(); |
344
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
345
|
|
|
// go define the function you need when we click the see_more option |
346
|
|
|
setTimeout(function () { |
347
|
|
|
do_see_more_option(); |
348
|
|
|
}, 301); // timeout to avoid problem in suggestions display |
349
|
|
|
event.preventDefault(); |
350
|
|
|
} else { |
351
|
|
|
$input_text.val($this.html()); |
352
|
|
|
$input_text.attr('data-lastval', $this.html()); |
353
|
|
|
$suggestions.empty(); |
354
|
|
|
$suggestions_text.empty(); |
355
|
|
|
setTimeout(function () { |
356
|
|
|
$input_text.focus(); |
357
|
|
|
}, 300); // timeout to avoid problem in suggestions display |
358
|
|
|
event.preventDefault(); |
359
|
|
|
} |
360
|
|
|
} |
361
|
|
|
if (!event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 40) { |
362
|
|
|
// tab (if authorised) or bottom |
363
|
|
|
if ($next_suggestion.length) { |
364
|
|
|
$input_text.val($next_suggestion.html()); |
365
|
|
|
$next_suggestion.focus(); |
366
|
|
|
} else { |
367
|
|
|
$input_text.val($input_text.attr('data-lastval')); |
368
|
|
|
if (!event.shiftKey && event.keyCode == 9) { |
369
|
|
|
// tab closes the list |
370
|
|
|
var e = jQuery.Event("keydown"); |
371
|
|
|
e.which = 27; // # Some key code value |
372
|
|
|
e.keyCode = 27; |
373
|
|
|
$this.trigger(e); |
374
|
|
|
} else { |
375
|
|
|
setTimeout(function () { |
376
|
|
|
$input_text.focus(); |
377
|
|
|
}, 300); |
378
|
|
|
} // timeout to avoid problem in suggestions display |
379
|
|
|
} |
380
|
|
|
event.preventDefault(); |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
if (event.shiftKey && event.keyCode == 9 && $autorise_tab_options || event.keyCode == 38) { |
384
|
|
|
// top or Maj+tab (if authorised) |
385
|
|
|
if ($previous_suggestion.length) { |
386
|
|
|
$input_text.val($previous_suggestion.html()); |
387
|
|
|
$previous_suggestion.focus(); |
388
|
|
|
} else { |
389
|
|
|
$input_text.val($input_text.attr('data-lastval')).focus(); |
390
|
|
|
} |
391
|
|
|
event.preventDefault(); |
392
|
|
|
} |
393
|
|
|
}) |
394
|
|
|
// clear button |
395
|
|
|
.on('click', '.js-clear-button', function () { |
396
|
|
|
var $this = $(this), |
397
|
|
|
$container = $this.parent(), |
398
|
|
|
$input_text = $container.find('.js-combobox'), |
399
|
|
|
$suggestions = $container.find('.js-suggest div'), |
400
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'); |
401
|
|
|
|
402
|
|
|
$suggestions.empty(); |
403
|
|
|
$suggestions_text.empty(); |
404
|
|
|
$input_text.val(''); |
405
|
|
|
$input_text.attr('data-lastval', ''); |
406
|
|
|
}).on('click', '.js-suggestion', function () { |
407
|
|
|
var $this = $(this), |
408
|
|
|
value = $this.html(), |
409
|
|
|
$container = $this.parents('.js-container'), |
410
|
|
|
$input_text = $container.find('.js-combobox'), |
411
|
|
|
$suggestions = $container.find('.js-suggest div'), |
412
|
|
|
$suggestions_text = $container.find('.js-suggestion-text'); |
413
|
|
|
|
414
|
|
|
if ($this.hasClass('js-seemore')) { |
415
|
|
|
$suggestions.empty(); |
416
|
|
|
$suggestions_text.empty(); |
417
|
|
|
$input_text.focus(); |
418
|
|
|
// go define the function you need when we click the see_more option |
419
|
|
|
do_see_more_option(); |
420
|
|
|
} else { |
421
|
|
|
$input_text.val(value).focus(); |
422
|
|
|
$suggestions.empty(); |
423
|
|
|
$suggestions_text.empty(); |
424
|
|
|
} |
425
|
|
|
}); |
426
|
|
|
} |
427
|
|
|
}); |
428
|
|
|
|
429
|
|
|
/***/ }), |
430
|
|
|
|
431
|
|
|
/***/ 2: |
432
|
|
|
/***/ (function(module, exports, __webpack_require__) { |
433
|
|
|
|
434
|
|
|
module.exports = __webpack_require__("./resources/assets/js/autocomplete.js"); |
435
|
|
|
|
436
|
|
|
|
437
|
|
|
/***/ }) |
438
|
|
|
|
439
|
|
|
/******/ }); |