semantic-ui-sass 1.7.3.0 → 1.8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/javascripts/semantic-ui/api.js +22 -11
  4. data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
  5. data/app/assets/javascripts/semantic-ui/dropdown.js +204 -105
  6. data/app/assets/javascripts/semantic-ui/form.js +259 -43
  7. data/app/assets/javascripts/semantic-ui/popup.js +4 -3
  8. data/app/assets/javascripts/semantic-ui/search.js +310 -152
  9. data/app/assets/javascripts/semantic-ui/sidebar.js +18 -7
  10. data/app/assets/javascripts/semantic-ui/sticky.js +1 -1
  11. data/app/assets/javascripts/semantic-ui/transition.js +35 -23
  12. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  13. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1 -1
  14. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +31 -1
  15. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +21 -20
  16. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
  17. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1 -1
  18. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +15 -3
  19. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  20. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
  21. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +70 -31
  22. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1 -1
  23. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  24. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +1 -1
  25. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +11 -8
  26. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +9 -19
  27. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
  28. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  29. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  30. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +1 -1
  31. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +1 -1
  32. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
  33. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -1
  34. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +7 -7
  35. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +55 -28
  36. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
  37. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1 -1
  38. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +2 -1
  39. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  40. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +5 -2
  41. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
  42. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
  43. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
  44. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  45. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +2 -1
  46. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
  47. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  48. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1557 -538
  49. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +1 -1
  50. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
  54. data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
  55. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
  56. data/lib/semantic/ui/sass/version.rb +2 -2
  57. metadata +2 -2
