fomantic-ui 2.10.0-beta.5 → 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 +29 -43
- 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 +9 -14
- 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 +150 -150
- 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 +28 -42
- 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 +8 -13
- 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 +1 -6
- package/types/fomantic-ui-embed.d.ts +1 -1
- package/types/fomantic-ui-search.d.ts +1 -1
@@ -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
|
@@ -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: {
|
@@ -1477,22 +1472,22 @@
|
|
1477
1472
|
|
1478
1473
|
templates: {
|
1479
1474
|
escape: function (string, settings) {
|
1480
|
-
if (settings.preserveHTML) {
|
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);
|
@@ -1544,7 +1539,7 @@
|
|
1544
1539
|
if (result[fields.image] !== undefined) {
|
1545
1540
|
html += ''
|
1546
1541
|
+ '<div class="image">'
|
1547
|
-
+ ' <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, '') + '"' : '') + '>'
|
1548
1543
|
+ '</div>';
|
1549
1544
|
}
|
1550
1545
|
html += '<div class="content">';
|
@@ -1598,7 +1593,7 @@
|
|
1598
1593
|
if (result[fields.image] !== undefined) {
|
1599
1594
|
html += ''
|
1600
1595
|
+ '<div class="image">'
|
1601
|
-
+ ' <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, '') + '"' : '') + '>'
|
1602
1597
|
+ '</div>';
|
1603
1598
|
}
|
1604
1599
|
html += '<div class="content">';
|
@@ -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,i="."+e,t=e+"-module",v=j(this),p=v.find(g.prompt),s=v.find(g.searchButton),n=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(i).removeData(t)},refresh:function(){b.debug("Refreshing selector cache"),p=v.find(g.prompt),s=v.find(g.searchButton),v.find(g.category),n=v.find(g.results),a=v.find(g.result)},refreshResults:function(){n=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()+i,g.prompt,b.event.input),p.attr("autocomplete",b.is.chrome()?"fomantic-search":"off")),v.on("focus"+i,g.prompt,b.event.focus).on("blur"+i,g.prompt,b.event.blur).on("keydown"+i,g.prompt,b.handleKeyboard).on("click"+i,g.searchButton,b.query).on("mousedown"+i,g.results,b.event.result.mousedown).on("mouseup"+i,g.results,b.event.result.mouseup).on("click"+i,g.result,b.event.result.click).on("click"+i,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"+i,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),i=r.attr("href")||!1,n=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),i&&(e.preventDefault(),b.verbose("Opening search link found in result",r),"_blank"===n||e.ctrlKey?F.open(i):F.location.href=i)}}},ensureVisible:function(e){var t,s,r;0!==e.length&&(e=(t=e.position().top)+e.outerHeight(!0),s=n.scrollTop(),r=n.height(),t<0?n.scrollTop(s+t):r<e&&n.scrollTop(s+(e-r)))},handleKeyboard:function(e){var t,s=v.find(g.result),r=v.find(g.category),i=s.filter("."+f.active),n=s.index(i),a=s.length,i=0<i.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&&i?(b.verbose("Up key pressed, changing active result"),t=n-1<0?n:n-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<=n+1?n:n+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,i){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),i(),d.apiSettings&&"function"==typeof d.apiSettings.onSuccess&&d.apiSettings.onSuccess.call(this,e,t,s)},onFailure:function(e,t,s){b.displayMessage(h.serverError),i(),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 n.hasClass(f.animating)},chrome:function(){return!!F.chrome&&!F.StyleMedia},hidden:function(){return n.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""===n.html()},visible:function(){return 0<n.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(i,e,t){i=b.remove.diacritics(String(i));function n(e,t){var s=-1===j.inArray(t,a),r=-1===j.inArray(t,c),i=-1===j.inArray(t,o);s&&r&&i&&e.push(t)}var a=[],o=[],c=[],s=i.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)?n(a,s):"exact"===d.fullTextSearch&&b.exactSearch(i,t)||"some"===d.fullTextSearch&&b.wordSearch(i,t)||"all"===d.fullTextSearch&&b.wordSearch(i,t,!0)?n(o,s):!0===d.fullTextSearch&&b.fuzzySearch(i,t)&&n(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+/),i=r.length,n=!1,a=0;a<i&&!(!(n=b.exactSearch(r[a],t))&&s||n&&!s);a++);return n},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 i=0,n=0;i<r;i++){for(var a=!1,o=e.charCodeAt(i);n<s;)if(t.charCodeAt(n++)===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!==n.length&&""!==n.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===n.length&&(n=j("<div />").addClass(f.results).appendTo(v))}},inject:{result:function(e,t,s){b.verbose("Injecting result into results");s=(void 0!==s?n.children().eq(s).children(g.results).first():n).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(n,e))return b.debug("onResultsAdd callback cancelled default action"),!1;e?(n.html(e),b.refreshResults(),d.selectFirstResult&&b.select.firstResult(),b.showResults()):b.hideResults(function(){n.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"),n.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"),n.stop().fadeIn(d.duration,d.easing)),d.onResultsOpen.call(n))},hideResults:function(e){e=D(e)?e:function(){},b.is.visible()&&(b.can.transition()?(b.debug("Hiding results with css animations"),n.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"),n.stop().fadeOut(d.duration,d.easing)),d.onResultsClose.call(n))},generateResults:function(n){b.debug("Generating html from response",n);var e,t,s,a,o,r=d.templates[d.type],i=j.isPlainObject(n[u.results])&&!j.isEmptyObject(n[u.results]),c=Array.isArray(n[u.results])&&0<n[u.results].length,l="";return i||c?(0<d.maxResults&&(i?"standard"===d.type&&b.error(h.maxResults):n[u.results]=n[u.results].slice(0,d.maxResults)),d.highlightMatches&&(c=n[u.results],i=d.ignoreSearchCase?"i":"",e=b.get.value().split(""),t=d.ignoreDiacritics?"[̀-ͯ]?":"",s="(?![^<]*>)",a=new RegExp(s+"("+e.join(t+")(.*?)"+s+"(")+t+")",i),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,i){j.each(d.searchFields,function(e,t){var s;"string"!=typeof i[t]&&"number"!=typeof i[t]||(s="string"==typeof i[t]?i[t]:i[t].toString(),s=(s=d.ignoreDiacritics?s.normalize("NFD"):s).replace(/<\/?mark>/g,""),n[u.results][r][t]=s.replace(a,o))})})),D(r)?l=r(n,d):b.error(h.noTemplate,!1)):d.showNoResults&&(l=b.displayMessage(h.noResults,"empty",h.noResultsHeader)),d.onResults.call(m,n),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 i,n,s,a=o;return e=e||A,t=t||m,"string"==typeof r&&void 0!==a&&(r=r.split(/[ .]/),i=r.length-1,j.each(r,function(e,t){var s=e!==i?t+r[e+1].charAt(0).toUpperCase()+r[e+1].slice(1):r;if(j.isPlainObject(a[s])&&e!==i)a=a[s];else{if(void 0!==a[s])return n=a[s],!1;{if(!j.isPlainObject(a[t])||e===i)return void 0!==a[t]?n=a[t]:b.error(h.method,r),!1;a=a[t]}}})),D(n)?s=n.apply(t,e):void 0!==n&&(s=n),Array.isArray(S)?S.push(s):void 0!==S?S=[S,s]:void 0!==s&&(S=s),n}};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.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="",i=s.fields,n=s.templates.escape;return void 0!==e[i.categoryResults]&&(j.each(e[i.categoryResults],function(e,t){void 0!==t[i.results]&&0<t.results.length&&(r+='<div class="category">',void 0!==t[i.categoryName]&&(r+='<div class="name">'+n(t[i.categoryName],s)+"</div>"),r+='<div class="results">',j.each(t.results,function(e,t){r+=t[i.url]?'<a class="result" href="'+t[i.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[i.image]&&(r+='<div class="image"> <img src="'+t[i.image].replace(/"/g,"")+(t[i.alt]?'" alt="'+t[i.alt].replace(/"/g,""):"")+'"></div>'),r+='<div class="content">',void 0!==t[i.price]&&(r+='<div class="price">'+n(t[i.price],s)+"</div>"),void 0!==t[i.title]&&(r+='<div class="title">'+n(t[i.title],s)+"</div>"),void 0!==t[i.description]&&(r+='<div class="description">'+n(t[i.description],s)+"</div>"),r+="</div></a>"}),r+="</div></div>")}),e[i.action]&&(r+=!1===i.actionURL?'<div class="action">'+n(e[i.action][i.actionText],s)+"</div>":'<a href="'+e[i.action][i.actionURL].replace(/"/g,"")+'" class="action">'+n(e[i.action][i.actionText],s)+"</a>"),r)},standard:function(e,s){var r="",i=s.fields,n=s.templates.escape;return void 0!==e[i.results]&&(j.each(e[i.results],function(e,t){r+=t[i.url]?'<a class="result" href="'+t[i.url].replace(/"/g,"")+'">':'<a class="result">',void 0!==t[i.image]&&(r+='<div class="image"> <img src="'+t[i.image].replace(/"/g,"")+(t[i.alt]?'" alt="'+t[i.alt].replace(/"/g,""):"")+'"></div>'),r+='<div class="content">',void 0!==t[i.price]&&(r+='<div class="price">'+n(t[i.price],s)+"</div>"),void 0!==t[i.title]&&(r+='<div class="title">'+n(t[i.title],s)+"</div>"),void 0!==t[i.description]&&(r+='<div class="description">'+n(t[i.description],s)+"</div>"),r+="</div></a>"}),e[i.action]&&(r+=!1===i.actionURL?'<div class="action">'+n(e[i.action][i.actionText],s)+"</div>":'<a href="'+e[i.action][i.actionURL].replace(/"/g,"")+'" class="action">'+n(e[i.action][i.actionText],s)+"</a>"),r)}}},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
package/dist/components/toast.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.10.0-beta.
|
2
|
+
* # Fomantic-UI 2.10.0-beta.6+42a411a - Toast
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -192,7 +192,7 @@
|
|
192
192
|
$content.append($('<div/>', {
|
193
193
|
class: className.title,
|
194
194
|
id: titleId,
|
195
|
-
html: module.helpers.escape(settings.title),
|
195
|
+
html: module.helpers.escape(settings.title, settings),
|
196
196
|
}));
|
197
197
|
}
|
198
198
|
var descId = '_' + module.get.id() + 'desc';
|
@@ -200,7 +200,7 @@
|
|
200
200
|
$content.append($('<div/>', {
|
201
201
|
class: className.message,
|
202
202
|
id: descId,
|
203
|
-
html: module.helpers.escape(settings.message),
|
203
|
+
html: module.helpers.escape(settings.message, settings),
|
204
204
|
}));
|
205
205
|
|
206
206
|
$toast
|
@@ -232,10 +232,10 @@
|
|
232
232
|
$toast.find(selector.image).attr('src', settings.showImage).attr('alt', settings.alt || '');
|
233
233
|
}
|
234
234
|
if (settings.title !== '') {
|
235
|
-
$toast.find(selector.title).html(module.helpers.escape(settings.title));
|
235
|
+
$toast.find(selector.title).html(module.helpers.escape(settings.title, settings));
|
236
236
|
}
|
237
237
|
if (settings.message !== '') {
|
238
|
-
$toast.find(selector.message).html(module.helpers.escape(settings.message));
|
238
|
+
$toast.find(selector.message).html(module.helpers.escape(settings.message, settings));
|
239
239
|
}
|
240
240
|
}
|
241
241
|
if ($toast.hasClass(className.compact)) {
|
@@ -260,10 +260,10 @@
|
|
260
260
|
var
|
261
261
|
icon = el[fields.icon]
|
262
262
|
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '')
|
263
|
-
+ ' class="' + module.helpers.
|
263
|
+
+ ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
|
264
264
|
: '',
|
265
|
-
text = module.helpers.escape(el[fields.text] || ''),
|
266
|
-
cls = module.helpers.
|
265
|
+
text = module.helpers.escape(el[fields.text] || '', settings),
|
266
|
+
cls = module.helpers.escape(el[fields.class] || ''),
|
267
267
|
click = el[fields.click] && isFunction(el[fields.click])
|
268
268
|
? el[fields.click]
|
269
269
|
: function () {}
|
@@ -592,22 +592,18 @@
|
|
592
592
|
|
593
593
|
return result;
|
594
594
|
},
|
595
|
-
|
596
|
-
|
597
|
-
},
|
598
|
-
escape: function (string) {
|
599
|
-
if (settings.preserveHTML) {
|
595
|
+
escape: function (string, settings) {
|
596
|
+
if (settings !== undefined && settings.preserveHTML) {
|
600
597
|
return string;
|
601
598
|
}
|
602
599
|
var
|
603
|
-
badChars = /["'
|
604
|
-
shouldEscape = /["&'
|
600
|
+
badChars = /["'<>]/g,
|
601
|
+
shouldEscape = /["&'<>]/,
|
605
602
|
escape = {
|
606
603
|
'<': '<',
|
607
604
|
'>': '>',
|
608
605
|
'"': '"',
|
609
|
-
"'": '
|
610
|
-
'`': '`',
|
606
|
+
"'": ''',
|
611
607
|
},
|
612
608
|
escapedChar = function (chr) {
|
613
609
|
return escape[chr];
|
@@ -615,8 +611,7 @@
|
|
615
611
|
;
|
616
612
|
if (shouldEscape.test(string)) {
|
617
613
|
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
618
|
-
|
619
|
-
return string.replace(badChars, escapedChar);
|
614
|
+
string = string.replace(badChars, escapedChar);
|
620
615
|
}
|
621
616
|
|
622
617
|
return string;
|