fomantic-ui 2.10.0-beta.4 → 2.10.0-beta.6
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/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +1 -1
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +1 -1
- package/dist/components/api.min.js +1 -1
- 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 +1 -1
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +1 -1
- 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 +1 -1
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +1 -1
- 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 +1 -1
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +1 -1
- 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 +48 -58
- 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 +26 -8
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/emoji.css +1 -1
- package/dist/components/emoji.min.css +1 -1
- 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 +13 -18
- 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 +1 -1
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +1 -1
- 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/menu.css +1 -1
- package/dist/components/menu.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 +13 -18
- 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 +1 -1
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +1 -1
- 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 +5 -7
- 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 +1 -1
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +1 -1
- 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 +23 -5
- 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 +28 -31
- 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 +1 -1
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +1 -1
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +1 -1
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +1 -1
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +1 -1
- package/dist/components/slider.css +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/slider.min.css +1 -1
- package/dist/components/slider.min.js +1 -1
- package/dist/components/state.js +1 -1
- package/dist/components/state.min.js +1 -1
- 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 +1 -1
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +1 -1
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +1 -1
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +1 -1
- 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 +14 -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 +1 -1
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +1 -1
- package/dist/components/visibility.js +1 -1
- package/dist/components/visibility.min.js +1 -1
- package/dist/semantic.css +53 -53
- package/dist/semantic.js +188 -182
- package/dist/semantic.min.css +1 -1
- package/dist/semantic.min.js +2 -2
- package/package.json +1 -2
- package/src/definitions/modules/dropdown.js +47 -57
- package/src/definitions/modules/embed.js +25 -7
- package/src/definitions/modules/flyout.js +12 -17
- package/src/definitions/modules/modal.js +12 -17
- package/src/definitions/modules/popup.js +4 -6
- package/src/definitions/modules/rating.js +22 -4
- package/src/definitions/modules/search.js +27 -30
- package/src/definitions/modules/toast.js +13 -18
- package/tasks/config/defaults.js +0 -1
- package/tasks/config/project/install.js +5 -8
- package/tasks/install.js +10 -11
- package/types/fomantic-ui-dropdown.d.ts +44 -0
- package/types/fomantic-ui-embed.d.ts +1 -1
- package/types/fomantic-ui-search.d.ts +6 -6
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.6+42a411a - Search
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -461,10 +461,6 @@
|
|
461
461
|
settings.fullTextSearch = parameters.searchFullText;
|
462
462
|
module.error(settings.error.oldSearchSyntax, element);
|
463
463
|
}
|
464
|
-
if (settings.ignoreDiacritics && !String.prototype.normalize) {
|
465
|
-
settings.ignoreDiacritics = false;
|
466
|
-
module.error(error.noNormalize, element);
|
467
|
-
}
|
468
464
|
},
|
469
465
|
inputEvent: function () {
|
470
466
|
var
|
@@ -1140,7 +1136,7 @@
|
|
1140
1136
|
});
|
1141
1137
|
}
|
1142
1138
|
if (isFunction(template)) {
|
1143
|
-
html = template(response,
|
1139
|
+
html = template(response, settings);
|
1144
1140
|
} else {
|
1145
1141
|
module.error(error.noTemplate, false);
|
1146
1142
|
}
|
@@ -1433,7 +1429,6 @@
|
|
1433
1429
|
serverError: 'There was an issue querying the server.',
|
1434
1430
|
maxResults: 'Results must be an array to use maxResults setting',
|
1435
1431
|
method: 'The method you called is not defined.',
|
1436
|
-
noNormalize: '"ignoreDiacritics" setting will be ignored. Browser does not support String().normalize(). You may consider including <https://cdn.jsdelivr.net/npm/unorm@1.4.1/lib/unorm.min.js> as a polyfill.',
|
1437
1432
|
},
|
1438
1433
|
|
1439
1434
|
metadata: {
|
@@ -1476,23 +1471,23 @@
|
|
1476
1471
|
},
|
1477
1472
|
|
1478
1473
|
templates: {
|
1479
|
-
escape: function (string,
|
1480
|
-
if (preserveHTML) {
|
1474
|
+
escape: function (string, settings) {
|
1475
|
+
if (settings !== undefined && settings.preserveHTML) {
|
1481
1476
|
return string;
|
1482
1477
|
}
|
1483
1478
|
var
|
1484
|
-
badChars = /["'
|
1485
|
-
shouldEscape = /["&'
|
1479
|
+
badChars = /["'<>]/g,
|
1480
|
+
shouldEscape = /["&'<>]/,
|
1486
1481
|
escape = {
|
1487
1482
|
'<': '<',
|
1488
1483
|
'>': '>',
|
1489
1484
|
'"': '"',
|
1490
|
-
"'": '
|
1491
|
-
'`': '`',
|
1485
|
+
"'": ''',
|
1492
1486
|
},
|
1493
1487
|
escapedChar = function (chr) {
|
1494
1488
|
return escape[chr];
|
1495
|
-
}
|
1489
|
+
}
|
1490
|
+
;
|
1496
1491
|
if (shouldEscape.test(string)) {
|
1497
1492
|
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
1498
1493
|
string = string.replace(badChars, escapedChar);
|
@@ -1519,10 +1514,11 @@
|
|
1519
1514
|
|
1520
1515
|
return html;
|
1521
1516
|
},
|
1522
|
-
category: function (response,
|
1517
|
+
category: function (response, settings) {
|
1523
1518
|
var
|
1524
1519
|
html = '',
|
1525
|
-
|
1520
|
+
fields = settings.fields,
|
1521
|
+
escape = settings.templates.escape
|
1526
1522
|
;
|
1527
1523
|
if (response[fields.categoryResults] !== undefined) {
|
1528
1524
|
// each category
|
@@ -1531,7 +1527,7 @@
|
|
1531
1527
|
html += '<div class="category">';
|
1532
1528
|
|
1533
1529
|
if (category[fields.categoryName] !== undefined) {
|
1534
|
-
html += '<div class="name">' + escape(category[fields.categoryName],
|
1530
|
+
html += '<div class="name">' + escape(category[fields.categoryName], settings) + '</div>';
|
1535
1531
|
}
|
1536
1532
|
|
1537
1533
|
// each item inside category
|
@@ -1543,18 +1539,18 @@
|
|
1543
1539
|
if (result[fields.image] !== undefined) {
|
1544
1540
|
html += ''
|
1545
1541
|
+ '<div class="image">'
|
1546
|
-
+ ' <img src="' + result[fields.image].replace(/"/g, '') + (result[fields.alt] ? '
|
1542
|
+
+ ' <img src="' + result[fields.image].replace(/"/g, '') + '"' + (result[fields.alt] ? ' alt="' + result[fields.alt].replace(/"/g, '') + '"' : '') + '>'
|
1547
1543
|
+ '</div>';
|
1548
1544
|
}
|
1549
1545
|
html += '<div class="content">';
|
1550
1546
|
if (result[fields.price] !== undefined) {
|
1551
|
-
html += '<div class="price">' + escape(result[fields.price],
|
1547
|
+
html += '<div class="price">' + escape(result[fields.price], settings) + '</div>';
|
1552
1548
|
}
|
1553
1549
|
if (result[fields.title] !== undefined) {
|
1554
|
-
html += '<div class="title">' + escape(result[fields.title],
|
1550
|
+
html += '<div class="title">' + escape(result[fields.title], settings) + '</div>';
|
1555
1551
|
}
|
1556
1552
|
if (result[fields.description] !== undefined) {
|
1557
|
-
html += '<div class="description">' + escape(result[fields.description],
|
1553
|
+
html += '<div class="description">' + escape(result[fields.description], settings) + '</div>';
|
1558
1554
|
}
|
1559
1555
|
html += ''
|
1560
1556
|
+ '</div>';
|
@@ -1569,11 +1565,11 @@
|
|
1569
1565
|
html += fields.actionURL === false
|
1570
1566
|
? ''
|
1571
1567
|
+ '<div class="action">'
|
1572
|
-
+ escape(response[fields.action][fields.actionText],
|
1568
|
+
+ escape(response[fields.action][fields.actionText], settings)
|
1573
1569
|
+ '</div>'
|
1574
1570
|
: ''
|
1575
1571
|
+ '<a href="' + response[fields.action][fields.actionURL].replace(/"/g, '') + '" class="action">'
|
1576
|
-
+ escape(response[fields.action][fields.actionText],
|
1572
|
+
+ escape(response[fields.action][fields.actionText], settings)
|
1577
1573
|
+ '</a>';
|
1578
1574
|
}
|
1579
1575
|
|
@@ -1582,10 +1578,11 @@
|
|
1582
1578
|
|
1583
1579
|
return false;
|
1584
1580
|
},
|
1585
|
-
standard: function (response,
|
1581
|
+
standard: function (response, settings) {
|
1586
1582
|
var
|
1587
1583
|
html = '',
|
1588
|
-
|
1584
|
+
fields = settings.fields,
|
1585
|
+
escape = settings.templates.escape
|
1589
1586
|
;
|
1590
1587
|
if (response[fields.results] !== undefined) {
|
1591
1588
|
// each result
|
@@ -1596,18 +1593,18 @@
|
|
1596
1593
|
if (result[fields.image] !== undefined) {
|
1597
1594
|
html += ''
|
1598
1595
|
+ '<div class="image">'
|
1599
|
-
+ ' <img src="' + result[fields.image].replace(/"/g, '') + (result[fields.alt] ? '
|
1596
|
+
+ ' <img src="' + result[fields.image].replace(/"/g, '') + '"' + (result[fields.alt] ? ' alt="' + result[fields.alt].replace(/"/g, '') + '"' : '') + '>'
|
1600
1597
|
+ '</div>';
|
1601
1598
|
}
|
1602
1599
|
html += '<div class="content">';
|
1603
1600
|
if (result[fields.price] !== undefined) {
|
1604
|
-
html += '<div class="price">' + escape(result[fields.price],
|
1601
|
+
html += '<div class="price">' + escape(result[fields.price], settings) + '</div>';
|
1605
1602
|
}
|
1606
1603
|
if (result[fields.title] !== undefined) {
|
1607
|
-
html += '<div class="title">' + escape(result[fields.title],
|
1604
|
+
html += '<div class="title">' + escape(result[fields.title], settings) + '</div>';
|
1608
1605
|
}
|
1609
1606
|
if (result[fields.description] !== undefined) {
|
1610
|
-
html += '<div class="description">' + escape(result[fields.description],
|
1607
|
+
html += '<div class="description">' + escape(result[fields.description], settings) + '</div>';
|
1611
1608
|
}
|
1612
1609
|
html += ''
|
1613
1610
|
+ '</div>';
|
@@ -1617,11 +1614,11 @@
|
|
1617
1614
|
html += fields.actionURL === false
|
1618
1615
|
? ''
|
1619
1616
|
+ '<div class="action">'
|
1620
|
-
+ escape(response[fields.action][fields.actionText],
|
1617
|
+
+ escape(response[fields.action][fields.actionText], settings)
|
1621
1618
|
+ '</div>'
|
1622
1619
|
: ''
|
1623
1620
|
+ '<a href="' + response[fields.action][fields.actionURL].replace(/"/g, '') + '" class="action">'
|
1624
|
-
+ escape(response[fields.action][fields.actionText],
|
1621
|
+
+ escape(response[fields.action][fields.actionText], settings)
|
1625
1622
|
+ '</a>';
|
1626
1623
|
}
|
1627
1624
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.10.0-beta.
|
2
|
+
* # Fomantic UI - 2.10.0-beta.6+42a411a
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(j,F,q){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}F=void 0!==F&&F.Math===Math?F:globalThis,j.fn.search=function(R){var S,x=j(this),C=Date.now(),w=[],T=R,k="string"==typeof T,A=[].slice.call(arguments,1);return x.each(function(){var d=j.isPlainObject(R)?j.extend(!0,{},j.fn.search.settings,R):j.extend({},j.fn.search.settings),f=d.className,c=d.metadata,r=d.regExp,u=d.fields,g=d.selector,h=d.error,e=d.namespace,n="."+e,t=e+"-module",v=j(this),p=v.find(g.prompt),s=v.find(g.searchButton),i=v.find(g.results),a=v.find(g.result),m=(v.find(g.category),this),o=v.data(t),l=!1,y=!1,b={initialize:function(){b.verbose("Initializing module"),b.get.settings(),b.determine.searchFields(),b.bind.events(),b.set.type(),b.create.results(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),o=b,v.data(t,b)},destroy:function(){b.verbose("Destroying instance"),v.off(n).removeData(t)},refresh:function(){b.debug("Refreshing selector cache"),p=v.find(g.prompt),s=v.find(g.searchButton),v.find(g.category),i=v.find(g.results),a=v.find(g.result)},refreshResults:function(){i=v.find(g.results),a=v.find(g.result)},bind:{events:function(){b.verbose("Binding events to search"),d.automatic&&(v.on(b.get.inputEvent()+n,g.prompt,b.event.input),p.attr("autocomplete",b.is.chrome()?"fomantic-search":"off")),v.on("focus"+n,g.prompt,b.event.focus).on("blur"+n,g.prompt,b.event.blur).on("keydown"+n,g.prompt,b.handleKeyboard).on("click"+n,g.searchButton,b.query).on("mousedown"+n,g.results,b.event.result.mousedown).on("mouseup"+n,g.results,b.event.result.mouseup).on("click"+n,g.result,b.event.result.click).on("click"+n,g.remove,b.event.remove.click)}},determine:{searchFields:function(){R&&void 0!==R.searchFields&&(d.searchFields=Array.isArray(R.searchFields)?R.searchFields:[R.searchFields])}},event:{input:function(){d.searchDelay?(clearTimeout(b.timer),b.timer=setTimeout(function(){b.is.focused()&&b.query()},d.searchDelay)):b.query()},focus:function(){b.set.focus(),d.searchOnFocus&&b.has.minimumCharacters()&&b.query(function(){b.can.show()&&b.showResults()})},blur:function(e){function t(){b.cancel.query(),b.remove.focus(),b.timer=setTimeout(function(){b.hideResults()},d.hideDelay)}var s=q.activeElement===this;s||(y=!1,b.resultsClicked?(b.debug("Determining if user action caused search to close"),v.one("click.close"+n,g.results,function(e){b.is.inMessage(e)||l?p.trigger("focus"):(l=!1,b.is.animating()||b.is.hidden()||t())})):(b.debug("Input blurred without user action, closing results"),t()))},remove:{click:function(){b.clear.value(),p.trigger("focus")}},result:{mousedown:function(){b.resultsClicked=!0},mouseup:function(){b.resultsClicked=!1},click:function(e){b.debug("Search result selected");var t=j(this),s=t.find(g.title).eq(0),r=t.is("a[href]")?t:t.find("a[href]").eq(0),n=r.attr("href")||!1,i=r.attr("target")||!1,s=0<s.length&&s.text(),a=b.get.results(),t=t.data(c.result)||b.get.result(s,a),o=b.get.value();if(D(d.onSelect)&&!1===d.onSelect.call(m,t,a))return b.debug("Custom onSelect callback cancelled default select action"),void(l=!0);b.hideResults(),s&&b.get.value()===o&&b.set.value(s),n&&(e.preventDefault(),b.verbose("Opening search link found in result",r),"_blank"===i||e.ctrlKey?F.open(n):F.location.href=n)}}},ensureVisible:function(e){var t,s,r;0!==e.length&&(e=(t=e.position().top)+e.outerHeight(!0),s=i.scrollTop(),r=i.height(),t<0?i.scrollTop(s+t):r<e&&i.scrollTop(s+(e-r)))},handleKeyboard:function(e){var t,s=v.find(g.result),r=v.find(g.category),n=s.filter("."+f.active),i=s.index(n),a=s.length,n=0<n.length,o=e.which,c=13,l=38,u=40;if(o===27&&(b.is.visible()?b.hideResults():(b.verbose("Escape key pressed, blurring search field"),p.trigger("blur")),e.stopPropagation(),y=!0),b.is.visible())if(o===c){if(b.verbose("Enter key pressed, selecting active result"),0<s.filter("."+f.active).length)return b.event.result.click.call(s.filter("."+f.active),e),e.preventDefault(),!1}else o===l&&n?(b.verbose("Up key pressed, changing active result"),t=i-1<0?i:i-1,r.removeClass(f.active),s.removeClass(f.active).eq(t).addClass(f.active).closest(r).addClass(f.active),b.ensureVisible(s.eq(t)),e.preventDefault()):o===u&&(b.verbose("Down key pressed, changing active result"),t=a<=i+1?i:i+1,r.removeClass(f.active),s.removeClass(f.active).eq(t).addClass(f.active).closest(r).addClass(f.active),b.ensureVisible(s.eq(t)),e.preventDefault());else o===c&&(b.verbose("Enter key pressed, executing query"),b.query(),b.set.buttonPressed(),p.one("keyup",b.remove.buttonFocus))},setup:{api:function(r,n){var e={debug:d.debug,on:!1,cache:d.cache,action:"search",urlData:{query:r}};j.extend(!0,e,d.apiSettings,{onSuccess:function(e,t,s){b.parse.response.call(m,e,r),n(),d.apiSettings&&"function"==typeof d.apiSettings.onSuccess&&d.apiSettings.onSuccess.call(this,e,t,s)},onFailure:function(e,t,s){b.displayMessage(h.serverError),n(),d.apiSettings&&"function"==typeof d.apiSettings.onFailure&&d.apiSettings.onFailure.call(this,e,t,s)},onAbort:function(e,t,s){d.apiSettings&&"function"==typeof d.apiSettings.onAbort&&d.apiSettings.onAbort.call(this,e,t,s)},onError:function(e,t,s){b.error(),d.apiSettings&&"function"==typeof d.apiSettings.onError&&d.apiSettings.onError.call(this,e,t,s)}}),b.verbose("Setting up API request",e),v.api(e)}},can:{useAPI:function(){return void 0!==j.fn.api},show:function(){return b.is.focused()&&!b.is.visible()&&!b.is.empty()},transition:function(){return d.transition&&void 0!==j.fn.transition}},is:{animating:function(){return i.hasClass(f.animating)},chrome:function(){return!!F.chrome&&!F.StyleMedia},hidden:function(){return i.hasClass(f.hidden)},inMessage:function(e){var t;if(e.target)return t=j(e.target),j.contains(q.documentElement,e.target)&&0<t.closest(g.message).length},empty:function(){return""===i.html()},visible:function(){return 0<i.filter(":visible").length},focused:function(){return 0<p.filter(":focus").length}},get:{settings:function(){j.isPlainObject(R)&&R.searchFullText&&(d.fullTextSearch=R.searchFullText,b.error(d.error.oldSearchSyntax,m)),d.ignoreDiacritics&&!String.prototype.normalize&&(d.ignoreDiacritics=!1,b.error(h.noNormalize,m))},inputEvent:function(){var e=p[0];return void 0!==e&&void 0!==e.oninput?"input":void 0!==e&&void 0!==e.onpropertychange?"propertychange":"keyup"},value:function(){return p.val()},results:function(){return v.data(c.results)},result:function(s,e){var r=!1;return s=void 0!==s?s:b.get.value(),e=void 0!==e?e:b.get.results(),"category"===d.type?(b.debug("Finding result that matches",s),j.each(e,function(e,t){if(Array.isArray(t.results)&&(r=b.search.object(s,t.results)[0]))return!1})):(b.debug("Finding result in results object",s),r=b.search.object(s,e)[0]),r||!1}},select:{firstResult:function(){b.verbose("Selecting first result"),a.first().addClass(f.active)}},set:{focus:function(){v.addClass(f.focus)},loading:function(){v.addClass(f.loading)},value:function(e){b.verbose("Setting search input value",e),p.val(e)},type:function(e){e=e||d.type,f[e]&&v.addClass(f[e])},buttonPressed:function(){s.addClass(f.pressed)}},remove:{loading:function(){v.removeClass(f.loading)},focus:function(){v.removeClass(f.focus)},buttonPressed:function(){s.removeClass(f.pressed)},diacritics:function(e){return d.ignoreDiacritics?e.normalize("NFD").replace(/[\u0300-\u036F]/g,""):e}},query:function(e){e=D(e)?e:function(){};var t=b.get.value(),s=b.read.cache(t);e=e||function(){},b.has.minimumCharacters()?(s?(b.debug("Reading result from cache",t),b.save.results(s.results),d.onResults.call(m,s.results,!0),b.addResults(s.html),b.inject.id(s.results),e()):(b.debug("Querying for",t),j.isPlainObject(d.source)||Array.isArray(d.source)?(b.search.local(t),e()):b.can.useAPI()?b.search.remote(t,e):(b.error(h.source),e())),d.onSearchQuery.call(m,t)):b.hideResults()},search:{local:function(e){var t,s=b.search.object(e,d.source);b.set.loading(),b.save.results(s),b.debug("Returned full local search results",s),0<d.maxResults&&(b.debug("Using specified max results",s),s=s.slice(0,d.maxResults)),"category"===d.type&&(s=b.create.categoryResults(s)),t=b.generateResults({results:s}),b.remove.loading(),b.addResults(t),b.inject.id(s),b.write.cache(e,{html:t,results:s})},remote:function(e,t){t=D(t)?t:function(){},v.api("is loading")&&v.api("abort"),b.setup.api(e,t),v.api("query")},object:function(n,e,t){n=b.remove.diacritics(String(n));function i(e,t){var s=-1===j.inArray(t,a),r=-1===j.inArray(t,c),n=-1===j.inArray(t,o);s&&r&&n&&e.push(t)}var a=[],o=[],c=[],s=n.replace(r.escape,"\\$&"),l=new RegExp(r.beginsWith+s,d.ignoreSearchCase?"i":"");if(e=e||d.source,t=void 0!==t?t:d.searchFields,Array.isArray(t)||(t=[t]),void 0===e||!1===e)return b.error(h.source),[];var u=t.length-1;return j.each(e,function(e,s){var r=[];j.each(t,function(e,t){if("string"==typeof s[t]||"number"==typeof s[t]){t="string"==typeof s[t]?b.remove.diacritics(s[t]):s[t].toString();if(t=j("<div/>",{html:t}).text().trim(),"all"===d.fullTextSearch){if(r.push(t),e<u)return!0;t=r.join(" ")}"all"!==d.fullTextSearch&&-1!==t.search(l)?i(a,s):"exact"===d.fullTextSearch&&b.exactSearch(n,t)||"some"===d.fullTextSearch&&b.wordSearch(n,t)||"all"===d.fullTextSearch&&b.wordSearch(n,t,!0)?i(o,s):!0===d.fullTextSearch&&b.fuzzySearch(n,t)&&i(c,s)}})}),j.merge(o,c),j.merge(a,o),a}},exactSearch:function(e,t){return d.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),-1<t.indexOf(e)},wordSearch:function(e,t,s){for(var r=e.split(/\s+/),n=r.length,i=!1,a=0;a<n&&!(!(i=b.exactSearch(r[a],t))&&s||i&&!s);a++);return i},fuzzySearch:function(e,t){var s=t.length,r=e.length;if("string"!=typeof e)return!1;if(d.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),s<r)return!1;if(r===s)return e===t;for(var n=0,i=0;n<r;n++){for(var a=!1,o=e.charCodeAt(n);i<s;)if(t.charCodeAt(i++)===o){a=!0;break}if(!a)return!1}return!0},parse:{response:function(e,t){Array.isArray(e)&&((s={})[u.results]=e,e=s);var s=b.generateResults(e);b.verbose("Parsing server response",e),void 0!==e&&void 0!==t&&void 0!==e[u.results]&&(b.addResults(s),b.inject.id(e[u.results]),b.write.cache(t,{html:s,results:e[u.results]}),b.save.results(e[u.results]))}},cancel:{query:function(){b.can.useAPI()&&v.api("abort")}},has:{minimumCharacters:function(){return b.get.value().length>=d.minCharacters},results:function(){return 0!==i.length&&""!==i.html()}},clear:{cache:function(e){var t=v.data(c.cache);e?t&&t[e]&&(b.debug("Removing value from cache",e),delete t[e],v.data(c.cache,t)):(b.debug("Clearing cache",e),v.removeData(c.cache))},value:function(){b.set.value("")}},read:{cache:function(e){var t=v.data(c.cache);return!!d.cache&&(b.verbose("Checking cache for generated html for query",e),"object"==typeof t&&void 0!==t[e]&&t[e])}},create:{categoryResults:function(e){var s={};return j.each(e,function(e,t){t.category&&(void 0===s[t.category]?(b.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){var s,e=e+1;return void 0!==t?(t=String.fromCharCode(97+t),b.verbose("Creating category result id",s=t+e)):b.verbose("Creating result id",s=e),s},results:function(){0===i.length&&(i=j("<div />").addClass(f.results).appendTo(v))}},inject:{result:function(e,t,s){b.verbose("Injecting result into results");s=(void 0!==s?i.children().eq(s).children(g.results).first():i).children(g.result).eq(t);b.verbose("Injecting results metadata",s),s.data(c.result,e)},id:function(e){b.debug("Injecting unique ids into results");var s=0,r=0;return"category"===d.type?j.each(e,function(e,t){0<t.results.length&&(r=0,j.each(t.results,function(e,t){void 0===t.id&&(t.id=b.create.id(r,s)),b.inject.result(t,r,s),r++}),s++)}):j.each(e,function(e,t){void 0===t.id&&(t.id=b.create.id(r)),b.inject.result(t,r),r++}),e}},save:{results:function(e){b.verbose("Saving current search results to metadata",e),v.data(c.results,e)}},write:{cache:function(e,t){var s=void 0!==v.data(c.cache)?v.data(c.cache):{};d.cache&&(b.verbose("Writing generated html to cache",e,t),s[e]=t,v.data(c.cache,s))}},addResults:function(e){if(D(d.onResultsAdd)&&!1===d.onResultsAdd.call(i,e))return b.debug("onResultsAdd callback cancelled default action"),!1;e?(i.html(e),b.refreshResults(),d.selectFirstResult&&b.select.firstResult(),b.showResults()):b.hideResults(function(){i.empty()})},showResults:function(e){e=D(e)?e:function(){},y||!b.is.visible()&&b.has.results()&&(b.can.transition()?(b.debug("Showing results with css animations"),i.transition({animation:d.transition+" in",debug:d.debug,verbose:d.verbose,silent:d.silent,duration:d.duration,onShow:function(){var e=v.find(g.result).eq(0);b.ensureVisible(e)},onComplete:function(){e()},queue:!0})):(b.debug("Showing results with javascript"),i.stop().fadeIn(d.duration,d.easing)),d.onResultsOpen.call(i))},hideResults:function(e){e=D(e)?e:function(){},b.is.visible()&&(b.can.transition()?(b.debug("Hiding results with css animations"),i.transition({animation:d.transition+" out",debug:d.debug,verbose:d.verbose,silent:d.silent,duration:d.duration,onComplete:function(){e()},queue:!0})):(b.debug("Hiding results with javascript"),i.stop().fadeOut(d.duration,d.easing)),d.onResultsClose.call(i))},generateResults:function(i){b.debug("Generating html from response",i);var e,t,s,a,o,r=d.templates[d.type],n=j.isPlainObject(i[u.results])&&!j.isEmptyObject(i[u.results]),c=Array.isArray(i[u.results])&&0<i[u.results].length,l="";return n||c?(0<d.maxResults&&(n?"standard"===d.type&&b.error(h.maxResults):i[u.results]=i[u.results].slice(0,d.maxResults)),d.highlightMatches&&(c=i[u.results],n=d.ignoreSearchCase?"i":"",e=b.get.value().split(""),t=d.ignoreDiacritics?"[̀-ͯ]?":"",s="(?![^<]*>)",a=new RegExp(s+"("+e.join(t+")(.*?)"+s+"(")+t+")",n),o=function(){return[].slice.call(arguments,1,2*e.length).map(function(e,t){return 1&t?e:"<mark>"+e+"</mark>"}).join("")},j.each(c,function(r,n){j.each(d.searchFields,function(e,t){var s;"string"!=typeof n[t]&&"number"!=typeof n[t]||(s="string"==typeof n[t]?n[t]:n[t].toString(),s=(s=d.ignoreDiacritics?s.normalize("NFD"):s).replace(/<\/?mark>/g,""),i[u.results][r][t]=s.replace(a,o))})})),D(r)?l=r(i,u,d.preserveHTML):b.error(h.noTemplate,!1)):d.showNoResults&&(l=b.displayMessage(h.noResults,"empty",h.noResultsHeader)),d.onResults.call(m,i),l},displayMessage:function(e,t,s){return b.debug("Displaying message",e,t=t||"standard",s),b.addResults(d.templates.message(e,t,s)),d.templates.message(e,t,s)},setting:function(e,t){if(j.isPlainObject(e))j.extend(!0,d,e);else{if(void 0===t)return d[e];d[e]=t}},internal:function(e,t){if(j.isPlainObject(e))j.extend(!0,b,e);else{if(void 0===t)return b[e];b[e]=t}},debug:function(){!d.silent&&d.debug&&(d.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,d.name+":"),b.debug.apply(console,arguments)))},verbose:function(){!d.silent&&d.verbose&&d.debug&&(d.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),b.verbose.apply(console,arguments)))},error:function(){d.silent||(b.error=Function.prototype.bind.call(console.error,console,d.name+":"),b.error.apply(console,arguments))},performance:{log:function(e){var t,s;d.performance&&(s=(t=Date.now())-(C||t),C=t,w.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:m,"Execution Time":s})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(function(){b.performance.display()},500)},display:function(){var e=d.name+":",s=0;C=!1,clearTimeout(b.performance.timer),j.each(w,function(e,t){s+=t["Execution Time"]}),e+=" "+s+"ms",1<x.length&&(e+=" ("+x.length+")"),0<w.length&&(console.groupCollapsed(e),console.table?console.table(w):j.each(w,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),w=[]}},invoke:function(r,e,t){var n,i,s,a=o;return e=e||A,t=t||m,"string"==typeof r&&void 0!==a&&(r=r.split(/[ .]/),n=r.length-1,j.each(r,function(e,t){var s=e!==n?t+r[e+1].charAt(0).toUpperCase()+r[e+1].slice(1):r;if(j.isPlainObject(a[s])&&e!==n)a=a[s];else{if(void 0!==a[s])return i=a[s],!1;{if(!j.isPlainObject(a[t])||e===n)return void 0!==a[t]?i=a[t]:b.error(h.method,r),!1;a=a[t]}}})),D(i)?s=i.apply(t,e):void 0!==i&&(s=i),Array.isArray(S)?S.push(s):void 0!==S?S=[S,s]:void 0!==s&&(S=s),i}};k?(void 0===o&&b.initialize(),b.invoke(T)):(void 0!==o&&o.invoke("destroy"),b.initialize())}),void 0!==S?S:this},j.fn.search.settings={name:"Search",namespace:"search",silent:!1,debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,selectFirstResult:!1,apiSettings:!1,source:!1,searchOnFocus:!0,searchFields:["id","title","description"],displayField:"",fullTextSearch:"exact",highlightMatches:!1,ignoreDiacritics:!1,ignoreSearchCase:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,showNoResults:!0,preserveHTML:!1,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(e){},onResults:function(e,t){},onResultsOpen:function(){},onResultsClose:function(){},className:{animating:"animating",active:"active",category:"category",empty:"empty",focus:"focus",hidden:"hidden",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Fomantic API module was not included",noResultsHeader:"No Results",noResults:"Your search returned no results",noTemplate:"A valid template name was not specified.",oldSearchSyntax:"searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined.",noNormalize:'"ignoreDiacritics" setting will be ignored. Browser does not support String().normalize(). You may consider including <https://cdn.jsdelivr.net/npm/unorm@1.4.1/lib/unorm.min.js> as a polyfill.'},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[$()*+./?[\\\]^{|}-]/g,beginsWith:"(?:\\s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",alt:"alt",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",remove:"> .icon.input > .remove.icon",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(t)return e;var s={"<":"<",">":">",'"':""","'":"'","`":"`"};return e=/["&'<>`]/.test(e)?(e=(e=e.replace(/&(?![\d#a-z]{1,12};)/gi,"&")).replace(/["'<>`]/g,function(e){return s[e]})).replace(/<(\/)*mark>/g,"<$1mark>"):e},message:function(e,t,s){var r="";return void 0!==e&&void 0!==t&&(r+='<div class="message '+t+'">',s&&(r+='<div class="header">'+s+"</div>"),r=r+' <div class="description">'+e+"</div></div>"),r},category:function(e,s,r){var n="",i=j.fn.search.settings.templates.escape;return void 0!==e[s.categoryResults]&&(j.each(e[s.categoryResults],function(e,t){void 0!==t[s.results]&&0<t.results.length&&(n+='<div class="category">',void 0!==t[s.categoryName]&&(n+='<div class="name">'+i(t[s.categoryName],r)+"</div>"),n+='<div class="results">',j.each(t.results,function(e,t){n+=t[s.url]?'<a class="result" href="'+t[s.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[s.image]&&(n+='<div class="image"> <img src="'+t[s.image].replace(/"/g,"")+(t[s.alt]?'" alt="'+t[s.alt].replace(/"/g,""):"")+'"></div>'),n+='<div class="content">',void 0!==t[s.price]&&(n+='<div class="price">'+i(t[s.price],r)+"</div>"),void 0!==t[s.title]&&(n+='<div class="title">'+i(t[s.title],r)+"</div>"),void 0!==t[s.description]&&(n+='<div class="description">'+i(t[s.description],r)+"</div>"),n+="</div></a>"}),n+="</div></div>")}),e[s.action]&&(n+=!1===s.actionURL?'<div class="action">'+i(e[s.action][s.actionText],r)+"</div>":'<a href="'+e[s.action][s.actionURL].replace(/"/g,"")+'" class="action">'+i(e[s.action][s.actionText],r)+"</a>"),n)},standard:function(e,s,r){var n="",i=j.fn.search.settings.templates.escape;return void 0!==e[s.results]&&(j.each(e[s.results],function(e,t){n+=t[s.url]?'<a class="result" href="'+t[s.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[s.image]&&(n+='<div class="image"> <img src="'+t[s.image].replace(/"/g,"")+(t[s.alt]?'" alt="'+t[s.alt].replace(/"/g,""):"")+'"></div>'),n+='<div class="content">',void 0!==t[s.price]&&(n+='<div class="price">'+i(t[s.price],r)+"</div>"),void 0!==t[s.title]&&(n+='<div class="title">'+i(t[s.title],r)+"</div>"),void 0!==t[s.description]&&(n+='<div class="description">'+i(t[s.description],r)+"</div>"),n+="</div></a>"}),e[s.action]&&(n+=!1===s.actionURL?'<div class="action">'+i(e[s.action][s.actionText],r)+"</div>":'<a href="'+e[s.action][s.actionURL].replace(/"/g,"")+'" class="action">'+i(e[s.action][s.actionText],r)+"</a>"),n)}}},j.extend(j.easing,{easeOutExpo:function(e){return 1===e?1:1-Math.pow(2,-10*e)}})}(jQuery,window,document);
|
11
|
+
!function(j,F,q){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}F=void 0!==F&&F.Math===Math?F:globalThis,j.fn.search=function(R){var S,x=j(this),C=Date.now(),w=[],T=R,k="string"==typeof T,A=[].slice.call(arguments,1);return x.each(function(){var d=j.isPlainObject(R)?j.extend(!0,{},j.fn.search.settings,R):j.extend({},j.fn.search.settings),f=d.className,c=d.metadata,r=d.regExp,u=d.fields,g=d.selector,h=d.error,e=d.namespace,n="."+e,t=e+"-module",v=j(this),p=v.find(g.prompt),s=v.find(g.searchButton),i=v.find(g.results),a=v.find(g.result),m=(v.find(g.category),this),o=v.data(t),l=!1,y=!1,b={initialize:function(){b.verbose("Initializing module"),b.get.settings(),b.determine.searchFields(),b.bind.events(),b.set.type(),b.create.results(),b.instantiate()},instantiate:function(){b.verbose("Storing instance of module",b),o=b,v.data(t,b)},destroy:function(){b.verbose("Destroying instance"),v.off(n).removeData(t)},refresh:function(){b.debug("Refreshing selector cache"),p=v.find(g.prompt),s=v.find(g.searchButton),v.find(g.category),i=v.find(g.results),a=v.find(g.result)},refreshResults:function(){i=v.find(g.results),a=v.find(g.result)},bind:{events:function(){b.verbose("Binding events to search"),d.automatic&&(v.on(b.get.inputEvent()+n,g.prompt,b.event.input),p.attr("autocomplete",b.is.chrome()?"fomantic-search":"off")),v.on("focus"+n,g.prompt,b.event.focus).on("blur"+n,g.prompt,b.event.blur).on("keydown"+n,g.prompt,b.handleKeyboard).on("click"+n,g.searchButton,b.query).on("mousedown"+n,g.results,b.event.result.mousedown).on("mouseup"+n,g.results,b.event.result.mouseup).on("click"+n,g.result,b.event.result.click).on("click"+n,g.remove,b.event.remove.click)}},determine:{searchFields:function(){R&&void 0!==R.searchFields&&(d.searchFields=Array.isArray(R.searchFields)?R.searchFields:[R.searchFields])}},event:{input:function(){d.searchDelay?(clearTimeout(b.timer),b.timer=setTimeout(function(){b.is.focused()&&b.query()},d.searchDelay)):b.query()},focus:function(){b.set.focus(),d.searchOnFocus&&b.has.minimumCharacters()&&b.query(function(){b.can.show()&&b.showResults()})},blur:function(e){function t(){b.cancel.query(),b.remove.focus(),b.timer=setTimeout(function(){b.hideResults()},d.hideDelay)}var s=q.activeElement===this;s||(y=!1,b.resultsClicked?(b.debug("Determining if user action caused search to close"),v.one("click.close"+n,g.results,function(e){b.is.inMessage(e)||l?p.trigger("focus"):(l=!1,b.is.animating()||b.is.hidden()||t())})):(b.debug("Input blurred without user action, closing results"),t()))},remove:{click:function(){b.clear.value(),p.trigger("focus")}},result:{mousedown:function(){b.resultsClicked=!0},mouseup:function(){b.resultsClicked=!1},click:function(e){b.debug("Search result selected");var t=j(this),s=t.find(g.title).eq(0),r=t.is("a[href]")?t:t.find("a[href]").eq(0),n=r.attr("href")||!1,i=r.attr("target")||!1,s=0<s.length&&s.text(),a=b.get.results(),t=t.data(c.result)||b.get.result(s,a),o=b.get.value();if(D(d.onSelect)&&!1===d.onSelect.call(m,t,a))return b.debug("Custom onSelect callback cancelled default select action"),void(l=!0);b.hideResults(),s&&b.get.value()===o&&b.set.value(s),n&&(e.preventDefault(),b.verbose("Opening search link found in result",r),"_blank"===i||e.ctrlKey?F.open(n):F.location.href=n)}}},ensureVisible:function(e){var t,s,r;0!==e.length&&(e=(t=e.position().top)+e.outerHeight(!0),s=i.scrollTop(),r=i.height(),t<0?i.scrollTop(s+t):r<e&&i.scrollTop(s+(e-r)))},handleKeyboard:function(e){var t,s=v.find(g.result),r=v.find(g.category),n=s.filter("."+f.active),i=s.index(n),a=s.length,n=0<n.length,o=e.which,c=13,l=38,u=40;if(o===27&&(b.is.visible()?b.hideResults():(b.verbose("Escape key pressed, blurring search field"),p.trigger("blur")),e.stopPropagation(),y=!0),b.is.visible())if(o===c){if(b.verbose("Enter key pressed, selecting active result"),0<s.filter("."+f.active).length)return b.event.result.click.call(s.filter("."+f.active),e),e.preventDefault(),!1}else o===l&&n?(b.verbose("Up key pressed, changing active result"),t=i-1<0?i:i-1,r.removeClass(f.active),s.removeClass(f.active).eq(t).addClass(f.active).closest(r).addClass(f.active),b.ensureVisible(s.eq(t)),e.preventDefault()):o===u&&(b.verbose("Down key pressed, changing active result"),t=a<=i+1?i:i+1,r.removeClass(f.active),s.removeClass(f.active).eq(t).addClass(f.active).closest(r).addClass(f.active),b.ensureVisible(s.eq(t)),e.preventDefault());else o===c&&(b.verbose("Enter key pressed, executing query"),b.query(),b.set.buttonPressed(),p.one("keyup",b.remove.buttonFocus))},setup:{api:function(r,n){var e={debug:d.debug,on:!1,cache:d.cache,action:"search",urlData:{query:r}};j.extend(!0,e,d.apiSettings,{onSuccess:function(e,t,s){b.parse.response.call(m,e,r),n(),d.apiSettings&&"function"==typeof d.apiSettings.onSuccess&&d.apiSettings.onSuccess.call(this,e,t,s)},onFailure:function(e,t,s){b.displayMessage(h.serverError),n(),d.apiSettings&&"function"==typeof d.apiSettings.onFailure&&d.apiSettings.onFailure.call(this,e,t,s)},onAbort:function(e,t,s){d.apiSettings&&"function"==typeof d.apiSettings.onAbort&&d.apiSettings.onAbort.call(this,e,t,s)},onError:function(e,t,s){b.error(),d.apiSettings&&"function"==typeof d.apiSettings.onError&&d.apiSettings.onError.call(this,e,t,s)}}),b.verbose("Setting up API request",e),v.api(e)}},can:{useAPI:function(){return void 0!==j.fn.api},show:function(){return b.is.focused()&&!b.is.visible()&&!b.is.empty()},transition:function(){return d.transition&&void 0!==j.fn.transition}},is:{animating:function(){return i.hasClass(f.animating)},chrome:function(){return!!F.chrome&&!F.StyleMedia},hidden:function(){return i.hasClass(f.hidden)},inMessage:function(e){var t;if(e.target)return t=j(e.target),j.contains(q.documentElement,e.target)&&0<t.closest(g.message).length},empty:function(){return""===i.html()},visible:function(){return 0<i.filter(":visible").length},focused:function(){return 0<p.filter(":focus").length}},get:{settings:function(){j.isPlainObject(R)&&R.searchFullText&&(d.fullTextSearch=R.searchFullText,b.error(d.error.oldSearchSyntax,m))},inputEvent:function(){var e=p[0];return void 0!==e&&void 0!==e.oninput?"input":void 0!==e&&void 0!==e.onpropertychange?"propertychange":"keyup"},value:function(){return p.val()},results:function(){return v.data(c.results)},result:function(s,e){var r=!1;return s=void 0!==s?s:b.get.value(),e=void 0!==e?e:b.get.results(),"category"===d.type?(b.debug("Finding result that matches",s),j.each(e,function(e,t){if(Array.isArray(t.results)&&(r=b.search.object(s,t.results)[0]))return!1})):(b.debug("Finding result in results object",s),r=b.search.object(s,e)[0]),r||!1}},select:{firstResult:function(){b.verbose("Selecting first result"),a.first().addClass(f.active)}},set:{focus:function(){v.addClass(f.focus)},loading:function(){v.addClass(f.loading)},value:function(e){b.verbose("Setting search input value",e),p.val(e)},type:function(e){e=e||d.type,f[e]&&v.addClass(f[e])},buttonPressed:function(){s.addClass(f.pressed)}},remove:{loading:function(){v.removeClass(f.loading)},focus:function(){v.removeClass(f.focus)},buttonPressed:function(){s.removeClass(f.pressed)},diacritics:function(e){return d.ignoreDiacritics?e.normalize("NFD").replace(/[\u0300-\u036F]/g,""):e}},query:function(e){e=D(e)?e:function(){};var t=b.get.value(),s=b.read.cache(t);e=e||function(){},b.has.minimumCharacters()?(s?(b.debug("Reading result from cache",t),b.save.results(s.results),d.onResults.call(m,s.results,!0),b.addResults(s.html),b.inject.id(s.results),e()):(b.debug("Querying for",t),j.isPlainObject(d.source)||Array.isArray(d.source)?(b.search.local(t),e()):b.can.useAPI()?b.search.remote(t,e):(b.error(h.source),e())),d.onSearchQuery.call(m,t)):b.hideResults()},search:{local:function(e){var t,s=b.search.object(e,d.source);b.set.loading(),b.save.results(s),b.debug("Returned full local search results",s),0<d.maxResults&&(b.debug("Using specified max results",s),s=s.slice(0,d.maxResults)),"category"===d.type&&(s=b.create.categoryResults(s)),t=b.generateResults({results:s}),b.remove.loading(),b.addResults(t),b.inject.id(s),b.write.cache(e,{html:t,results:s})},remote:function(e,t){t=D(t)?t:function(){},v.api("is loading")&&v.api("abort"),b.setup.api(e,t),v.api("query")},object:function(n,e,t){n=b.remove.diacritics(String(n));function i(e,t){var s=-1===j.inArray(t,a),r=-1===j.inArray(t,c),n=-1===j.inArray(t,o);s&&r&&n&&e.push(t)}var a=[],o=[],c=[],s=n.replace(r.escape,"\\$&"),l=new RegExp(r.beginsWith+s,d.ignoreSearchCase?"i":"");if(e=e||d.source,t=void 0!==t?t:d.searchFields,Array.isArray(t)||(t=[t]),void 0===e||!1===e)return b.error(h.source),[];var u=t.length-1;return j.each(e,function(e,s){var r=[];j.each(t,function(e,t){if("string"==typeof s[t]||"number"==typeof s[t]){t="string"==typeof s[t]?b.remove.diacritics(s[t]):s[t].toString();if(t=j("<div/>",{html:t}).text().trim(),"all"===d.fullTextSearch){if(r.push(t),e<u)return!0;t=r.join(" ")}"all"!==d.fullTextSearch&&-1!==t.search(l)?i(a,s):"exact"===d.fullTextSearch&&b.exactSearch(n,t)||"some"===d.fullTextSearch&&b.wordSearch(n,t)||"all"===d.fullTextSearch&&b.wordSearch(n,t,!0)?i(o,s):!0===d.fullTextSearch&&b.fuzzySearch(n,t)&&i(c,s)}})}),j.merge(o,c),j.merge(a,o),a}},exactSearch:function(e,t){return d.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),-1<t.indexOf(e)},wordSearch:function(e,t,s){for(var r=e.split(/\s+/),n=r.length,i=!1,a=0;a<n&&!(!(i=b.exactSearch(r[a],t))&&s||i&&!s);a++);return i},fuzzySearch:function(e,t){var s=t.length,r=e.length;if("string"!=typeof e)return!1;if(d.ignoreSearchCase&&(e=e.toLowerCase(),t=t.toLowerCase()),s<r)return!1;if(r===s)return e===t;for(var n=0,i=0;n<r;n++){for(var a=!1,o=e.charCodeAt(n);i<s;)if(t.charCodeAt(i++)===o){a=!0;break}if(!a)return!1}return!0},parse:{response:function(e,t){Array.isArray(e)&&((s={})[u.results]=e,e=s);var s=b.generateResults(e);b.verbose("Parsing server response",e),void 0!==e&&void 0!==t&&void 0!==e[u.results]&&(b.addResults(s),b.inject.id(e[u.results]),b.write.cache(t,{html:s,results:e[u.results]}),b.save.results(e[u.results]))}},cancel:{query:function(){b.can.useAPI()&&v.api("abort")}},has:{minimumCharacters:function(){return b.get.value().length>=d.minCharacters},results:function(){return 0!==i.length&&""!==i.html()}},clear:{cache:function(e){var t=v.data(c.cache);e?t&&t[e]&&(b.debug("Removing value from cache",e),delete t[e],v.data(c.cache,t)):(b.debug("Clearing cache",e),v.removeData(c.cache))},value:function(){b.set.value("")}},read:{cache:function(e){var t=v.data(c.cache);return!!d.cache&&(b.verbose("Checking cache for generated html for query",e),"object"==typeof t&&void 0!==t[e]&&t[e])}},create:{categoryResults:function(e){var s={};return j.each(e,function(e,t){t.category&&(void 0===s[t.category]?(b.verbose("Creating new category of results",t.category),s[t.category]={name:t.category,results:[t]}):s[t.category].results.push(t))}),s},id:function(e,t){var s,e=e+1;return void 0!==t?(t=String.fromCharCode(97+t),b.verbose("Creating category result id",s=t+e)):b.verbose("Creating result id",s=e),s},results:function(){0===i.length&&(i=j("<div />").addClass(f.results).appendTo(v))}},inject:{result:function(e,t,s){b.verbose("Injecting result into results");s=(void 0!==s?i.children().eq(s).children(g.results).first():i).children(g.result).eq(t);b.verbose("Injecting results metadata",s),s.data(c.result,e)},id:function(e){b.debug("Injecting unique ids into results");var s=0,r=0;return"category"===d.type?j.each(e,function(e,t){0<t.results.length&&(r=0,j.each(t.results,function(e,t){void 0===t.id&&(t.id=b.create.id(r,s)),b.inject.result(t,r,s),r++}),s++)}):j.each(e,function(e,t){void 0===t.id&&(t.id=b.create.id(r)),b.inject.result(t,r),r++}),e}},save:{results:function(e){b.verbose("Saving current search results to metadata",e),v.data(c.results,e)}},write:{cache:function(e,t){var s=void 0!==v.data(c.cache)?v.data(c.cache):{};d.cache&&(b.verbose("Writing generated html to cache",e,t),s[e]=t,v.data(c.cache,s))}},addResults:function(e){if(D(d.onResultsAdd)&&!1===d.onResultsAdd.call(i,e))return b.debug("onResultsAdd callback cancelled default action"),!1;e?(i.html(e),b.refreshResults(),d.selectFirstResult&&b.select.firstResult(),b.showResults()):b.hideResults(function(){i.empty()})},showResults:function(e){e=D(e)?e:function(){},y||!b.is.visible()&&b.has.results()&&(b.can.transition()?(b.debug("Showing results with css animations"),i.transition({animation:d.transition+" in",debug:d.debug,verbose:d.verbose,silent:d.silent,duration:d.duration,onShow:function(){var e=v.find(g.result).eq(0);b.ensureVisible(e)},onComplete:function(){e()},queue:!0})):(b.debug("Showing results with javascript"),i.stop().fadeIn(d.duration,d.easing)),d.onResultsOpen.call(i))},hideResults:function(e){e=D(e)?e:function(){},b.is.visible()&&(b.can.transition()?(b.debug("Hiding results with css animations"),i.transition({animation:d.transition+" out",debug:d.debug,verbose:d.verbose,silent:d.silent,duration:d.duration,onComplete:function(){e()},queue:!0})):(b.debug("Hiding results with javascript"),i.stop().fadeOut(d.duration,d.easing)),d.onResultsClose.call(i))},generateResults:function(i){b.debug("Generating html from response",i);var e,t,s,a,o,r=d.templates[d.type],n=j.isPlainObject(i[u.results])&&!j.isEmptyObject(i[u.results]),c=Array.isArray(i[u.results])&&0<i[u.results].length,l="";return n||c?(0<d.maxResults&&(n?"standard"===d.type&&b.error(h.maxResults):i[u.results]=i[u.results].slice(0,d.maxResults)),d.highlightMatches&&(c=i[u.results],n=d.ignoreSearchCase?"i":"",e=b.get.value().split(""),t=d.ignoreDiacritics?"[̀-ͯ]?":"",s="(?![^<]*>)",a=new RegExp(s+"("+e.join(t+")(.*?)"+s+"(")+t+")",n),o=function(){return[].slice.call(arguments,1,2*e.length).map(function(e,t){return 1&t?e:"<mark>"+e+"</mark>"}).join("")},j.each(c,function(r,n){j.each(d.searchFields,function(e,t){var s;"string"!=typeof n[t]&&"number"!=typeof n[t]||(s="string"==typeof n[t]?n[t]:n[t].toString(),s=(s=d.ignoreDiacritics?s.normalize("NFD"):s).replace(/<\/?mark>/g,""),i[u.results][r][t]=s.replace(a,o))})})),D(r)?l=r(i,d):b.error(h.noTemplate,!1)):d.showNoResults&&(l=b.displayMessage(h.noResults,"empty",h.noResultsHeader)),d.onResults.call(m,i),l},displayMessage:function(e,t,s){return b.debug("Displaying message",e,t=t||"standard",s),b.addResults(d.templates.message(e,t,s)),d.templates.message(e,t,s)},setting:function(e,t){if(j.isPlainObject(e))j.extend(!0,d,e);else{if(void 0===t)return d[e];d[e]=t}},internal:function(e,t){if(j.isPlainObject(e))j.extend(!0,b,e);else{if(void 0===t)return b[e];b[e]=t}},debug:function(){!d.silent&&d.debug&&(d.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,d.name+":"),b.debug.apply(console,arguments)))},verbose:function(){!d.silent&&d.verbose&&d.debug&&(d.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),b.verbose.apply(console,arguments)))},error:function(){d.silent||(b.error=Function.prototype.bind.call(console.error,console,d.name+":"),b.error.apply(console,arguments))},performance:{log:function(e){var t,s;d.performance&&(s=(t=Date.now())-(C||t),C=t,w.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:m,"Execution Time":s})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(function(){b.performance.display()},500)},display:function(){var e=d.name+":",s=0;C=!1,clearTimeout(b.performance.timer),j.each(w,function(e,t){s+=t["Execution Time"]}),e+=" "+s+"ms",1<x.length&&(e+=" ("+x.length+")"),0<w.length&&(console.groupCollapsed(e),console.table?console.table(w):j.each(w,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),w=[]}},invoke:function(r,e,t){var n,i,s,a=o;return e=e||A,t=t||m,"string"==typeof r&&void 0!==a&&(r=r.split(/[ .]/),n=r.length-1,j.each(r,function(e,t){var s=e!==n?t+r[e+1].charAt(0).toUpperCase()+r[e+1].slice(1):r;if(j.isPlainObject(a[s])&&e!==n)a=a[s];else{if(void 0!==a[s])return i=a[s],!1;{if(!j.isPlainObject(a[t])||e===n)return void 0!==a[t]?i=a[t]:b.error(h.method,r),!1;a=a[t]}}})),D(i)?s=i.apply(t,e):void 0!==i&&(s=i),Array.isArray(S)?S.push(s):void 0!==S?S=[S,s]:void 0!==s&&(S=s),i}};k?(void 0===o&&b.initialize(),b.invoke(T)):(void 0!==o&&o.invoke("destroy"),b.initialize())}),void 0!==S?S:this},j.fn.search.settings={name:"Search",namespace:"search",silent:!1,debug:!1,verbose:!1,performance:!0,type:"standard",minCharacters:1,selectFirstResult:!1,apiSettings:!1,source:!1,searchOnFocus:!0,searchFields:["id","title","description"],displayField:"",fullTextSearch:"exact",highlightMatches:!1,ignoreDiacritics:!1,ignoreSearchCase:!0,automatic:!0,hideDelay:0,searchDelay:200,maxResults:7,cache:!0,showNoResults:!0,preserveHTML:!1,transition:"scale",duration:200,easing:"easeOutExpo",onSelect:!1,onResultsAdd:!1,onSearchQuery:function(e){},onResults:function(e,t){},onResultsOpen:function(){},onResultsClose:function(){},className:{animating:"animating",active:"active",category:"category",empty:"empty",focus:"focus",hidden:"hidden",loading:"loading",results:"results",pressed:"down"},error:{source:"Cannot search. No source used, and Fomantic API module was not included",noResultsHeader:"No Results",noResults:"Your search returned no results",noTemplate:"A valid template name was not specified.",oldSearchSyntax:"searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",serverError:"There was an issue querying the server.",maxResults:"Results must be an array to use maxResults setting",method:"The method you called is not defined."},metadata:{cache:"cache",results:"results",result:"result"},regExp:{escape:/[$()*+./?[\\\]^{|}-]/g,beginsWith:"(?:\\s|^)"},fields:{categories:"results",categoryName:"name",categoryResults:"results",description:"description",image:"image",alt:"alt",price:"price",results:"results",title:"title",url:"url",action:"action",actionText:"text",actionURL:"url"},selector:{prompt:".prompt",remove:"> .icon.input > .remove.icon",searchButton:".search.button",results:".results",message:".results > .message",category:".category",result:".result",title:".title, .name"},templates:{escape:function(e,t){if(void 0!==t&&t.preserveHTML)return e;var s={"<":"<",">":">",'"':""","'":"'"};return e=/["&'<>]/.test(e)?(e=(e=e.replace(/&(?![\d#a-z]{1,12};)/gi,"&")).replace(/["'<>]/g,function(e){return s[e]})).replace(/<(\/)*mark>/g,"<$1mark>"):e},message:function(e,t,s){var r="";return void 0!==e&&void 0!==t&&(r+='<div class="message '+t+'">',s&&(r+='<div class="header">'+s+"</div>"),r=r+' <div class="description">'+e+"</div></div>"),r},category:function(e,s){var r="",n=s.fields,i=s.templates.escape;return void 0!==e[n.categoryResults]&&(j.each(e[n.categoryResults],function(e,t){void 0!==t[n.results]&&0<t.results.length&&(r+='<div class="category">',void 0!==t[n.categoryName]&&(r+='<div class="name">'+i(t[n.categoryName],s)+"</div>"),r+='<div class="results">',j.each(t.results,function(e,t){r+=t[n.url]?'<a class="result" href="'+t[n.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[n.image]&&(r+='<div class="image"> <img src="'+t[n.image].replace(/"/g,"")+'"'+(t[n.alt]?' alt="'+t[n.alt].replace(/"/g,"")+'"':"")+"></div>"),r+='<div class="content">',void 0!==t[n.price]&&(r+='<div class="price">'+i(t[n.price],s)+"</div>"),void 0!==t[n.title]&&(r+='<div class="title">'+i(t[n.title],s)+"</div>"),void 0!==t[n.description]&&(r+='<div class="description">'+i(t[n.description],s)+"</div>"),r+="</div></a>"}),r+="</div></div>")}),e[n.action]&&(r+=!1===n.actionURL?'<div class="action">'+i(e[n.action][n.actionText],s)+"</div>":'<a href="'+e[n.action][n.actionURL].replace(/"/g,"")+'" class="action">'+i(e[n.action][n.actionText],s)+"</a>"),r)},standard:function(e,s){var r="",n=s.fields,i=s.templates.escape;return void 0!==e[n.results]&&(j.each(e[n.results],function(e,t){r+=t[n.url]?'<a class="result" href="'+t[n.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[n.image]&&(r+='<div class="image"> <img src="'+t[n.image].replace(/"/g,"")+'"'+(t[n.alt]?' alt="'+t[n.alt].replace(/"/g,"")+'"':"")+"></div>"),r+='<div class="content">',void 0!==t[n.price]&&(r+='<div class="price">'+i(t[n.price],s)+"</div>"),void 0!==t[n.title]&&(r+='<div class="title">'+i(t[n.title],s)+"</div>"),void 0!==t[n.description]&&(r+='<div class="description">'+i(t[n.description],s)+"</div>"),r+="</div></a>"}),e[n.action]&&(r+=!1===n.actionURL?'<div class="action">'+i(e[n.action][n.actionText],s)+"</div>":'<a href="'+e[n.action][n.actionURL].replace(/"/g,"")+'" class="action">'+i(e[n.action][n.actionText],s)+"</a>"),r)}}},j.extend(j.easing,{easeOutExpo:function(e){return 1===e?1:1-Math.pow(2,-10*e)}})}(jQuery,window,document);
|
package/dist/components/shape.js
CHANGED
package/dist/components/site.css
CHANGED
package/dist/components/site.js
CHANGED
package/dist/components/state.js
CHANGED
package/dist/components/step.css
CHANGED
package/dist/components/tab.css
CHANGED
package/dist/components/tab.js
CHANGED
package/dist/components/text.css
CHANGED