@@ -32,6 +32,8 @@ $.fn.search = function(parameters) {
32
32
  settings = $.extend(true, {}, $.fn.search.settings, parameters),
33
33
 
34
34
  className = settings.className,
35
+ metadata = settings.metadata,
36
+ regExp = settings.regExp,
35
37
  selector = settings.selector,
36
38
  error = settings.error,
37
39
  namespace = settings.namespace,
@@ -107,9 +109,7 @@ $.fn.search = function(parameters) {
107
109
  },
108
110
  event: {
109
111
  focus: function() {
110
- $module
111
- .addClass(className.focus)
112
- ;
112
+ module.set.focus();
113
113
  clearTimeout(module.timer);
114
114
  module.throttle();
115
115
  if( module.has.minimumCharacters() ) {
@@ -117,11 +117,12 @@ $.fn.search = function(parameters) {
117
117
  }
118
118
  },
119
119
  blur: function(event) {
120
- module.cancel();
121
- $module
122
- .removeClass(className.focus)
120
+ var
121
+ pageLostFocus = (document.activeElement === this)
123
122
  ;
124
- if(!module.resultsClicked) {
123
+ if(!pageLostFocus && !module.resultsClicked) {
124
+ module.cancel.query();
125
+ module.remove.focus();
125
126
  module.timer = setTimeout(module.hideResults, settings.hideDelay);
126
127
  }
127
128
  },
@@ -136,30 +137,35 @@ $.fn.search = function(parameters) {
136
137
  module.debug('Search result selected');
137
138
  var
138
139
  $result = $(this),
139
- $title = $result.find('.title'),
140
- title = $title.html()
140
+ $title = $result.find(selector.title).eq(0),
141
+ $link = $result.find('a[href]').eq(0),
142
+ href = $link.attr('href') || false,
143
+ target = $link.attr('target') || false,
144
+ title = $title.html(),
145
+ name = ($title.length > 0)
146
+ ? $title.text()
147
+ : false,
148
+ results = module.get.results(),
149
+ result = module.get.result(name, results),
150
+ returnedValue
141
151
  ;
142
- if(settings.onSelect == 'default' || settings.onSelect.call(this, event) == 'default') {
143
- var
144
- $link = $result.find('a[href]').eq(0),
145
- $title = $result.find(selector.title).eq(0),
146
- href = $link.attr('href') || false,
147
- target = $link.attr('target') || false,
148
- name = ($title.length > 0)
149
- ? $title.text()
150
- : false
151
- ;
152
- module.hideResults();
153
- if(name) {
154
- $prompt.val(name);
152
+ if( $.isFunction(settings.onSelect) ) {
153
+ if(settings.onSelect.call(element, result, results) === false) {
154
+ module.debug('Custom onSelect callback cancelled default select action');
155
+ return;
155
156
  }
156
- if(href) {
157
- if(target == '_blank' || event.ctrlKey) {
158
- window.open(href);
159
- }
160
- else {
161
- window.location.href = (href);
162
- }
157
+ }
158
+ module.hideResults();
159
+ if(name) {
160
+ module.set.value(name);
161
+ }
162
+ if(href) {
163
+ module.verbose('Opening search link found in result', $link);
164
+ if(target == '_blank' || event.ctrlKey) {
165
+ window.open(href);
166
+ }
167
+ else {
168
+ window.location.href = (href);
163
169
  }
164
170
  }
165
171
  }
@@ -167,20 +173,20 @@ $.fn.search = function(parameters) {
167
173
  },
168
174
  handleKeyboard: function(event) {
169
175
  var
170
- // force latest jq dom
171
- $result = $module.find(selector.result),
172
- $category = $module.find(selector.category),
173
- keyCode = event.which,
174
- keys = {
176
+ // force selector refresh
177
+ $result = $module.find(selector.result),
178
+ $category = $module.find(selector.category),
179
+ currentIndex = $result.index( $result.filter('.' + className.active) ),
180
+ resultSize = $result.length,
181
+
182
+ keyCode = event.which,
183
+ keys = {
175
184
  backspace : 8,
176
185
  enter : 13,
177
186
  escape : 27,
178
187
  upArrow : 38,
179
188
  downArrow : 40
180
189
  },
181
- activeClass = className.active,
182
- currentIndex = $result.index( $result.filter('.' + activeClass) ),
183
- resultSize = $result.length,
184
190
  newIndex
185
191
  ;
186
192
  // search shortcuts
@@ -190,12 +196,11 @@ $.fn.search = function(parameters) {
190
196
  .trigger('blur')
191
197
  ;
192
198
  }
193
- // result shortcuts
194
- if($results.filter(':visible').length > 0) {
199
+ if( module.is.visible() ) {
195
200
  if(keyCode == keys.enter) {
196
201
  module.verbose('Enter key pressed, selecting active result');
197
- if( $result.filter('.' + activeClass).length > 0 ) {
198
- module.event.result.click.call($result.filter('.' + activeClass), event);
202
+ if( $result.filter('.' + className.active).length > 0 ) {
203
+ module.event.result.click.call($result.filter('.' + className.active), event);
199
204
  event.preventDefault();
200
205
  return false;
201
206
  }
@@ -207,14 +212,14 @@ $.fn.search = function(parameters) {
207
212
  : currentIndex - 1
208
213
  ;
209
214
  $category
210
- .removeClass(activeClass)
215
+ .removeClass(className.active)
211
216
  ;
212
217
  $result
213
- .removeClass(activeClass)
218
+ .removeClass(className.active)
214
219
  .eq(newIndex)
215
- .addClass(activeClass)
220
+ .addClass(className.active)
216
221
  .closest($category)
217
- .addClass(activeClass)
222
+ .addClass(className.active)
218
223
  ;
219
224
  event.preventDefault();
220
225
  }
@@ -225,14 +230,14 @@ $.fn.search = function(parameters) {
225
230
  : currentIndex + 1
226
231
  ;
227
232
  $category
228
- .removeClass(activeClass)
233
+ .removeClass(className.active)
229
234
  ;
230
235
  $result
231
- .removeClass(activeClass)
236
+ .removeClass(className.active)
232
237
  .eq(newIndex)
233
- .addClass(activeClass)
238
+ .addClass(className.active)
234
239
  .closest($category)
235
- .addClass(activeClass)
240
+ .addClass(className.active)
236
241
  ;
237
242
  event.preventDefault();
238
243
  }
@@ -242,24 +247,115 @@ $.fn.search = function(parameters) {
242
247
  if(keyCode == keys.enter) {
243
248
  module.verbose('Enter key pressed, executing query');
244
249
  module.query();
245
- $searchButton
246
- .addClass(className.down)
247
- ;
248
- $prompt
249
- .one('keyup', function(){
250
- $searchButton
251
- .removeClass(className.down)
252
- ;
253
- })
254
- ;
250
+ module.set.buttonPressed();
251
+ $prompt.one('keyup', module.remove.buttonFocus);
252
+ }
253
+ }
254
+ },
255
+
256
+ setup: {
257
+ api: function() {
258
+ var
259
+ apiSettings = {
260
+ on : false,
261
+ action : 'search',
262
+ onFailure : module.error
263
+ },
264
+ searchHTML
265
+ ;
266
+ module.verbose('First request, initializing API');
267
+ $module.api(apiSettings);
268
+ }
269
+ },
270
+
271
+ can: {
272
+ useAPI: function() {
273
+ return $.fn.api !== undefined;
274
+ },
275
+ transition: function() {
276
+ return settings.transition && $.fn.transition !== undefined && $module.transition('is supported');
277
+ }
278
+ },
279
+
280
+ is: {
281
+ empty: function() {
282
+ return ($results.html() === '');
283
+ },
284
+ visible: function() {
285
+ return ($results.filter(':visible').length > 0);
286
+ },
287
+ focused: function() {
288
+ return ($prompt.filter(':focus').length > 0);
289
+ }
290
+ },
291
+
292
+ get: {
293
+ value: function() {
294
+ return $prompt.val();
295
+ },
296
+ results: function() {
297
+ var
298
+ results = $module.data(metadata.results)
299
+ ;
300
+ return results;
301
+ },
302
+ result: function(value, results) {
303
+ var
304
+ result = false
305
+ ;
306
+ value = value || module.get.value();
307
+ results = results || module.get.results();
308
+ if(settings.type === 'category') {
309
+ module.debug('Finding result from category results', value);
310
+ $.each(results, function(index, category) {
311
+ if(category.results !== undefined) {
312
+ result = module.search.object(value, category.results)[0];
313
+ if(result.length > 0) {
314
+ return true;
315
+ }
316
+ }
317
+ });
255
318
  }
319
+ else {
320
+ module.debug('Finding result in results object', value);
321
+ result = module.search.object(value, results)[0];
322
+ }
323
+ return result;
324
+ },
325
+ },
326
+
327
+ set: {
328
+ focus: function() {
329
+ $module.addClass(className.focus);
330
+ },
331
+ loading: function() {
332
+ $module.addClass(className.loading);
333
+ },
334
+ value: function(value) {
335
+ module.verbose('Setting search input value', value);
336
+ $prompt.val(value);
337
+ },
338
+ buttonPressed: function() {
339
+ $searchButton.addClass(className.pressed);
340
+ }
341
+ },
342
+
343
+ remove: {
344
+ loading: function() {
345
+ $module.removeClass(className.loading);
346
+ },
347
+ focus: function() {
348
+ $module.removeClass(className.focus);
349
+ },
350
+ buttonPressed: function() {
351
+ $searchButton.removeClass(className.pressed);
256
352
  }
257
353
  },
258
354
 
259
355
  query: function() {
260
356
  var
261
- searchTerm = $prompt.val(),
262
- cachedHTML = module.read.cache(searchTerm)
357
+ searchTerm = module.get.value(),
358
+ cachedHTML = module.read.cachedHTML(searchTerm)
263
359
  ;
264
360
  if(cachedHTML) {
265
361
  module.debug('Reading result for ' + searchTerm + ' from cache');
@@ -270,15 +366,15 @@ $.fn.search = function(parameters) {
270
366
  if($.isPlainObject(settings.source) || $.isArray(settings.source)) {
271
367
  module.search.local(searchTerm);
272
368
  }
273
- else if(settings.apiSettings) {
274
- module.search.remote(searchTerm);
275
- }
276
- else if($.fn.api !== undefined && $.api.settings.api.search !== undefined) {
277
- module.debug('Searching with default search API endpoint');
278
- settings.apiSettings = {
279
- action: 'search'
280
- };
281
- module.search.remote(searchTerm);
369
+ else if( module.can.useAPI() ) {
370
+ if(settings.apiSettings) {
371
+ module.debug('Searching with specified API settings', settings.apiSettings);
372
+ module.search.remote(searchTerm);
373
+ }
374
+ else if($.api.settings.api.search !== undefined) {
375
+ module.debug('Searching with default search API endpoint');
376
+ module.search.remote(searchTerm);
377
+ }
282
378
  }
283
379
  else {
284
380
  module.error(error.source);
@@ -290,21 +386,64 @@ $.fn.search = function(parameters) {
290
386
  search: {
291
387
  local: function(searchTerm) {
292
388
  var
293
- results = [],
389
+ searchResults = module.search.object(searchTerm, settings.content),
390
+ searchHTML
391
+ ;
392
+ module.set.loading();
393
+ module.save.results(searchResults);
394
+ module.debug('Returned local search results', searchResults);
395
+
396
+ searchHTML = module.generateResults({
397
+ results: searchResults
398
+ });
399
+ module.remove.loading();
400
+ module.write.cachedHTML(searchTerm, searchHTML);
401
+ module.addResults(searchHTML);
402
+ },
403
+ remote: function(searchTerm) {
404
+ var
405
+ apiSettings = {
406
+ onSuccess : function(response) {
407
+ module.parse.response.call(element, response, searchTerm);
408
+ },
409
+ urlData: {
410
+ query: searchTerm
411
+ }
412
+ }
413
+ ;
414
+ if( !$module.api('get request') ) {
415
+ module.setup.api();
416
+ }
417
+ $.extend(true, apiSettings, settings.apiSettings);
418
+ module.debug('Executing search', apiSettings);
419
+ module.cancel.query();
420
+ $module
421
+ .api('setting', apiSettings)
422
+ .api('query')
423
+ ;
424
+ },
425
+ object: function(searchTerm, source) {
426
+ var
427
+ results = [],
294
428
  fullTextResults = [],
295
429
  searchFields = $.isArray(settings.searchFields)
296
430
  ? settings.searchFields
297
431
  : [settings.searchFields],
298
- searchRegExp = new RegExp('(?:\s|^)' + searchTerm, 'i'),
299
- fullTextRegExp = new RegExp(searchTerm, 'i'),
300
- searchHTML
301
- ;
302
- $module
303
- .addClass(className.loading)
432
+ searchRegExp = new RegExp(regExp.exact + searchTerm, 'i'),
433
+ fullTextRegExp = new RegExp(searchTerm, 'i')
304
434
  ;
435
+
436
+ source = source || settings.source;
437
+
438
+ // exit conditions on no source
439
+ if(source === undefined) {
440
+ module.error(error.source);
441
+ return [];
442
+ }
443
+
305
444
  // iterate through search fields in array order
306
445
  $.each(searchFields, function(index, field) {
307
- $.each(settings.source, function(label, content) {
446
+ $.each(source, function(label, content) {
308
447
  var
309
448
  fieldExists = (typeof content[field] == 'string'),
310
449
  notAlreadyResult = ($.inArray(content, results) == -1 && $.inArray(content, fullTextResults) == -1)
@@ -319,37 +458,26 @@ $.fn.search = function(parameters) {
319
458
  }
320
459
  });
321
460
  });
322
- searchHTML = module.generateResults({
323
- results: $.merge(results, fullTextResults)
324
- });
325
- $module
326
- .removeClass(className.loading)
327
- ;
328
- module.write.cache(searchTerm, searchHTML);
329
- module.addResults(searchHTML);
330
- },
331
- remote: function(searchTerm) {
461
+ return $.merge(results, fullTextResults);
462
+ }
463
+ },
464
+
465
+ parse: {
466
+ response: function(response, searchTerm) {
332
467
  var
333
- apiSettings = {
334
- stateContext : $module,
335
- urlData : {
336
- query: searchTerm
337
- },
338
- onSuccess : function(response) {
339
- searchHTML = module.generateResults(response);
340
- module.write.cache(searchTerm, searchHTML);
341
- module.addResults(searchHTML);
342
- },
343
- onFailure : module.error
344
- },
345
- searchHTML
468
+ searchHTML = module.generateResults(response)
346
469
  ;
347
- module.cancel();
348
- module.debug('Executing search');
349
- $.extend(true, apiSettings, settings.apiSettings);
350
- $.api(apiSettings);
470
+ module.verbose('Parsing server response', response);
471
+ if(response !== undefined) {
472
+ if(searchTerm) {
473
+ module.write.cachedHTML(searchTerm, searchHTML);
474
+ if(response.results !== undefined) {
475
+ module.save.results(response.results);
476
+ }
477
+ }
478
+ module.addResults(searchHTML);
479
+ }
351
480
  }
352
-
353
481
  },
354
482
 
355
483
  throttle: function() {
@@ -362,20 +490,18 @@ $.fn.search = function(parameters) {
362
490
  }
363
491
  },
364
492
 
365
- cancel: function() {
366
- var
367
- xhr = $module.data('xhr') || false
368
- ;
369
- if( xhr && xhr.state() != 'resolved') {
370
- module.debug('Cancelling last search');
371
- xhr.abort();
493
+ cancel: {
494
+ query: function() {
495
+ if( module.can.useAPI() ) {
496
+ $module.api('abort');
497
+ }
372
498
  }
373
499
  },
374
500
 
375
501
  has: {
376
502
  minimumCharacters: function() {
377
503
  var
378
- searchTerm = $prompt.val(),
504
+ searchTerm = module.get.value(),
379
505
  numCharacters = searchTerm.length
380
506
  ;
381
507
  return (numCharacters >= settings.minCharacters);
@@ -383,43 +509,61 @@ $.fn.search = function(parameters) {
383
509
  },
384
510
 
385
511
  read: {
386
- cache: function(name) {
512
+ cachedHTML: function(name) {
387
513
  var
388
- cache = $module.data('cache')
389
- ;
390
- return (settings.cache && (typeof cache == 'object') && (cache[name] !== undefined) )
391
- ? cache[name]
392
- : false
514
+ cache = $module.data(metadata.cache)
393
515
  ;
516
+ if(settings.cache) {
517
+ module.verbose('Checking cache for generated html for query', name);
518
+ return (typeof cache == 'object') && (cache[name] !== undefined)
519
+ ? cache[name]
520
+ : false
521
+ ;
522
+ }
523
+ return false;
524
+ }
525
+ },
526
+
527
+ save: {
528
+ results: function(results) {
529
+ module.verbose('Saving current search results to metadata', results);
530
+ $module.data(metadata.results, results);
394
531
  }
395
532
  },
396
533
 
397
534
  write: {
398
- cache: function(name, value) {
535
+ cachedHTML: function(name, value) {
399
536
  var
400
- cache = ($module.data('cache') !== undefined)
401
- ? $module.data('cache')
537
+ cache = ($module.data(metadata.cache) !== undefined)
538
+ ? $module.data(metadata.cache)
402
539
  : {}
403
540
  ;
404
- cache[name] = value;
405
- $module
406
- .data('cache', cache)
407
- ;
541
+ if(settings.cache) {
542
+ module.verbose('Writing generated html to cache', name, value);
543
+ cache[name] = value;
544
+ $module
545
+ .data(metadata.cache, cache)
546
+ ;
547
+ }
408
548
  }
409
549
  },
410
550
 
411
551
  addResults: function(html) {
412
- if(settings.onResultsAdd == 'default' || settings.onResultsAdd.call($results, html) == 'default') {
413
- $results
414
- .html(html)
415
- ;
552
+ if( $.isFunction(settings.onResultsAdd) ) {
553
+ if( settings.onResultsAdd.call($results, html) === false ) {
554
+ module.debug('onResultsAdd callback cancelled default action');
555
+ return false;
556
+ }
416
557
  }
558
+ $results
559
+ .html(html)
560
+ ;
417
561
  module.showResults();
418
562
  },
419
563
 
420
564
  showResults: function() {
421
- if( ($results.filter(':visible').length === 0) && ($prompt.filter(':focus').length > 0) && $results.html() !== '') {
422
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is inward')) {
565
+ if( !module.is.visible() && module.is.focused() && !module.is.empty() ) {
566
+ if( module.can.transition() ) {
423
567
  module.debug('Showing results with css animations');
424
568
  $results
425
569
  .transition({
@@ -440,8 +584,8 @@ $.fn.search = function(parameters) {
440
584
  }
441
585
  },
442
586
  hideResults: function() {
443
- if($results.filter(':visible').length > 0) {
444
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported') && !$results.transition('is outward')) {
587
+ if( module.is.visible() ) {
588
+ if( module.can.transition() ) {
445
589
  module.debug('Hiding results with css animations');
446
590
  $results
447
591
  .transition({
@@ -455,7 +599,7 @@ $.fn.search = function(parameters) {
455
599
  module.debug('Hiding results with javascript');
456
600
  $results
457
601
  .stop()
458
- .fadeIn(settings.duration, settings.easing)
602
+ .fadeOut(settings.duration, settings.easing)
459
603
  ;
460
604
  }
461
605
  settings.onResultsClose.call($results);
@@ -465,15 +609,19 @@ $.fn.search = function(parameters) {
465
609
  generateResults: function(response) {
466
610
  module.debug('Generating html from response', response);
467
611
  var
468
- template = settings.templates[settings.type],
469
- html = ''
612
+ template = settings.templates[settings.type],
613
+ isProperObject = ($.isPlainObject(response.results) && !$.isEmptyObject(response.results)),
614
+ isProperArray = ($.isArray(response.results) && response.results.length > 0),
615
+ html = ''
470
616
  ;
471
- if(($.isPlainObject(response.results) && !$.isEmptyObject(response.results)) || ($.isArray(response.results) && response.results.length > 0) ) {
617
+ if(isProperObject || isProperArray ) {
472
618
  if(settings.maxResults > 0) {
473
- response.results = $.isArray(response.results)
474
- ? response.results.slice(0, settings.maxResults)
475
- : response.results
476
- ;
619
+ if(isProperObject) {
620
+ module.error(error.maxResults);
621
+ }
622
+ else {
623
+ response.results = response.results.slice(0, settings.maxResults);
624
+ }
477
625
  }
478
626
  if($.isFunction(template)) {
479
627
  html = template(response);
@@ -683,11 +831,12 @@ $.fn.search.settings = {
683
831
  verbose : true,
684
832
  performance : true,
685
833
 
686
- // api config
687
- apiSettings : false,
688
834
  type : 'standard',
689
835
  minCharacters : 1,
690
836
 
837
+ // api config
838
+ apiSettings : false,
839
+
691
840
  source : false,
692
841
  searchFields : [
693
842
  'title',
@@ -697,7 +846,7 @@ $.fn.search.settings = {
697
846
 
698
847
  automatic : 'true',
699
848
  hideDelay : 0,
700
- searchDelay : 300,
849
+ searchDelay : 100,
701
850
  maxResults : 7,
702
851
  cache : true,
703
852
 
@@ -705,9 +854,8 @@ $.fn.search.settings = {
705
854
  duration : 300,
706
855
  easing : 'easeOutExpo',
707
856
 
708
- // onSelect default action is defined in module
709
- onSelect : 'default',
710
- onResultsAdd : 'default',
857
+ onSelect : false,
858
+ onResultsAdd : false,
711
859
 
712
860
  onSearchQuery : function(){},
713
861
  onResults : function(response){},
@@ -717,10 +865,10 @@ $.fn.search.settings = {
717
865
 
718
866
  className: {
719
867
  active : 'active',
720
- down : 'down',
721
- focus : 'focus',
722
868
  empty : 'empty',
723
- loading : 'loading'
869
+ focus : 'focus',
870
+ loading : 'loading',
871
+ pressed : 'down'
724
872
  },
725
873
 
726
874
  error : {
@@ -729,9 +877,19 @@ $.fn.search.settings = {
729
877
  logging : 'Error in debug logging, exiting.',
730
878
  noTemplate : 'A valid template name was not specified.',
731
879
  serverError : 'There was an issue with querying the server.',
880
+ maxResults : 'Results must be an array to use maxResults setting',
732
881
  method : 'The method you called is not defined.'
733
882
  },
734
883
 
884
+ metadata: {
885
+ cache : 'cache',
886
+ results : 'results'
887
+ },
888
+
889
+ regExp: {
890
+ exact: '(?:\s|^)'
891
+ },
892
+
735
893
  selector : {
736
894
  prompt : '.prompt',
737
895
  searchButton : '.search.button',