fomantic-ui 2.9.1-beta.23 → 2.9.1-beta.25
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/.eslint/eqeqeq-rule.js +18 -0
- package/.eslint/index.js +26 -0
- package/.eslint/no-extra-parens-rule.js +17 -0
- package/.eslint/package.json +11 -0
- package/.eslintrc.js +7 -13
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +24 -24
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +58 -58
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +84 -72
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +17 -17
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +18 -18
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +264 -254
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +19 -19
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +29 -25
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +158 -141
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +32 -28
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +10 -10
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +79 -71
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +40 -42
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +13 -13
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +42 -42
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +36 -36
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +29 -29
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +16 -16
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.js +79 -58
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +14 -14
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +25 -25
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +34 -34
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +43 -19
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +26 -26
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +29 -29
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +50 -50
- package/dist/semantic.js +1218 -1120
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/gulpfile.js +1 -1
- package/package.json +2 -1
- package/scripts/nightly-version.js +3 -1
- package/src/definitions/behaviors/api.js +57 -57
- package/src/definitions/behaviors/form.js +157 -140
- package/src/definitions/behaviors/state.js +13 -13
- package/src/definitions/behaviors/visibility.js +28 -28
- package/src/definitions/globals/site.js +15 -15
- package/src/definitions/modules/accordion.js +23 -23
- package/src/definitions/modules/calendar.js +83 -71
- package/src/definitions/modules/checkbox.js +16 -16
- package/src/definitions/modules/dimmer.js +17 -17
- package/src/definitions/modules/dropdown.js +263 -253
- package/src/definitions/modules/embed.js +18 -18
- package/src/definitions/modules/flyout.js +28 -24
- package/src/definitions/modules/modal.js +31 -27
- package/src/definitions/modules/nag.js +9 -9
- package/src/definitions/modules/popup.js +78 -70
- package/src/definitions/modules/progress.js +39 -41
- package/src/definitions/modules/rating.js +12 -12
- package/src/definitions/modules/search.js +41 -41
- package/src/definitions/modules/shape.js +35 -35
- package/src/definitions/modules/sidebar.js +28 -28
- package/src/definitions/modules/slider.js +78 -57
- package/src/definitions/modules/sticky.js +24 -24
- package/src/definitions/modules/tab.js +33 -33
- package/src/definitions/modules/toast.js +42 -18
- package/src/definitions/modules/transition.js +25 -25
- package/tasks/admin/components/create.js +1 -1
- package/tasks/admin/components/init.js +2 -2
- package/tasks/admin/components/update.js +4 -4
- package/tasks/admin/distributions/create.js +6 -7
- package/tasks/admin/distributions/init.js +2 -2
- package/tasks/admin/distributions/update.js +4 -4
- package/tasks/admin/publish.js +1 -3
- package/tasks/admin/register.js +5 -5
- package/tasks/admin/release.js +1 -3
- package/tasks/build/assets.js +1 -1
- package/tasks/build.js +1 -1
- package/tasks/check-install.js +1 -1
- package/tasks/clean.js +1 -1
- package/tasks/collections/admin.js +1 -1
- package/tasks/collections/rtl.js +1 -1
- package/tasks/config/admin/github.js +3 -4
- package/tasks/config/npm/gulpfile.js +1 -1
- package/tasks/config/project/config.js +10 -8
- package/tasks/config/project/install.js +14 -14
- package/tasks/config/project/release.js +3 -2
- package/tasks/config/tasks.js +4 -4
- package/tasks/config/user.js +5 -3
- package/tasks/docs/build.js +1 -1
- package/tasks/docs/metadata.js +2 -2
- package/tasks/docs/serve.js +2 -1
- package/tasks/install.js +3 -3
- package/tasks/rtl/build.js +1 -3
- package/tasks/rtl/watch.js +1 -3
- package/tasks/version.js +1 -3
- package/tasks/watch.js +1 -1
- package/test/modules/module.spec.js +1 -1
@@ -15,7 +15,7 @@
|
|
15
15
|
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
16
|
}
|
17
17
|
|
18
|
-
window =
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
19
|
? window
|
20
20
|
: globalThis;
|
21
21
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
performance = [],
|
30
30
|
|
31
31
|
query = arguments[0],
|
32
|
-
methodInvoked =
|
32
|
+
methodInvoked = typeof query === 'string',
|
33
33
|
queryArguments = [].slice.call(arguments, 1),
|
34
34
|
|
35
35
|
returnedValue
|
@@ -37,7 +37,7 @@
|
|
37
37
|
|
38
38
|
$allModules.each(function () {
|
39
39
|
var
|
40
|
-
settings =
|
40
|
+
settings = $.isPlainObject(parameters)
|
41
41
|
? $.extend(true, {}, $.fn.progress.settings, parameters)
|
42
42
|
: $.extend({}, $.fn.progress.settings),
|
43
43
|
|
@@ -107,11 +107,9 @@
|
|
107
107
|
forceArray: function (element) {
|
108
108
|
return Array.isArray(element)
|
109
109
|
? element
|
110
|
-
: !isNaN(element)
|
110
|
+
: (!isNaN(element)
|
111
111
|
? [element]
|
112
|
-
: typeof element === 'string'
|
113
|
-
? element.split(',')
|
114
|
-
: [];
|
112
|
+
: (typeof element === 'string' ? element.split(',') : [])); // eslint-disable-line unicorn/no-nested-ternary
|
115
113
|
},
|
116
114
|
},
|
117
115
|
|
@@ -256,7 +254,7 @@
|
|
256
254
|
return module.progressPoll;
|
257
255
|
},
|
258
256
|
total: function () {
|
259
|
-
return
|
257
|
+
return module.get.total() !== false;
|
260
258
|
},
|
261
259
|
},
|
262
260
|
|
@@ -269,12 +267,12 @@
|
|
269
267
|
var
|
270
268
|
value = module.get.value(index),
|
271
269
|
total = module.get.total(),
|
272
|
-
percent =
|
270
|
+
percent = animating
|
273
271
|
? module.get.displayPercent(index)
|
274
272
|
: module.get.percent(index),
|
275
|
-
left =
|
273
|
+
left = total !== false
|
276
274
|
? Math.max(0, total - value)
|
277
|
-
:
|
275
|
+
: 100 - percent
|
278
276
|
;
|
279
277
|
templateText = templateText || '';
|
280
278
|
templateText = templateText
|
@@ -311,7 +309,7 @@
|
|
311
309
|
},
|
312
310
|
|
313
311
|
updateInterval: function () {
|
314
|
-
if (settings.updateInterval
|
312
|
+
if (settings.updateInterval === 'auto') {
|
315
313
|
return settings.duration;
|
316
314
|
}
|
317
315
|
|
@@ -325,10 +323,10 @@
|
|
325
323
|
},
|
326
324
|
|
327
325
|
numericValue: function (value) {
|
328
|
-
return
|
329
|
-
? (value.replace(/[^\d.]/g, '') !== ''
|
330
|
-
? +
|
331
|
-
: false
|
326
|
+
return typeof value === 'string'
|
327
|
+
? (value.replace(/[^\d.]/g, '') !== ''
|
328
|
+
? +value.replace(/[^\d.]/g, '')
|
329
|
+
: false)
|
332
330
|
: value;
|
333
331
|
},
|
334
332
|
|
@@ -357,12 +355,12 @@
|
|
357
355
|
barWidth = $bar.width(),
|
358
356
|
totalWidth = $module.width(),
|
359
357
|
minDisplay = parseInt($bar.css('min-width'), 10),
|
360
|
-
displayPercent =
|
361
|
-
? (
|
358
|
+
displayPercent = barWidth > minDisplay
|
359
|
+
? (barWidth / totalWidth) * 100
|
362
360
|
: module.percent
|
363
361
|
;
|
364
362
|
|
365
|
-
return
|
363
|
+
return settings.precision > 0
|
366
364
|
? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
|
367
365
|
: Math.round(displayPercent);
|
368
366
|
},
|
@@ -454,7 +452,7 @@
|
|
454
452
|
var barCounts = $bars.length;
|
455
453
|
var isMultiple = barCounts > 1;
|
456
454
|
var percents = values.map(function (value, index) {
|
457
|
-
var allZero =
|
455
|
+
var allZero = index === barCounts - 1 && valuesSum === 0;
|
458
456
|
var $bar = $($bars[index]);
|
459
457
|
if (value === 0 && isMultiple && !allZero) {
|
460
458
|
$bar.css('display', 'none');
|
@@ -462,7 +460,7 @@
|
|
462
460
|
if (isMultiple && allZero) {
|
463
461
|
$bar.css('background', 'transparent');
|
464
462
|
}
|
465
|
-
if (firstNonZeroIndex
|
463
|
+
if (firstNonZeroIndex === -1) {
|
466
464
|
firstNonZeroIndex = index;
|
467
465
|
}
|
468
466
|
lastNonZeroIndex = index;
|
@@ -477,10 +475,10 @@
|
|
477
475
|
values.forEach(function (_, index) {
|
478
476
|
var $bar = $($bars[index]);
|
479
477
|
$bar.css({
|
480
|
-
borderTopLeftRadius: index
|
481
|
-
borderBottomLeftRadius: index
|
482
|
-
borderTopRightRadius: index
|
483
|
-
borderBottomRightRadius: index
|
478
|
+
borderTopLeftRadius: index === firstNonZeroIndex ? '' : '0',
|
479
|
+
borderBottomLeftRadius: index === firstNonZeroIndex ? '' : '0',
|
480
|
+
borderTopRightRadius: index === lastNonZeroIndex ? '' : '0',
|
481
|
+
borderBottomRightRadius: index === lastNonZeroIndex ? '' : '0',
|
484
482
|
});
|
485
483
|
});
|
486
484
|
$module
|
@@ -489,7 +487,7 @@
|
|
489
487
|
},
|
490
488
|
duration: function (duration) {
|
491
489
|
duration = duration || settings.duration;
|
492
|
-
duration =
|
490
|
+
duration = typeof duration === 'number'
|
493
491
|
? duration + 'ms'
|
494
492
|
: duration;
|
495
493
|
module.verbose('Setting progress bar transition duration', duration);
|
@@ -501,11 +499,11 @@
|
|
501
499
|
},
|
502
500
|
percent: function (percents) {
|
503
501
|
percents = module.helper.forceArray(percents).map(function (percent) {
|
504
|
-
percent =
|
505
|
-
? +
|
502
|
+
percent = typeof percent === 'string'
|
503
|
+
? +percent.replace('%', '')
|
506
504
|
: percent;
|
507
505
|
|
508
|
-
return
|
506
|
+
return settings.limitValues
|
509
507
|
? Math.max(0, Math.min(100, percent))
|
510
508
|
: percent;
|
511
509
|
});
|
@@ -524,13 +522,13 @@
|
|
524
522
|
} else {
|
525
523
|
var autoPrecision = settings.precision > 0
|
526
524
|
? settings.precision
|
527
|
-
: isMultipleValues
|
525
|
+
: (isMultipleValues
|
528
526
|
? module.helper.derivePrecision(Math.min.apply(null, module.value), module.total)
|
529
|
-
: 0;
|
527
|
+
: 0);
|
530
528
|
|
531
529
|
// round display percentage
|
532
530
|
var roundedPercents = percents.map(function (percent) {
|
533
|
-
return
|
531
|
+
return autoPrecision > 0
|
534
532
|
? Math.round(percent * (10 * autoPrecision)) / (10 * autoPrecision)
|
535
533
|
: Math.round(percent)
|
536
534
|
;
|
@@ -538,7 +536,7 @@
|
|
538
536
|
module.percent = roundedPercents;
|
539
537
|
if (hasTotal) {
|
540
538
|
module.value = percents.map(function (percent) {
|
541
|
-
return
|
539
|
+
return autoPrecision > 0
|
542
540
|
? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
|
543
541
|
: Math.round((percent / 100) * module.total * 10) / 10;
|
544
542
|
});
|
@@ -584,7 +582,7 @@
|
|
584
582
|
}
|
585
583
|
},
|
586
584
|
state: function (percent) {
|
587
|
-
percent =
|
585
|
+
percent = percent !== undefined
|
588
586
|
? percent
|
589
587
|
: module.helper.sum(module.percent);
|
590
588
|
if (percent === 100) {
|
@@ -612,10 +610,10 @@
|
|
612
610
|
var $progress = $(element);
|
613
611
|
if (text !== undefined) {
|
614
612
|
$progress.text(module.get.text(text, index));
|
615
|
-
} else if (settings.label
|
613
|
+
} else if (settings.label === 'ratio' && module.has.total()) {
|
616
614
|
module.verbose('Adding ratio to bar label');
|
617
615
|
$progress.text(module.get.text(settings.text.ratio, index));
|
618
|
-
} else if (settings.label
|
616
|
+
} else if (settings.label === 'percent') {
|
619
617
|
module.verbose('Adding percentage to bar label');
|
620
618
|
$progress.text(module.get.text(settings.text.percent, index));
|
621
619
|
}
|
@@ -864,17 +862,17 @@
|
|
864
862
|
query = query.split(/[ .]/);
|
865
863
|
maxDepth = query.length - 1;
|
866
864
|
$.each(query, function (depth, value) {
|
867
|
-
var camelCaseValue =
|
865
|
+
var camelCaseValue = depth !== maxDepth
|
868
866
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
869
867
|
: query
|
870
868
|
;
|
871
|
-
if ($.isPlainObject(object[camelCaseValue]) && (depth
|
869
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
872
870
|
object = object[camelCaseValue];
|
873
871
|
} else if (object[camelCaseValue] !== undefined) {
|
874
872
|
found = object[camelCaseValue];
|
875
873
|
|
876
874
|
return false;
|
877
|
-
} else if ($.isPlainObject(object[value]) && (depth
|
875
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
878
876
|
object = object[value];
|
879
877
|
} else if (object[value] !== undefined) {
|
880
878
|
found = object[value];
|
@@ -917,7 +915,7 @@
|
|
917
915
|
}
|
918
916
|
});
|
919
917
|
|
920
|
-
return
|
918
|
+
return returnedValue !== undefined
|
921
919
|
? returnedValue
|
922
920
|
: this;
|
923
921
|
};
|
@@ -947,7 +945,7 @@
|
|
947
945
|
|
948
946
|
label: 'percent',
|
949
947
|
precision: 0,
|
950
|
-
framerate:
|
948
|
+
framerate: 1000 / 30, /// 30 fps
|
951
949
|
|
952
950
|
percent: false,
|
953
951
|
total: false,
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
16
|
}
|
17
17
|
|
18
|
-
window =
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
19
|
? window
|
20
20
|
: globalThis;
|
21
21
|
|
@@ -28,13 +28,13 @@
|
|
28
28
|
performance = [],
|
29
29
|
|
30
30
|
query = arguments[0],
|
31
|
-
methodInvoked =
|
31
|
+
methodInvoked = typeof query === 'string',
|
32
32
|
queryArguments = [].slice.call(arguments, 1),
|
33
33
|
returnedValue
|
34
34
|
;
|
35
35
|
$allModules.each(function () {
|
36
36
|
var
|
37
|
-
settings =
|
37
|
+
settings = $.isPlainObject(parameters)
|
38
38
|
? $.extend(true, {}, $.fn.rating.settings, parameters)
|
39
39
|
: $.extend({}, $.fn.rating.settings),
|
40
40
|
|
@@ -143,11 +143,11 @@
|
|
143
143
|
$activeIcon = $(this),
|
144
144
|
currentRating = module.get.rating(),
|
145
145
|
rating = $icon.index($activeIcon) + 1,
|
146
|
-
canClear =
|
147
|
-
?
|
146
|
+
canClear = settings.clearable === 'auto'
|
147
|
+
? $icon.length === 1
|
148
148
|
: settings.clearable
|
149
149
|
;
|
150
|
-
if (canClear && currentRating
|
150
|
+
if (canClear && currentRating === rating) {
|
151
151
|
module.clearRating();
|
152
152
|
} else {
|
153
153
|
module.set.rating(rating);
|
@@ -249,8 +249,8 @@
|
|
249
249
|
rating: function (rating) {
|
250
250
|
var
|
251
251
|
ratingIndex = Math.floor(
|
252
|
-
|
253
|
-
?
|
252
|
+
rating - 1 >= 0
|
253
|
+
? rating - 1
|
254
254
|
: 0
|
255
255
|
),
|
256
256
|
$activeIcon = $icon.eq(ratingIndex),
|
@@ -414,17 +414,17 @@
|
|
414
414
|
query = query.split(/[ .]/);
|
415
415
|
maxDepth = query.length - 1;
|
416
416
|
$.each(query, function (depth, value) {
|
417
|
-
var camelCaseValue =
|
417
|
+
var camelCaseValue = depth !== maxDepth
|
418
418
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
419
419
|
: query
|
420
420
|
;
|
421
|
-
if ($.isPlainObject(object[camelCaseValue]) && (depth
|
421
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
422
422
|
object = object[camelCaseValue];
|
423
423
|
} else if (object[camelCaseValue] !== undefined) {
|
424
424
|
found = object[camelCaseValue];
|
425
425
|
|
426
426
|
return false;
|
427
|
-
} else if ($.isPlainObject(object[value]) && (depth
|
427
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
428
428
|
object = object[value];
|
429
429
|
} else if (object[value] !== undefined) {
|
430
430
|
found = object[value];
|
@@ -464,7 +464,7 @@
|
|
464
464
|
}
|
465
465
|
});
|
466
466
|
|
467
|
-
return
|
467
|
+
return returnedValue !== undefined
|
468
468
|
? returnedValue
|
469
469
|
: this;
|
470
470
|
};
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
16
|
}
|
17
17
|
|
18
|
-
window =
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
19
|
? window
|
20
20
|
: globalThis;
|
21
21
|
|
@@ -28,13 +28,13 @@
|
|
28
28
|
performance = [],
|
29
29
|
|
30
30
|
query = arguments[0],
|
31
|
-
methodInvoked =
|
31
|
+
methodInvoked = typeof query === 'string',
|
32
32
|
queryArguments = [].slice.call(arguments, 1),
|
33
33
|
returnedValue
|
34
34
|
;
|
35
35
|
$allModules.each(function () {
|
36
36
|
var
|
37
|
-
settings =
|
37
|
+
settings = $.isPlainObject(parameters)
|
38
38
|
? $.extend(true, {}, $.fn.search.settings, parameters)
|
39
39
|
: $.extend({}, $.fn.search.settings),
|
40
40
|
|
@@ -166,7 +166,7 @@
|
|
166
166
|
},
|
167
167
|
blur: function (event) {
|
168
168
|
var
|
169
|
-
pageLostFocus =
|
169
|
+
pageLostFocus = document.activeElement === this,
|
170
170
|
callback = function () {
|
171
171
|
module.cancel.query();
|
172
172
|
module.remove.focus();
|
@@ -215,7 +215,7 @@
|
|
215
215
|
href = $link.attr('href') || false,
|
216
216
|
target = $link.attr('target') || false,
|
217
217
|
// title is used for result lookup
|
218
|
-
value =
|
218
|
+
value = $title.length > 0
|
219
219
|
? $title.text()
|
220
220
|
: false,
|
221
221
|
results = module.get.results(),
|
@@ -237,10 +237,10 @@
|
|
237
237
|
if (href) {
|
238
238
|
event.preventDefault();
|
239
239
|
module.verbose('Opening search link found in result', $link);
|
240
|
-
if (target
|
240
|
+
if (target === '_blank' || event.ctrlKey) {
|
241
241
|
window.open(href);
|
242
242
|
} else {
|
243
|
-
window.location.href =
|
243
|
+
window.location.href = href;
|
244
244
|
}
|
245
245
|
}
|
246
246
|
},
|
@@ -289,7 +289,7 @@
|
|
289
289
|
newIndex
|
290
290
|
;
|
291
291
|
// search shortcuts
|
292
|
-
if (keyCode
|
292
|
+
if (keyCode === keys.escape) {
|
293
293
|
if (!module.is.visible()) {
|
294
294
|
module.verbose('Escape key pressed, blurring search field');
|
295
295
|
$prompt.trigger('blur');
|
@@ -300,7 +300,7 @@
|
|
300
300
|
resultsDismissed = true;
|
301
301
|
}
|
302
302
|
if (module.is.visible()) {
|
303
|
-
if (keyCode
|
303
|
+
if (keyCode === keys.enter) {
|
304
304
|
module.verbose('Enter key pressed, selecting active result');
|
305
305
|
if ($result.filter('.' + className.active).length > 0) {
|
306
306
|
module.event.result.click.call($result.filter('.' + className.active), event);
|
@@ -308,9 +308,9 @@
|
|
308
308
|
|
309
309
|
return false;
|
310
310
|
}
|
311
|
-
} else if (keyCode
|
311
|
+
} else if (keyCode === keys.upArrow && hasActiveResult) {
|
312
312
|
module.verbose('Up key pressed, changing active result');
|
313
|
-
newIndex =
|
313
|
+
newIndex = currentIndex - 1 < 0
|
314
314
|
? currentIndex
|
315
315
|
: currentIndex - 1;
|
316
316
|
$category
|
@@ -325,9 +325,9 @@
|
|
325
325
|
;
|
326
326
|
module.ensureVisible($result.eq(newIndex));
|
327
327
|
event.preventDefault();
|
328
|
-
} else if (keyCode
|
328
|
+
} else if (keyCode === keys.downArrow) {
|
329
329
|
module.verbose('Down key pressed, changing active result');
|
330
|
-
newIndex =
|
330
|
+
newIndex = currentIndex + 1 >= resultSize
|
331
331
|
? currentIndex
|
332
332
|
: currentIndex + 1;
|
333
333
|
$category
|
@@ -345,7 +345,7 @@
|
|
345
345
|
}
|
346
346
|
} else {
|
347
347
|
// query shortcuts
|
348
|
-
if (keyCode
|
348
|
+
if (keyCode === keys.enter) {
|
349
349
|
module.verbose('Enter key pressed, executing query');
|
350
350
|
module.query();
|
351
351
|
module.set.buttonPressed();
|
@@ -431,16 +431,16 @@
|
|
431
431
|
isInDOM = $.contains(document.documentElement, event.target)
|
432
432
|
;
|
433
433
|
|
434
|
-
return
|
434
|
+
return isInDOM && $target.closest(selector.message).length > 0;
|
435
435
|
},
|
436
436
|
empty: function () {
|
437
|
-
return
|
437
|
+
return $results.html() === '';
|
438
438
|
},
|
439
439
|
visible: function () {
|
440
|
-
return
|
440
|
+
return $results.filter(':visible').length > 0;
|
441
441
|
},
|
442
442
|
focused: function () {
|
443
|
-
return
|
443
|
+
return $prompt.filter(':focus').length > 0;
|
444
444
|
},
|
445
445
|
},
|
446
446
|
|
@@ -458,11 +458,11 @@
|
|
458
458
|
inputEvent: function () {
|
459
459
|
var
|
460
460
|
prompt = $prompt[0],
|
461
|
-
inputEvent =
|
461
|
+
inputEvent = prompt !== undefined && prompt.oninput !== undefined
|
462
462
|
? 'input'
|
463
|
-
: (prompt !== undefined && prompt.onpropertychange !== undefined
|
463
|
+
: (prompt !== undefined && prompt.onpropertychange !== undefined
|
464
464
|
? 'propertychange'
|
465
|
-
: 'keyup'
|
465
|
+
: 'keyup')
|
466
466
|
;
|
467
467
|
|
468
468
|
return inputEvent;
|
@@ -477,10 +477,10 @@
|
|
477
477
|
var
|
478
478
|
result = false
|
479
479
|
;
|
480
|
-
value =
|
480
|
+
value = value !== undefined
|
481
481
|
? value
|
482
482
|
: module.get.value();
|
483
|
-
results =
|
483
|
+
results = results !== undefined
|
484
484
|
? results
|
485
485
|
: module.get.results();
|
486
486
|
if (settings.type === 'category') {
|
@@ -596,7 +596,7 @@
|
|
596
596
|
module.debug('Using specified max results', results);
|
597
597
|
results = results.slice(0, settings.maxResults);
|
598
598
|
}
|
599
|
-
if (settings.type
|
599
|
+
if (settings.type === 'category') {
|
600
600
|
results = module.create.categoryResults(results);
|
601
601
|
}
|
602
602
|
searchHTML = module.generateResults({
|
@@ -634,9 +634,9 @@
|
|
634
634
|
// avoid duplicates when pushing results
|
635
635
|
addResult = function (array, result) {
|
636
636
|
var
|
637
|
-
notResult =
|
638
|
-
notFuzzyResult =
|
639
|
-
notExactResults =
|
637
|
+
notResult = $.inArray(result, results) === -1,
|
638
|
+
notFuzzyResult = $.inArray(result, fuzzyResults) === -1,
|
639
|
+
notExactResults = $.inArray(result, exactResults) === -1
|
640
640
|
;
|
641
641
|
if (notResult && notFuzzyResult && notExactResults) {
|
642
642
|
array.push(result);
|
@@ -644,7 +644,7 @@
|
|
644
644
|
}
|
645
645
|
;
|
646
646
|
source = source || settings.source;
|
647
|
-
searchFields =
|
647
|
+
searchFields = searchFields !== undefined
|
648
648
|
? searchFields
|
649
649
|
: settings.searchFields;
|
650
650
|
|
@@ -709,7 +709,7 @@
|
|
709
709
|
return false;
|
710
710
|
}
|
711
711
|
if (queryLength === termLength) {
|
712
|
-
return
|
712
|
+
return query === term;
|
713
713
|
}
|
714
714
|
for (var characterIndex = 0, nextCharacterIndex = 0; characterIndex < queryLength; characterIndex++) {
|
715
715
|
var
|
@@ -772,7 +772,7 @@
|
|
772
772
|
numCharacters = searchTerm.length
|
773
773
|
;
|
774
774
|
|
775
|
-
return
|
775
|
+
return numCharacters >= settings.minCharacters;
|
776
776
|
},
|
777
777
|
results: function () {
|
778
778
|
if ($results.length === 0) {
|
@@ -782,7 +782,7 @@
|
|
782
782
|
html = $results.html()
|
783
783
|
;
|
784
784
|
|
785
|
-
return html
|
785
|
+
return html !== '';
|
786
786
|
},
|
787
787
|
},
|
788
788
|
|
@@ -843,7 +843,7 @@
|
|
843
843
|
},
|
844
844
|
id: function (resultIndex, categoryIndex) {
|
845
845
|
var
|
846
|
-
resultID =
|
846
|
+
resultID = resultIndex + 1, // not zero indexed
|
847
847
|
letterID,
|
848
848
|
id
|
849
849
|
;
|
@@ -873,7 +873,7 @@
|
|
873
873
|
result: function (result, resultIndex, categoryIndex) {
|
874
874
|
module.verbose('Injecting result into results');
|
875
875
|
var
|
876
|
-
$selectedResult =
|
876
|
+
$selectedResult = categoryIndex !== undefined
|
877
877
|
? $results
|
878
878
|
.children().eq(categoryIndex)
|
879
879
|
.children(selector.results)
|
@@ -935,7 +935,7 @@
|
|
935
935
|
write: {
|
936
936
|
cache: function (name, value) {
|
937
937
|
var
|
938
|
-
cache =
|
938
|
+
cache = $module.data(metadata.cache) !== undefined
|
939
939
|
? $module.data(metadata.cache)
|
940
940
|
: {}
|
941
941
|
;
|
@@ -1045,14 +1045,14 @@
|
|
1045
1045
|
module.debug('Generating html from response', response);
|
1046
1046
|
var
|
1047
1047
|
template = settings.templates[settings.type],
|
1048
|
-
isProperObject =
|
1049
|
-
isProperArray =
|
1048
|
+
isProperObject = $.isPlainObject(response[fields.results]) && !$.isEmptyObject(response[fields.results]),
|
1049
|
+
isProperArray = Array.isArray(response[fields.results]) && response[fields.results].length > 0,
|
1050
1050
|
html = ''
|
1051
1051
|
;
|
1052
1052
|
if (isProperObject || isProperArray) {
|
1053
1053
|
if (settings.maxResults > 0) {
|
1054
1054
|
if (isProperObject) {
|
1055
|
-
if (settings.type
|
1055
|
+
if (settings.type === 'standard') {
|
1056
1056
|
module.error(error.maxResults);
|
1057
1057
|
}
|
1058
1058
|
} else {
|
@@ -1190,17 +1190,17 @@
|
|
1190
1190
|
query = query.split(/[ .]/);
|
1191
1191
|
maxDepth = query.length - 1;
|
1192
1192
|
$.each(query, function (depth, value) {
|
1193
|
-
var camelCaseValue =
|
1193
|
+
var camelCaseValue = depth !== maxDepth
|
1194
1194
|
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
1195
1195
|
: query
|
1196
1196
|
;
|
1197
|
-
if ($.isPlainObject(object[camelCaseValue]) && (depth
|
1197
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
1198
1198
|
object = object[camelCaseValue];
|
1199
1199
|
} else if (object[camelCaseValue] !== undefined) {
|
1200
1200
|
found = object[camelCaseValue];
|
1201
1201
|
|
1202
1202
|
return false;
|
1203
|
-
} else if ($.isPlainObject(object[value]) && (depth
|
1203
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
1204
1204
|
object = object[value];
|
1205
1205
|
} else if (object[value] !== undefined) {
|
1206
1206
|
found = object[value];
|
@@ -1240,7 +1240,7 @@
|
|
1240
1240
|
}
|
1241
1241
|
});
|
1242
1242
|
|
1243
|
-
return
|
1243
|
+
return returnedValue !== undefined
|
1244
1244
|
? returnedValue
|
1245
1245
|
: this;
|
1246
1246
|
};
|