Ajax Search for WooCommerce - Version 1.14.0

Version Description

Download this release

Release Info

Developer damian-gora
Plugin Icon 128x128 Ajax Search for WooCommerce
Version 1.14.0
Comparing to
See all releases

Code changes from version 1.13.0 to 1.14.0

ajax-search-for-woocommerce.php CHANGED
@@ -4,13 +4,13 @@
4
  * Plugin Name: FiboSearch - AJAX Search for WooCommerce
5
  * Plugin URI: https://fibosearch.com?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
6
  * Description: The most popular WooCommerce product search. Gives your users a well-designed advanced AJAX search bar with live search suggestions.
7
- * Version: 1.13.0
8
  * Author: FiboSearch Team
9
  * Author URI: https://fibosearch.com?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
10
  * Text Domain: ajax-search-for-woocommerce
11
  * Domain Path: /languages
12
  * WC requires at least: 3.3
13
- * WC tested up to: 5.5
14
  *
15
  */
16
  // Exit if accessed directly
4
  * Plugin Name: FiboSearch - AJAX Search for WooCommerce
5
  * Plugin URI: https://fibosearch.com?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
6
  * Description: The most popular WooCommerce product search. Gives your users a well-designed advanced AJAX search bar with live search suggestions.
7
+ * Version: 1.14.0
8
  * Author: FiboSearch Team
9
  * Author URI: https://fibosearch.com?utm_source=wp-admin&utm_medium=referral&utm_campaign=author_uri&utm_gen=utmdc
10
  * Text Domain: ajax-search-for-woocommerce
11
  * Domain Path: /languages
12
  * WC requires at least: 3.3
13
+ * WC tested up to: 5.8
14
  *
15
  */
16
  // Exit if accessed directly
assets/css/admin-style.css CHANGED
@@ -1679,3 +1679,39 @@ h3.dgwt-wcas-troubleshooting-issue-title {
1679
  .dgwt-wcas-settings-filters-rules-container .selectize-control.single::before {
1680
  right: 34px;
1681
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1679
  .dgwt-wcas-settings-filters-rules-container .selectize-control.single::before {
1680
  right: 34px;
1681
  }
1682
+
1683
+ .dgwt-wcas-debug table {
1684
+ margin-top: 30px;
1685
+ }
1686
+
1687
+ .dgwt-wcas-debug table th h3 {
1688
+ margin: 0;
1689
+ }
1690
+
1691
+ .dgwt-wcas-debug .widefat td {
1692
+ font-size: 13px;
1693
+ line-height: 9px;
1694
+ border-bottom: 1px solid #eee;
1695
+ padding: 10px 2px;
1696
+ }
1697
+
1698
+ .dgwt-wcas-debug .widefat td:first-child {
1699
+ text-align: right;
1700
+ color: #7c3b7d;
1701
+ font-size: 14px;
1702
+ width: 130px;
1703
+ padding-right: 10px;
1704
+ border-right: 1px solid #eee;
1705
+ }
1706
+ .dgwt-wcas-debug .widefat td:last-child {
1707
+ padding-left: 10px;
1708
+ }
1709
+
1710
+ .dgwt-wcas-table-wordlist p{
1711
+ line-height: 167%;
1712
+ column-count: 5;
1713
+ font-size: 15px;
1714
+ column-gap: 40px;
1715
+ column-rule: 1px solid #eee;
1716
+ font-family: monospace;
1717
+ }
assets/js/admin.js CHANGED
@@ -757,20 +757,35 @@
757
  ];
758
  for (var i = 0; i < options.length; i++) {
759
  var selector = "input[id='dgwt_wcas_settings\\[" + options[i] + "\\]']";
 
760
  var $el = $(selector),
 
761
  methodToCall = 'onChange' + _this.camelCase(options[i]);
762
 
763
- if (typeof _this[methodToCall] == 'function') {
764
  _this[methodToCall]($el, $el.val());
765
- }
766
 
767
- $(document).on('change', selector, function () {
768
- methodToCall = $(this).attr('id').replace(']', '').replace('dgwt_wcas_settings[', '');
769
- methodToCall = 'onChange' + _this.camelCase(methodToCall);
770
- if (typeof (_this[methodToCall]) === 'function') {
771
- _this[methodToCall]($(this), this.value);
772
- }
773
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  }
775
  },
776
  onColorHandler: function () {
@@ -1071,13 +1086,13 @@
1071
 
1072
  $('.dgwt-wcas-suggestion-headline').show();
1073
 
1074
- if (!_this.isChecked($("input[id*='show_matching_categories']"))) {
1075
  $('.dgwt-wcas-suggestion-headline-cat').hide();
1076
  }
1077
- if (!_this.isChecked($("input[id*='show_matching_tags']"))) {
1078
  $('.dgwt-wcas-suggestion-headline-tag').hide();
1079
  }
1080
- if (!_this.isChecked($("input[id*='show_matching_brands']"))) {
1081
  $('.dgwt-wcas-suggestion-headline-brand').hide();
1082
  }
1083
  if (!_this.isChecked($("input[id*='show_matching_posts']"))) {
757
  ];
758
  for (var i = 0; i < options.length; i++) {
759
  var selector = "input[id='dgwt_wcas_settings\\[" + options[i] + "\\]']";
760
+ var altSelector = "input[id^='dgwt_wcas_settings'][data-option-trigger='"+options[i]+"']";
761
  var $el = $(selector),
762
+ $altEl = $(altSelector)
763
  methodToCall = 'onChange' + _this.camelCase(options[i]);
764
 
765
+ if (typeof _this[methodToCall] == 'function' && $el.length > 0) {
766
  _this[methodToCall]($el, $el.val());
 
767
 
768
+ $(document).on('change', selector, function () {
769
+ methodToCall = $(this).attr('id').replace(']', '').replace('dgwt_wcas_settings[', '');
770
+ methodToCall = 'onChange' + _this.camelCase(methodToCall);
771
+ if (typeof (_this[methodToCall]) === 'function') {
772
+ _this[methodToCall]($(this), this.value);
773
+ }
774
+ });
775
+ } else if (typeof _this[methodToCall] == 'function' && $altEl.length > 0) {
776
+ _this[methodToCall]($altEl, $altEl.val());
777
+
778
+ $(document).on('change', altSelector, function () {
779
+ methodToCall = $(this).data('option-trigger');
780
+ methodToCall = 'onChange' + _this.camelCase(methodToCall);
781
+ if (typeof (_this[methodToCall]) === 'function') {
782
+ _this[methodToCall]($(this), this.value);
783
+ }
784
+ });
785
+ } else {
786
+ // Fallback for methods related to non-existing elements (eg. brands)
787
+ _this[methodToCall]('', '');
788
+ }
789
  }
790
  },
791
  onColorHandler: function () {
1086
 
1087
  $('.dgwt-wcas-suggestion-headline').show();
1088
 
1089
+ if (!_this.isChecked($("input[data-option-trigger='show_matching_categories']"))) {
1090
  $('.dgwt-wcas-suggestion-headline-cat').hide();
1091
  }
1092
+ if (!_this.isChecked($("input[data-option-trigger='show_matching_tags']"))) {
1093
  $('.dgwt-wcas-suggestion-headline-tag').hide();
1094
  }
1095
+ if (!_this.isChecked($("input[data-option-trigger='show_matching_brands']"))) {
1096
  $('.dgwt-wcas-suggestion-headline-brand').hide();
1097
  }
1098
  if (!_this.isChecked($("input[id*='show_matching_posts']"))) {
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- !function(s){var t={inputSel:"dgwt-wcas-options-toggle input[type=radio]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=s('[name="'+t+'"]').closest("."+this.groupSel),a=s('[name="'+t+'"]:checked').val(),i="";this.hideAll(e),(a=a.replace("_","-")).length>0&&(i="wcas-opt-"+a),s("."+i).length>0&&s("."+i).fadeIn()},hideAll:function(s){s.find('tr[class*="wcas-opt-"]').hide()},registerListeners:function(){var t=this;s("."+t.inputSel).on("change",function(){t.reloadChoices(s(this).attr("name"))})},init:function(){var t=this,e=s("."+t.inputSel+":checked");e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this).attr("name"))}))}},e={inputSel:"dgwt-wcas-options-cb-toggle input[type=checkbox]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=t.is(":checked"),a=this.getGroupSelector(t);s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide(),e&&s("."+a).each(function(){s(this).hasClass("js-dgwt-wcas-adv-settings")&&s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")||s(this).fadeIn()})},getGroupSelector(t){var e=t.closest(".dgwt-wcas-options-cb-toggle"),a="",i=e.attr("class").split(/\s+/);return s.each(i,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(a=t)}),a},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.reloadChoices(s(this))})},refresh:function(){var t=this,e=s("."+t.inputSel);e.length>0&&e.each(function(){var e=s(this).is(":checked"),a=t.getGroupSelector(s(this));e?s("."+a).fadeIn():s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide()})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this))}))}},a={inputSel:"js-dgwt-wcas-options-toggle-sibling input[type=checkbox]",toogleSibling:function(s){s.is(":checked")?s.closest("label").next().fadeIn():s.closest("label").next().hide()},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.toogleSibling(s(this))})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.toogleSibling(s(this))}))}},i={layoutSelect:"select[id*='search_layout']",overlayMobile:"input[id*='enable_mobile_overlay']",mobileBreakpoint:"input[id*='mobile_breakpoint']",searchIconColor:"input[id*='search_icon_color']",$select:null,$overlayMobileEl:null,$mobileBreakpointEl:null,$searchIconColorEl:null,setConditions:function(){var t=this.$select.find("option:selected").val(),e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled");switch(this.hideOption(this.$overlayMobileEl),this.hideOption(this.$mobileBreakpointEl),this.hideOption(this.$searchIconColorEl),s("input[id*='bg_search_icon_color']").closest("tr").show(),t){case"icon":e&&this.showOption(this.$searchIconColorEl);break;case"icon-flexible":e&&(this.showOption(this.$mobileBreakpointEl),this.showOption(this.$searchIconColorEl));break;default:e&&(this.showOption(this.$overlayMobileEl),s("input[id*='bg_search_icon_color']").closest("tr").hide(),this.$overlayMobileEl.is(":checked")&&this.showOption(this.$mobileBreakpointEl))}},hideOption:function(s){s.closest("tr").hide()},showOption:function(s){s.closest("tr").show()},registerListeners:function(){var s=this;s.$select.on("change",function(){s.setConditions()}),s.$overlayMobileEl.on("change",function(){s.setConditions()})},init:function(){var t=this,e=s(t.layoutSelect);e.length>0&&(t.$select=e,t.$overlayMobileEl=s(t.overlayMobile),t.$mobileBreakpointEl=s(t.mobileBreakpoint),t.$searchIconColorEl=s(t.searchIconColor),t.registerListeners(),setTimeout(function(){t.setConditions()},400))}},o={actionTriggerClass:"js-ajax-build-index",actionStopTriggerClass:"js-ajax-stop-build-index",indexingWrappoerClass:"js-dgwt-wcas-indexing-wrapper",getWrapper:function(){return s("."+this.indexingWrappoerClass).closest(".dgwt-wcas-settings-info")},registerListeners:function(){var t=this;s(document).on("click","."+t.actionTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s(".dgwt-wcas-settings-info").addClass("wcas-ajax-build-index-wait");var i=!!a.hasClass("js-ajax-build-index-emergency");i&&(s(".dgwt-wcas-indexing-header__title").text("[Emergency mode] Wait... Indexing in progress"),s(".dgwt-wcas-indexing-header__troubleshooting, .dgwt-wcas-indexing-header__actions, .js-dgwt-wcas-indexer-details").hide()),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index",emergency:i,_wpnonce:dgwt_wcas.nonces.build_index},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled"),s(".dgwt-wcas-settings-info").removeClass("wcas-ajax-build-index-wait"),i&&window.location.reload()}})}),s(document).on("click","."+t.actionStopTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_stop_build_index",_wpnonce:dgwt_wcas.nonces.stop_build_index},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled")}})})},heartbeat:function(){var t=this;setTimeout(function(){s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index_heartbeat",_wpnonce:dgwt_wcas.nonces.build_index_heartbeat},success:function(e){void 0!==e&&e.success&&(t.getWrapper().html(e.data.html),e.data.loop?t.heartbeat():e.data.refresh_once.length>0&&(document.cookie.split(";").some(function(s){return 0===s.trim().indexOf("dgwt_wcas_refresh_once="+e.data.refresh_once)})||"none"!==s("#dgwt_wcas_troubleshooting-tab").css("display")||(document.cookie="dgwt_wcas_refresh_once="+e.data.refresh_once,location.reload())))}})},1e3)},detailsToggle:function(){var t;s(document).on("click",".js-dgwt-wcas-indexing-details-trigger",function(e){e.preventDefault();var a=s(".js-dgwt-wcas-indexer-details");a.hasClass("show")?(a.removeClass("show"),a.addClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("show").removeClass("hide"),s(".js-dgwt-wcas-indexing__hided").addClass("hide").removeClass("show"),t=!1):(a.addClass("show"),a.removeClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("hide").removeClass("show"),s(".js-dgwt-wcas-indexing__hided").addClass("show").removeClass("hide"),t=!0),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_index_details_toggle",display:t}})})},init:function(){this.registerListeners(),s("."+this.indexingWrappoerClass).length>0&&this.heartbeat(),this.detailsToggle()}},n={init:function(){var t=this;s(".dgwt-wcas-selectize").length>0&&s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:s(".dgwt-wcas-selectize").data("security")},success:function(s){void 0!==s&&void 0!==s.data&&t.initSelectize(s.data)}})},initSelectize:function(t){var e=s(".dgwt-wcas-selectize");e.length>0&&e.each(function(){var e=s(this),a=e.data("options"),i=t;if(a.length>0){a=JSON.parse('["'+decodeURI(a.replace(/&/g,'","').replace(/=/g,'","'))+'"]');var o="";a.forEach(function(s,t){if((t+1)%2==0){var e={value:s,label:o};i.push(e),o=""}o=s})}s(this).selectize({persist:!1,maxItems:null,valueField:"key",labelField:"label",searchField:["value","label"],options:i,create:function(s){return{value:s.key,label:s.label}},load:function(t,a){if(!t.length)return a();s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:e.data("security")},error:function(){a()},success:function(s){a(s.data)}})}})})}},c={init:function(){var t=s(".js-dgwt-wcas-tooltip");t.length>0&&t.each(function(){var t=s(this)[0],e=s(this).data("tooltip-html-el"),a=s(this).data("tooltip-placement");if(e){new DgwtWcasTooltip(t,{title:s("."+e+" > .dgwt-wcas-tooltip-wrapper")[0],placement:a,trigger:"hover",html:!0})}})}},r={advClass:"js-dgwt-wcas-adv-settings",highlightClass:"dgwt-wcas-opt-highlight",transClass:"dgwt-wcas-opt-transition",init:function(){this.clickListener(),this.setStartingState()},clickListener:function(){var t=this;s(document).on("click",".js-dgwt-wcas-settings__advanced",function(){var e;e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")?"show":"hide",t.saveChoice(e)})},setStartingState:function(){var t=s("."+this.advClass);t.length>0&&(s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled")?(t.show(),e.refresh()):t.hide())},saveChoice:function(t){s(".js-dgwt-wcas-settings__advanced").append('<span class="dgwt-wcas-adv-settings-saving">saving...</span>'),s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_adv_settings",adv_settings_value:t}}).done(function(t){s(".dgwt-wcas-adv-settings-saving").remove()});var e=s(".js-dgwt-wcas-adv-settings-toggle");"show"===t&&(e.removeClass("woocommerce-input-toggle--disabled"),e.addClass("woocommerce-input-toggle--enabled")),"hide"===t&&(e.removeClass("woocommerce-input-toggle--enabled"),e.addClass("woocommerce-input-toggle--disabled")),this.toggleAdvancedOpt(t)},toggleAdvancedOpt:function(t){var a=this,o=s("."+a.advClass);o.length>0&&(o.addClass(a.highlightClass),o.addClass(a.transClass),"show"===t&&o.fadeIn(500,function(){setTimeout(function(){o.removeClass(a.highlightClass),setTimeout(function(){o.removeClass(a.transClass),e.refresh(),i.setConditions()},500)},500)}),"hide"===t&&setTimeout(function(){o.removeClass(a.transClass),o.fadeOut(500,function(){o.removeClass(a.highlightClass)})},500))}};window.DGWT_WCAS_SEARCH_PREVIEW={previewWrapper:{},searchWrapp:{},suggestionWrapp:{},searchInput:{},init:function(){this.previewWrapper=s(".js-dgwt-wcas-preview"),this.searchWrapp=s(".js-dgwt-wcas-search-wrapp"),this.suggestionWrapp=s(".js-dgwt-wcas-suggestions-wrapp"),this.detailsWrapp=s(".js-dgwt-wcas-details-wrapp"),this.searchInput=s(".js-dgwt-wcas-search-input"),this.onChangeHandler(),this.onColorHandler(),this.onTypeHandler(),this.disableSubmit(),this.noResultsHandler(),this.fixSizesInit()},isChecked:function(s){return!!(s.length>0&&s.is(":checked"))},isColor:function(s){return"string"==typeof s&&7===s.length&&"#"===s.charAt(0)},camelCase:function(s){for(var t=s.split("_"),e="",a=0;a<t.length;a++)e+=t[a].charAt(0).toUpperCase()+t[a].slice(1);return e},disableSubmit:function(){var t,e;s(".js-dgwt-wcas-preview-source").on("click",function(a){a.preventDefault();var i=a.pageX-100,o=a.pageY+10;void 0!==t&&(clearTimeout(t),e&&e.remove()),s("body").append('<div class="dgwt-wcas-click-alert">No interaction! This is only a preview.</div>'),(e=s(".dgwt-wcas-click-alert")).css({left:i,top:o}),s(".dgwt-wcas-preview-source").addClass("dgwt-wcas-preview-source-no-click"),t=setTimeout(function(){e.fadeOut(500,function(){s(this).remove(),s(".dgwt-wcas-preview-source").removeClass("dgwt-wcas-preview-source-no-click")})},2e3)})},noResultsHandler:function(){var t=this,e=".js-dgwt-wcas-preview .dgwt-wcas-suggestion:not(.js-dgwt-wcas-suggestion-nores)",a="input[id*='search_no_results_text']";s(document).on("focus",a,function(){s(e).addClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").removeClass("dgwt-wcas-hide"),t.detailsWrapp.addClass("dgwt-wcas-hide"),t.suggestionWrapp.addClass("dgwt-wcas-preview-nores")}),s(document).on("blur",a,function(){s(e).removeClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").addClass("dgwt-wcas-hide"),t.detailsWrapp.removeClass("dgwt-wcas-hide"),t.suggestionWrapp.removeClass("dgwt-wcas-preview-nores")})},onChangeHandler:function(){for(var t=this,e=["show_submit_button","max_form_width","show_product_image","show_product_sku","show_product_desc","show_product_price","show_matching_categories","show_categories_images","show_matching_tags","show_matching_brands","show_brands_images","show_matching_posts","show_matching_pages","show_grouped_results","suggestions_limit","show_details_box"],a=0;a<e.length;a++){var i="input[id='dgwt_wcas_settings\\["+e[a]+"\\]']",o=s(i),n="onChange"+t.camelCase(e[a]);"function"==typeof t[n]&&t[n](o,o.val()),s(document).on("change",i,function(){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onChange"+t.camelCase(n),"function"==typeof t[n]&&t[n](s(this),this.value)})}},onColorHandler:function(){for(var t=this,e=["search_icon_color","bg_input_color","text_input_color","border_input_color","bg_submit_color","text_submit_color","sug_bg_color","sug_hover_color","sug_text_color","sug_highlight_color","sug_border_color"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onColor"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("change",i,function(e){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onColor"+t.camelCase(n),t[n](s(this),this.value)})}},onColorChangeHandler:function(s,t){var e=s.attr("id").replace("]","").replace("dgwt_wcas_settings[","");this[e="onColor"+this.camelCase(e)](s,t)},onTypeHandler:function(){for(var t=this,e=["search_submit_text","search_placeholder","search_no_results_text","search_see_all_results_text"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onType"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("input",i,function(e){n=s(e.target).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onType"+t.camelCase(n),t[n](s(e.target),this.value)})}},onChangeMaxFormWidth:function(t,e){e.length>0&&"0"!=e?(this.searchWrapp.css("max-width",e+"px"),this.suggestionWrapp.css("max-width",e+"px")):(this.searchWrapp.css("max-width","100%"),this.suggestionWrapp.css("max-width","100%")),this.onChangeShowDetailsBox(s("input[id*='show_details_box']"))},onChangeShowSubmitButton:function(t,e){var a=s(".js-dgwt-wcas-search-submit");if(this.isChecked(t)){this.searchWrapp.addClass("dgwt-wcas-has-submit"),this.searchWrapp.removeClass("dgwt-wcas-no-submit"),a.show(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").hide();var i=s("input[id*='bg_submit_color']"),o=s("input[id*='text_submit_color']");this.onColorBgSubmitColor(i,i.val()),this.onColorTextSubmitColor(o,o.val())}else this.searchWrapp.addClass("dgwt-wcas-no-submit"),this.searchWrapp.removeClass("dgwt-wcas-has-submit"),a.hide(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").show()},onChangeShowProductImage:function(t,e){var a=s(".js-dgwt-wcas-si"),i=s(".js-dgwt-wcas-content-wrapp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-img"),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-st").remove(),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-sp").remove(),i.show(),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-img"),i.each(function(){s(this).closest(".dgwt-wcas-suggestion-product").append(s(this).html())}),i.hide(),a.hide())},onChangeShowProductSku:function(t,e){var a=s(".js-dgwt-wcas-sku");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-sku"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-sku"),a.hide())},onChangeShowProductDesc:function(t,e){var a=s(".js-dgwt-wcas-sd");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-desc"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-desc"),a.hide())},onChangeShowProductPrice:function(t,e){var a=s(".js-dgwt-wcas-sp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-price"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-price"),a.hide())},onChangeShowMatchingCategories:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-cat"),i=s(".dgwt-wcas-suggestion-cat");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowCategoriesImages:function(t,e){var a=s(".js-dgwt-wcas-suggestion-cat");this.isChecked(t)?a.addClass("dgwt-wcas-has-img"):a.removeClass("dgwt-wcas-has-img")},onChangeShowMatchingTags:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-tag"),i=s(".dgwt-wcas-suggestion-tag");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingBrands:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-brand"),i=s(".dgwt-wcas-suggestion-brand");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowBrandsImages:function(t,e){var a=s(".js-dgwt-wcas-suggestion-brand");this.isChecked(t)?a.addClass("dgwt-wcas-has-img"):a.removeClass("dgwt-wcas-has-img")},onChangeShowMatchingPosts:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-post"),i=s(".dgwt-wcas-suggestion-post");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPages:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-page"),i=s(".dgwt-wcas-suggestion-page");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowGroupedResults:function(t,e){var a=s(".dgwt-wcas-st--direct-headline"),i=s(".dgwt-wcas-suggestion-headline");this.isChecked(t)?(a.addClass("dgwt-wcas-hidden"),this.suggestionWrapp.addClass("dgwt-wcas-has-headings"),s(".dgwt-wcas-suggestion-headline").show(),this.isChecked(s("input[id*='show_matching_categories']"))||s(".dgwt-wcas-suggestion-headline-cat").hide(),this.isChecked(s("input[id*='show_matching_tags']"))||s(".dgwt-wcas-suggestion-headline-tag").hide(),this.isChecked(s("input[id*='show_matching_brands']"))||s(".dgwt-wcas-suggestion-headline-brand").hide(),this.isChecked(s("input[id*='show_matching_posts']"))||s(".dgwt-wcas-suggestion-headline-post").hide(),this.isChecked(s("input[id*='show_matching_pages']"))||s(".dgwt-wcas-suggestion-headline-page").hide()):(a.removeClass("dgwt-wcas-hidden"),i.hide(),this.suggestionWrapp.removeClass("dgwt-wcas-has-headings"))},onChangeSuggestionsLimit:function(t,e){setTimeout(function(){var a=0,i=7,o=s(".dgwt-wcas-suggestion-duplicated"),n=["brand","cat","tag","post","page","product"];e.length>0&&"0"!=e&&(i=Math.abs(e)),o.length>0&&o.remove();var c=[];for(a=0;a<n.length;a++){var r=s(".dgwt-wcas-suggestion-"+n[a]+":not(.js-dgwt-wcas-suggestion-hidden)");r.length>0&&c.push(r)}var d=c.length;if(c.length>0)for(var l=i-c.length,g=c.length-1;l>0;){var h=c[g].clone();h.addClass("dgwt-wcas-suggestion-duplicated"),h.removeClass("dgwt-wcas-suggestion-selected"),c[g].after(h),d++,--g<0&&(g=c.length-1),l--}d>i&&t.val(d)},10)},onChangeShowDetailsBox:function(t,e){var a=this;a.isChecked(t)?(a.detailsWrapp.show(),a.searchWrapp.addClass("dgwt-wcas-is-detail-box"),a.previewWrapper.addClass("dgwt-wcas-is-details"),a.previewWrapper.addClass("dgwt-wcas-details-right"),setTimeout(function(){if(s(".dgwt-wcas-suggestion-product:not(.dgwt-wcas-suggestion-duplicated)").addClass("dgwt-wcas-suggestion-selected"),a.searchWrapp.width()>=550){a.previewWrapper.addClass("dgwt-wcas-full-width");var t=getComputedStyle(a.searchWrapp[0]).width;(t=Math.round(parseFloat(t.replace("px",""))))%2==0?(a.suggestionWrapp.css("width",Math.round(t/2)),a.detailsWrapp.css("width",Math.round(t/2))):(a.suggestionWrapp.css("width",Math.floor(t/2)),a.detailsWrapp.css("width",Math.ceil(t/2)))}else a.suggestionWrapp.width(a.searchWrapp.width())},10)):(a.detailsWrapp.hide(),a.searchWrapp.removeClass("dgwt-wcas-is-detail-box"),a.previewWrapper.removeClass("dgwt-wcas-is-details"),a.previewWrapper.removeClass("dgwt-wcas-details-right"),a.previewWrapper.removeClass("dgwt-wcas-full-width"),s(".dgwt-wcas-suggestion-product").removeClass("dgwt-wcas-suggestion-selected"),a.suggestionWrapp.css("width",""),a.detailsWrapp.css("width",""))},onColorSearchIconColor:function(s,t){},onColorBgInputColor:function(s,t){this.isColor(t)?this.searchInput.css("background-color",t):this.searchInput.css("background-color","")},onColorTextInputColor:function(t,e){var a="dgwt-wcas-preview-placeholder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-search-input::placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-webkit-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-ms-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-ico-magnifier path {fill:"+e+"}",i+="</style>",s("head").append(i),this.searchInput.css("color",e)}else{this.searchInput.css("color","");var o=s("."+a);o.length>0&&o.remove()}},onColorBorderInputColor:function(s,t){this.isColor(t)?this.searchInput.css("border-color",t):this.searchInput.css("border-color","")},onColorBgSubmitColor:function(t,e){if(this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)){var a='<style class="dgwt-wcas-preview-submit-style">';a+=".dgwt-wcas-search-submit::before{border-color: transparent "+e+"!important;}",a+=".dgwt-wcas-search-submit:hover::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit:focus::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit{background-color: "+e+"!important;}",a+=".dgwt-wcas-om-bar .dgwt-wcas-om-return{background-color: "+e+"!important;}",a+="</style>",s("head").append(a)}else{var i=s(".dgwt-wcas-preview-submit-style");i.length>0&&i.remove()}},onColorTextSubmitColor:function(t,e){this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)?(s(".js-dgwt-wcas-search-submit").css("color",e),s(".dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier path").css("fill",e)):(this.searchInput.css("background-color",""),s(".js-dgwt-wcas-search-submit").css("color",""),s(".dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier path").css("fill",""))},onColorSugBgColor:function(t,e){var a="dgwt-wcas-preview-sugbgcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp",i+="{background-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHoverColor:function(t,e){this.isColor(e)?setTimeout(function(){s(".dgwt-wcas-suggestion-selected").css("background-color",e)},50):s(".dgwt-wcas-suggestion-selected").css("background-color","")},onColorSugTextColor:function(t,e){var a="dgwt-wcas-preview-sugtextcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp *,",i+=".dgwt-wcas-details-wrapp *,",i+=".dgwt-wcas-sd,",i+=".dgwt-wcas-suggestion *",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHighlightColor:function(t,e){var a="dgwt-wcas-preview-sughighlight-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-st strong,",i+=".dgwt-wcas-sd strong",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugBorderColor:function(t,e){var a="dgwt-wcas-preview-sugborder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp,",i+=".dgwt-wcas-suggestion,",i+=".dgwt-wcas-datails-title,",i+=".dgwt-wcas-details-more-products",i+="{border-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onTypeSearchSubmitText:function(t,e){var a=s(".js-dgwt-wcas-search-submit-l"),i=s(".js-dgwt-wcas-search-submit-m");e.length>0?(a.text(e),a.show(),i.hide()):(a.text(""),a.hide(),i.show())},onTypeSearchPlaceholder:function(s,t){0==t.length&&(t=dgwt_wcas.labels.search_placeholder),this.searchInput.attr("placeholder",t)},onTypeSearchNoResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.no_results),s(".js-dgwt-wcas-suggestion-nores span").text(e)},onTypeSearchSeeAllResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.show_more),s(".js-dgwt-wcas-st-more-label").text(e)},fixSizesInit:function(){var t=this;s(document).on("click","#dgwt_wcas_autocomplete-tab",function(){t.onChangeShowDetailsBox(s("input[id*='show_details_box']"))})}};var d={settingsTab:"#dgwt_wcas_troubleshooting-tab",noIssuesClass:".js-dgwt-wcas-troubleshooting-no-issues",counterClass:".js-dgwt-wcas-troubleshooting-count",issuesListClass:".js-dgwt-wcas-troubleshooting-issues",progressBar:".dgwt-wcas-troubleshooting-wrapper .progress_bar",progressBarInner:".dgwt-wcas-troubleshooting-wrapper .progress-bar-inner",resetButtonName:"dgwt-wcas-reset-async-tests",fixOutofstockButtonName:"dgwt-wcas-fix-out-of-stock-relationships",dismissElementorTemplateButtonName:"dgwt-wcas-dismiss-elementor-template",init:function(){var t=this;if(void 0===dgwt_wcas.troubleshooting)return;const e=dgwt_wcas.troubleshooting.tests.issues.critical+dgwt_wcas.troubleshooting.tests.issues.recommended;e>0&&(s(t.counterClass).text(e),s(t.settingsTab).addClass("enabled")),dgwt_wcas.troubleshooting.tests.results_async.length>0&&s.each(dgwt_wcas.troubleshooting.tests.results_async,function(){t.appendIssue(this,!1)}),dgwt_wcas.troubleshooting.tests.direct.length>0&&s.each(dgwt_wcas.troubleshooting.tests.direct,function(){t.appendIssue(this,!1)}),dgwt_wcas.troubleshooting.tests.async.length>0&&t.maybeRunNextAsyncTest(),s(document).on("click",'input[name="'+t.resetButtonName+'"]',function(e){s('input[name="'+t.resetButtonName+'"]').attr("disabled","disabled");var a={action:"dgwt_wcas_troubleshooting_reset_async_tests",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_reset_async_tests};return s.post(ajaxurl,a,function(){location.reload()}),!1}),s(document).on("click",'input[name="'+t.fixOutofstockButtonName+'"]',function(e){s('input[name="'+t.fixOutofstockButtonName+'"]').attr("disabled","disabled").next().addClass("loading");var a={action:"dgwt_wcas_troubleshooting_fix_outofstock",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_fix_outofstock};return s.post(ajaxurl,a,function(){location.reload()}),!1}),s(document).on("click",'input[name="'+t.dismissElementorTemplateButtonName+'"]',function(e){s('input[name="'+t.dismissElementorTemplateButtonName+'"]').attr("disabled","disabled");var a={action:"dgwt_wcas_troubleshooting_dismiss_elementor_template",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_dismiss_elementor_template};return s.post(ajaxurl,a,function(){location.reload()}),!1})},appendIssue:function(t,e){var a,i=wp.template("dgwt-wcas-troubleshooting-issue"),o=s(this.issuesListClass+"-"+t.status);"good"!==t.status&&(s(this.noIssuesClass).hide(),e&&dgwt_wcas.troubleshooting.tests.issues[t.status]++,(a=dgwt_wcas.troubleshooting.tests.issues.critical+dgwt_wcas.troubleshooting.tests.issues.recommended)>0&&(s(this.counterClass).text(a),s(this.settingsTab).addClass("enabled")),s(o).append(i(t)))},maybeRunNextAsyncTest:function(){var t=this;dgwt_wcas.troubleshooting.tests.async.length>0&&s.each(dgwt_wcas.troubleshooting.tests.async,function(){var e={action:"dgwt_wcas_troubleshooting_test",test:this.test,_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_async_test};return!!this.completed||(this.completed=!0,s(t.progressBar).show(),s.post(ajaxurl,e,function(s){s.success&&t.appendIssue(s.data,!0),t.maybeRunNextAsyncTest()}),!1)}),t.recalculateProgression()},recalculateProgression:function(){var t=this,e=dgwt_wcas.troubleshooting.tests.async.length,a=0;s.each(dgwt_wcas.troubleshooting.tests.async,function(){this.completed&&a++});var i=Math.ceil(a/e*100);s(t.progressBarInner).css("width",i+"%"),100===i&&setTimeout(function(){s(t.progressBar).slideUp()},2e3)}},l={moveOptionClass:".js-dgwt-wcas-move-option",init:function(){var t=s(this.moveOptionClass);t.length>0&&s.each(t,function(t,e){var a=s("#"+s(e).data("move-dest").replace(/(:|\.|\[|\])/g,"\\$1"));a.length>0&&(s(e).closest("tr").hasClass("dgwt-wcas-premium-only")&&s(e).addClass("dgwt-wcas-premium-only"),s(e).clone().appendTo(a.closest("td fieldset"))),s(e).closest("tr").remove()})}},g=function(){if("undefined"!=typeof Vue){Vue.component("dgwt-wcas-rule",{template:"#dgwt-wcas-settings-filters-rules-rule",components:{Selectize:Selectize},props:["nonce","rule","rules","index"],data:()=>({isSelectActive:!0}),computed:{ruleValue(s){return this.rule.group}},watch:{rule:{handler:function(){this.$emit("update:rule",this.index)},deep:!0},ruleValue(){var s=this;this.$emit("change:group",this.index),this.isSelectActive=!1,setTimeout(function(){s.isSelectActive=!0},0)}},methods:{deleteRule(){this.$emit("delete:rule",this.index)},getSelectizeSettings(t){var e=void 0===dgwt_wcas_filters_rules_selected_options[t]?[]:dgwt_wcas_filters_rules_selected_options[t];return function({nonce:t,options:e,type:a}){return{persist:!1,maxItems:null,valueField:"key",labelField:"label",searchField:["label"],options:e,preload:!0,create:function(s){return{value:s.key,label:s.label}},load:function(e,i){s.ajax({url:ajaxurl,method:"POST",data:{action:"dgwt_wcas_settings_search_terms",query:e,type:a,_wpnonce:t},error:function(){i()},success:function(s){i(s.data)}})}}}({nonce:this.nonce,type:t,options:e})}}});new Vue({el:"#dgwt-wcas-settings-filters-rules",components:{Selectize:Selectize},data:()=>({rules:[]}),mounted(){try{const t=JSON.parse(this.$refs["dgwt-wcas-settings-filters-rules-ref"].value);s.each(t,function(s,e){t[s].key=Math.random()}),this.rules=t}catch(s){}this.updateInput()},methods:{addRule(){this.rules.push({group:"",values:[],key:Math.random()}),this.updateInput()},changeGroup(s){this.rules[s].values=[],this.updateInput()},deleteRule(s){this.rules=this.rules.filter(function(t,e){return e!==s}),this.updateInput()},updateInput(){const s=JSON.parse(JSON.stringify(this.rules));this.$refs["dgwt-wcas-settings-filters-rules-ref"].value=JSON.stringify(s.map(function(s){return s.key,delete s.key,s}))}}})}};s(document).ready(function(){var h,u;(h=s(".js-dgwt-wcas-settings-margin-nob")).length>0&&h.each(function(){var t=s(this).find("td .dgwt-wcas-fieldset");if(t.length>0){var e=s(this).prev(".js-dgwt-wcas-settings-margin");if(e.length>0){var a=s(this).attr("class").split(/\s+/),i="";s.each(a,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(i=t)});var o=t.clone(!0,!0);o.addClass("dgwt-wcas-settings-margin-nob"),i&&o.addClass(i),o.appendTo(e.find("td")),s(this).remove()}}}),t.init(),e.init(),i.init(),(u=s(".js-dgwt-wcas-sgs-autocolspan")).length>0&&u.find("td").attr("colspan",2),o.init(),n.init(),c.init(),r.init(),d.init(),l.init(),a.init(),g(),window.DGWT_WCAS_SEARCH_PREVIEW.init()})}(jQuery);
1
+ !function(s){var t={inputSel:"dgwt-wcas-options-toggle input[type=radio]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=s('[name="'+t+'"]').closest("."+this.groupSel),a=s('[name="'+t+'"]:checked').val(),i="";this.hideAll(e),(a=a.replace("_","-")).length>0&&(i="wcas-opt-"+a),s("."+i).length>0&&s("."+i).fadeIn()},hideAll:function(s){s.find('tr[class*="wcas-opt-"]').hide()},registerListeners:function(){var t=this;s("."+t.inputSel).on("change",function(){t.reloadChoices(s(this).attr("name"))})},init:function(){var t=this,e=s("."+t.inputSel+":checked");e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this).attr("name"))}))}},e={inputSel:"dgwt-wcas-options-cb-toggle input[type=checkbox]",groupSel:"dgwt_wcas_settings-group",reloadChoices:function(t){var e=t.is(":checked"),a=this.getGroupSelector(t);s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide(),e&&s("."+a).each(function(){s(this).hasClass("js-dgwt-wcas-adv-settings")&&s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")||s(this).fadeIn()})},getGroupSelector(t){var e=t.closest(".dgwt-wcas-options-cb-toggle"),a="",i=e.attr("class").split(/\s+/);return s.each(i,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(a=t)}),a},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.reloadChoices(s(this))})},refresh:function(){var t=this,e=s("."+t.inputSel);e.length>0&&e.each(function(){var e=s(this).is(":checked"),a=t.getGroupSelector(s(this));e?s("."+a).fadeIn():s("."+a+":not(.dgwt-wcas-options-cb-toggle)").hide()})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.reloadChoices(s(this))}))}},a={inputSel:"js-dgwt-wcas-options-toggle-sibling input[type=checkbox]",toogleSibling:function(s){s.is(":checked")?s.closest("label").next().fadeIn():s.closest("label").next().hide()},registerListeners:function(){var t=this;s(document).on("change","."+t.inputSel,function(){t.toogleSibling(s(this))})},init:function(){var t=this,e=s("."+t.inputSel);e.length>0&&(t.registerListeners(),e.each(function(){t.toogleSibling(s(this))}))}},i={layoutSelect:"select[id*='search_layout']",overlayMobile:"input[id*='enable_mobile_overlay']",mobileBreakpoint:"input[id*='mobile_breakpoint']",searchIconColor:"input[id*='search_icon_color']",$select:null,$overlayMobileEl:null,$mobileBreakpointEl:null,$searchIconColorEl:null,setConditions:function(){var t=this.$select.find("option:selected").val(),e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled");switch(this.hideOption(this.$overlayMobileEl),this.hideOption(this.$mobileBreakpointEl),this.hideOption(this.$searchIconColorEl),s("input[id*='bg_search_icon_color']").closest("tr").show(),t){case"icon":e&&this.showOption(this.$searchIconColorEl);break;case"icon-flexible":e&&(this.showOption(this.$mobileBreakpointEl),this.showOption(this.$searchIconColorEl));break;default:e&&(this.showOption(this.$overlayMobileEl),s("input[id*='bg_search_icon_color']").closest("tr").hide(),this.$overlayMobileEl.is(":checked")&&this.showOption(this.$mobileBreakpointEl))}},hideOption:function(s){s.closest("tr").hide()},showOption:function(s){s.closest("tr").show()},registerListeners:function(){var s=this;s.$select.on("change",function(){s.setConditions()}),s.$overlayMobileEl.on("change",function(){s.setConditions()})},init:function(){var t=this,e=s(t.layoutSelect);e.length>0&&(t.$select=e,t.$overlayMobileEl=s(t.overlayMobile),t.$mobileBreakpointEl=s(t.mobileBreakpoint),t.$searchIconColorEl=s(t.searchIconColor),t.registerListeners(),setTimeout(function(){t.setConditions()},400))}},o={actionTriggerClass:"js-ajax-build-index",actionStopTriggerClass:"js-ajax-stop-build-index",indexingWrappoerClass:"js-dgwt-wcas-indexing-wrapper",getWrapper:function(){return s("."+this.indexingWrappoerClass).closest(".dgwt-wcas-settings-info")},registerListeners:function(){var t=this;s(document).on("click","."+t.actionTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s(".dgwt-wcas-settings-info").addClass("wcas-ajax-build-index-wait");var i=!!a.hasClass("js-ajax-build-index-emergency");i&&(s(".dgwt-wcas-indexing-header__title").text("[Emergency mode] Wait... Indexing in progress"),s(".dgwt-wcas-indexing-header__troubleshooting, .dgwt-wcas-indexing-header__actions, .js-dgwt-wcas-indexer-details").hide()),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index",emergency:i,_wpnonce:dgwt_wcas.nonces.build_index},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled"),s(".dgwt-wcas-settings-info").removeClass("wcas-ajax-build-index-wait"),i&&window.location.reload()}})}),s(document).on("click","."+t.actionStopTriggerClass,function(e){e.preventDefault();var a=s(this);a.attr("disabled","disabled"),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_stop_build_index",_wpnonce:dgwt_wcas.nonces.stop_build_index},success:function(s){void 0!==s&&s.success&&(t.getWrapper().html(s.data.html),t.heartbeat())},complete:function(){a.removeAttr("disabled")}})})},heartbeat:function(){var t=this;setTimeout(function(){s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_build_index_heartbeat",_wpnonce:dgwt_wcas.nonces.build_index_heartbeat},success:function(e){void 0!==e&&e.success&&(t.getWrapper().html(e.data.html),e.data.loop?t.heartbeat():e.data.refresh_once.length>0&&(document.cookie.split(";").some(function(s){return 0===s.trim().indexOf("dgwt_wcas_refresh_once="+e.data.refresh_once)})||"none"!==s("#dgwt_wcas_troubleshooting-tab").css("display")||(document.cookie="dgwt_wcas_refresh_once="+e.data.refresh_once,location.reload())))}})},1e3)},detailsToggle:function(){var t;s(document).on("click",".js-dgwt-wcas-indexing-details-trigger",function(e){e.preventDefault();var a=s(".js-dgwt-wcas-indexer-details");a.hasClass("show")?(a.removeClass("show"),a.addClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("show").removeClass("hide"),s(".js-dgwt-wcas-indexing__hided").addClass("hide").removeClass("show"),t=!1):(a.addClass("show"),a.removeClass("hide"),s(".js-dgwt-wcas-indexing__showd").addClass("hide").removeClass("show"),s(".js-dgwt-wcas-indexing__hided").addClass("show").removeClass("hide"),t=!0),s.ajax({url:ajaxurl,type:"post",data:{action:"dgwt_wcas_index_details_toggle",display:t}})})},init:function(){this.registerListeners(),s("."+this.indexingWrappoerClass).length>0&&this.heartbeat(),this.detailsToggle()}},n={init:function(){var t=this;s(".dgwt-wcas-selectize").length>0&&s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:s(".dgwt-wcas-selectize").data("security")},success:function(s){void 0!==s&&void 0!==s.data&&t.initSelectize(s.data)}})},initSelectize:function(t){var e=s(".dgwt-wcas-selectize");e.length>0&&e.each(function(){var e=s(this),a=e.data("options"),i=t;if(a.length>0){a=JSON.parse('["'+decodeURI(a.replace(/&/g,'","').replace(/=/g,'","'))+'"]');var o="";a.forEach(function(s,t){if((t+1)%2==0){var e={value:s,label:o};i.push(e),o=""}o=s})}s(this).selectize({persist:!1,maxItems:null,valueField:"key",labelField:"label",searchField:["value","label"],options:i,create:function(s){return{value:s.key,label:s.label}},load:function(t,a){if(!t.length)return a();s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_settings_list_custom_fields",_wpnonce:e.data("security")},error:function(){a()},success:function(s){a(s.data)}})}})})}},c={init:function(){var t=s(".js-dgwt-wcas-tooltip");t.length>0&&t.each(function(){var t=s(this)[0],e=s(this).data("tooltip-html-el"),a=s(this).data("tooltip-placement");if(e){new DgwtWcasTooltip(t,{title:s("."+e+" > .dgwt-wcas-tooltip-wrapper")[0],placement:a,trigger:"hover",html:!0})}})}},r={advClass:"js-dgwt-wcas-adv-settings",highlightClass:"dgwt-wcas-opt-highlight",transClass:"dgwt-wcas-opt-transition",init:function(){this.clickListener(),this.setStartingState()},clickListener:function(){var t=this;s(document).on("click",".js-dgwt-wcas-settings__advanced",function(){var e;e=s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--disabled")?"show":"hide",t.saveChoice(e)})},setStartingState:function(){var t=s("."+this.advClass);t.length>0&&(s(".js-dgwt-wcas-adv-settings-toggle").hasClass("woocommerce-input-toggle--enabled")?(t.show(),e.refresh()):t.hide())},saveChoice:function(t){s(".js-dgwt-wcas-settings__advanced").append('<span class="dgwt-wcas-adv-settings-saving">saving...</span>'),s.ajax({url:ajaxurl,data:{action:"dgwt_wcas_adv_settings",adv_settings_value:t}}).done(function(t){s(".dgwt-wcas-adv-settings-saving").remove()});var e=s(".js-dgwt-wcas-adv-settings-toggle");"show"===t&&(e.removeClass("woocommerce-input-toggle--disabled"),e.addClass("woocommerce-input-toggle--enabled")),"hide"===t&&(e.removeClass("woocommerce-input-toggle--enabled"),e.addClass("woocommerce-input-toggle--disabled")),this.toggleAdvancedOpt(t)},toggleAdvancedOpt:function(t){var a=this,o=s("."+a.advClass);o.length>0&&(o.addClass(a.highlightClass),o.addClass(a.transClass),"show"===t&&o.fadeIn(500,function(){setTimeout(function(){o.removeClass(a.highlightClass),setTimeout(function(){o.removeClass(a.transClass),e.refresh(),i.setConditions()},500)},500)}),"hide"===t&&setTimeout(function(){o.removeClass(a.transClass),o.fadeOut(500,function(){o.removeClass(a.highlightClass)})},500))}};window.DGWT_WCAS_SEARCH_PREVIEW={previewWrapper:{},searchWrapp:{},suggestionWrapp:{},searchInput:{},init:function(){this.previewWrapper=s(".js-dgwt-wcas-preview"),this.searchWrapp=s(".js-dgwt-wcas-search-wrapp"),this.suggestionWrapp=s(".js-dgwt-wcas-suggestions-wrapp"),this.detailsWrapp=s(".js-dgwt-wcas-details-wrapp"),this.searchInput=s(".js-dgwt-wcas-search-input"),this.onChangeHandler(),this.onColorHandler(),this.onTypeHandler(),this.disableSubmit(),this.noResultsHandler(),this.fixSizesInit()},isChecked:function(s){return!!(s.length>0&&s.is(":checked"))},isColor:function(s){return"string"==typeof s&&7===s.length&&"#"===s.charAt(0)},camelCase:function(s){for(var t=s.split("_"),e="",a=0;a<t.length;a++)e+=t[a].charAt(0).toUpperCase()+t[a].slice(1);return e},disableSubmit:function(){var t,e;s(".js-dgwt-wcas-preview-source").on("click",function(a){a.preventDefault();var i=a.pageX-100,o=a.pageY+10;void 0!==t&&(clearTimeout(t),e&&e.remove()),s("body").append('<div class="dgwt-wcas-click-alert">No interaction! This is only a preview.</div>'),(e=s(".dgwt-wcas-click-alert")).css({left:i,top:o}),s(".dgwt-wcas-preview-source").addClass("dgwt-wcas-preview-source-no-click"),t=setTimeout(function(){e.fadeOut(500,function(){s(this).remove(),s(".dgwt-wcas-preview-source").removeClass("dgwt-wcas-preview-source-no-click")})},2e3)})},noResultsHandler:function(){var t=this,e=".js-dgwt-wcas-preview .dgwt-wcas-suggestion:not(.js-dgwt-wcas-suggestion-nores)",a="input[id*='search_no_results_text']";s(document).on("focus",a,function(){s(e).addClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").removeClass("dgwt-wcas-hide"),t.detailsWrapp.addClass("dgwt-wcas-hide"),t.suggestionWrapp.addClass("dgwt-wcas-preview-nores")}),s(document).on("blur",a,function(){s(e).removeClass("dgwt-wcas-hide"),s(".js-dgwt-wcas-suggestion-nores").addClass("dgwt-wcas-hide"),t.detailsWrapp.removeClass("dgwt-wcas-hide"),t.suggestionWrapp.removeClass("dgwt-wcas-preview-nores")})},onChangeHandler:function(){for(var t=this,e=["show_submit_button","max_form_width","show_product_image","show_product_sku","show_product_desc","show_product_price","show_matching_categories","show_categories_images","show_matching_tags","show_matching_brands","show_brands_images","show_matching_posts","show_matching_pages","show_grouped_results","suggestions_limit","show_details_box"],a=0;a<e.length;a++){var i="input[id='dgwt_wcas_settings\\["+e[a]+"\\]']",o="input[id^='dgwt_wcas_settings'][data-option-trigger='"+e[a]+"']",n=s(i),c=s(o);methodToCall="onChange"+t.camelCase(e[a]),"function"==typeof t[methodToCall]&&n.length>0?(t[methodToCall](n,n.val()),s(document).on("change",i,function(){methodToCall=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),methodToCall="onChange"+t.camelCase(methodToCall),"function"==typeof t[methodToCall]&&t[methodToCall](s(this),this.value)})):"function"==typeof t[methodToCall]&&c.length>0?(t[methodToCall](c,c.val()),s(document).on("change",o,function(){methodToCall=s(this).data("option-trigger"),methodToCall="onChange"+t.camelCase(methodToCall),"function"==typeof t[methodToCall]&&t[methodToCall](s(this),this.value)})):t[methodToCall]("","")}},onColorHandler:function(){for(var t=this,e=["search_icon_color","bg_input_color","text_input_color","border_input_color","bg_submit_color","text_submit_color","sug_bg_color","sug_hover_color","sug_text_color","sug_highlight_color","sug_border_color"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onColor"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("change",i,function(e){n=s(this).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onColor"+t.camelCase(n),t[n](s(this),this.value)})}},onColorChangeHandler:function(s,t){var e=s.attr("id").replace("]","").replace("dgwt_wcas_settings[","");this[e="onColor"+this.camelCase(e)](s,t)},onTypeHandler:function(){for(var t=this,e=["search_submit_text","search_placeholder","search_no_results_text","search_see_all_results_text"],a=0;a<e.length;a++){var i="input[id*='"+e[a]+"']",o=s(i),n="onType"+t.camelCase(e[a]);t[n](o,o.val()),s(document).on("input",i,function(e){n=s(e.target).attr("id").replace("]","").replace("dgwt_wcas_settings[",""),n="onType"+t.camelCase(n),t[n](s(e.target),this.value)})}},onChangeMaxFormWidth:function(t,e){e.length>0&&"0"!=e?(this.searchWrapp.css("max-width",e+"px"),this.suggestionWrapp.css("max-width",e+"px")):(this.searchWrapp.css("max-width","100%"),this.suggestionWrapp.css("max-width","100%")),this.onChangeShowDetailsBox(s("input[id*='show_details_box']"))},onChangeShowSubmitButton:function(t,e){var a=s(".js-dgwt-wcas-search-submit");if(this.isChecked(t)){this.searchWrapp.addClass("dgwt-wcas-has-submit"),this.searchWrapp.removeClass("dgwt-wcas-no-submit"),a.show(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").hide();var i=s("input[id*='bg_submit_color']"),o=s("input[id*='text_submit_color']");this.onColorBgSubmitColor(i,i.val()),this.onColorTextSubmitColor(o,o.val())}else this.searchWrapp.addClass("dgwt-wcas-no-submit"),this.searchWrapp.removeClass("dgwt-wcas-has-submit"),a.hide(),s(".dgwt-wcas-sf-wrapp > .dgwt-wcas-ico-magnifier").show()},onChangeShowProductImage:function(t,e){var a=s(".js-dgwt-wcas-si"),i=s(".js-dgwt-wcas-content-wrapp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-img"),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-st").remove(),s(".dgwt-wcas-suggestion-product > .dgwt-wcas-sp").remove(),i.show(),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-img"),i.each(function(){s(this).closest(".dgwt-wcas-suggestion-product").append(s(this).html())}),i.hide(),a.hide())},onChangeShowProductSku:function(t,e){var a=s(".js-dgwt-wcas-sku");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-sku"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-sku"),a.hide())},onChangeShowProductDesc:function(t,e){var a=s(".js-dgwt-wcas-sd");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-desc"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-desc"),a.hide())},onChangeShowProductPrice:function(t,e){var a=s(".js-dgwt-wcas-sp");this.isChecked(t)?(this.suggestionWrapp.addClass("dgwt-wcas-has-price"),a.show()):(this.suggestionWrapp.removeClass("dgwt-wcas-has-price"),a.hide())},onChangeShowMatchingCategories:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-cat"),i=s(".dgwt-wcas-suggestion-cat");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowCategoriesImages:function(t,e){var a=s(".js-dgwt-wcas-suggestion-cat");this.isChecked(t)?a.addClass("dgwt-wcas-has-img"):a.removeClass("dgwt-wcas-has-img")},onChangeShowMatchingTags:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-tag"),i=s(".dgwt-wcas-suggestion-tag");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingBrands:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-brand"),i=s(".dgwt-wcas-suggestion-brand");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowBrandsImages:function(t,e){var a=s(".js-dgwt-wcas-suggestion-brand");this.isChecked(t)?a.addClass("dgwt-wcas-has-img"):a.removeClass("dgwt-wcas-has-img")},onChangeShowMatchingPosts:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-post"),i=s(".dgwt-wcas-suggestion-post");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowMatchingPages:function(t,e){var a=s(".dgwt-wcas-suggestion-headline-page"),i=s(".dgwt-wcas-suggestion-page");this.isChecked(t)?(a.show(),i.show(),i.removeClass("js-dgwt-wcas-suggestion-hidden"),this.onChangeShowGroupedResults(s("input[id*='show_grouped_results']"))):(a.hide(),i.hide(),i.addClass("js-dgwt-wcas-suggestion-hidden"));var o=s("input[id*='suggestions_limit']");this.onChangeSuggestionsLimit(o,o.val())},onChangeShowGroupedResults:function(t,e){var a=s(".dgwt-wcas-st--direct-headline"),i=s(".dgwt-wcas-suggestion-headline");this.isChecked(t)?(a.addClass("dgwt-wcas-hidden"),this.suggestionWrapp.addClass("dgwt-wcas-has-headings"),s(".dgwt-wcas-suggestion-headline").show(),this.isChecked(s("input[data-option-trigger='show_matching_categories']"))||s(".dgwt-wcas-suggestion-headline-cat").hide(),this.isChecked(s("input[data-option-trigger='show_matching_tags']"))||s(".dgwt-wcas-suggestion-headline-tag").hide(),this.isChecked(s("input[data-option-trigger='show_matching_brands']"))||s(".dgwt-wcas-suggestion-headline-brand").hide(),this.isChecked(s("input[id*='show_matching_posts']"))||s(".dgwt-wcas-suggestion-headline-post").hide(),this.isChecked(s("input[id*='show_matching_pages']"))||s(".dgwt-wcas-suggestion-headline-page").hide()):(a.removeClass("dgwt-wcas-hidden"),i.hide(),this.suggestionWrapp.removeClass("dgwt-wcas-has-headings"))},onChangeSuggestionsLimit:function(t,e){setTimeout(function(){var a=0,i=7,o=s(".dgwt-wcas-suggestion-duplicated"),n=["brand","cat","tag","post","page","product"];e.length>0&&"0"!=e&&(i=Math.abs(e)),o.length>0&&o.remove();var c=[];for(a=0;a<n.length;a++){var r=s(".dgwt-wcas-suggestion-"+n[a]+":not(.js-dgwt-wcas-suggestion-hidden)");r.length>0&&c.push(r)}var d=c.length;if(c.length>0)for(var l=i-c.length,g=c.length-1;l>0;){var h=c[g].clone();h.addClass("dgwt-wcas-suggestion-duplicated"),h.removeClass("dgwt-wcas-suggestion-selected"),c[g].after(h),d++,--g<0&&(g=c.length-1),l--}d>i&&t.val(d)},10)},onChangeShowDetailsBox:function(t,e){var a=this;a.isChecked(t)?(a.detailsWrapp.show(),a.searchWrapp.addClass("dgwt-wcas-is-detail-box"),a.previewWrapper.addClass("dgwt-wcas-is-details"),a.previewWrapper.addClass("dgwt-wcas-details-right"),setTimeout(function(){if(s(".dgwt-wcas-suggestion-product:not(.dgwt-wcas-suggestion-duplicated)").addClass("dgwt-wcas-suggestion-selected"),a.searchWrapp.width()>=550){a.previewWrapper.addClass("dgwt-wcas-full-width");var t=getComputedStyle(a.searchWrapp[0]).width;(t=Math.round(parseFloat(t.replace("px",""))))%2==0?(a.suggestionWrapp.css("width",Math.round(t/2)),a.detailsWrapp.css("width",Math.round(t/2))):(a.suggestionWrapp.css("width",Math.floor(t/2)),a.detailsWrapp.css("width",Math.ceil(t/2)))}else a.suggestionWrapp.width(a.searchWrapp.width())},10)):(a.detailsWrapp.hide(),a.searchWrapp.removeClass("dgwt-wcas-is-detail-box"),a.previewWrapper.removeClass("dgwt-wcas-is-details"),a.previewWrapper.removeClass("dgwt-wcas-details-right"),a.previewWrapper.removeClass("dgwt-wcas-full-width"),s(".dgwt-wcas-suggestion-product").removeClass("dgwt-wcas-suggestion-selected"),a.suggestionWrapp.css("width",""),a.detailsWrapp.css("width",""))},onColorSearchIconColor:function(s,t){},onColorBgInputColor:function(s,t){this.isColor(t)?this.searchInput.css("background-color",t):this.searchInput.css("background-color","")},onColorTextInputColor:function(t,e){var a="dgwt-wcas-preview-placeholder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-search-input::placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-webkit-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input::-moz-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-search-input:-ms-input-placeholder{opacity: 0.3; color:"+e+"!important;}",i+=".dgwt-wcas-ico-magnifier path {fill:"+e+"}",i+="</style>",s("head").append(i),this.searchInput.css("color",e)}else{this.searchInput.css("color","");var o=s("."+a);o.length>0&&o.remove()}},onColorBorderInputColor:function(s,t){this.isColor(t)?this.searchInput.css("border-color",t):this.searchInput.css("border-color","")},onColorBgSubmitColor:function(t,e){if(this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)){var a='<style class="dgwt-wcas-preview-submit-style">';a+=".dgwt-wcas-search-submit::before{border-color: transparent "+e+"!important;}",a+=".dgwt-wcas-search-submit:hover::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit:focus::before{border-right-color: "+e+"!important;}",a+=".dgwt-wcas-search-submit{background-color: "+e+"!important;}",a+=".dgwt-wcas-om-bar .dgwt-wcas-om-return{background-color: "+e+"!important;}",a+="</style>",s("head").append(a)}else{var i=s(".dgwt-wcas-preview-submit-style");i.length>0&&i.remove()}},onColorTextSubmitColor:function(t,e){this.isChecked(s("input[id*='show_submit_button']"))&&this.isColor(e)?(s(".js-dgwt-wcas-search-submit").css("color",e),s(".dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier path").css("fill",e)):(this.searchInput.css("background-color",""),s(".js-dgwt-wcas-search-submit").css("color",""),s(".dgwt-wcas-search-submit .dgwt-wcas-ico-magnifier path").css("fill",""))},onColorSugBgColor:function(t,e){var a="dgwt-wcas-preview-sugbgcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp",i+="{background-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHoverColor:function(t,e){this.isColor(e)?setTimeout(function(){s(".dgwt-wcas-suggestion-selected").css("background-color",e)},50):s(".dgwt-wcas-suggestion-selected").css("background-color","")},onColorSugTextColor:function(t,e){var a="dgwt-wcas-preview-sugtextcol-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp *,",i+=".dgwt-wcas-details-wrapp *,",i+=".dgwt-wcas-sd,",i+=".dgwt-wcas-suggestion *",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugHighlightColor:function(t,e){var a="dgwt-wcas-preview-sughighlight-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-st strong,",i+=".dgwt-wcas-sd strong",i+="{color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onColorSugBorderColor:function(t,e){var a="dgwt-wcas-preview-sugborder-style";if(this.isColor(e)){var i='<style class="'+a+'">';i+=".dgwt-wcas-suggestions-wrapp,",i+=".dgwt-wcas-details-wrapp,",i+=".dgwt-wcas-suggestion,",i+=".dgwt-wcas-datails-title,",i+=".dgwt-wcas-details-more-products",i+="{border-color: "+e+"!important;}",i+="</style>",s("head").append(i)}else{var o=s("."+a);o.length>0&&o.remove()}},onTypeSearchSubmitText:function(t,e){var a=s(".js-dgwt-wcas-search-submit-l"),i=s(".js-dgwt-wcas-search-submit-m");e.length>0?(a.text(e),a.show(),i.hide()):(a.text(""),a.hide(),i.show())},onTypeSearchPlaceholder:function(s,t){0==t.length&&(t=dgwt_wcas.labels.search_placeholder),this.searchInput.attr("placeholder",t)},onTypeSearchNoResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.no_results),s(".js-dgwt-wcas-suggestion-nores span").text(e)},onTypeSearchSeeAllResultsText:function(t,e){0==e.length&&(e=dgwt_wcas.labels.show_more),s(".js-dgwt-wcas-st-more-label").text(e)},fixSizesInit:function(){var t=this;s(document).on("click","#dgwt_wcas_autocomplete-tab",function(){t.onChangeShowDetailsBox(s("input[id*='show_details_box']"))})}};var d={settingsTab:"#dgwt_wcas_troubleshooting-tab",noIssuesClass:".js-dgwt-wcas-troubleshooting-no-issues",counterClass:".js-dgwt-wcas-troubleshooting-count",issuesListClass:".js-dgwt-wcas-troubleshooting-issues",progressBar:".dgwt-wcas-troubleshooting-wrapper .progress_bar",progressBarInner:".dgwt-wcas-troubleshooting-wrapper .progress-bar-inner",resetButtonName:"dgwt-wcas-reset-async-tests",fixOutofstockButtonName:"dgwt-wcas-fix-out-of-stock-relationships",dismissElementorTemplateButtonName:"dgwt-wcas-dismiss-elementor-template",init:function(){var t=this;if(void 0===dgwt_wcas.troubleshooting)return;const e=dgwt_wcas.troubleshooting.tests.issues.critical+dgwt_wcas.troubleshooting.tests.issues.recommended;e>0&&(s(t.counterClass).text(e),s(t.settingsTab).addClass("enabled")),dgwt_wcas.troubleshooting.tests.results_async.length>0&&s.each(dgwt_wcas.troubleshooting.tests.results_async,function(){t.appendIssue(this,!1)}),dgwt_wcas.troubleshooting.tests.direct.length>0&&s.each(dgwt_wcas.troubleshooting.tests.direct,function(){t.appendIssue(this,!1)}),dgwt_wcas.troubleshooting.tests.async.length>0&&t.maybeRunNextAsyncTest(),s(document).on("click",'input[name="'+t.resetButtonName+'"]',function(e){s('input[name="'+t.resetButtonName+'"]').attr("disabled","disabled");var a={action:"dgwt_wcas_troubleshooting_reset_async_tests",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_reset_async_tests};return s.post(ajaxurl,a,function(){location.reload()}),!1}),s(document).on("click",'input[name="'+t.fixOutofstockButtonName+'"]',function(e){s('input[name="'+t.fixOutofstockButtonName+'"]').attr("disabled","disabled").next().addClass("loading");var a={action:"dgwt_wcas_troubleshooting_fix_outofstock",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_fix_outofstock};return s.post(ajaxurl,a,function(){location.reload()}),!1}),s(document).on("click",'input[name="'+t.dismissElementorTemplateButtonName+'"]',function(e){s('input[name="'+t.dismissElementorTemplateButtonName+'"]').attr("disabled","disabled");var a={action:"dgwt_wcas_troubleshooting_dismiss_elementor_template",_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_dismiss_elementor_template};return s.post(ajaxurl,a,function(){location.reload()}),!1})},appendIssue:function(t,e){var a,i=wp.template("dgwt-wcas-troubleshooting-issue"),o=s(this.issuesListClass+"-"+t.status);"good"!==t.status&&(s(this.noIssuesClass).hide(),e&&dgwt_wcas.troubleshooting.tests.issues[t.status]++,(a=dgwt_wcas.troubleshooting.tests.issues.critical+dgwt_wcas.troubleshooting.tests.issues.recommended)>0&&(s(this.counterClass).text(a),s(this.settingsTab).addClass("enabled")),s(o).append(i(t)))},maybeRunNextAsyncTest:function(){var t=this;dgwt_wcas.troubleshooting.tests.async.length>0&&s.each(dgwt_wcas.troubleshooting.tests.async,function(){var e={action:"dgwt_wcas_troubleshooting_test",test:this.test,_wpnonce:dgwt_wcas.troubleshooting.nonce.troubleshooting_async_test};return!!this.completed||(this.completed=!0,s(t.progressBar).show(),s.post(ajaxurl,e,function(s){s.success&&t.appendIssue(s.data,!0),t.maybeRunNextAsyncTest()}),!1)}),t.recalculateProgression()},recalculateProgression:function(){var t=this,e=dgwt_wcas.troubleshooting.tests.async.length,a=0;s.each(dgwt_wcas.troubleshooting.tests.async,function(){this.completed&&a++});var i=Math.ceil(a/e*100);s(t.progressBarInner).css("width",i+"%"),100===i&&setTimeout(function(){s(t.progressBar).slideUp()},2e3)}},l={moveOptionClass:".js-dgwt-wcas-move-option",init:function(){var t=s(this.moveOptionClass);t.length>0&&s.each(t,function(t,e){var a=s("#"+s(e).data("move-dest").replace(/(:|\.|\[|\])/g,"\\$1"));a.length>0&&(s(e).closest("tr").hasClass("dgwt-wcas-premium-only")&&s(e).addClass("dgwt-wcas-premium-only"),s(e).clone().appendTo(a.closest("td fieldset"))),s(e).closest("tr").remove()})}},g=function(){if("undefined"!=typeof Vue){Vue.component("dgwt-wcas-rule",{template:"#dgwt-wcas-settings-filters-rules-rule",components:{Selectize:Selectize},props:["nonce","rule","rules","index"],data:()=>({isSelectActive:!0}),computed:{ruleValue(s){return this.rule.group}},watch:{rule:{handler:function(){this.$emit("update:rule",this.index)},deep:!0},ruleValue(){var s=this;this.$emit("change:group",this.index),this.isSelectActive=!1,setTimeout(function(){s.isSelectActive=!0},0)}},methods:{deleteRule(){this.$emit("delete:rule",this.index)},getSelectizeSettings(t){var e=void 0===dgwt_wcas_filters_rules_selected_options[t]?[]:dgwt_wcas_filters_rules_selected_options[t];return function({nonce:t,options:e,type:a}){return{persist:!1,maxItems:null,valueField:"key",labelField:"label",searchField:["label"],options:e,preload:!0,create:function(s){return{value:s.key,label:s.label}},load:function(e,i){s.ajax({url:ajaxurl,method:"POST",data:{action:"dgwt_wcas_settings_search_terms",query:e,type:a,_wpnonce:t},error:function(){i()},success:function(s){i(s.data)}})}}}({nonce:this.nonce,type:t,options:e})}}});new Vue({el:"#dgwt-wcas-settings-filters-rules",components:{Selectize:Selectize},data:()=>({rules:[]}),mounted(){try{const t=JSON.parse(this.$refs["dgwt-wcas-settings-filters-rules-ref"].value);s.each(t,function(s,e){t[s].key=Math.random()}),this.rules=t}catch(s){}this.updateInput()},methods:{addRule(){this.rules.push({group:"",values:[],key:Math.random()}),this.updateInput()},changeGroup(s){this.rules[s].values=[],this.updateInput()},deleteRule(s){this.rules=this.rules.filter(function(t,e){return e!==s}),this.updateInput()},updateInput(){const s=JSON.parse(JSON.stringify(this.rules));this.$refs["dgwt-wcas-settings-filters-rules-ref"].value=JSON.stringify(s.map(function(s){return s.key,delete s.key,s}))}}})}};s(document).ready(function(){var h,u;(h=s(".js-dgwt-wcas-settings-margin-nob")).length>0&&h.each(function(){var t=s(this).find("td .dgwt-wcas-fieldset");if(t.length>0){var e=s(this).prev(".js-dgwt-wcas-settings-margin");if(e.length>0){var a=s(this).attr("class").split(/\s+/),i="";s.each(a,function(s,t){-1!==t.indexOf("js-dgwt-wcas-cbtgroup-")&&(i=t)});var o=t.clone(!0,!0);o.addClass("dgwt-wcas-settings-margin-nob"),i&&o.addClass(i),o.appendTo(e.find("td")),s(this).remove()}}}),t.init(),e.init(),i.init(),(u=s(".js-dgwt-wcas-sgs-autocolspan")).length>0&&u.find("td").attr("colspan",2),o.init(),n.init(),c.init(),r.init(),d.init(),l.init(),a.init(),g(),window.DGWT_WCAS_SEARCH_PREVIEW.init()})}(jQuery);
assets/js/search.js CHANGED
@@ -284,7 +284,7 @@
284
  }
285
 
286
  function _transformResult(response) {
287
- return typeof response === 'string' ? $.parseJSON(response) : response;
288
  }
289
 
290
  function _formatResult(suggestionValue, currentValue, highlight, options) {
@@ -309,7 +309,8 @@
309
  .replace(/&lt;sup/g, '<sup')
310
  .replace(/&lt;\/sup/g, '</sup')
311
  .replace(/sup&gt;/g, 'sup>')
312
- .replace(/&lt;(\/?(strong|b|br))&gt;/g, '<$1>');
 
313
 
314
  }
315
 
@@ -461,6 +462,10 @@
461
  });
462
 
463
  }
 
 
 
 
464
  });
465
 
466
  // Position preloader
@@ -705,7 +710,15 @@
705
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
706
 
707
  $el.on('click.autocomplete', function (e) {
708
- that.enableOverlayMobile();
 
 
 
 
 
 
 
 
709
  });
710
 
711
  }
@@ -1124,6 +1137,9 @@
1124
  case keys.RETURN:
1125
 
1126
  if (that.selectedIndex === -1) {
 
 
 
1127
  that.hide();
1128
  return;
1129
  }
@@ -1434,7 +1450,7 @@
1434
  url: dgwt_wcas.ajax_details_endpoint,
1435
  success: function (response) {
1436
 
1437
- var result = typeof response === 'string' ? jQuery.parseJSON(response) : response;
1438
 
1439
  if (typeof result.items != 'undefined') {
1440
  for (var i = 0; i < result.items.length; i++) {
@@ -1445,13 +1461,6 @@
1445
  if (typeof result.items[i]['price'] != 'undefined' && result.items[i]['price'].length > 0) {
1446
  that.cachedPrices[cacheKey] = result.items[i]['price'];
1447
  }
1448
-
1449
- // Preload images
1450
- if (typeof result.items[i]['imageSrc'] != 'undefined' && result.items[i]['imageSrc'].length > 0) {
1451
- var tempImg = new Image();
1452
- tempImg.src = result.items[i]['imageSrc'];
1453
- }
1454
-
1455
  }
1456
  }
1457
 
@@ -1906,7 +1915,7 @@
1906
  if (suggestion.taxonomy === 'product_cat') {
1907
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat';
1908
  if (!options.showHeadings) {
1909
- prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels.category + '</span>';
1910
  }
1911
  if (typeof suggestion.breadcrumbs != 'undefined' && suggestion.breadcrumbs) {
1912
  title = suggestion.breadcrumbs + ' &gt; ' + suggestion.value;
@@ -1917,12 +1926,17 @@
1917
  } else if (suggestion.taxonomy === 'product_tag') {
1918
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag';
1919
  if (!options.showHeadings) {
1920
- prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels.tag + '</span>';
1921
  }
1922
  } else if (options.isPremium && suggestion.taxonomy === options.taxonomyBrands) {
1923
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand';
1924
  if (!options.showHeadings) {
1925
- prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels.brand + '</span>';
 
 
 
 
 
1926
  }
1927
  } else if (options.isPremium && suggestion.type === 'vendor') {
1928
  classes += ' dgwt-wcas-suggestion-vendor dgwt-wcas-suggestion-vendor';
@@ -2020,10 +2034,22 @@
2020
  html += is_img ? '<div class="dgwt-wcas-content-wrapp">' : '';
2021
 
2022
 
 
 
 
 
 
 
 
 
2023
  // Title
2024
- html += '<span class="dgwt-wcas-st">';
2025
  html += '<span class="dgwt-wcas-st-title">' + formatResult(suggestion.value, value, true, options) + parent + '</span>';
2026
 
 
 
 
 
 
2027
  // SKU
2028
  if (options.showSKU === true && typeof suggestion.sku != 'undefined' && suggestion.sku.length > 0) {
2029
  html += '<span class="dgwt-wcas-sku">(' + dgwt_wcas.labels.sku_label + ' ' + formatResult(suggestion.sku, value, true, options) + ')</span>';
@@ -2047,26 +2073,44 @@
2047
 
2048
  }
2049
 
2050
- html += '</span>';
 
 
 
2051
 
2052
- // Price
2053
- if (options.showPrice === true && typeof suggestion.price != 'undefined') {
2054
- html += '<span class="dgwt-wcas-sp">' + suggestion.price + '</span>';
 
 
 
 
 
 
 
 
 
 
 
 
 
2055
  }
2056
 
2057
- // On sale product badge
2058
- if (options.showFeaturedBadge === true && suggestion.on_sale === true) {
2059
- html += '<span class="dgwt-wcas-badge dgwt-wcas-badge-os">' + options.saleBadgeText + '</span>';
2060
  }
2061
 
2062
- // Featured product badge
2063
- if (options.showFeaturedBadge === true && suggestion.featured === true) {
2064
- html += '<span class="dgwt-wcas-badge dgwt-wcas-badge-f">' + options.featuredBadgeText + '</span>';
2065
  }
2066
 
 
 
2067
 
2068
  html += is_img ? '</div>' : '';
2069
- html += '</div>';
2070
 
2071
  }
2072
  });
@@ -2368,6 +2412,7 @@
2368
  return;
2369
  }
2370
 
 
2371
  that.hide();
2372
  that.onSelect(i);
2373
  },
@@ -2471,7 +2516,7 @@
2471
  that.currentValue = that.getValue(suggestion.value);
2472
 
2473
  if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
2474
- that.el.val(that.currentValue);
2475
  }
2476
 
2477
  if (suggestion.url.length > 0) {
@@ -2587,6 +2632,10 @@
2587
  disableOverlayMobile: function ($overlayWrap) {
2588
  var that = this;
2589
 
 
 
 
 
2590
  var $suggestionsWrapp = that.getSuggestionsContainer();
2591
 
2592
  var $clonedForm = $('.js-dgwt-wcas-om-bar').find('.' + that.options.searchFormClass);
@@ -2799,6 +2848,7 @@
2799
  taxonomyBrands: dgwt_wcas.taxonomy_brands,
2800
  mobileBreakpoint: mobileBreakpoint,
2801
  mobileOverlayWrapper: dgwt_wcas.mobile_overlay_wrapper,
 
2802
  debounceWaitMs: dgwt_wcas.debounce_wait_ms,
2803
  sendGAEvents: dgwt_wcas.send_ga_events,
2804
  convertHtml: dgwt_wcas.convert_html,
284
  }
285
 
286
  function _transformResult(response) {
287
+ return typeof response === 'string' ? JSON.parse(response) : response;
288
  }
289
 
290
  function _formatResult(suggestionValue, currentValue, highlight, options) {
309
  .replace(/&lt;sup/g, '<sup')
310
  .replace(/&lt;\/sup/g, '</sup')
311
  .replace(/sup&gt;/g, 'sup>')
312
+ .replace(/&lt;(\/?(strong|b|br|span))&gt;/g, '<$1>')
313
+ .replace(/&lt;(strong|span)\s+class\s*=\s*&quot;([^&]+)&quot;&gt;/g, '<$1 class="$2">');
314
 
315
  }
316
 
462
  });
463
 
464
  }
465
+
466
+ // Clean before submit
467
+ that.disableOverlayMobile();
468
+
469
  });
470
 
471
  // Position preloader
710
  var $el = $formWrapper.find('.js-dgwt-wcas-enable-mobile-form');
711
 
712
  $el.on('click.autocomplete', function (e) {
713
+
714
+ if (that.options.mobileOverlayDelay > 0) {
715
+ setTimeout(function () {
716
+ that.enableOverlayMobile();
717
+ }, that.options.mobileOverlayDelay);
718
+ } else {
719
+ that.enableOverlayMobile();
720
+ }
721
+
722
  });
723
 
724
  }
1137
  case keys.RETURN:
1138
 
1139
  if (that.selectedIndex === -1) {
1140
+ if (that.options.disableSubmit) {
1141
+ return false;
1142
+ }
1143
  that.hide();
1144
  return;
1145
  }
1450
  url: dgwt_wcas.ajax_details_endpoint,
1451
  success: function (response) {
1452
 
1453
+ var result = typeof response === 'string' ? JSON.parse(response) : response;
1454
 
1455
  if (typeof result.items != 'undefined') {
1456
  for (var i = 0; i < result.items.length; i++) {
1461
  if (typeof result.items[i]['price'] != 'undefined' && result.items[i]['price'].length > 0) {
1462
  that.cachedPrices[cacheKey] = result.items[i]['price'];
1463
  }
 
 
 
 
 
 
 
1464
  }
1465
  }
1466
 
1915
  if (suggestion.taxonomy === 'product_cat') {
1916
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat';
1917
  if (!options.showHeadings) {
1918
+ prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels['tax_' + suggestion.taxonomy] + '</span>';
1919
  }
1920
  if (typeof suggestion.breadcrumbs != 'undefined' && suggestion.breadcrumbs) {
1921
  title = suggestion.breadcrumbs + ' &gt; ' + suggestion.value;
1926
  } else if (suggestion.taxonomy === 'product_tag') {
1927
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag';
1928
  if (!options.showHeadings) {
1929
+ prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels['tax_' + suggestion.taxonomy] + '</span>';
1930
  }
1931
  } else if (options.isPremium && suggestion.taxonomy === options.taxonomyBrands) {
1932
  classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand';
1933
  if (!options.showHeadings) {
1934
+ prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels['tax_' + suggestion.taxonomy] + '</span>';
1935
+ }
1936
+ } else if (options.isPremium && suggestion.type === 'taxonomy') {
1937
+ classes += ' dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tax-' + suggestion.taxonomy;
1938
+ if (!options.showHeadings) {
1939
+ prepend += '<span class="dgwt-wcas-st--direct-headline">' + dgwt_wcas.labels['tax_' + suggestion.taxonomy] + '</span>';
1940
  }
1941
  } else if (options.isPremium && suggestion.type === 'vendor') {
1942
  classes += ' dgwt-wcas-suggestion-vendor dgwt-wcas-suggestion-vendor';
2034
  html += is_img ? '<div class="dgwt-wcas-content-wrapp">' : '';
2035
 
2036
 
2037
+ // Open Title wrapper
2038
+ html += '<div class="dgwt-wcas-st">';
2039
+
2040
+ // Custom content before title (3rd party)
2041
+ if (typeof suggestion.title_before != 'undefined' && suggestion.title_before) {
2042
+ html += suggestion.title_before;
2043
+ }
2044
+
2045
  // Title
 
2046
  html += '<span class="dgwt-wcas-st-title">' + formatResult(suggestion.value, value, true, options) + parent + '</span>';
2047
 
2048
+ // Custom content after title (3rd party)
2049
+ if (typeof suggestion.title_after != 'undefined' && suggestion.title_after) {
2050
+ html += suggestion.title_after;
2051
+ }
2052
+
2053
  // SKU
2054
  if (options.showSKU === true && typeof suggestion.sku != 'undefined' && suggestion.sku.length > 0) {
2055
  html += '<span class="dgwt-wcas-sku">(' + dgwt_wcas.labels.sku_label + ' ' + formatResult(suggestion.sku, value, true, options) + ')</span>';
2073
 
2074
  }
2075
 
2076
+ // Custom content after description (3rd party)
2077
+ if (typeof suggestion.content_after != 'undefined' && suggestion.content_after) {
2078
+ html += suggestion.content_after;
2079
+ }
2080
 
2081
+ // Close title wrapper
2082
+ html += '</div>';
2083
+
2084
+
2085
+ var showPrice = options.showPrice === true && typeof suggestion.price != 'undefined',
2086
+ showMetaBefore = typeof suggestion.meta_before != 'undefined',
2087
+ showMetaAfter = typeof suggestion.meta_after != 'undefined',
2088
+ showMeta = showPrice || showMetaBefore || showMetaAfter;
2089
+ // @todo show sale and featured badges
2090
+
2091
+ // Meta
2092
+ html += showMeta ? '<div class="dgwt-wcas-meta">' : '';
2093
+
2094
+ // Custom content before meta (3rd party)
2095
+ if (showMetaBefore) {
2096
+ html += suggestion.meta_before;
2097
  }
2098
 
2099
+ // Price
2100
+ if (showPrice) {
2101
+ html += '<span class="dgwt-wcas-sp">' + suggestion.price + '</span>';
2102
  }
2103
 
2104
+ // Custom content after meta (3rd party)
2105
+ if (showMetaAfter) {
2106
+ html += suggestion.meta_after;
2107
  }
2108
 
2109
+ // Close Meta
2110
+ html += showMeta ? '</div>' : '';
2111
 
2112
  html += is_img ? '</div>' : '';
2113
+ html += '</a>';
2114
 
2115
  }
2116
  });
2412
  return;
2413
  }
2414
 
2415
+ that.disableOverlayMobile();
2416
  that.hide();
2417
  that.onSelect(i);
2418
  },
2516
  that.currentValue = that.getValue(suggestion.value);
2517
 
2518
  if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
2519
+ that.el.val(that.currentValue.replace(/(<([^>]+)>)/gi, ' ').replace(/\s\s+/g, ' '));
2520
  }
2521
 
2522
  if (suggestion.url.length > 0) {
2632
  disableOverlayMobile: function ($overlayWrap) {
2633
  var that = this;
2634
 
2635
+ if (!$('html').hasClass('dgwt-wcas-overlay-mobile-on')) {
2636
+ return;
2637
+ }
2638
+
2639
  var $suggestionsWrapp = that.getSuggestionsContainer();
2640
 
2641
  var $clonedForm = $('.js-dgwt-wcas-om-bar').find('.' + that.options.searchFormClass);
2848
  taxonomyBrands: dgwt_wcas.taxonomy_brands,
2849
  mobileBreakpoint: mobileBreakpoint,
2850
  mobileOverlayWrapper: dgwt_wcas.mobile_overlay_wrapper,
2851
+ mobileOverlayDelay: dgwt_wcas.mobile_overlay_delay,
2852
  debounceWaitMs: dgwt_wcas.debounce_wait_ms,
2853
  sendGAEvents: dgwt_wcas.send_ga_events,
2854
  convertHtml: dgwt_wcas.convert_html,
assets/js/search.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"function"==typeof require?e(require("jquery")):e(jQuery)}(function(e){"use strict";var t={escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t.setAttribute("unselectable","on"),t},highlight:function(e,s){if(dgwt_wcas.is_premium){var i,o=s.split(/ /),a=!1,n="";if(o)for(n=o[o.length-1],o=o.sort(function(e,t){return t.length-e.length}),i=0;i<o.length;i++)if(o[i]&&o[i].length>=1){var r=o[i].replace(/[\^\@]/g,"");if(r.length>0){if(1===r.trim().length&&o[i]!==n)var l="((\\s|^)"+t.escapeRegExChars(r.trim())+"\\s)";else l=1===r.trim().length&&o[i]===n?"((\\s|^)"+t.escapeRegExChars(r.trim())+")":"("+t.escapeRegExChars(r.trim())+")";e=e.replace(new RegExp(l,"gi"),"^^$1@@"),a=!0}}a&&(e=(e=e.replace(/\^\^/g,"<strong>")).replace(/@@/g,"</strong>"))}else l="("+t.escapeRegExChars(s)+")",e=e.replace(new RegExp(l,"gi"),"<strong>$1</strong>");return e},debounce:function(e,t){var i,o=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=o,void e();s.id=o,i=setTimeout(function(){o===s.id?(e(),s.id=""):clearTimeout(i)},t)},mouseHoverDebounce:function(t,s,i){var o;o=setTimeout(function(){e(s+":hover").length>0?t():clearTimeout(o)},i)},getActiveInstance:function(){var t,s=e(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=e(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return t=s.data("autocomplete"),!1}),t},hashCode:function(e){for(var t=0,s=e.length;s>0;)t=(t<<5)-t+e.charCodeAt(--s)|0;return t<0?-1*t:t}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,o=9,a=13,n=38,r=39,l=40,c=e.noop;function d(t,s){this.element=t,this.el=e(t),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.detailsRequestsSent=[],this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.autoAligmentprocess=null,this.noSuggestionsContainer=null,this.latestActivateSource="",this.actionTriggerSource="",this.options=e.extend(!0,{},d.defaults,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.isMouseDownOnSearchElements=!1,this.initialize(),this.setOptions(s)}d.utils=t,e.DgwtWcasAutocompleteSearch=d,d.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,dynamicPrices:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:function(e,s,i,o){if(!s)return e;i&&(e=t.highlight(e,s));if(!o.convertHtml)return e;return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/&lt;sup/g,"<sup").replace(/&lt;\/sup/g,"</sup").replace(/sup&gt;/g,"sup>").replace(/&lt;(\/?(strong|b|br))&gt;/g,"<$1>")},delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",formClass:"dgwt-wcas-search-form",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(e,t,s){return-1!==e.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(t){return"string"==typeof t?e.parseJSON(t):t},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0,enableGASiteSearchModule:!1,showProductVendor:!1,disableHits:!1,disableSubmit:!1},d.prototype={initialize:function(){var s=this;s.element.setAttribute("autocomplete","off"),s.createContainers(),s.registerEventsSearchBar(),s.registerEventsSuggestions(),s.registerEventsDetailsPanel(),s.registerIconHandler(),s.registerEventsFixedMenu(),s.fixPositionCapture=function(){s.adjustContainerWidth(),s.visible&&s.fixPosition()},e(window).on("resize.autocomplete",function(){var e=t.getActiveInstance();void 0!==e&&e.fixPositionCapture()}),s.initMobileMode(),s.hideAfterClickOutsideListener(),s.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),s.detailsContainer&&s.detailsContainer.length>0&&s.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(t){var s=this.options;0==e("."+s.containerClass).length?(this.suggestionsContainer=e(d.utils.createNode(s.containerClass)),this.suggestionsContainer.appendTo(s.appendTo||"body"),this.suggestionsContainer.addClass("woocommerce"),!0===s.showImage&&this.suggestionsContainer.addClass("dgwt-wcas-has-img"),!0===s.showPrice&&this.suggestionsContainer.addClass("dgwt-wcas-has-price"),!0===s.showDescription&&this.suggestionsContainer.addClass("dgwt-wcas-has-desc"),!0===s.showSKU&&this.suggestionsContainer.addClass("dgwt-wcas-has-sku"),!0===s.showHeadings&&this.suggestionsContainer.addClass("dgwt-wcas-has-headings"),"auto"!==s.width&&this.suggestionsContainer.width(s.width)):this.suggestionsContainer=e("."+this.options.containerClass),this.canShowDetailsBox()&&(0==e("."+s.containerDetailsClass).length?(this.detailsContainer=e(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=e("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;e(document).on("click.autocomplete","."+s.options.closeTrigger,function(){t.getActiveInstance().close()}),s.el.closest("."+s.options.formClass).on("submit.autocomplete",function(t){if(s.options.disableSubmit)return t.preventDefault(),!1;var i=e(this).find("."+s.options.searchInputClass);if(i.length&&0===i.val().length)return t.preventDefault(),!1;s.suggestions.length>0&&e.each(s.suggestions,function(e,i){if(void 0!==i.type&&"product_variation"==i.type)return s.select(e),t.preventDefault(),!1})}),"complete"===document.readyState?s.positionPreloader():e(window).on("load",function(){s.positionPreloader()}),s.el.on("keydown.autocomplete",function(e){s.onKeyPress(e)}),s.el.on("keyup.autocomplete",function(e){s.onKeyUp(e)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(e){s.onKeyUp(e)}),s.el.on("input.autocomplete",function(e){s.onKeyUp(e)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;if(!this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")){e(document).on("mouseenter.autocomplete",s,function(){var s=t.getActiveInstance();if(void 0!==s){var i=e(this).data("index"),o='.dgwt-wcas-suggestion[data-index="'+i+'"]',a=s.canShowDetailsBox()?100:1;s.selectedIndex!=i&&t.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.latestActivateSource="mouse",s.getDetails(s.suggestions[i]),s.activate(i))},o,a)}});var i=!1;e(document).on("click.autocomplete",s,function(s){if(i)s.preventDefault();else{var o=t.getActiveInstance();o.actionTriggerSource="click",i=!0,setTimeout(function(){i=!1},500),void 0!==s.ctrlKey&&!1!==s.ctrlKey||(o.select(e(this).data("index")),s.preventDefault())}}),e(document).on("mousedown.autocomplete",s,function(s){var o=this;0===s.button&&setTimeout(function(){i||t.getActiveInstance().select(e(o).data("index"))},250)}),e("."+this.options.containerClass).on("mousedown.autocomplete",function(e){t.getActiveInstance().isMouseDownOnSearchElements=!0})}},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(e(document).on("change.autocomplete",'[name="js-dgwt-wcas-quantity"]',function(t){e(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",e(this).val())}),e("."+this.options.containerDetailsClass).on("mousedown.autocomplete",function(e){t.getActiveInstance().isMouseDownOnSearchElements=!0}))},registerIconHandler:function(){var s=this,i=s.getFormWrapper(),o=i.find("."+s.options.formClass);i.on("click.autocomplete",".js-dgwt-wcas-search-icon-handler",function(e){var t=i.find("."+s.options.searchInputClass);if(i.hasClass("dgwt-wcas-layout-icon-open"))s.hide(),o.hide(!0),i.removeClass("dgwt-wcas-layout-icon-open");else{var a=i.find(".dgwt-wcas-search-icon-arrow");o.hide(),a.hide(),i.addClass("dgwt-wcas-layout-icon-open"),s.positionIconSearchMode(i),o.fadeIn(200,function(){a.show(),s.positionPreloader(i),t.focus()})}}),0==e(".js-dgwt-wcas-initialized").length&&e(".js-dgwt-wcas-search-icon-handler").length>0&&e(document).on("click.autocomplete",function(i){if(e(".dgwt-wcas-layout-icon-open").length){var o=e(i.target);if(!(o.closest("."+s.options.searchFormClass).length>0||o.closest("."+s.options.containerClass).length>0||o.closest("."+s.options.containerDetailsClass).length>0)){var a=t.getActiveInstance();if(void 0!==a){var n=a.getFormWrapper().find("."+s.options.formClass);n.hide(),a.hide(!0),n.css({left:"0"})}s.hideIconModeSearch()}}}),e(window).on("resize.autocomplete",function(){s.applyFlexibleMode()}),"complete"==document.readyState?s.applyFlexibleMode():e(window).on("load.autocomplete",function(){s.applyFlexibleMode()})},registerEventsFixedMenu:function(){var t=this;e(window).on("scroll.autocomplete",function(){if(t.suggestions.length>0&&t.elementOrParentIsFixed(t.getFormWrapper()))if(0===e(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(e){setTimeout(function(){t.fixHeight(),t.fixPositionCapture()},e)})}else t.fixHeight(),t.fixPositionCapture()})},initMobileMode:function(){var e=this,t=e.getFormWrapper();t.hasClass("js-dgwt-wcas-mobile-overlay-enabled")&&e.isMobileMode()&&(t.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>'),t.find(".js-dgwt-wcas-enable-mobile-form").on("click.autocomplete",function(t){e.enableOverlayMobile()}))},applyFlexibleMode:function(){var t=e(".js-dgwt-wcas-layout-icon-flexible");t.length&&(this.isMobileMode()?(t.addClass("js-dgwt-wcas-layout-icon"),t.addClass("dgwt-wcas-layout-icon")):(t.removeClass("js-dgwt-wcas-layout-icon"),t.removeClass("dgwt-wcas-layout-icon")),t.addClass("dgwt-wcas-layout-icon-flexible-loaded"))},onFocus:function(){e("."+this.options.searchFormClass).removeClass("dgwt-wcas-active"),this.getFormWrapper().addClass("dgwt-wcas-active"),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){var t=this.options,s=this.el.val(),i=this.getQuery(s);this.isMobileMode()||this.isMouseDownOnSearchElements||(this.hide(),this.selection&&this.currentValue!==i&&(t.onInvalidateSelection||e.noop).call(this.element))},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(t){var s=this,i=s.getSuggestionsContainer(),o=e.extend({},s.options,t);(s.isLocal=Array.isArray(o.lookup),s.isLocal&&(o.lookup=s.verifySuggestionsFormat(o.lookup)),o.orientation=s.validateOrientation(o.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex}),!0===o.showDetailsPanel)&&s.getDetailsContainer().css({"z-index":o.zIndex-1});o.onSearchComplete=function(){s.getFormWrapper().removeClass("dgwt-wcas-processing"),s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.showCloseButton()},this.options=o},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.badQueries=[]},clear:function(e){e&&this.clearCache(),this.currentValue="",this.suggestions=[]},close:function(){this.hide(),this.clear(!1),this.hideCloseButton(),this.el.closest("."+this.options.searchFormClass).find("."+this.options.searchInputClass).val("").focus()},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var e=this.getFormOffset();this.getSuggestionsContainer().css(e),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var t=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.getDetailsContainer(),o=this.getFormOffset(),a=o.left;if(0==i.length)return!1;var n=!0===this.options.isRtl?1:2,r=Math.round(o.left);if(o.left=r+Math.round(s.width()+n),i.css(o),t.width()>=550)return e("body").removeClass("dgwt-wcas-details-outside"),e("body").removeClass("dgwt-wcas-details-right"),e("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(s.css("left",r+Math.round(i.width()+n)+"px"),i.css("left",a+"px")));var l=e(window).width(),c=i.width(),d=i.offset();e("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(o.left=o.left+1);var g=!1,u=!1;l<d.left+c&&(g=!0,e("body").removeClass("dgwt-wcas-details-right"),e("body").addClass("dgwt-wcas-details-left"),i.css("left",Math.round(parseFloat(s.css("left").replace("px","")))-i.outerWidth()+"px")),(d=i.offset()).left<1&&(u=!0,e("body").removeClass("dgwt-wcas-details-left"),e("body").addClass("dgwt-wcas-details-right")),u&&g?(e("body").removeClass("dgwt-wcas-details-left"),e("body").removeClass("dgwt-wcas-details-right"),e("body").addClass("dgwt-wcas-details-notfit")):e("body").removeClass("dgwt-wcas-details-notfit")},fixHeight:function(){if(1!=this.options.showDetailsPanel)return!1;var e=this.getSuggestionsContainer(),t=this.getDetailsContainer();e.css("height","auto"),t.css("height","auto");var s=e.outerHeight(),i=t.outerHeight();return e.find(".dgwt-wcas-suggestion:last-child").removeClass("dgwt-wcas-suggestion-no-border-bottom"),!(s<=340&&i<=340)&&(e.find(".dgwt-wcas-suggestion:last-child").addClass("dgwt-wcas-suggestion-no-border-bottom"),i<s&&t.css("height",s+"px"),s<i&&e.css("height",i+"px"),!1)},automaticAlignment:function(){var e=this,t=e.getFormWrapper().find(".dgwt-wcas-search-input"),s=e.getSuggestionsContainer(),i=e.getDetailsContainer();if(null==e.autoAligmentprocess){var o=[t.width(),s.height()];e.options.showDetailsPanel&&(o[2]=i.height()),e.autoAligmentprocess=setInterval(function(){var a=[t.width(),s.height()];e.options.showDetailsPanel&&(a[2]=i.height());for(var n=0;n<o.length;n++)if(o[n]!=a[n]){e.fixHeight(),e.fixPositionCapture(),o=a;break}e.options.showDetailsPanel&&(i.find(".dgwt-wcas-details-inner").height()-i.height()>2&&e.fixHeight())},10)}},getFormOffset:function(){var t=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,o=t.outerHeight(),a=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=e(window).height(),c=e(window).scrollTop(),d=-c+n.top-o,g=c+l-(n.top+a+o);i=Math.max(d,g)===d?"top":"bottom"}if("top"===i){s[0].getBoundingClientRect().top;var u=t[0].getBoundingClientRect().top;s.css("height","auto"),u<s.height()&&s.height(u-10),r.top+=-s.outerHeight()}else r.top+=a;return r},getFormWrapper:function(){return this.el.closest("."+this.options.searchFormClass)},getSuggestionsContainer:function(){return e("."+this.options.containerClass)},getDetailsContainer:function(){return e("."+this.options.containerDetailsClass)},scrollDownSuggestions:function(){var e=this.getSuggestionsContainer();e[0].scrollTop=e[0].scrollHeight},isCursorAtEnd:function(){var e,t=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(e){if(this.disabled||this.visible||e.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(e.which){case i:this.el.val(this.currentValue),this.hide();break;case r:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case o:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case a:if(-1===this.selectedIndex)return void this.hide();this.actionTriggerSource="enter",this.select(this.selectedIndex);break;case n:this.moveUp();break;case l:this.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else this.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case n:case l:return}clearTimeout(t.onChangeTimeout),t.currentValue!==t.el.val()&&(t.findBestHint(),t.options.deferRequestBy>0?t.onChangeTimeout=setTimeout(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var t=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(t.onInvalidateSelection||e.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,t.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<t.minChars?(this.hideCloseButton(),this.hide()):this.getSuggestions(i)}},isExactMatch:function(e){var t=this.suggestions;return 1===t.length&&t[0].value.toLowerCase()===e.toLowerCase()},canShowDetailsBox:function(){return 1==this.options.showDetailsPanel&&!this.isMobileMode()},isMobileMode:function(){return e(window).width()<this.options.mobileBreakpoint},getQuery:function(t){var s,i=this.options.delimiter;return i?(s=t.split(i),e.trim(s[s.length-1])):t.trim()},getSuggestionsLocal:function(t){var s,i=this.options,o=t.toLowerCase(),a=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:e.grep(i.lookup,function(e){return a(e,t,o)})},n&&s.suggestions.length>n&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(i){var o,a,n,r,l=this,c=l.options,d=c.serviceUrl,g=l.getFormWrapper();c.params[c.paramName]=i,void 0!==dgwt_wcas.current_lang&&(c.params.l=dgwt_wcas.current_lang),c.params=l.applyCustomParams(c.params),l.preloader("show","form","dgwt-wcas-inner-preloader"),g.addClass("dgwt-wcas-processing"),!1!==c.onSearchStart.call(l.element,c.params)&&(a=c.ignoreParams?null:c.params,e.isFunction(c.lookup)?c.lookup(i,function(e){l.suggestions=e.suggestions,l.suggest(),l.selectFirstSuggestion(e.suggestions),c.onSearchComplete.call(l.element,i,e.suggestions)}):(l.isLocal?o=l.getSuggestionsLocal(i):(e.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+e.param(a||{}),o=l.cachedResponse[n]),o&&Array.isArray(o.suggestions)?(l.suggestions=o.suggestions,l.suggest(),l.selectFirstSuggestion(o.suggestions),c.onSearchComplete.call(l.element,i,o.suggestions)):l.isBadQuery(i)?c.onSearchComplete.call(l.element,i,[]):(l.abortAjax(),r={url:d,data:a,type:c.type,dataType:c.dataType},e.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,t.debounce(function(){var t=s.object,o=s.ajaxSettings;t.currentRequest=e.ajax(o).done(function(e){var s;t.currentRequest=null,void 0!==(s=t.options.transformResult(e,i)).suggestions&&(t.processResponse(s,i,n),t.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?t.gaEvent(i,"Autocomplete Search without results"):t.gaEvent(i,"Autocomplete Search with results")),t.fixPositionCapture(),t.options.onSearchComplete.call(t.element,i,s.suggestions),t.updatePrices()}).fail(function(e,s,o){t.options.onSearchError.call(t.element,i,e,s,o)})},c.debounceWaitMs))))},getDetails:function(t){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=t&&void 0!==t.type&&("string"!=typeof t.type||"more_products"!==t.type)){s.fixHeight();s.getDetailsContainer();var i=s.prepareSuggestionObjectID(t);if(null!=s.cachedDetails[i])s.detailsPanelSetScene(i),s.fixHeight(),s.fixPositionCapture();else{var o={action:dgwt_wcas.action_result_details,items:[]};if(e.each(s.suggestions,function(e,t){if(void 0!==t.type&&"more_products"!=t.type&&"headline"!=t.type){var i={objectID:s.prepareSuggestionObjectID(t),value:null!=t.value?t.value:""};o.items.push(i)}}),s.detailsPanelClearScene(),s.preloader("show","details",""),-1!=e.inArray(i,s.detailsRequestsSent))return;s.detailsRequestsSent.push(i),e.ajax({data:o,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(e){var t="string"==typeof e?jQuery.parseJSON(e):e;if(void 0!==t.items)for(var i=0;i<t.items.length;i++){var o=t.items[i].objectID;if(s.cachedDetails[o]={html:t.items[i].html},s.detailsPanelAddToScene(o),void 0!==t.items[i].price&&t.items[i].price.length>0&&(s.cachedPrices[o]=t.items[i].price),void 0!==t.items[i].imageSrc&&t.items[i].imageSrc.length>0)(new Image).src=t.items[i].imageSrc}s.preloader("hide","details","");var a=s.prepareSuggestionObjectID(s.suggestions[s.selectedIndex]);null!=s.cachedDetails[a]?s.detailsPanelSetScene(a):s.detailsPanelClearScene(),s.fixPositionCapture(),s.fixHeight(),s.updatePrices(!0)},error:function(e,t){s.preloader("hide","details",""),s.detailsPanelClearScene(),s.fixPositionCapture(),s.fixHeight()}})}e(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},updatePrices:function(t){var s,i,o=this,a=[];if(o.options.showPrice&&o.options.dynamicPrices&&0!=o.suggestions.length){for(s=0;s<o.suggestions.length;s++)if(void 0!==o.suggestions[s].type&&("product"==o.suggestions[s].type||"product_variation"==o.suggestions[s].type)){var n="product__"+o.suggestions[s].post_id;void 0!==o.cachedPrices[n]?o.updatePrice(s,o.cachedPrices[n]):(o.applyPreloaderForPrice(s),a.push(o.suggestions[s].post_id))}if(!t&&a.length>0){var r={action:void 0===dgwt_wcas.action_get_prices?"dgwt_wcas_get_prices":dgwt_wcas.action_get_prices,items:a};e.ajax({data:r,type:"post",url:dgwt_wcas.ajax_prices_endpoint,success:function(e){if(void 0!==e.success&&e.success&&e.data.length>0)for(s=0;s<e.data.length;s++){var t=e.data[s].id,a=e.data[s].price;if(o.suggestions.length>0)for(i=0;i<o.suggestions.length;i++)if(void 0!==o.suggestions[i].type&&("product"==o.suggestions[i].type||"product_variation"==o.suggestions[i].type)&&o.suggestions[i].post_id==t){var n="product__"+t;o.cachedPrices[n]=a,o.updatePrice(i,a)}}},error:function(e,t){}})}}},updatePrice:function(t,s){if(void 0!==this.suggestions[t]){this.suggestions[t].price=s;var i=e(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+t+'"] .dgwt-wcas-sp');i.length&&i.html(s)}},applyCustomParams:function(e){if("object"==typeof dgwt_wcas.custom_params){var t=dgwt_wcas.custom_params;for(var s in t)e[s]=t[s]}var i=this.el.data("custom-params");if("object"==typeof i)for(var s in i)e[s]=i[s];return e},applyPreloaderForPrice:function(t){if(void 0!==this.suggestions[t]){var s=e(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+t+'"] .dgwt-wcas-sp');s.length&&s.html('<div class="dgwt-wcas-preloader-price"><div class="dgwt-wcas-preloader-price-inner"> <div></div><div></div><div></div></div></div>')}},prepareSuggestionObjectID:function(e){var t="";return void 0!==e&&void 0!==e.type&&(null!=e.post_id&&(t=e.type+"__"+e.post_id,"product_variation"===e.type&&(t+="__"+e.variation_id),void 0!==e.post_type&&(t=e.type+"__"+e.post_id+"__"+e.post_type)),null!=e.term_id&&null!=e.taxonomy&&(t=e.type+"__"+e.term_id+"__"+e.taxonomy)),t},detailsPanelSetScene:function(e){var s=this.getDetailsContainer(),i=t.hashCode(e),o=s.find('.dgwt-wcas-details-inner[data-object="'+i+'"]');o.length&&(this.preloader("hide","details",""),this.detailsPanelClearScene(),o.addClass("dgwt-wcas-details-inner-active"))},detailsPanelAddToScene:function(e){var s=this.getDetailsContainer(),i=this.cachedDetails[e],o=t.hashCode(e),a="";void 0!==i&&"string"==typeof i.html&&(a=i.html.replace("<div ",'<div data-object="'+o+'" ')),0==s.find('.dgwt-wcas-details-inner[data-object="'+o+'"]').length&&s.append(a)},detailsPanelClearScene:function(){var e=this.getDetailsContainer().find(".dgwt-wcas-details-inner");e.length&&e.removeClass("dgwt-wcas-details-inner-active")},selectFirstSuggestion:function(t){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=t&&t.length>0&&e.each(this.suggestions,function(e,t){if(void 0!==t.type&&"more_products"!=t.type&&"headline"!=t.type&&"no-results"!=t.type)return s=e,!1;void 0!==t.type&&"no-results"!==t.type||(i=!0)}),i||(this.latestActivateSource="system",this.getDetails(t[s]),this.activate(s)))},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,s=t.length;s--;)if(0===e.indexOf(t[s]))return!0;return!1},hide:function(t){this.getFormWrapper();var s=this.getSuggestionsContainer(),i=this.getDetailsContainer();e.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),s.hide(),s.removeClass(this.classes.suggestionsContainerOrientTop),i.hide(),e("body").removeClass("dgwt-wcas-open"),e("body").removeClass("dgwt-wcas-block-scroll"),e("body").removeClass("dgwt-wcas-is-details"),e("body").removeClass("dgwt-wcas-full-width"),e("body").removeClass("dgwt-wcas-nores"),e("body").removeClass("dgwt-wcas-details-outside"),e("body").removeClass("dgwt-wcas-details-right"),e("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),"boolean"==typeof t&&t&&(this.hideCloseButton(),this.currentValue="",this.suggestions=[]),this.signalHint(null)},positionIconSearchMode:function(t){var s=-20,i=t.find("."+this.options.formClass),o=i.width(),a=e(window).width(),n=t[0].getBoundingClientRect().left;i[0].getBoundingClientRect().left;var r=(n+10)/a;s=Math.floor(o*r*-1),s=Math.max(s,-1*n),i.css({left:s+"px"})},hideIconModeSearch:function(){var t=e(".dgwt-wcas-layout-icon-open");t.length>0&&t.removeClass("dgwt-wcas-layout-icon-open")},hideAfterClickOutsideListener:function(){var t=this;t.isMobileMode()||e(document).mouseup(function(s){if(t.visible){t.getSuggestionsContainer(),t.getDetailsContainer();var i=!(e(s.target).closest("."+t.options.searchFormClass).length>0||e(s.target).hasClass(t.options.searchFormClass)),o=!(e(s.target).closest("."+t.options.containerClass).length>0||e(s.target).hasClass(t.options.containerClass));if(t.canShowDetailsBox()){var a=!(e(s.target).closest("."+t.options.containerDetailsClass).length>0||e(s.target).hasClass(t.options.containerDetailsClass));i&&o&&a&&t.hide()}else i&&o&&t.hide()}})},suggest:function(){if(this.suggestions.length){var t,s=this,i=s.options,o=i.groupBy,a=i.formatResult,n=s.getQuery(s.currentValue),r=s.classes.suggestion,l=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),g=e(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(e("body").removeClass("dgwt-wcas-nores"),e.each(s.suggestions,function(l,c){var d="",g=!1,u="string"==typeof c.url&&c.url.length?c.url:"#";if(o&&(h+=function(e,s){var i=e.data[o];return t===i?"":'<div class="autocomplete-group"><strong>'+(t=i)+"</strong></div>"}(c,0)),void 0===c.type||"product"!=c.type&&"product_variation"!=c.type){var p,w=r,f="dgwt-wcas-st",m="",v="",b="",C=!0;"product_cat"===c.taxonomy?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.category+"</span>"),void 0!==c.breadcrumbs&&c.breadcrumbs&&(b=c.breadcrumbs+" &gt; "+c.value,v+='<span class="dgwt-wcas-st-breadcrumbs">'+dgwt_wcas.labels.in+" "+c.breadcrumbs+"</span>")):"product_tag"===c.taxonomy?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.tag+"</span>")):i.isPremium&&c.taxonomy===i.taxonomyBrands?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.brand+"</span>")):i.isPremium&&"vendor"===c.type?(w+=" dgwt-wcas-suggestion-vendor dgwt-wcas-suggestion-vendor",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.vendor+"</span>")):i.isPremium&&"post"===c.type?(w+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-tp-post",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.post+"</span>")):i.isPremium&&"page"===c.type?(w+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-pt-page",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.page+"</span>")):"more_products"===c.type?(w+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",f="dgwt-wcas-st-more",c.value=dgwt_wcas.labels.show_more+" ("+c.total+")",C=!1):i.showHeadings&&"headline"===c.type?(w+=" js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline",void 0!==dgwt_wcas.labels[c.value+"_plu"]&&(c.value=dgwt_wcas.labels[c.value+"_plu"]),C=!1):(w+=" dgwt-wcas-suggestion-nores",c.value=dgwt_wcas.labels.no_results,C=!1,!0===i.showDetailsPanel&&s.detailsPanelClearScene(),e("body").addClass("dgwt-wcas-nores")),void 0!==c.image_src&&c.image_src&&(p=!0),b=b.length>0?' title="'+b+'"':"",h+='<a href="'+u+'" class="'+w+'" data-index="'+l+'">',p&&(h+='<span class="dgwt-wcas-si"><img src="'+c.image_src+'" /></span>',h+='<div class="dgwt-wcas-content-wrapp">'),h+="<span"+b+' class="'+f+'">',"vendor"===c.type?(h+='<span class="dgwt-wcas-st-title">'+m+a(c.value,n,C,i)+v+"</span>",c.shop_city&&(h+='<span class="dgwt-wcas-vendor-city"><span> - </span>'+a(c.shop_city,n,!0,i)+"</span>"),void 0!==c.desc&&c.desc&&(h+='<span class="dgwt-wcas-sd">'+a(c.desc,n,!0,i)+"</span>")):h+=m+a(c.value,n,C,i)+v,h+="</span>",h+=p?"</div>":"",h+="</a>"}else{!0===i.showImage&&void 0!==c.thumb_html&&(g=!0);var y="product_variation"===c.type?" dgwt-wcas-suggestion-product-var":"";if(d+=void 0!==c.post_id?'data-post-id="'+c.post_id+'" ':"",d+=void 0!==c.taxonomy?'data-taxonomy="'+c.taxonomy+'" ':"",d+=void 0!==c.term_id?'data-term-id="'+c.term_id+'" ':"",h+='<a href="'+u+'" class="'+r+" dgwt-wcas-suggestion-product"+y+'" data-index="'+l+'" '+d+">",g&&(h+='<span class="dgwt-wcas-si">'+c.thumb_html+"</span>"),h+=g?'<div class="dgwt-wcas-content-wrapp">':"",h+='<span class="dgwt-wcas-st">',h+='<span class="dgwt-wcas-st-title">'+a(c.value,n,!0,i)+"</span>",!0===i.showSKU&&void 0!==c.sku&&c.sku.length>0&&(h+='<span class="dgwt-wcas-sku">('+dgwt_wcas.labels.sku_label+" "+a(c.sku,n,!0,i)+")</span>"),!0===i.showDescription&&void 0!==c.desc&&c.desc&&(h+='<span class="dgwt-wcas-sd">'+a(c.desc,n,!0,i)+"</span>"),!0===i.showProductVendor&&void 0!==c.vendor&&c.vendor){var _='<span class="dgwt-wcas-product-vendor"><span class="dgwt-wcas-product-vendor-label">'+dgwt_wcas.labels.vendor_sold_by+" </span>"+c.vendor+"</span>";void 0!==c.vendor_url&&c.vendor_url?h+='<span class="dgwt-wcas-product-vendor-link" data-url="'+c.vendor_url+'">'+_+"</span>":h+=_}h+="</span>",!0===i.showPrice&&void 0!==c.price&&(h+='<span class="dgwt-wcas-sp">'+c.price+"</span>"),!0===i.showFeaturedBadge&&!0===c.on_sale&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-os">'+i.saleBadgeText+"</span>"),!0===i.showFeaturedBadge&&!0===c.featured&&(h+='<span class="dgwt-wcas-badge dgwt-wcas-badge-f">'+i.featuredBadgeText+"</span>"),h+=g?"</div>":"",h+="</div>"}}),this.adjustContainerWidth(),g.detach(),c.html(h),e.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),e("body").addClass("dgwt-wcas-open"),s.isMouseDownOnSearchElements=!1,s.automaticAlignment(),!0===i.showDetailsPanel&&(e("body").addClass("dgwt-wcas-is-details"),d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+r).first().addClass(l)),s.visible=!0,s.fixPositionCapture(),"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),e("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var t,s=this.options,i=e("body"),o=this.getFormWrapper(),a=this.getSuggestionsContainer(),n=this.getDetailsContainer(),r=this.getFormOffset();if(o.length){var l=getComputedStyle(o[0]).width;if(l=Math.round(parseFloat(l.replace("px",""))),"auto"===s.width&&(t=this.el.outerWidth(),a.css("width",t+"px")),this.canShowDetailsBox()){if(o.width()>=550)return i.addClass("dgwt-wcas-full-width"),l%2==0?(a.css("width",Math.round(l/2)),n.css("width",Math.round(l/2))):(a.css("width",Math.floor(l/2)),n.css("width",Math.ceil(l/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):a.css("left",l/2+r.left+"px"));i.addClass("dgwt-wcas-details-right")}}},positionPreloader:function(t){var s="object"==typeof t?t.find(".dgwt-wcas-search-submit"):e(".dgwt-wcas-search-submit");s.length>0&&s.each(function(){var t=e(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?t.css("left",6+e(this).outerWidth()+"px"):t.css("right",e(this).outerWidth()+"px")})},findBestHint:function(){var t=this.el.val().toLowerCase(),s=null;t&&(e.each(this.suggestions,function(e,i){var o=0===i.value.toLowerCase().indexOf(t);return o&&(s=i),!o}),this.signalHint(s))},signalHint:function(t){var s="";t&&(s=this.currentValue+t.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=t,(this.options.onHint||e.noop)(s))},preloader:function(e,t,s){var i,o,a="dgwt-wcas-preloader-wrapp",n=null==s?a:a+" "+s;if("form"===t){if(1!=dgwt_wcas.show_preloader)return;o=this.getFormWrapper().find(".dgwt-wcas-preloader")}else"details"===t&&(o=this.getDetailsContainer());if(0!=o.length)if("form"!==t){var r=o.find("."+a);if("hide"!==e){if("show"===e){var l=this.options.isRtl?"-rtl":"";i='<div class="'+n+'"><img class="dgwt-wcas-placeholder-preloader" src="'+dgwt_wcas.img_url+"placeholder"+l+'.png" /></div>',this.detailsPanelClearScene(),r.length&&r.remove(),o.prepend(i)}}else r.length&&r.remove()}else"hide"===e?(o.removeClass(s),o.html("")):(o.addClass(s),"string"==typeof dgwt_wcas.preloader_icon&&o.html(dgwt_wcas.preloader_icon))},verifySuggestionsFormat:function(t){return t.length&&"string"==typeof t[0]?e.map(t,function(e){return{value:e,data:null}}):t},validateOrientation:function(t,s){return t=e.trim(t||"").toLowerCase(),-1===e.inArray(t,["auto","bottom","top"])&&(t=s),t},processResponse:function(e,t,s){var i=this.options;e.suggestions=this.verifySuggestionsFormat(e.suggestions),i.noCache||(this.cachedResponse[s]=e,i.preventBadQueries&&!e.suggestions.length&&this.badQueries.push(t)),t===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&e.suggestions.reverse(),this.suggestions=e.suggestions,this.suggest())},activate:function(t){var s,i=this.classes.selected,o=this.getSuggestionsContainer(),a=o.find("."+this.classes.suggestion);return o.find("."+i).removeClass(i),this.selectedIndex=t,-1!==this.selectedIndex&&a.length>this.selectedIndex?(s=a.get(this.selectedIndex),e(s).addClass(i),s):null},selectHint:function(){var t=e.inArray(this.hint,this.suggestions);this.select(t)},select:function(e){this.options.disableHits||(this.hide(),this.onSelect(e))},moveUp:function(){if(-1!==this.selectedIndex){if(this.latestActivateSource="key",0===this.selectedIndex)return this.getSuggestionsContainer().children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint();this.adjustScroll(this.selectedIndex-1,"up")}},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&(this.latestActivateSource="key",this.adjustScroll(this.selectedIndex+1,"down"))},adjustScroll:function(t,s){if("headline"===this.suggestions[t].type&&(t="down"===s?t+1:t-1),void 0!==this.suggestions[t]){var i=this.activate(t);if(this.getDetails(this.suggestions[t]),"more_products"!==this.suggestions[t].type&&i&&!this.canShowDetailsBox()){var o,a,n,r=this.getSuggestionsContainer(),l=e(i).outerHeight();o=i.offsetTop,n=(a=r.scrollTop())+this.options.maxHeight-l,o<a?r.scrollTop(o):o>n&&r.scrollTop(o-this.options.maxHeight+l),this.options.preserveInput||(this.ignoreValueChange=!0),this.signalHint(null)}}},onSelect:function(t){var s=this.options.onSelect,i=this.suggestions[t];void 0===i.type||"more_products"!==i.type&&("enter"!==this.actionTriggerSource||"key"==this.latestActivateSource||"product_variation"==i.type)?(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,e.isFunction(s)&&s.call(this.element,i)):this.el.closest("form").trigger("submit")},getValue:function(e){var t,s,i=this.options.delimiter;return i?1===(s=(t=this.currentValue).split(i)).length?e:t.substr(0,t.length-s[s.length-1].length)+e:e},dispose:function(){var t=this.el,s=this.getFormWrapper(),i=this.getSuggestionsContainer(),o=(this.getDetailsContainer(),t.closest("."+this.options.formClass),s.find(".js-dgwt-wcas-enable-mobile-form"));s.length&&s.find("*").each(function(){e(this).off(".autocomplete")});t.removeData("autocomplete"),e(window).off("resize.autocomplete",this.fixPositionCapture),s.removeClass("dgwt-wcas-active"),this.close(),o.length&&o.remove(),i.length&&i.html("")},enableOverlayMobile:function(){var t=this;if("on"!==t.overlayMobileState){t.overlayMobileState="on";var s,i=t.getFormWrapper(),o=t.getSuggestionsContainer(),a="";e("html").addClass("dgwt-wcas-overlay-mobile-on"),a+='<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile">',a+='<div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar">',a+='<button class="dgwt-wcas-om-return js-dgwt-wcas-om-return">',"string"==typeof dgwt_wcas.back_icon&&(a+=dgwt_wcas.back_icon),a+="</button>",a+="</div>",a+="</div>",e(t.options.mobileOverlayWrapper).append(a),(s=e(".js-dgwt-wcas-overlay-mobile")).css("zIndex",99999999999),i.after('<span class="js-dgwt-wcas-om-hook"></span>'),i.appendTo(".js-dgwt-wcas-om-bar"),o.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+t.options.searchInputClass).focus(),e(document).on("click.autocomplete",".js-dgwt-wcas-om-return",function(e){t.disableOverlayMobile(s)})}},disableOverlayMobile:function(t){var s=this,i=s.getSuggestionsContainer(),o=e(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);o.hasClass("dgwt-wcas-has-submit-off")&&(o.removeClass("dgwt-wcas-has-submit-off"),o.addClass("dgwt-wcas-has-submit")),o.removeClass("dgwt-wcas-search-wrapp-mobile"),e("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),e(".js-dgwt-wcas-om-hook").after(o),e(".js-dgwt-wcas-overlay-mobile").remove(),e(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){o.find("."+s.options.searchInputClass).val("");var e=o.find(".dgwt-wcas-close");o.length>0&&(e.removeClass("dgwt-wcas-close"),e.html("")),s.hide()},150),s.overlayMobileState="off"},showCloseButton:function(){var e=void 0!==dgwt_wcas.close_icon?dgwt_wcas.close_icon:"",t=this.getFormWrapper().find("."+this.options.preloaderClass);t.addClass(this.options.closeTrigger),t.html(e)},hideCloseButton:function(){var e=this.getFormWrapper().find("."+this.options.closeTrigger);e.length&&(e.removeClass(this.options.closeTrigger),e.html(""))},elementOrParentIsFixed:function(t){var s=t.add(t.parents()),i=!1;return s.each(function(){if("fixed"===e(this).css("position"))return i=!0,!1}),i},gaEvent:function(e,t){var s=!(!window.hasOwnProperty("GoogleAnalyticsObject")||!window.hasOwnProperty(window.GoogleAnalyticsObject))&&window[window.GoogleAnalyticsObject];if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)gtag("event","autocomplete_search",{event_label:e,event_category:t});else if(!1!==s){var i=s.getAll()[0];i&&i.send({hitType:"event",eventCategory:t,eventAction:"autocomplete_search",eventLabel:e})}}catch(e){}if(this.options.enableGASiteSearchModule)try{if("undefined"!=typeof gtag)gtag("event","page_view",{page_path:"/?s="+encodeURI(e)+"&post_type=product&dgwt_wcas=1"});else if(!1!==s){var o=s.getAll()[0];o&&(o.set("page","/?s="+encodeURI(e)+"&post_type=product&dgwt_wcas=1"),o.send("pageview"))}}catch(e){}}},e.fn.dgwtWcasAutocomplete=function(t,s){return arguments.length?this.each(function(){var i=e(this),o=i.data("autocomplete");"string"==typeof t?o&&"function"==typeof o[t]&&o[t](s):(o&&o.dispose&&o.dispose(),o=new d(this,t),i.data("autocomplete",o))}):this.first().data("autocomplete")},e.fn.autocomplete||(e.fn.autocomplete=e.fn.dgwtWcasAutocomplete),function(){function t(){var t=e(".dgwt-wcas-search-input"),s=[];t.length>1&&t.each(function(){var t=e(this).attr("id");if(-1==e.inArray(t,s))s.push(t);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,e(this).attr("id",i),e(this).closest("form").find("label").attr("for",i)}})}function s(){var t=e(".dgwt-wcas-search-input");t.length>0&&t.each(function(){"object"!=typeof e(this).data("autocomplete")&&e(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}navigator.userAgent.match(/Trident\/7\./)&&function(e,t){function s(e,t){var s=arguments.length>2?arguments[2]:[];if(!1===a(e))throw new TypeError(Object.prototype.toString.call(e)+"is not a function.");return e.apply(t,s)}function i(e,t,s){var i={value:s,writable:!0,enumerable:!1,configurable:!0};Object.defineProperty(e,t,i)}function o(e,t){return e[t]}function a(e){return"function"==typeof e}function n(e){if(null===e||e===t)throw TypeError();return Object(e)}function r(e,s){var i=function(e,t){return n(e)[t]}(e,s);if(null===i||i===t)return t;if(!1===a(i))throw new TypeError("Method not callable: "+s);return i}function l(t){switch(typeof t){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";default:return null===t?"null":"Symbol"in e&&(t instanceof e.Symbol||t.constructor===e.Symbol)?"symbol":"object"}}function c(s){if("object"!==l(s))return!1;var i="Symbol"in e&&"match"in e.Symbol?o(s,e.Symbol.match):t;if(i!==t)return Boolean(i);try{var a=s.lastIndex;return s.lastIndex=0,RegExp.prototype.exec.call(s),!0}catch(e){}finally{s.lastIndex=a}return!1}function d(e,t){return l(e)===l(t)&&("number"===l(e)?!(!isNaN(e)||!isNaN(t))||1/e==1/0&&1/t==-1/0||1/e==-1/0&&1/t==1/0||e===t:function(e,t){return e===t}(e,t))}function g(e){if("symbol"===l(e))throw new TypeError("Cannot convert a Symbol value to a number");var t=Number(e);return isNaN(t)?0:1/t==1/0||1/t==-1/0||t===1/0||t===-1/0?t:(t<0?-1:1)*Math.floor(Math.abs(t))}function u(i){var n=arguments.length>1?arguments[1]:t;if("object"===l(i)){if(arguments.length<2)var c="default";else n===String?c="string":n===Number&&(c="number");var d="function"==typeof e.Symbol&&"symbol"==typeof e.Symbol.toPrimitive?r(i,e.Symbol.toPrimitive):t;if(d!==t){var g=s(d,i,[c]);if("object"!==l(g))return g;throw new TypeError("Cannot convert exotic object to primitive.")}return"default"===c&&(c="number"),function(e,t){if("string"===t)var i=["toString","valueOf"];else i=["valueOf","toString"];for(var n=0;n<i.length;++n){var r=o(e,i[n]);if(a(r)){var c=s(r,e);if("object"!==l(c))return c}}throw new TypeError("Cannot convert to primitive.")}(i,c)}return i}function h(e){switch(l(e)){case"symbol":throw new TypeError("Cannot convert a Symbol value to a string");case"object":return h(u(e,String));default:return String(e)}}i(Array.prototype,"includes",function(e){var t=n(this),s=function(e){var t=g(e);return t<=0?0:Math.min(t,Math.pow(2,53)-1)}(o(t,"length"));if(0===s)return!1;var i=g(arguments[1]);if(i>=0)var a=i;else(a=s+i)<0&&(a=0);for(;a<s;){if(d(e,o(t,h(a))))return!0;a+=1}return!1}),i(String.prototype,"includes",function(e){var s=arguments.length>1?arguments[1]:t,i=h(function(e){if(null===e||e===t)throw TypeError(Object.prototype.toString.call(e)+" is not coercible to Object.");return e}(this));if(c(e))throw new TypeError("First argument to String.prototype.includes must not be a regular expression");var o=h(e),a=g(s),n=i.length,r=Math.min(Math.max(a,0),n);return-1!==String.prototype.indexOf.call(i,o,r)})}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),e(document).ready(function(){(["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document)&&e("html").addClass("dgwt-wcas-is-ios");var t=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()<s||"ontouchend"in document)&&(t=!1),window.dgwt_wcas.config={minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"s",showDetailsPanel:t,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,dynamicPrices:!(void 0===dgwt_wcas.dynamic_prices||!dgwt_wcas.dynamic_prices),saleBadgeText:dgwt_wcas.labels.sale_badge,featuredBadgeText:dgwt_wcas.labels.featured_badge,isRtl:1==dgwt_wcas.is_rtl,showHeadings:1==dgwt_wcas.show_headings,isPremium:1==dgwt_wcas.is_premium,taxonomyBrands:dgwt_wcas.taxonomy_brands,mobileBreakpoint:s,mobileOverlayWrapper:dgwt_wcas.mobile_overlay_wrapper,debounceWaitMs:dgwt_wcas.debounce_wait_ms,sendGAEvents:dgwt_wcas.send_ga_events,convertHtml:dgwt_wcas.convert_html,enableGASiteSearchModule:dgwt_wcas.enable_ga_site_search_module,appendTo:void 0!==dgwt_wcas.suggestions_wrapper?dgwt_wcas.suggestions_wrapper:"body",showProductVendor:!(void 0===dgwt_wcas.show_product_vendor||!dgwt_wcas.show_product_vendor),disableHits:!(void 0===dgwt_wcas.disable_hits||!dgwt_wcas.disable_hits),disableSubmit:!(void 0===dgwt_wcas.disable_submit||!dgwt_wcas.disable_submit)},e(".dgwt-wcas-search-input").dgwtWcasAutocomplete(window.dgwt_wcas.config)}),e(window).on("load",function(){var t=0,s=setInterval(function(){var i=document.activeElement;if("object"==typeof i&&e(i).length&&e(i).hasClass("dgwt-wcas-search-input")){var o=e(i).closest(".dgwt-wcas-search-wrapp");o.length&&!o.hasClass("dgwt-wcas-active")&&(o.addClass("dgwt-wcas-active"),clearInterval(s))}t>10&&clearInterval(s),t++},500)}),e(document).ready(function(){setTimeout(function(){t(),s()},500)}),e(window).on("load",function(){setTimeout(function(){t(),s()},500),void 0!==window.elementorFrontend&&void 0!==window.elementorFrontend.documentsManager&&void 0!==window.elementorFrontend.documentsManager.documents&&e.each(elementorFrontend.documentsManager.documents,function(e,t){void 0!==t.getModal&&t.getModal&&t.getModal().on("show",function(){setTimeout(function(){s()},300)})})})}()});
1
+ !function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e.setAttribute("unselectable","on"),e},highlight:function(t,s){if(dgwt_wcas.is_premium){var i,o=s.split(/ /),a=!1,n="";if(o)for(n=o[o.length-1],o=o.sort(function(t,e){return e.length-t.length}),i=0;i<o.length;i++)if(o[i]&&o[i].length>=1){var r=o[i].replace(/[\^\@]/g,"");if(r.length>0){if(1===r.trim().length&&o[i]!==n)var l="((\\s|^)"+e.escapeRegExChars(r.trim())+"\\s)";else l=1===r.trim().length&&o[i]===n?"((\\s|^)"+e.escapeRegExChars(r.trim())+")":"("+e.escapeRegExChars(r.trim())+")";t=t.replace(new RegExp(l,"gi"),"^^$1@@"),a=!0}}a&&(t=(t=t.replace(/\^\^/g,"<strong>")).replace(/@@/g,"</strong>"))}else l="("+e.escapeRegExChars(s)+")",t=t.replace(new RegExp(l,"gi"),"<strong>$1</strong>");return t},debounce:function(t,e){var i,o=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=o,void t();s.id=o,i=setTimeout(function(){o===s.id?(t(),s.id=""):clearTimeout(i)},e)},mouseHoverDebounce:function(e,s,i){var o;o=setTimeout(function(){t(s+":hover").length>0?e():clearTimeout(o)},i)},getActiveInstance:function(){var e,s=t(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=t(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return e=s.data("autocomplete"),!1}),e},hashCode:function(t){for(var e=0,s=t.length;s>0;)e=(e<<5)-e+t.charCodeAt(--s)|0;return e<0?-1*e:e}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,o=9,a=13,n=38,r=39,l=40,c=t.noop;function d(e,s){this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.detailsRequestsSent=[],this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.autoAligmentprocess=null,this.noSuggestionsContainer=null,this.latestActivateSource="",this.actionTriggerSource="",this.options=t.extend(!0,{},d.defaults,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.isMouseDownOnSearchElements=!1,this.initialize(),this.setOptions(s)}d.utils=e,t.DgwtWcasAutocompleteSearch=d,d.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,dynamicPrices:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:function(t,s,i,o){if(!s)return t;i&&(t=e.highlight(t,s));if(!o.convertHtml)return t;return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/&lt;sup/g,"<sup").replace(/&lt;\/sup/g,"</sup").replace(/sup&gt;/g,"sup>").replace(/&lt;(\/?(strong|b|br|span))&gt;/g,"<$1>").replace(/&lt;(strong|span)\s+class\s*=\s*&quot;([^&]+)&quot;&gt;/g,'<$1 class="$2">')},delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",formClass:"dgwt-wcas-search-form",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(t){return"string"==typeof t?JSON.parse(t):t},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0,enableGASiteSearchModule:!1,showProductVendor:!1,disableHits:!1,disableSubmit:!1},d.prototype={initialize:function(){var s=this;s.element.setAttribute("autocomplete","off"),s.createContainers(),s.registerEventsSearchBar(),s.registerEventsSuggestions(),s.registerEventsDetailsPanel(),s.registerIconHandler(),s.registerEventsFixedMenu(),s.fixPositionCapture=function(){s.adjustContainerWidth(),s.visible&&s.fixPosition()},t(window).on("resize.autocomplete",function(){var t=e.getActiveInstance();void 0!==t&&t.fixPositionCapture()}),s.initMobileMode(),s.hideAfterClickOutsideListener(),s.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),s.detailsContainer&&s.detailsContainer.length>0&&s.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(e){var s=this.options;0==t("."+s.containerClass).length?(this.suggestionsContainer=t(d.utils.createNode(s.containerClass)),this.suggestionsContainer.appendTo(s.appendTo||"body"),this.suggestionsContainer.addClass("woocommerce"),!0===s.showImage&&this.suggestionsContainer.addClass("dgwt-wcas-has-img"),!0===s.showPrice&&this.suggestionsContainer.addClass("dgwt-wcas-has-price"),!0===s.showDescription&&this.suggestionsContainer.addClass("dgwt-wcas-has-desc"),!0===s.showSKU&&this.suggestionsContainer.addClass("dgwt-wcas-has-sku"),!0===s.showHeadings&&this.suggestionsContainer.addClass("dgwt-wcas-has-headings"),"auto"!==s.width&&this.suggestionsContainer.width(s.width)):this.suggestionsContainer=t("."+this.options.containerClass),this.canShowDetailsBox()&&(0==t("."+s.containerDetailsClass).length?(this.detailsContainer=t(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=t("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;t(document).on("click.autocomplete","."+s.options.closeTrigger,function(){e.getActiveInstance().close()}),s.el.closest("."+s.options.formClass).on("submit.autocomplete",function(e){if(s.options.disableSubmit)return e.preventDefault(),!1;var i=t(this).find("."+s.options.searchInputClass);if(i.length&&0===i.val().length)return e.preventDefault(),!1;s.suggestions.length>0&&t.each(s.suggestions,function(t,i){if(void 0!==i.type&&"product_variation"==i.type)return s.select(t),e.preventDefault(),!1}),s.disableOverlayMobile()}),"complete"===document.readyState?s.positionPreloader():t(window).on("load",function(){s.positionPreloader()}),s.el.on("keydown.autocomplete",function(t){s.onKeyPress(t)}),s.el.on("keyup.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("input.autocomplete",function(t){s.onKeyUp(t)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;if(!this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")){t(document).on("mouseenter.autocomplete",s,function(){var s=e.getActiveInstance();if(void 0!==s){var i=t(this).data("index"),o='.dgwt-wcas-suggestion[data-index="'+i+'"]',a=s.canShowDetailsBox()?100:1;s.selectedIndex!=i&&e.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.latestActivateSource="mouse",s.getDetails(s.suggestions[i]),s.activate(i))},o,a)}});var i=!1;t(document).on("click.autocomplete",s,function(s){if(i)s.preventDefault();else{var o=e.getActiveInstance();o.actionTriggerSource="click",i=!0,setTimeout(function(){i=!1},500),void 0!==s.ctrlKey&&!1!==s.ctrlKey||(o.select(t(this).data("index")),s.preventDefault())}}),t(document).on("mousedown.autocomplete",s,function(s){var o=this;0===s.button&&setTimeout(function(){i||e.getActiveInstance().select(t(o).data("index"))},250)}),t("."+this.options.containerClass).on("mousedown.autocomplete",function(t){e.getActiveInstance().isMouseDownOnSearchElements=!0})}},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(t(document).on("change.autocomplete",'[name="js-dgwt-wcas-quantity"]',function(e){t(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",t(this).val())}),t("."+this.options.containerDetailsClass).on("mousedown.autocomplete",function(t){e.getActiveInstance().isMouseDownOnSearchElements=!0}))},registerIconHandler:function(){var s=this,i=s.getFormWrapper(),o=i.find("."+s.options.formClass);i.on("click.autocomplete",".js-dgwt-wcas-search-icon-handler",function(t){var e=i.find("."+s.options.searchInputClass);if(i.hasClass("dgwt-wcas-layout-icon-open"))s.hide(),o.hide(!0),i.removeClass("dgwt-wcas-layout-icon-open");else{var a=i.find(".dgwt-wcas-search-icon-arrow");o.hide(),a.hide(),i.addClass("dgwt-wcas-layout-icon-open"),s.positionIconSearchMode(i),o.fadeIn(200,function(){a.show(),s.positionPreloader(i),e.focus()})}}),0==t(".js-dgwt-wcas-initialized").length&&t(".js-dgwt-wcas-search-icon-handler").length>0&&t(document).on("click.autocomplete",function(i){if(t(".dgwt-wcas-layout-icon-open").length){var o=t(i.target);if(!(o.closest("."+s.options.searchFormClass).length>0||o.closest("."+s.options.containerClass).length>0||o.closest("."+s.options.containerDetailsClass).length>0)){var a=e.getActiveInstance();if(void 0!==a){var n=a.getFormWrapper().find("."+s.options.formClass);n.hide(),a.hide(!0),n.css({left:"0"})}s.hideIconModeSearch()}}}),t(window).on("resize.autocomplete",function(){s.applyFlexibleMode()}),"complete"==document.readyState?s.applyFlexibleMode():t(window).on("load.autocomplete",function(){s.applyFlexibleMode()})},registerEventsFixedMenu:function(){var e=this;t(window).on("scroll.autocomplete",function(){if(e.suggestions.length>0&&e.elementOrParentIsFixed(e.getFormWrapper()))if(0===t(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(t){setTimeout(function(){e.fixHeight(),e.fixPositionCapture()},t)})}else e.fixHeight(),e.fixPositionCapture()})},initMobileMode:function(){var t=this,e=t.getFormWrapper();e.hasClass("js-dgwt-wcas-mobile-overlay-enabled")&&t.isMobileMode()&&(e.prepend('<div class="js-dgwt-wcas-enable-mobile-form dgwt-wcas-enable-mobile-form"></div>'),e.find(".js-dgwt-wcas-enable-mobile-form").on("click.autocomplete",function(e){t.options.mobileOverlayDelay>0?setTimeout(function(){t.enableOverlayMobile()},t.options.mobileOverlayDelay):t.enableOverlayMobile()}))},applyFlexibleMode:function(){var e=t(".js-dgwt-wcas-layout-icon-flexible");e.length&&(this.isMobileMode()?(e.addClass("js-dgwt-wcas-layout-icon"),e.addClass("dgwt-wcas-layout-icon")):(e.removeClass("js-dgwt-wcas-layout-icon"),e.removeClass("dgwt-wcas-layout-icon")),e.addClass("dgwt-wcas-layout-icon-flexible-loaded"))},onFocus:function(){t("."+this.options.searchFormClass).removeClass("dgwt-wcas-active"),this.getFormWrapper().addClass("dgwt-wcas-active"),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){var e=this.options,s=this.el.val(),i=this.getQuery(s);this.isMobileMode()||this.isMouseDownOnSearchElements||(this.hide(),this.selection&&this.currentValue!==i&&(e.onInvalidateSelection||t.noop).call(this.element))},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=this,i=s.getSuggestionsContainer(),o=t.extend({},s.options,e);(s.isLocal=Array.isArray(o.lookup),s.isLocal&&(o.lookup=s.verifySuggestionsFormat(o.lookup)),o.orientation=s.validateOrientation(o.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":o.maxHeight+"px",width:o.width+"px","z-index":o.zIndex}),!0===o.showDetailsPanel)&&s.getDetailsContainer().css({"z-index":o.zIndex-1});o.onSearchComplete=function(){s.getFormWrapper().removeClass("dgwt-wcas-processing"),s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.showCloseButton()},this.options=o},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.cachedPrices={},this.badQueries=[]},clear:function(t){t&&this.clearCache(),this.currentValue="",this.suggestions=[]},close:function(){this.hide(),this.clear(!1),this.hideCloseButton(),this.el.closest("."+this.options.searchFormClass).find("."+this.options.searchInputClass).val("").focus()},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this.getFormOffset();this.getSuggestionsContainer().css(t),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.getDetailsContainer(),o=this.getFormOffset(),a=o.left;if(0==i.length)return!1;var n=!0===this.options.isRtl?1:2,r=Math.round(o.left);if(o.left=r+Math.round(s.width()+n),i.css(o),e.width()>=550)return t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(s.css("left",r+Math.round(i.width()+n)+"px"),i.css("left",a+"px")));var l=t(window).width(),c=i.width(),d=i.offset();t("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(o.left=o.left+1);var g=!1,u=!1;l<d.left+c&&(g=!0,t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-left"),i.css("left",Math.round(parseFloat(s.css("left").replace("px","")))-i.outerWidth()+"px")),(d=i.offset()).left<1&&(u=!0,t("body").removeClass("dgwt-wcas-details-left"),t("body").addClass("dgwt-wcas-details-right")),u&&g?(t("body").removeClass("dgwt-wcas-details-left"),t("body").removeClass("dgwt-wcas-details-right"),t("body").addClass("dgwt-wcas-details-notfit")):t("body").removeClass("dgwt-wcas-details-notfit")},fixHeight:function(){if(1!=this.options.showDetailsPanel)return!1;var t=this.getSuggestionsContainer(),e=this.getDetailsContainer();t.css("height","auto"),e.css("height","auto");var s=t.outerHeight(),i=e.outerHeight();return t.find(".dgwt-wcas-suggestion:last-child").removeClass("dgwt-wcas-suggestion-no-border-bottom"),!(s<=340&&i<=340)&&(t.find(".dgwt-wcas-suggestion:last-child").addClass("dgwt-wcas-suggestion-no-border-bottom"),i<s&&e.css("height",s+"px"),s<i&&t.css("height",i+"px"),!1)},automaticAlignment:function(){var t=this,e=t.getFormWrapper().find(".dgwt-wcas-search-input"),s=t.getSuggestionsContainer(),i=t.getDetailsContainer();if(null==t.autoAligmentprocess){var o=[e.width(),s.height()];t.options.showDetailsPanel&&(o[2]=i.height()),t.autoAligmentprocess=setInterval(function(){var a=[e.width(),s.height()];t.options.showDetailsPanel&&(a[2]=i.height());for(var n=0;n<o.length;n++)if(o[n]!=a[n]){t.fixHeight(),t.fixPositionCapture(),o=a;break}t.options.showDetailsPanel&&(i.find(".dgwt-wcas-details-inner").height()-i.height()>2&&t.fixHeight())},10)}},getFormOffset:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,o=e.outerHeight(),a=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=t(window).height(),c=t(window).scrollTop(),d=-c+n.top-o,g=c+l-(n.top+a+o);i=Math.max(d,g)===d?"top":"bottom"}if("top"===i){s[0].getBoundingClientRect().top;var u=e[0].getBoundingClientRect().top;s.css("height","auto"),u<s.height()&&s.height(u-10),r.top+=-s.outerHeight()}else r.top+=a;return r},getFormWrapper:function(){return this.el.closest("."+this.options.searchFormClass)},getSuggestionsContainer:function(){return t("."+this.options.containerClass)},getDetailsContainer:function(){return t("."+this.options.containerDetailsClass)},scrollDownSuggestions:function(){var t=this.getSuggestionsContainer();t[0].scrollTop=t[0].scrollHeight},isCursorAtEnd:function(){var t,e=this.el.val().length,s=this.element.selectionStart;return"number"==typeof s?s===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(t){if(this.disabled||this.visible||t.which!==l||!this.currentValue){if(!this.disabled&&this.visible){switch(t.which){case i:this.el.val(this.currentValue),this.hide();break;case r:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case o:if(this.hint&&this.options.onHint)return void this.selectHint();if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),!1===this.options.tabDisabled)return;break;case a:if(-1===this.selectedIndex)return!this.options.disableSubmit&&void this.hide();this.actionTriggerSource="enter",this.select(this.selectedIndex);break;case n:this.moveUp();break;case l:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}}else this.suggest()},onKeyUp:function(t){var e=this;if(!e.disabled){switch(t.which){case n:case l:return}clearTimeout(e.onChangeTimeout),e.currentValue!==e.el.val()&&(e.findBestHint(),e.options.deferRequestBy>0?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.length<e.minChars?(this.hideCloseButton(),this.hide()):this.getSuggestions(i)}},isExactMatch:function(t){var e=this.suggestions;return 1===e.length&&e[0].value.toLowerCase()===t.toLowerCase()},canShowDetailsBox:function(){return 1==this.options.showDetailsPanel&&!this.isMobileMode()},isMobileMode:function(){return t(window).width()<this.options.mobileBreakpoint},getQuery:function(e){var s,i=this.options.delimiter;return i?(s=e.split(i),t.trim(s[s.length-1])):e.trim()},getSuggestionsLocal:function(e){var s,i=this.options,o=e.toLowerCase(),a=i.lookupFilter,n=parseInt(i.lookupLimit,10);return s={suggestions:t.grep(i.lookup,function(t){return a(t,e,o)})},n&&s.suggestions.length>n&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(i){var o,a,n,r,l=this,c=l.options,d=c.serviceUrl,g=l.getFormWrapper();c.params[c.paramName]=i,void 0!==dgwt_wcas.current_lang&&(c.params.l=dgwt_wcas.current_lang),c.params=l.applyCustomParams(c.params),l.preloader("show","form","dgwt-wcas-inner-preloader"),g.addClass("dgwt-wcas-processing"),!1!==c.onSearchStart.call(l.element,c.params)&&(a=c.ignoreParams?null:c.params,t.isFunction(c.lookup)?c.lookup(i,function(t){l.suggestions=t.suggestions,l.suggest(),l.selectFirstSuggestion(t.suggestions),c.onSearchComplete.call(l.element,i,t.suggestions)}):(l.isLocal?o=l.getSuggestionsLocal(i):(t.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+t.param(a||{}),o=l.cachedResponse[n]),o&&Array.isArray(o.suggestions)?(l.suggestions=o.suggestions,l.suggest(),l.selectFirstSuggestion(o.suggestions),c.onSearchComplete.call(l.element,i,o.suggestions)):l.isBadQuery(i)?c.onSearchComplete.call(l.element,i,[]):(l.abortAjax(),r={url:d,data:a,type:c.type,dataType:c.dataType},t.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,e.debounce(function(){var e=s.object,o=s.ajaxSettings;e.currentRequest=t.ajax(o).done(function(t){var s;e.currentRequest=null,void 0!==(s=e.options.transformResult(t,i)).suggestions&&(e.processResponse(s,i,n),e.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?e.gaEvent(i,"Autocomplete Search without results"):e.gaEvent(i,"Autocomplete Search with results")),e.fixPositionCapture(),e.options.onSearchComplete.call(e.element,i,s.suggestions),e.updatePrices()}).fail(function(t,s,o){e.options.onSearchError.call(e.element,i,t,s,o)})},c.debounceWaitMs))))},getDetails:function(e){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=e&&void 0!==e.type&&("string"!=typeof e.type||"more_products"!==e.type)){s.fixHeight();s.getDetailsContainer();var i=s.prepareSuggestionObjectID(e);if(null!=s.cachedDetails[i])s.detailsPanelSetScene(i),s.fixHeight(),s.fixPositionCapture();else{var o={action:dgwt_wcas.action_result_details,items:[]};if(t.each(s.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type){var i={objectID:s.prepareSuggestionObjectID(e),value:null!=e.value?e.value:""};o.items.push(i)}}),s.detailsPanelClearScene(),s.preloader("show","details",""),-1!=t.inArray(i,s.detailsRequestsSent))return;s.detailsRequestsSent.push(i),t.ajax({data:o,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(t){var e="string"==typeof t?JSON.parse(t):t;if(void 0!==e.items)for(var i=0;i<e.items.length;i++){var o=e.items[i].objectID;s.cachedDetails[o]={html:e.items[i].html},s.detailsPanelAddToScene(o),void 0!==e.items[i].price&&e.items[i].price.length>0&&(s.cachedPrices[o]=e.items[i].price)}s.preloader("hide","details","");var a=s.prepareSuggestionObjectID(s.suggestions[s.selectedIndex]);null!=s.cachedDetails[a]?s.detailsPanelSetScene(a):s.detailsPanelClearScene(),s.fixPositionCapture(),s.fixHeight(),s.updatePrices(!0)},error:function(t,e){s.preloader("hide","details",""),s.detailsPanelClearScene(),s.fixPositionCapture(),s.fixHeight()}})}t(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},updatePrices:function(e){var s,i,o=this,a=[];if(o.options.showPrice&&o.options.dynamicPrices&&0!=o.suggestions.length){for(s=0;s<o.suggestions.length;s++)if(void 0!==o.suggestions[s].type&&("product"==o.suggestions[s].type||"product_variation"==o.suggestions[s].type)){var n="product__"+o.suggestions[s].post_id;void 0!==o.cachedPrices[n]?o.updatePrice(s,o.cachedPrices[n]):(o.applyPreloaderForPrice(s),a.push(o.suggestions[s].post_id))}if(!e&&a.length>0){var r={action:void 0===dgwt_wcas.action_get_prices?"dgwt_wcas_get_prices":dgwt_wcas.action_get_prices,items:a};t.ajax({data:r,type:"post",url:dgwt_wcas.ajax_prices_endpoint,success:function(t){if(void 0!==t.success&&t.success&&t.data.length>0)for(s=0;s<t.data.length;s++){var e=t.data[s].id,a=t.data[s].price;if(o.suggestions.length>0)for(i=0;i<o.suggestions.length;i++)if(void 0!==o.suggestions[i].type&&("product"==o.suggestions[i].type||"product_variation"==o.suggestions[i].type)&&o.suggestions[i].post_id==e){var n="product__"+e;o.cachedPrices[n]=a,o.updatePrice(i,a)}}},error:function(t,e){}})}}},updatePrice:function(e,s){if(void 0!==this.suggestions[e]){this.suggestions[e].price=s;var i=t(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+e+'"] .dgwt-wcas-sp');i.length&&i.html(s)}},applyCustomParams:function(t){if("object"==typeof dgwt_wcas.custom_params){var e=dgwt_wcas.custom_params;for(var s in e)t[s]=e[s]}var i=this.el.data("custom-params");if("object"==typeof i)for(var s in i)t[s]=i[s];return t},applyPreloaderForPrice:function(e){if(void 0!==this.suggestions[e]){var s=t(".dgwt-wcas-suggestions-wrapp").find('[data-index="'+e+'"] .dgwt-wcas-sp');s.length&&s.html('<div class="dgwt-wcas-preloader-price"><div class="dgwt-wcas-preloader-price-inner"> <div></div><div></div><div></div></div></div>')}},prepareSuggestionObjectID:function(t){var e="";return void 0!==t&&void 0!==t.type&&(null!=t.post_id&&(e=t.type+"__"+t.post_id,"product_variation"===t.type&&(e+="__"+t.variation_id),void 0!==t.post_type&&(e=t.type+"__"+t.post_id+"__"+t.post_type)),null!=t.term_id&&null!=t.taxonomy&&(e=t.type+"__"+t.term_id+"__"+t.taxonomy)),e},detailsPanelSetScene:function(t){var s=this.getDetailsContainer(),i=e.hashCode(t),o=s.find('.dgwt-wcas-details-inner[data-object="'+i+'"]');o.length&&(this.preloader("hide","details",""),this.detailsPanelClearScene(),o.addClass("dgwt-wcas-details-inner-active"))},detailsPanelAddToScene:function(t){var s=this.getDetailsContainer(),i=this.cachedDetails[t],o=e.hashCode(t),a="";void 0!==i&&"string"==typeof i.html&&(a=i.html.replace("<div ",'<div data-object="'+o+'" ')),0==s.find('.dgwt-wcas-details-inner[data-object="'+o+'"]').length&&s.append(a)},detailsPanelClearScene:function(){var t=this.getDetailsContainer().find(".dgwt-wcas-details-inner");t.length&&t.removeClass("dgwt-wcas-details-inner-active")},selectFirstSuggestion:function(e){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=e&&e.length>0&&t.each(this.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type&&"no-results"!=e.type)return s=t,!1;void 0!==e.type&&"no-results"!==e.type||(i=!0)}),i||(this.latestActivateSource="system",this.getDetails(e[s]),this.activate(s)))},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(e){this.getFormWrapper();var s=this.getSuggestionsContainer(),i=this.getDetailsContainer();t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),s.hide(),s.removeClass(this.classes.suggestionsContainerOrientTop),i.hide(),t("body").removeClass("dgwt-wcas-open"),t("body").removeClass("dgwt-wcas-block-scroll"),t("body").removeClass("dgwt-wcas-is-details"),t("body").removeClass("dgwt-wcas-full-width"),t("body").removeClass("dgwt-wcas-nores"),t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),"boolean"==typeof e&&e&&(this.hideCloseButton(),this.currentValue="",this.suggestions=[]),this.signalHint(null)},positionIconSearchMode:function(e){var s=-20,i=e.find("."+this.options.formClass),o=i.width(),a=t(window).width(),n=e[0].getBoundingClientRect().left;i[0].getBoundingClientRect().left;var r=(n+10)/a;s=Math.floor(o*r*-1),s=Math.max(s,-1*n),i.css({left:s+"px"})},hideIconModeSearch:function(){var e=t(".dgwt-wcas-layout-icon-open");e.length>0&&e.removeClass("dgwt-wcas-layout-icon-open")},hideAfterClickOutsideListener:function(){var e=this;e.isMobileMode()||t(document).mouseup(function(s){if(e.visible){e.getSuggestionsContainer(),e.getDetailsContainer();var i=!(t(s.target).closest("."+e.options.searchFormClass).length>0||t(s.target).hasClass(e.options.searchFormClass)),o=!(t(s.target).closest("."+e.options.containerClass).length>0||t(s.target).hasClass(e.options.containerClass));if(e.canShowDetailsBox()){var a=!(t(s.target).closest("."+e.options.containerDetailsClass).length>0||t(s.target).hasClass(e.options.containerDetailsClass));i&&o&&a&&e.hide()}else i&&o&&e.hide()}})},suggest:function(){if(this.suggestions.length){var e,s=this,i=s.options,o=i.groupBy,a=i.formatResult,n=s.getQuery(s.currentValue),r=s.classes.suggestion,l=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),g=t(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(t("body").removeClass("dgwt-wcas-nores"),t.each(s.suggestions,function(l,c){var d="",g=!1,u="string"==typeof c.url&&c.url.length?c.url:"#";if(o&&(h+=function(t,s){var i=t.data[o];return e===i?"":'<div class="autocomplete-group"><strong>'+(e=i)+"</strong></div>"}(c,0)),void 0===c.type||"product"!=c.type&&"product_variation"!=c.type){var p,w=r,f="dgwt-wcas-st",m="",v="",b="",y=!0;"product_cat"===c.taxonomy?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels["tax_"+c.taxonomy]+"</span>"),void 0!==c.breadcrumbs&&c.breadcrumbs&&(b=c.breadcrumbs+" &gt; "+c.value,v+='<span class="dgwt-wcas-st-breadcrumbs">'+dgwt_wcas.labels.in+" "+c.breadcrumbs+"</span>")):"product_tag"===c.taxonomy?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels["tax_"+c.taxonomy]+"</span>")):i.isPremium&&c.taxonomy===i.taxonomyBrands?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels["tax_"+c.taxonomy]+"</span>")):i.isPremium&&"taxonomy"===c.type?(w+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tax-"+c.taxonomy,i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels["tax_"+c.taxonomy]+"</span>")):i.isPremium&&"vendor"===c.type?(w+=" dgwt-wcas-suggestion-vendor dgwt-wcas-suggestion-vendor",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.vendor+"</span>")):i.isPremium&&"post"===c.type?(w+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-tp-post",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.post+"</span>")):i.isPremium&&"page"===c.type?(w+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-pt-page",i.showHeadings||(m+='<span class="dgwt-wcas-st--direct-headline">'+dgwt_wcas.labels.page+"</span>")):"more_products"===c.type?(w+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",f="dgwt-wcas-st-more",c.value=dgwt_wcas.labels.show_more+" ("+c.total+")",y=!1):i.showHeadings&&"headline"===c.type?(w+=" js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline",void 0!==dgwt_wcas.labels[c.value+"_plu"]&&(c.value=dgwt_wcas.labels[c.value+"_plu"]),y=!1):(w+=" dgwt-wcas-suggestion-nores",c.value=dgwt_wcas.labels.no_results,y=!1,!0===i.showDetailsPanel&&s.detailsPanelClearScene(),t("body").addClass("dgwt-wcas-nores")),void 0!==c.image_src&&c.image_src&&(p=!0),b=b.length>0?' title="'+b+'"':"",h+='<a href="'+u+'" class="'+w+'" data-index="'+l+'">',p&&(h+='<span class="dgwt-wcas-si"><img src="'+c.image_src+'" /></span>',h+='<div class="dgwt-wcas-content-wrapp">'),h+="<span"+b+' class="'+f+'">',"vendor"===c.type?(h+='<span class="dgwt-wcas-st-title">'+m+a(c.value,n,y,i)+v+"</span>",c.shop_city&&(h+='<span class="dgwt-wcas-vendor-city"><span> - </span>'+a(c.shop_city,n,!0,i)+"</span>"),void 0!==c.desc&&c.desc&&(h+='<span class="dgwt-wcas-sd">'+a(c.desc,n,!0,i)+"</span>")):h+=m+a(c.value,n,y,i)+v,h+="</span>",h+=p?"</div>":"",h+="</a>"}else{!0===i.showImage&&void 0!==c.thumb_html&&(g=!0);var C="product_variation"===c.type?" dgwt-wcas-suggestion-product-var":"";if(d+=void 0!==c.post_id?'data-post-id="'+c.post_id+'" ':"",d+=void 0!==c.taxonomy?'data-taxonomy="'+c.taxonomy+'" ':"",d+=void 0!==c.term_id?'data-term-id="'+c.term_id+'" ':"",h+='<a href="'+u+'" class="'+r+" dgwt-wcas-suggestion-product"+C+'" data-index="'+l+'" '+d+">",g&&(h+='<span class="dgwt-wcas-si">'+c.thumb_html+"</span>"),h+=g?'<div class="dgwt-wcas-content-wrapp">':"",h+='<div class="dgwt-wcas-st">',void 0!==c.title_before&&c.title_before&&(h+=c.title_before),h+='<span class="dgwt-wcas-st-title">'+a(c.value,n,!0,i)+"</span>",void 0!==c.title_after&&c.title_after&&(h+=c.title_after),!0===i.showSKU&&void 0!==c.sku&&c.sku.length>0&&(h+='<span class="dgwt-wcas-sku">('+dgwt_wcas.labels.sku_label+" "+a(c.sku,n,!0,i)+")</span>"),!0===i.showDescription&&void 0!==c.desc&&c.desc&&(h+='<span class="dgwt-wcas-sd">'+a(c.desc,n,!0,i)+"</span>"),!0===i.showProductVendor&&void 0!==c.vendor&&c.vendor){var _='<span class="dgwt-wcas-product-vendor"><span class="dgwt-wcas-product-vendor-label">'+dgwt_wcas.labels.vendor_sold_by+" </span>"+c.vendor+"</span>";void 0!==c.vendor_url&&c.vendor_url?h+='<span class="dgwt-wcas-product-vendor-link" data-url="'+c.vendor_url+'">'+_+"</span>":h+=_}void 0!==c.content_after&&c.content_after&&(h+=c.content_after),h+="</div>";var x=!0===i.showPrice&&void 0!==c.price,S=void 0!==c.meta_before,P=void 0!==c.meta_after,D=x||S||P;h+=D?'<div class="dgwt-wcas-meta">':"",S&&(h+=c.meta_before),x&&(h+='<span class="dgwt-wcas-sp">'+c.price+"</span>"),P&&(h+=c.meta_after),h+=D?"</div>":"",h+=g?"</div>":"",h+="</a>"}}),this.adjustContainerWidth(),g.detach(),c.html(h),t.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),t("body").addClass("dgwt-wcas-open"),s.isMouseDownOnSearchElements=!1,s.automaticAlignment(),!0===i.showDetailsPanel&&(t("body").addClass("dgwt-wcas-is-details"),d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+r).first().addClass(l)),s.visible=!0,s.fixPositionCapture(),"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),t("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var e,s=this.options,i=t("body"),o=this.getFormWrapper(),a=this.getSuggestionsContainer(),n=this.getDetailsContainer(),r=this.getFormOffset();if(o.length){var l=getComputedStyle(o[0]).width;if(l=Math.round(parseFloat(l.replace("px",""))),"auto"===s.width&&(e=this.el.outerWidth(),a.css("width",e+"px")),this.canShowDetailsBox()){if(o.width()>=550)return i.addClass("dgwt-wcas-full-width"),l%2==0?(a.css("width",Math.round(l/2)),n.css("width",Math.round(l/2))):(a.css("width",Math.floor(l/2)),n.css("width",Math.ceil(l/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):a.css("left",l/2+r.left+"px"));i.addClass("dgwt-wcas-details-right")}}},positionPreloader:function(e){var s="object"==typeof e?e.find(".dgwt-wcas-search-submit"):t(".dgwt-wcas-search-submit");s.length>0&&s.each(function(){var e=t(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?e.css("left",6+t(this).outerWidth()+"px"):e.css("right",t(this).outerWidth()+"px")})},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var o=0===i.value.toLowerCase().indexOf(e);return o&&(s=i),!o}),this.signalHint(s))},signalHint:function(e){var s="";e&&(s=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=e,(this.options.onHint||t.noop)(s))},preloader:function(t,e,s){var i,o,a="dgwt-wcas-preloader-wrapp",n=null==s?a:a+" "+s;if("form"===e){if(1!=dgwt_wcas.show_preloader)return;o=this.getFormWrapper().find(".dgwt-wcas-preloader")}else"details"===e&&(o=this.getDetailsContainer());if(0!=o.length)if("form"!==e){var r=o.find("."+a);if("hide"!==t){if("show"===t){var l=this.options.isRtl?"-rtl":"";i='<div class="'+n+'"><img class="dgwt-wcas-placeholder-preloader" src="'+dgwt_wcas.img_url+"placeholder"+l+'.png" /></div>',this.detailsPanelClearScene(),r.length&&r.remove(),o.prepend(i)}}else r.length&&r.remove()}else"hide"===t?(o.removeClass(s),o.html("")):(o.addClass(s),"string"==typeof dgwt_wcas.preloader_icon&&o.html(dgwt_wcas.preloader_icon))},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&t.suggestions.reverse(),this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,o=this.getSuggestionsContainer(),a=o.find("."+this.classes.suggestion);return o.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&a.length>this.selectedIndex?(s=a.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.options.disableHits||(this.disableOverlayMobile(),this.hide(),this.onSelect(t))},moveUp:function(){if(-1!==this.selectedIndex){if(this.latestActivateSource="key",0===this.selectedIndex)return this.getSuggestionsContainer().children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint();this.adjustScroll(this.selectedIndex-1,"up")}},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&(this.latestActivateSource="key",this.adjustScroll(this.selectedIndex+1,"down"))},adjustScroll:function(e,s){if("headline"===this.suggestions[e].type&&(e="down"===s?e+1:e-1),void 0!==this.suggestions[e]){var i=this.activate(e);if(this.getDetails(this.suggestions[e]),"more_products"!==this.suggestions[e].type&&i&&!this.canShowDetailsBox()){var o,a,n,r=this.getSuggestionsContainer(),l=t(i).outerHeight();o=i.offsetTop,n=(a=r.scrollTop())+this.options.maxHeight-l,o<a?r.scrollTop(o):o>n&&r.scrollTop(o-this.options.maxHeight+l),this.options.preserveInput||(this.ignoreValueChange=!0),this.signalHint(null)}}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];void 0===i.type||"more_products"!==i.type&&("enter"!==this.actionTriggerSource||"key"==this.latestActivateSource||"product_variation"==i.type)?(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue.replace(/(<([^>]+)>)/gi," ").replace(/\s\s+/g," ")),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i)):this.el.closest("form").trigger("submit")},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){var e=this.el,s=this.getFormWrapper(),i=this.getSuggestionsContainer(),o=(this.getDetailsContainer(),e.closest("."+this.options.formClass),s.find(".js-dgwt-wcas-enable-mobile-form"));s.length&&s.find("*").each(function(){t(this).off(".autocomplete")});e.removeData("autocomplete"),t(window).off("resize.autocomplete",this.fixPositionCapture),s.removeClass("dgwt-wcas-active"),this.close(),o.length&&o.remove(),i.length&&i.html("")},enableOverlayMobile:function(){var e=this;if("on"!==e.overlayMobileState){e.overlayMobileState="on";var s,i=e.getFormWrapper(),o=e.getSuggestionsContainer(),a="";t("html").addClass("dgwt-wcas-overlay-mobile-on"),a+='<div class="js-dgwt-wcas-overlay-mobile dgwt-wcas-overlay-mobile">',a+='<div class="dgwt-wcas-om-bar js-dgwt-wcas-om-bar">',a+='<button class="dgwt-wcas-om-return js-dgwt-wcas-om-return">',"string"==typeof dgwt_wcas.back_icon&&(a+=dgwt_wcas.back_icon),a+="</button>",a+="</div>",a+="</div>",t(e.options.mobileOverlayWrapper).append(a),(s=t(".js-dgwt-wcas-overlay-mobile")).css("zIndex",99999999999),i.after('<span class="js-dgwt-wcas-om-hook"></span>'),i.appendTo(".js-dgwt-wcas-om-bar"),o.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+e.options.searchInputClass).focus(),t(document).on("click.autocomplete",".js-dgwt-wcas-om-return",function(t){e.disableOverlayMobile(s)})}},disableOverlayMobile:function(e){var s=this;if(t("html").hasClass("dgwt-wcas-overlay-mobile-on")){var i=s.getSuggestionsContainer(),o=t(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);o.hasClass("dgwt-wcas-has-submit-off")&&(o.removeClass("dgwt-wcas-has-submit-off"),o.addClass("dgwt-wcas-has-submit")),o.removeClass("dgwt-wcas-search-wrapp-mobile"),t("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),t(".js-dgwt-wcas-om-hook").after(o),t(".js-dgwt-wcas-overlay-mobile").remove(),t(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){o.find("."+s.options.searchInputClass).val("");var t=o.find(".dgwt-wcas-close");o.length>0&&(t.removeClass("dgwt-wcas-close"),t.html("")),s.hide()},150),s.overlayMobileState="off"}},showCloseButton:function(){var t=void 0!==dgwt_wcas.close_icon?dgwt_wcas.close_icon:"",e=this.getFormWrapper().find("."+this.options.preloaderClass);e.addClass(this.options.closeTrigger),e.html(t)},hideCloseButton:function(){var t=this.getFormWrapper().find("."+this.options.closeTrigger);t.length&&(t.removeClass(this.options.closeTrigger),t.html(""))},elementOrParentIsFixed:function(e){var s=e.add(e.parents()),i=!1;return s.each(function(){if("fixed"===t(this).css("position"))return i=!0,!1}),i},gaEvent:function(t,e){var s=!(!window.hasOwnProperty("GoogleAnalyticsObject")||!window.hasOwnProperty(window.GoogleAnalyticsObject))&&window[window.GoogleAnalyticsObject];if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)gtag("event","autocomplete_search",{event_label:t,event_category:e});else if(!1!==s){var i=s.getAll()[0];i&&i.send({hitType:"event",eventCategory:e,eventAction:"autocomplete_search",eventLabel:t})}}catch(t){}if(this.options.enableGASiteSearchModule)try{if("undefined"!=typeof gtag)gtag("event","page_view",{page_path:"/?s="+encodeURI(t)+"&post_type=product&dgwt_wcas=1"});else if(!1!==s){var o=s.getAll()[0];o&&(o.set("page","/?s="+encodeURI(t)+"&post_type=product&dgwt_wcas=1"),o.send("pageview"))}}catch(t){}}},t.fn.dgwtWcasAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),o=i.data("autocomplete");"string"==typeof e?o&&"function"==typeof o[e]&&o[e](s):(o&&o.dispose&&o.dispose(),o=new d(this,e),i.data("autocomplete",o))}):this.first().data("autocomplete")},t.fn.autocomplete||(t.fn.autocomplete=t.fn.dgwtWcasAutocomplete),function(){function e(){var e=t(".dgwt-wcas-search-input"),s=[];e.length>1&&e.each(function(){var e=t(this).attr("id");if(-1==t.inArray(e,s))s.push(e);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,t(this).attr("id",i),t(this).closest("form").find("label").attr("for",i)}})}function s(){var e=t(".dgwt-wcas-search-input");e.length>0&&e.each(function(){"object"!=typeof t(this).data("autocomplete")&&t(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}navigator.userAgent.match(/Trident\/7\./)&&function(t,e){function s(t,e){var s=arguments.length>2?arguments[2]:[];if(!1===a(t))throw new TypeError(Object.prototype.toString.call(t)+"is not a function.");return t.apply(e,s)}function i(t,e,s){var i={value:s,writable:!0,enumerable:!1,configurable:!0};Object.defineProperty(t,e,i)}function o(t,e){return t[e]}function a(t){return"function"==typeof t}function n(t){if(null===t||t===e)throw TypeError();return Object(t)}function r(t,s){var i=function(t,e){return n(t)[e]}(t,s);if(null===i||i===e)return e;if(!1===a(i))throw new TypeError("Method not callable: "+s);return i}function l(e){switch(typeof e){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";default:return null===e?"null":"Symbol"in t&&(e instanceof t.Symbol||e.constructor===t.Symbol)?"symbol":"object"}}function c(s){if("object"!==l(s))return!1;var i="Symbol"in t&&"match"in t.Symbol?o(s,t.Symbol.match):e;if(i!==e)return Boolean(i);try{var a=s.lastIndex;return s.lastIndex=0,RegExp.prototype.exec.call(s),!0}catch(t){}finally{s.lastIndex=a}return!1}function d(t,e){return l(t)===l(e)&&("number"===l(t)?!(!isNaN(t)||!isNaN(e))||1/t==1/0&&1/e==-1/0||1/t==-1/0&&1/e==1/0||t===e:function(t,e){return t===e}(t,e))}function g(t){if("symbol"===l(t))throw new TypeError("Cannot convert a Symbol value to a number");var e=Number(t);return isNaN(e)?0:1/e==1/0||1/e==-1/0||e===1/0||e===-1/0?e:(e<0?-1:1)*Math.floor(Math.abs(e))}function u(i){var n=arguments.length>1?arguments[1]:e;if("object"===l(i)){if(arguments.length<2)var c="default";else n===String?c="string":n===Number&&(c="number");var d="function"==typeof t.Symbol&&"symbol"==typeof t.Symbol.toPrimitive?r(i,t.Symbol.toPrimitive):e;if(d!==e){var g=s(d,i,[c]);if("object"!==l(g))return g;throw new TypeError("Cannot convert exotic object to primitive.")}return"default"===c&&(c="number"),function(t,e){if("string"===e)var i=["toString","valueOf"];else i=["valueOf","toString"];for(var n=0;n<i.length;++n){var r=o(t,i[n]);if(a(r)){var c=s(r,t);if("object"!==l(c))return c}}throw new TypeError("Cannot convert to primitive.")}(i,c)}return i}function h(t){switch(l(t)){case"symbol":throw new TypeError("Cannot convert a Symbol value to a string");case"object":return h(u(t,String));default:return String(t)}}i(Array.prototype,"includes",function(t){var e=n(this),s=function(t){var e=g(t);return e<=0?0:Math.min(e,Math.pow(2,53)-1)}(o(e,"length"));if(0===s)return!1;var i=g(arguments[1]);if(i>=0)var a=i;else(a=s+i)<0&&(a=0);for(;a<s;){if(d(t,o(e,h(a))))return!0;a+=1}return!1}),i(String.prototype,"includes",function(t){var s=arguments.length>1?arguments[1]:e,i=h(function(t){if(null===t||t===e)throw TypeError(Object.prototype.toString.call(t)+" is not coercible to Object.");return t}(this));if(c(t))throw new TypeError("First argument to String.prototype.includes must not be a regular expression");var o=h(t),a=g(s),n=i.length,r=Math.min(Math.max(a,0),n);return-1!==String.prototype.indexOf.call(i,o,r)})}("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),t(document).ready(function(){(["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document)&&t("html").addClass("dgwt-wcas-is-ios");var e=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()<s||"ontouchend"in document)&&(e=!1),window.dgwt_wcas.config={minChars:dgwt_wcas.min_chars,width:dgwt_wcas.sug_width,autoSelectFirst:!1,triggerSelectOnValidInput:!1,serviceUrl:dgwt_wcas.ajax_search_endpoint,paramName:"s",showDetailsPanel:e,showImage:1==dgwt_wcas.show_images,showPrice:1==dgwt_wcas.show_price,showDescription:1==dgwt_wcas.show_desc,showSKU:1==dgwt_wcas.show_sku,showSaleBadge:1==dgwt_wcas.show_sale_badge,showFeaturedBadge:1==dgwt_wcas.show_featured_badge,dynamicPrices:!(void 0===dgwt_wcas.dynamic_prices||!dgwt_wcas.dynamic_prices),saleBadgeText:dgwt_wcas.labels.sale_badge,featuredBadgeText:dgwt_wcas.labels.featured_badge,isRtl:1==dgwt_wcas.is_rtl,showHeadings:1==dgwt_wcas.show_headings,isPremium:1==dgwt_wcas.is_premium,taxonomyBrands:dgwt_wcas.taxonomy_brands,mobileBreakpoint:s,mobileOverlayWrapper:dgwt_wcas.mobile_overlay_wrapper,mobileOverlayDelay:dgwt_wcas.mobile_overlay_delay,debounceWaitMs:dgwt_wcas.debounce_wait_ms,sendGAEvents:dgwt_wcas.send_ga_events,convertHtml:dgwt_wcas.convert_html,enableGASiteSearchModule:dgwt_wcas.enable_ga_site_search_module,appendTo:void 0!==dgwt_wcas.suggestions_wrapper?dgwt_wcas.suggestions_wrapper:"body",showProductVendor:!(void 0===dgwt_wcas.show_product_vendor||!dgwt_wcas.show_product_vendor),disableHits:!(void 0===dgwt_wcas.disable_hits||!dgwt_wcas.disable_hits),disableSubmit:!(void 0===dgwt_wcas.disable_submit||!dgwt_wcas.disable_submit)},t(".dgwt-wcas-search-input").dgwtWcasAutocomplete(window.dgwt_wcas.config)}),t(window).on("load",function(){var e=0,s=setInterval(function(){var i=document.activeElement;if("object"==typeof i&&t(i).length&&t(i).hasClass("dgwt-wcas-search-input")){var o=t(i).closest(".dgwt-wcas-search-wrapp");o.length&&!o.hasClass("dgwt-wcas-active")&&(o.addClass("dgwt-wcas-active"),clearInterval(s))}e>10&&clearInterval(s),e++},500)}),t(document).ready(function(){setTimeout(function(){e(),s()},500)}),t(window).on("load",function(){setTimeout(function(){e(),s()},500),void 0!==window.elementorFrontend&&void 0!==window.elementorFrontend.documentsManager&&void 0!==window.elementorFrontend.documentsManager.documents&&t.each(elementorFrontend.documentsManager.documents,function(t,e){void 0!==e.getModal&&e.getModal&&e.getModal().on("show",function(){setTimeout(function(){s()},300)})})})}()});
includes/Admin/Install.php CHANGED
@@ -3,7 +3,6 @@
3
  namespace DgoraWcas\Admin;
4
 
5
  use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Builder ;
6
- use DgoraWcas\Helpers ;
7
  // Exit if accessed directly
8
  if ( !defined( 'ABSPATH' ) ) {
9
  exit;
@@ -34,6 +33,7 @@ class Install
34
  }
35
  self::saveActivationDate();
36
  self::createOptions();
 
37
  // Update plugin version
38
  update_option( 'dgwt_wcas_version', DGWT_WCAS_VERSION );
39
  }
@@ -63,6 +63,84 @@ class Install
63
  update_option( DGWT_WCAS_SETTINGS_KEY, $updateOptions );
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * Save activation timestamp
68
  * Used to display notice, asking for a feedback
3
  namespace DgoraWcas\Admin;
4
 
5
  use DgoraWcas\Engines\TNTSearchMySQL\Indexer\Builder ;
 
6
  // Exit if accessed directly
7
  if ( !defined( 'ABSPATH' ) ) {
8
  exit;
33
  }
34
  self::saveActivationDate();
35
  self::createOptions();
36
+ self::maybeUpgradeOptions();
37
  // Update plugin version
38
  update_option( 'dgwt_wcas_version', DGWT_WCAS_VERSION );
39
  }
63
  update_option( DGWT_WCAS_SETTINGS_KEY, $updateOptions );
64
  }
65
 
66
+ private static function maybeUpgradeOptions()
67
+ {
68
+ $settingsVersion = (int) get_option( 'dgwt_wcas_settings_version', 0 );
69
+
70
+ if ( $settingsVersion < 1 ) {
71
+ if ( (int) get_option( 'dgwt_wcas_settings_version_pro', 0 ) === 0 ) {
72
+ self::upgradeOptionsTo1();
73
+ }
74
+ update_option( 'dgwt_wcas_settings_version', 1 );
75
+ DGWT_WCAS()->settings->clearCache();
76
+ }
77
+
78
+ }
79
+
80
+ private static function upgradeOptionsTo1()
81
+ {
82
+ $settings = get_option( DGWT_WCAS_SETTINGS_KEY );
83
+ if ( empty($settings) ) {
84
+ return;
85
+ }
86
+ // Product categories
87
+
88
+ if ( isset( $settings['show_matching_categories'] ) ) {
89
+ $settings['show_product_tax_product_cat'] = $settings['show_matching_categories'];
90
+ unset( $settings['show_matching_categories'] );
91
+ }
92
+
93
+
94
+ if ( isset( $settings['show_categories_images'] ) ) {
95
+ $settings['show_product_tax_product_cat_images'] = $settings['show_categories_images'];
96
+ unset( $settings['show_categories_images'] );
97
+ }
98
+
99
+
100
+ if ( isset( $settings['search_in_product_categories'] ) ) {
101
+ $settings['search_in_product_tax_product_cat'] = $settings['search_in_product_categories'];
102
+ unset( $settings['search_in_product_categories'] );
103
+ }
104
+
105
+ // Product tags
106
+
107
+ if ( isset( $settings['show_matching_tags'] ) ) {
108
+ $settings['show_product_tax_product_tag'] = $settings['show_matching_tags'];
109
+ unset( $settings['show_matching_tags'] );
110
+ }
111
+
112
+
113
+ if ( isset( $settings['search_in_product_tags'] ) ) {
114
+ $settings['search_in_product_tax_product_tag'] = $settings['search_in_product_tags'];
115
+ unset( $settings['search_in_product_tags'] );
116
+ }
117
+
118
+ // Product brands
119
+
120
+ if ( DGWT_WCAS()->brands->hasBrands() ) {
121
+
122
+ if ( isset( $settings['show_matching_brands'] ) ) {
123
+ $settings['show_product_tax_' . DGWT_WCAS()->brands->getBrandTaxonomy()] = $settings['show_matching_brands'];
124
+ unset( $settings['show_matching_brands'] );
125
+ }
126
+
127
+
128
+ if ( isset( $settings['search_in_brands'] ) ) {
129
+ $settings['search_in_product_tax_' . DGWT_WCAS()->brands->getBrandTaxonomy()] = $settings['search_in_brands'];
130
+ unset( $settings['search_in_brands'] );
131
+ }
132
+
133
+
134
+ if ( isset( $settings['show_brands_images'] ) ) {
135
+ $settings['show_product_tax_' . DGWT_WCAS()->brands->getBrandTaxonomy() . '_images'] = $settings['show_brands_images'];
136
+ unset( $settings['show_brands_images'] );
137
+ }
138
+
139
+ }
140
+
141
+ update_option( DGWT_WCAS_SETTINGS_KEY, $settings );
142
+ }
143
+
144
  /**
145
  * Save activation timestamp
146
  * Used to display notice, asking for a feedback
includes/Admin/SettingsAPI.php CHANGED
@@ -175,6 +175,7 @@ class SettingsAPI
175
  'sanitize_callback' => ( isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '' ),
176
  'type' => $type,
177
  'move_dest' => ( isset( $option['move_dest'] ) ? $option['move_dest'] : '' ),
 
178
  );
179
  add_settings_field(
180
  "{$this->name}[" . $option['name'] . ']',
@@ -295,10 +296,11 @@ class SettingsAPI
295
  );
296
  $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $this->name, $args['id'] );
297
  $html .= sprintf(
298
- '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />',
299
  $this->name,
300
  $args['id'],
301
- checked( $value, 'on', false )
 
302
  );
303
  $html .= sprintf( '<p class="%1$s-description-field">%2$s</p></label>', $this->name, $args['desc'] );
304
  $html .= '</fieldset>';
175
  'sanitize_callback' => ( isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '' ),
176
  'type' => $type,
177
  'move_dest' => ( isset( $option['move_dest'] ) ? $option['move_dest'] : '' ),
178
+ 'input_data' => ( isset( $option['input_data'] ) ? $option['input_data'] : '' ),
179
  );
180
  add_settings_field(
181
  "{$this->name}[" . $option['name'] . ']',
296
  );
297
  $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $this->name, $args['id'] );
298
  $html .= sprintf(
299
+ '<input type="checkbox" class="checkbox" id="%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s %4$s />',
300
  $this->name,
301
  $args['id'],
302
+ checked( $value, 'on', false ),
303
+ $args['input_data']
304
  );
305
  $html .= sprintf( '<p class="%1$s-description-field">%2$s</p></label>', $this->name, $args['desc'] );
306
  $html .= '</fieldset>';
includes/Engines/WordPressNative/DetailsBox.php CHANGED
@@ -84,7 +84,6 @@ class DetailsBox
84
  $items[] = array(
85
  'objectID' => $item['objectID'],
86
  'html' => $productDetails['html'],
87
- 'imageSrc' => $productDetails['imageSrc'],
88
  'price' => $productDetails['price'],
89
  );
90
  }
@@ -122,14 +121,14 @@ class DetailsBox
122
  }
123
 
124
  $details = array(
125
- 'html' => '',
126
- 'imageSrc' => '',
127
- 'price' => '',
128
  );
129
  if ( !$product->isCorrect() ) {
130
  return $details;
131
  }
132
  $thumbSize = apply_filters( 'dgwt/wcas/suggestion_details/product/thumb_size', 'woocommerce_thumbnail' );
 
133
  $wooProduct = $product->getWooObject();
134
  $vars = array(
135
  'ID' => $product->getID(),
@@ -137,6 +136,8 @@ class DetailsBox
137
  'desc' => $product->getDescription( 'details-panel' ),
138
  'link' => $product->getPermalink(),
139
  'imageSrc' => $product->getThumbnailSrc( $thumbSize ),
 
 
140
  'sku' => $product->getSKU(),
141
  'reviewCount' => $product->getReviewCount(),
142
  'ratingHtml' => $product->getRatingHtml(),
@@ -179,7 +180,6 @@ class DetailsBox
179
  );
180
  }
181
 
182
- $details['imageSrc'] = $vars->imageSrc;
183
  $details['price'] = $vars->priceHtml;
184
  return $details;
185
  }
@@ -208,13 +208,7 @@ class DetailsBox
208
  // Details panel title
209
  $title .= '<span class="dgwt-wcas-datails-title">';
210
  $title .= '<span class="dgwt-wcas-details-title-tax">';
211
-
212
- if ( 'product_cat' === $taxonomy ) {
213
- $title .= Helpers::getLabel( 'category' ) . ': ';
214
- } else {
215
- $title .= Helpers::getLabel( 'tag' ) . ': ';
216
- }
217
-
218
  $title .= '</span>';
219
  $title .= esc_html( wp_unslash( $termName ) );
220
  $title .= '</span>';
84
  $items[] = array(
85
  'objectID' => $item['objectID'],
86
  'html' => $productDetails['html'],
 
87
  'price' => $productDetails['price'],
88
  );
89
  }
121
  }
122
 
123
  $details = array(
124
+ 'html' => '',
125
+ 'price' => '',
 
126
  );
127
  if ( !$product->isCorrect() ) {
128
  return $details;
129
  }
130
  $thumbSize = apply_filters( 'dgwt/wcas/suggestion_details/product/thumb_size', 'woocommerce_thumbnail' );
131
+ $responsiveImages = apply_filters( 'dgwt/wcas/suggestion_details/responsive_images', true );
132
  $wooProduct = $product->getWooObject();
133
  $vars = array(
134
  'ID' => $product->getID(),
136
  'desc' => $product->getDescription( 'details-panel' ),
137
  'link' => $product->getPermalink(),
138
  'imageSrc' => $product->getThumbnailSrc( $thumbSize ),
139
+ 'imageSrcset' => ( $responsiveImages ? $product->getThumbnailSrcset( $thumbSize ) : '' ),
140
+ 'imageSizes' => ( $responsiveImages ? $product->getThumbnailSizes( $thumbSize ) : '' ),
141
  'sku' => $product->getSKU(),
142
  'reviewCount' => $product->getReviewCount(),
143
  'ratingHtml' => $product->getRatingHtml(),
180
  );
181
  }
182
 
 
183
  $details['price'] = $vars->priceHtml;
184
  return $details;
185
  }
208
  // Details panel title
209
  $title .= '<span class="dgwt-wcas-datails-title">';
210
  $title .= '<span class="dgwt-wcas-details-title-tax">';
211
+ $title .= Helpers::getLabel( 'tax_' . $taxonomy ) . ': ';
 
 
 
 
 
 
212
  $title .= '</span>';
213
  $title .= esc_html( wp_unslash( $termName ) );
214
  $title .= '</span>';
includes/Engines/WordPressNative/Search.php CHANGED
@@ -107,6 +107,13 @@ class Search
107
  add_action( 'wp_ajax_nopriv_' . DGWT_WCAS_SEARCH_ACTION, array( $this, 'getSearchResults' ) );
108
  add_action( 'wp_ajax_' . DGWT_WCAS_SEARCH_ACTION, array( $this, 'getSearchResults' ) );
109
  }
 
 
 
 
 
 
 
110
 
111
  }
112
 
@@ -149,18 +156,18 @@ class Search
149
  $keyword = apply_filters( 'dgwt/wcas/phrase', $keyword );
150
  /* SEARCH IN WOO CATEGORIES */
151
 
152
- if ( !$remote && array_key_exists( 'product_cat', $this->groups ) ) {
153
- $limit = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['product_cat']['limit'] );
154
  $categories = $this->getCategories( $keyword, $limit );
155
- $this->groups['product_cat']['results'] = $categories;
156
  }
157
 
158
  /* SEARCH IN WOO TAGS */
159
 
160
- if ( !$remote && array_key_exists( 'product_tag', $this->groups ) ) {
161
- $limit = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['product_tag']['limit'] );
162
  $tags = $this->getTags( $keyword, $limit );
163
- $this->groups['product_tag']['results'] = $tags;
164
  }
165
 
166
  /* SEARCH IN PRODUCTS */
@@ -198,7 +205,14 @@ class Search
198
  $orderedProducts[$i] = $post;
199
  }
200
 
201
- $orderedProducts[$i]->score = Helpers::calcScore( $keyword, $post->post_title );
 
 
 
 
 
 
 
202
  $i++;
203
  }
204
  // Sort by relevance
@@ -513,27 +527,27 @@ class Search
513
  $search = $searchand = '';
514
  if ( !empty($q['search_terms']) ) {
515
  foreach ( (array) $q['search_terms'] as $term ) {
516
- $term = esc_sql( $wpdb->esc_like( $term ) );
517
  $search .= "{$searchand} (";
518
  // Search in title
519
 
520
  if ( in_array( 'title', $this->searchIn ) ) {
521
- $search .= "({$wpdb->posts}.post_title LIKE '{$n}{$term}{$n}')";
522
  } else {
523
  $search .= "(0 = 1)";
524
  }
525
 
526
  // Search in content
527
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_content' ) === 'on' && in_array( 'content', $this->searchIn ) ) {
528
- $search .= " OR ({$wpdb->posts}.post_content LIKE '{$n}{$term}{$n}')";
529
  }
530
  // Search in excerpt
531
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_excerpt' ) === 'on' && in_array( 'excerpt', $this->searchIn ) ) {
532
- $search .= " OR ({$wpdb->posts}.post_excerpt LIKE '{$n}{$term}{$n}')";
533
  }
534
  // Search in SKU
535
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_sku' ) === 'on' && in_array( 'sku', $this->searchIn ) ) {
536
- $search .= " OR (dgwt_wcasmsku.meta_key='_sku' AND dgwt_wcasmsku.meta_value LIKE '{$n}{$term}{$n}')";
537
  }
538
  $search .= ")";
539
  $searchand = ' AND ';
@@ -635,11 +649,6 @@ class Search
635
  if ( !empty($query->query_vars['order']) ) {
636
  $order = strtolower( $query->query_vars['order'] );
637
  }
638
- $slugs = strtok( $_SERVER["REQUEST_URI"], '?' );
639
- if ( $slugs == '/' ) {
640
- $slugs = '';
641
- }
642
- $baseUrl = home_url() . $slugs . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
643
  $urlPhrase = str_replace( "\\'", "'", $phrase );
644
  $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
645
  $args = array(
@@ -649,7 +658,7 @@ class Search
649
  if ( Multilingual::isMultilingual() ) {
650
  $args['l'] = Multilingual::getCurrentLanguage();
651
  }
652
- $url = add_query_arg( $args, $baseUrl );
653
  $postIn = array();
654
  $correctResponse = false;
655
  $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
@@ -841,13 +850,13 @@ class Search
841
  public function searchResultsGroups()
842
  {
843
  $groups = array();
844
- if ( DGWT_WCAS()->settings->getOption( 'show_matching_categories' ) === 'on' ) {
845
- $groups['product_cat'] = array(
846
  'limit' => 3,
847
  );
848
  }
849
- if ( DGWT_WCAS()->settings->getOption( 'show_matching_tags' ) === 'on' ) {
850
- $groups['product_tag'] = array(
851
  'limit' => 3,
852
  );
853
  }
@@ -894,5 +903,61 @@ class Search
894
  );
895
  }
896
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
897
 
898
  }
107
  add_action( 'wp_ajax_nopriv_' . DGWT_WCAS_SEARCH_ACTION, array( $this, 'getSearchResults' ) );
108
  add_action( 'wp_ajax_' . DGWT_WCAS_SEARCH_ACTION, array( $this, 'getSearchResults' ) );
109
  }
110
+
111
+ // Labels
112
+
113
+ if ( !dgoraAsfwFs()->is_premium() ) {
114
+ add_filter( 'dgwt/wcas/labels', array( $this, 'setTaxonomiesLabels' ), 5 );
115
+ add_filter( 'dgwt/wcas/labels', array( $this, 'fixTaxonomiesLabels' ), PHP_INT_MAX - 5 );
116
+ }
117
 
118
  }
119
 
156
  $keyword = apply_filters( 'dgwt/wcas/phrase', $keyword );
157
  /* SEARCH IN WOO CATEGORIES */
158
 
159
+ if ( !$remote && array_key_exists( 'tax_product_cat', $this->groups ) ) {
160
+ $limit = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['tax_product_cat']['limit'] );
161
  $categories = $this->getCategories( $keyword, $limit );
162
+ $this->groups['tax_product_cat']['results'] = $categories;
163
  }
164
 
165
  /* SEARCH IN WOO TAGS */
166
 
167
+ if ( !$remote && array_key_exists( 'tax_product_tag', $this->groups ) ) {
168
+ $limit = ( $this->flexibleLimits ? $this->totalLimit : $this->groups['tax_product_tag']['limit'] );
169
  $tags = $this->getTags( $keyword, $limit );
170
+ $this->groups['tax_product_tag']['results'] = $tags;
171
  }
172
 
173
  /* SEARCH IN PRODUCTS */
205
  $orderedProducts[$i] = $post;
206
  }
207
 
208
+ $score = Helpers::calcScore( $keyword, $post->post_title );
209
+ $orderedProducts[$i]->score = apply_filters(
210
+ 'dgwt/wcas/search_results/product/score',
211
+ $score,
212
+ $keyword,
213
+ $post->ID,
214
+ $post
215
+ );
216
  $i++;
217
  }
218
  // Sort by relevance
527
  $search = $searchand = '';
528
  if ( !empty($q['search_terms']) ) {
529
  foreach ( (array) $q['search_terms'] as $term ) {
530
+ $like = $n . $wpdb->esc_like( $term ) . $n;
531
  $search .= "{$searchand} (";
532
  // Search in title
533
 
534
  if ( in_array( 'title', $this->searchIn ) ) {
535
+ $search .= $wpdb->prepare( "({$wpdb->posts}.post_title LIKE %s)", $like );
536
  } else {
537
  $search .= "(0 = 1)";
538
  }
539
 
540
  // Search in content
541
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_content' ) === 'on' && in_array( 'content', $this->searchIn ) ) {
542
+ $search .= $wpdb->prepare( " OR ({$wpdb->posts}.post_content LIKE %s)", $like );
543
  }
544
  // Search in excerpt
545
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_excerpt' ) === 'on' && in_array( 'excerpt', $this->searchIn ) ) {
546
+ $search .= $wpdb->prepare( " OR ({$wpdb->posts}.post_excerpt LIKE %s)", $like );
547
  }
548
  // Search in SKU
549
  if ( DGWT_WCAS()->settings->getOption( 'search_in_product_sku' ) === 'on' && in_array( 'sku', $this->searchIn ) ) {
550
+ $search .= $wpdb->prepare( " OR (dgwt_wcasmsku.meta_key='_sku' AND dgwt_wcasmsku.meta_value LIKE %s)", $like );
551
  }
552
  $search .= ")";
553
  $searchand = ' AND ';
649
  if ( !empty($query->query_vars['order']) ) {
650
  $order = strtolower( $query->query_vars['order'] );
651
  }
 
 
 
 
 
652
  $urlPhrase = str_replace( "\\'", "'", $phrase );
653
  $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
654
  $args = array(
658
  if ( Multilingual::isMultilingual() ) {
659
  $args['l'] = Multilingual::getCurrentLanguage();
660
  }
661
+ $url = add_query_arg( $args, Helpers::getAjaxSearchEndpointUrl() );
662
  $postIn = array();
663
  $correctResponse = false;
664
  $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
850
  public function searchResultsGroups()
851
  {
852
  $groups = array();
853
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_tax_product_cat' ) === 'on' ) {
854
+ $groups['tax_product_cat'] = array(
855
  'limit' => 3,
856
  );
857
  }
858
+ if ( DGWT_WCAS()->settings->getOption( 'show_product_tax_product_tag' ) === 'on' ) {
859
+ $groups['tax_product_tag'] = array(
860
  'limit' => 3,
861
  );
862
  }
903
  );
904
  }
905
  }
906
+
907
+ /**
908
+ * Add taxonomies labels
909
+ *
910
+ * @param array $labels Labels used at frontend
911
+ *
912
+ * @return array
913
+ */
914
+ public function setTaxonomiesLabels( $labels )
915
+ {
916
+ $labels['tax_product_cat_plu'] = __( 'Categories', 'woocommerce' );
917
+ $labels['tax_product_cat'] = __( 'Category', 'woocommerce' );
918
+ $labels['tax_product_tag_plu'] = __( 'Tags' );
919
+ $labels['tax_product_tag'] = __( 'Tag' );
920
+ return $labels;
921
+ }
922
+
923
+ /**
924
+ * Backward compatibility for labels
925
+ *
926
+ * Full taxonomy names for categories and tags. All with prefix 'tax_'.
927
+ *
928
+ * @param array $labels Labels used at frontend
929
+ *
930
+ * @return array
931
+ */
932
+ public function fixTaxonomiesLabels( $labels )
933
+ {
934
+ // Product category. Old: 'category', 'product_cat_plu'.
935
+
936
+ if ( isset( $labels['category'] ) ) {
937
+ $labels['tax_product_cat'] = $labels['category'];
938
+ unset( $labels['category'] );
939
+ }
940
+
941
+
942
+ if ( isset( $labels['product_cat_plu'] ) ) {
943
+ $labels['tax_product_cat_plu'] = $labels['product_cat_plu'];
944
+ unset( $labels['product_cat_plu'] );
945
+ }
946
+
947
+ // Product tag. Old: 'tag', 'product_tag_plu'.
948
+
949
+ if ( isset( $labels['tag'] ) ) {
950
+ $labels['tax_product_tag'] = $labels['tag'];
951
+ unset( $labels['tag'] );
952
+ }
953
+
954
+
955
+ if ( isset( $labels['product_tag_plu'] ) ) {
956
+ $labels['tax_product_tag_plu'] = $labels['product_tag_plu'];
957
+ unset( $labels['product_tag_plu'] );
958
+ }
959
+
960
+ return $labels;
961
+ }
962
 
963
  }
includes/Helpers.php CHANGED
@@ -924,17 +924,11 @@ class Helpers
924
  */
925
  public static function getLabels()
926
  {
927
- $labels = apply_filters( 'dgwt/wcas/labels', array(
928
- 'category' => __( 'Category', 'woocommerce' ),
929
- 'tag' => __( 'Tag' ),
930
- 'brand' => __( 'Brand', 'ajax-search-for-woocommerce' ),
931
  'post' => __( 'Post' ),
932
  'page' => __( 'Page' ),
933
  'vendor' => __( 'Vendor', 'ajax-search-for-woocommerce' ),
934
- 'product_cat_plu' => __( 'Categories', 'woocommerce' ),
935
- 'product_tag_plu' => __( 'Tags' ),
936
  'product_plu' => __( 'Products', 'woocommerce' ),
937
- 'brand_plu' => __( 'Brands', 'ajax-search-for-woocommerce' ),
938
  'post_plu' => __( 'Posts' ),
939
  'page_plu' => __( 'Pages' ),
940
  'vendor_plu' => __( 'Vendors', 'ajax-search-for-woocommerce' ),
@@ -950,7 +944,6 @@ class Helpers
950
  'search_placeholder' => DGWT_WCAS()->settings->getOption( 'search_placeholder', __( 'Search for products...', 'ajax-search-for-woocommerce' ) ),
951
  'submit' => DGWT_WCAS()->settings->getOption( 'search_submit_text', '' ),
952
  ) );
953
- return $labels;
954
  }
955
 
956
  /**
@@ -1147,7 +1140,6 @@ class Helpers
1147
  public static function searchProducts( $phrase )
1148
  {
1149
  $postIn = array();
1150
- $baseUrl = home_url() . \WC_AJAX::get_endpoint( DGWT_WCAS_SEARCH_ACTION );
1151
  $urlPhrase = str_replace( "\\'", "'", $phrase );
1152
  $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
1153
  $args = array(
@@ -1157,7 +1149,7 @@ class Helpers
1157
  if ( Multilingual::isMultilingual() ) {
1158
  $args['l'] = Multilingual::getCurrentLanguage();
1159
  }
1160
- $url = add_query_arg( $args, $baseUrl );
1161
  $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
1162
  'timeout' => 120,
1163
  ) ) );
@@ -1219,5 +1211,37 @@ class Helpers
1219
 
1220
  return $authorization;
1221
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1222
 
1223
  }
924
  */
925
  public static function getLabels()
926
  {
927
+ return apply_filters( 'dgwt/wcas/labels', array(
 
 
 
928
  'post' => __( 'Post' ),
929
  'page' => __( 'Page' ),
930
  'vendor' => __( 'Vendor', 'ajax-search-for-woocommerce' ),
 
 
931
  'product_plu' => __( 'Products', 'woocommerce' ),
 
932
  'post_plu' => __( 'Posts' ),
933
  'page_plu' => __( 'Pages' ),
934
  'vendor_plu' => __( 'Vendors', 'ajax-search-for-woocommerce' ),
944
  'search_placeholder' => DGWT_WCAS()->settings->getOption( 'search_placeholder', __( 'Search for products...', 'ajax-search-for-woocommerce' ) ),
945
  'submit' => DGWT_WCAS()->settings->getOption( 'search_submit_text', '' ),
946
  ) );
 
947
  }
948
 
949
  /**
1140
  public static function searchProducts( $phrase )
1141
  {
1142
  $postIn = array();
 
1143
  $urlPhrase = str_replace( "\\'", "'", $phrase );
1144
  $urlPhrase = str_replace( '\\"', '"', $urlPhrase );
1145
  $args = array(
1149
  if ( Multilingual::isMultilingual() ) {
1150
  $args['l'] = Multilingual::getCurrentLanguage();
1151
  }
1152
+ $url = add_query_arg( $args, Helpers::getAjaxSearchEndpointUrl() );
1153
  $r = wp_remote_retrieve_body( wp_remote_get( $url, array(
1154
  'timeout' => 120,
1155
  ) ) );
1211
 
1212
  return $authorization;
1213
  }
1214
+
1215
+ /**
1216
+ * Get plugin version
1217
+ *
1218
+ * @return string
1219
+ */
1220
+ public static function getPluginVersion()
1221
+ {
1222
+ global $wpdb ;
1223
+ $version = $wpdb->get_var( "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'dgwt_wcas_version_pro'" );
1224
+ return ( empty($version) ? '' : $version );
1225
+ }
1226
+
1227
+ /**
1228
+ * Get AJAX search endpoint URL
1229
+ *
1230
+ * @param null $scheme
1231
+ *
1232
+ * @return string
1233
+ *
1234
+ * @see \WC_AJAX::get_endpoint() - Almost the same, but you can choose a scheme
1235
+ */
1236
+ public static function getAjaxSearchEndpointUrl( $scheme = null )
1237
+ {
1238
+ return esc_url_raw( apply_filters( 'woocommerce_ajax_get_endpoint', add_query_arg( 'wc-ajax', DGWT_WCAS_SEARCH_ACTION, remove_query_arg( array(
1239
+ 'remove_item',
1240
+ 'add-to-cart',
1241
+ 'added-to-cart',
1242
+ 'order_again',
1243
+ '_wpnonce'
1244
+ ), home_url( '/', $scheme ) ) ), DGWT_WCAS_SEARCH_ACTION ) );
1245
+ }
1246
 
1247
  }
includes/Integrations/Brands.php CHANGED
@@ -50,15 +50,15 @@ class Brands {
50
 
51
  public function init() {
52
  // Init brand stuff after theme is ready (to allow apply filters)
53
- add_action( 'after_setup_theme', function () {
54
  $this->setPluginInfo();
55
  $this->setBrandTaxonomy();
56
  $this->addSettings();
57
- } );
58
 
59
  add_filter( 'dgwt/wcas/suggestion_details/taxonomy/headline', array( $this, 'rebuildDetailsHeader' ), 10, 4 );
60
- add_filter( 'dgwt/wcas/taxonomies_with_images', array( $this, 'taxonomiesWithImages' ) );
61
  add_filter( 'dgwt/wcas/term/thumbnail_src', array( $this, 'termThumbnailSrc' ), 10, 4 );
 
62
  }
63
 
64
  /**
@@ -88,10 +88,16 @@ class Brands {
88
  * @return void
89
  */
90
  private function setBrandTaxonomy() {
91
- $brandTaxonomy = 'product_brand';
92
 
93
- if ( $this->hasBrands() ) {
94
  switch ( $this->pluginSlug ) {
 
 
 
 
 
 
95
  case 'yith-woocommerce-brands-add-on-premium/init.php':
96
  case 'yith-woocommerce-brands-add-on/init.php':
97
  $brandTaxonomy = 'yith_product_brand';
@@ -103,18 +109,14 @@ class Brands {
103
  case 'brands-for-woocommerce/woocommerce-brand.php':
104
  $brandTaxonomy = 'berocket_brand';
105
  break;
106
- case 'wpbingo/wpbingo.php':
107
- $brandTaxonomy = 'product_brand';
108
- break;
109
- case 'premmerce-woocommerce-brands/premmerce-brands.php':
110
- $brandTaxonomy = 'product_brand';
111
- break;
112
  }
113
  }
114
 
115
  $brandTaxonomy = apply_filters( 'dgwt/wcas/brands/taxonomy', $brandTaxonomy );
116
 
117
- $this->brandTaxonomy = $brandTaxonomy;
 
 
118
  }
119
 
120
  /**
@@ -142,7 +144,7 @@ class Brands {
142
  * @return bool
143
  */
144
  public function hasBrands() {
145
- return apply_filters( 'dgwt/wcas/brands/has_brands', ! empty( $this->pluginInfo ) );
146
  }
147
 
148
  /**
@@ -191,7 +193,7 @@ class Brands {
191
  }
192
 
193
  $settingsScope[220] = array(
194
- 'name' => 'search_in_brands',
195
  'label' => __( 'Search in brands', 'ajax-search-for-woocommerce' ) . $label,
196
  'class' => 'dgwt-wcas-premium-only',
197
  'type' => 'checkbox',
@@ -213,22 +215,24 @@ class Brands {
213
  }
214
 
215
  $settingsScope[1260] = array(
216
- 'name' => 'show_matching_brands',
217
- 'label' => __( 'Show brands', 'ajax-search-for-woocommerce' ) . $label,
218
- 'class' => 'dgwt-wcas-premium-only js-dgwt-wcas-options-toggle-sibling',
219
- 'type' => 'checkbox',
220
- 'default' => 'off',
 
221
  );
222
 
223
  if ( $this->doesPluginSupportImages() ) {
224
  $settingsScope[1270] = array(
225
- 'name' => 'show_brands_images',
226
- 'label' => __( 'show images', 'ajax-search-for-woocommerce' ),
227
- 'class' => 'dgwt-wcas-premium-only',
228
- 'type' => 'checkbox',
229
- 'default' => 'off',
230
- 'desc' => __( 'show images', 'ajax-search-for-woocommerce' ),
231
- 'move_dest' => 'show_matching_brands',
 
232
  );
233
  }
234
 
@@ -253,7 +257,7 @@ class Brands {
253
 
254
  $title = '<span class="dgwt-wcas-datails-title">';
255
  $title .= '<span class="dgwt-wcas-details-title-tax">';
256
- $title .= Helpers::getLabel( 'brand' ) . ': ';
257
  $title .= '</span>';
258
  $title .= $termName;
259
  $title .= '</span>';
@@ -263,26 +267,11 @@ class Brands {
263
 
264
  }
265
 
266
- /**
267
- * Add brand to the list of image supporting taxonomies
268
- *
269
- * @param array $taxonomies
270
- *
271
- * @return array
272
- */
273
- public function taxonomiesWithImages( $taxonomies ) {
274
- if ( $this->hasBrands() && $this->doesPluginSupportImages() ) {
275
- $taxonomies[] = $this->getBrandTaxonomy();
276
- }
277
-
278
- return $taxonomies;
279
- }
280
-
281
  /**
282
  * @param string $src
283
- * @param int $termID
284
  * @param string $size
285
- * @param Term $term
286
  */
287
  public function termThumbnailSrc( $src, $termID, $size, $term ) {
288
  /**
@@ -313,32 +302,50 @@ class Brands {
313
  return $src;
314
  }
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  /**
317
  * Check if a current brand plugin does support images
 
318
  * @return bool
319
  */
320
  private function doesPluginSupportImages() {
321
- $result = false;
322
-
323
- switch ( $this->pluginSlug ) {
324
- case 'woocommerce-brands/woocommerce-brands.php':
325
- $result = true;
326
- break;
327
- case 'yith-woocommerce-brands-add-on-premium/init.php':
328
- case 'yith-woocommerce-brands-add-on/init.php':
329
- $result = true;
330
- break;
331
- case 'perfect-woocommerce-brands/main.php':
332
- case 'perfect-woocommerce-brands/perfect-woocommerce-brands.php':
333
- $result = true;
334
- break;
335
- case 'brands-for-woocommerce/woocommerce-brand.php':
336
- $result = true;
337
- break;
338
- case 'premmerce-woocommerce-brands/premmerce-brands.php':
339
- $result = true;
340
- break;
341
- }
342
 
343
  return apply_filters( 'dgwt/wcas/brands/image_support', $result );
344
  }
50
 
51
  public function init() {
52
  // Init brand stuff after theme is ready (to allow apply filters)
53
+ add_action( 'init', function () {
54
  $this->setPluginInfo();
55
  $this->setBrandTaxonomy();
56
  $this->addSettings();
57
+ }, 100 );
58
 
59
  add_filter( 'dgwt/wcas/suggestion_details/taxonomy/headline', array( $this, 'rebuildDetailsHeader' ), 10, 4 );
 
60
  add_filter( 'dgwt/wcas/term/thumbnail_src', array( $this, 'termThumbnailSrc' ), 10, 4 );
61
+ add_filter( 'dgwt/wcas/indexer/taxonomies', array( $this, 'addBrandToCollectionOfTaxonomies' ), 5 );
62
  }
63
 
64
  /**
88
  * @return void
89
  */
90
  private function setBrandTaxonomy() {
91
+ $brandTaxonomy = '';
92
 
93
+ if ( ! empty( $this->pluginSlug ) ) {
94
  switch ( $this->pluginSlug ) {
95
+ case 'woocommerce-brands/woocommerce-brands.php':
96
+ case 'martfury-addons/martfury-addons.php':
97
+ case 'wpbingo/wpbingo.php':
98
+ case 'premmerce-woocommerce-brands/premmerce-brands.php':
99
+ $brandTaxonomy = 'product_brand';
100
+ break;
101
  case 'yith-woocommerce-brands-add-on-premium/init.php':
102
  case 'yith-woocommerce-brands-add-on/init.php':
103
  $brandTaxonomy = 'yith_product_brand';
109
  case 'brands-for-woocommerce/woocommerce-brand.php':
110
  $brandTaxonomy = 'berocket_brand';
111
  break;
 
 
 
 
 
 
112
  }
113
  }
114
 
115
  $brandTaxonomy = apply_filters( 'dgwt/wcas/brands/taxonomy', $brandTaxonomy );
116
 
117
+ if ( ! empty( $brandTaxonomy ) && taxonomy_exists( $brandTaxonomy ) ) {
118
+ $this->brandTaxonomy = $brandTaxonomy;
119
+ }
120
  }
121
 
122
  /**
144
  * @return bool
145
  */
146
  public function hasBrands() {
147
+ return ! empty( $this->brandTaxonomy );
148
  }
149
 
150
  /**
193
  }
194
 
195
  $settingsScope[220] = array(
196
+ 'name' => 'search_in_product_tax_' . $this->getBrandTaxonomy(),
197
  'label' => __( 'Search in brands', 'ajax-search-for-woocommerce' ) . $label,
198
  'class' => 'dgwt-wcas-premium-only',
199
  'type' => 'checkbox',
215
  }
216
 
217
  $settingsScope[1260] = array(
218
+ 'name' => 'show_product_tax_' . $this->getBrandTaxonomy(),
219
+ 'label' => __( 'Show brands', 'ajax-search-for-woocommerce' ) . $label,
220
+ 'class' => 'dgwt-wcas-premium-only js-dgwt-wcas-options-toggle-sibling',
221
+ 'type' => 'checkbox',
222
+ 'default' => 'off',
223
+ 'input_data' => 'data-option-trigger="show_matching_brands"',
224
  );
225
 
226
  if ( $this->doesPluginSupportImages() ) {
227
  $settingsScope[1270] = array(
228
+ 'name' => 'show_product_tax_' . $this->getBrandTaxonomy() . '_images',
229
+ 'label' => __( 'show images', 'ajax-search-for-woocommerce' ),
230
+ 'class' => 'dgwt-wcas-premium-only',
231
+ 'type' => 'checkbox',
232
+ 'default' => 'off',
233
+ 'desc' => __( 'show images', 'ajax-search-for-woocommerce' ),
234
+ 'move_dest' => 'show_product_tax_' . $this->getBrandTaxonomy(),
235
+ 'input_data' => 'data-option-trigger="show_brands_images"',
236
  );
237
  }
238
 
257
 
258
  $title = '<span class="dgwt-wcas-datails-title">';
259
  $title .= '<span class="dgwt-wcas-details-title-tax">';
260
+ $title .= Helpers::getLabel( 'tax_' . $this->getBrandTaxonomy() ) . ': ';
261
  $title .= '</span>';
262
  $title .= $termName;
263
  $title .= '</span>';
267
 
268
  }
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  /**
271
  * @param string $src
272
+ * @param int $termID
273
  * @param string $size
274
+ * @param Term $term
275
  */
276
  public function termThumbnailSrc( $src, $termID, $size, $term ) {
277
  /**
302
  return $src;
303
  }
304
 
305
+ /**
306
+ * Add brand to collection of supported taxonomies
307
+ *
308
+ * @param array $taxonomies Supported taxonomies
309
+ *
310
+ * @return array
311
+ */
312
+ public function addBrandToCollectionOfTaxonomies( $taxonomies ) {
313
+ if ( ! $this->hasBrands() ) {
314
+ return $taxonomies;
315
+ }
316
+
317
+ $taxonomies = is_array( $taxonomies ) ? $taxonomies : array();
318
+
319
+ $taxonomies[] = array(
320
+ 'taxonomy' => $this->getBrandTaxonomy(),
321
+ 'labels' => array(
322
+ 'name' => __( 'Brands', 'ajax-search-for-woocommerce' ),
323
+ 'singular_name' => __( 'Brand', 'ajax-search-for-woocommerce' ),
324
+ ),
325
+ 'image_support' => $this->doesPluginSupportImages(),
326
+ );
327
+
328
+ return $taxonomies;
329
+ }
330
+
331
  /**
332
  * Check if a current brand plugin does support images
333
+ *
334
  * @return bool
335
  */
336
  private function doesPluginSupportImages() {
337
+ $result = in_array(
338
+ $this->pluginSlug,
339
+ array(
340
+ 'yith-woocommerce-brands-add-on-premium/init.php',
341
+ 'yith-woocommerce-brands-add-on/init.php',
342
+ 'woocommerce-brands/woocommerce-brands.php',
343
+ 'perfect-woocommerce-brands/main.php',
344
+ 'perfect-woocommerce-brands/perfect-woocommerce-brands.php',
345
+ 'brands-for-woocommerce/woocommerce-brand.php',
346
+ 'premmerce-woocommerce-brands/premmerce-brands.php',
347
+ )
348
+ );
 
 
 
 
 
 
 
 
 
349
 
350
  return apply_filters( 'dgwt/wcas/brands/image_support', $result );
351
  }
includes/Integrations/Themes/GeneratePress/GeneratePress.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace DgoraWcas\Integrations\Themes\GeneratePress;
4
+
5
+ use DgoraWcas\Abstracts\ThemeIntegration;
6
+
7
+ // Exit if accessed directly
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
+
12
+ class GeneratePress extends ThemeIntegration {
13
+
14
+ public function __construct() {
15
+ $this->themeSlug = 'generatepress';
16
+ $this->themeName = 'GeneratePress';
17
+
18
+ parent::__construct();
19
+ }
20
+ }
includes/Integrations/Themes/ThemesCompatibility.php CHANGED
@@ -195,6 +195,10 @@ class ThemesCompatibility {
195
  'className' => 'EstorePro',
196
  'name' => 'eStore Pro',
197
  ),
 
 
 
 
198
  );
199
  }
200
 
195
  'className' => 'EstorePro',
196
  'name' => 'eStore Pro',
197
  ),
198
+ 'generatepress' => array(
199
+ 'slug' => 'generatepress',
200
+ 'name' => 'GeneratePress',
201
+ ),
202
  );
203
  }
204
 
includes/Product.php CHANGED
@@ -182,7 +182,47 @@ class Product
182
  */
183
  public function getThumbnail( $size = '' )
184
  {
185
- return '<img src="' . $this->getThumbnailSrc( $size ) . '" alt="' . $this->getName() . '" />';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
 
188
  /**
@@ -427,10 +467,10 @@ class Product
427
  /**
428
  * Get terms form specific taxonomy
429
  *
430
- * @param $taxonomy
431
- * @param $format output format
432
  *
433
- * @return string
434
  *
435
  */
436
  public function getTerms( $taxonomy = 'product_cat', $format = 'array' )
182
  */
183
  public function getThumbnail( $size = '' )
184
  {
185
+ return '<img src="' . $this->getThumbnailSrc( $size ) . '" alt="' . wp_strip_all_tags( $this->getName(), true ) . '" />';
186
+ }
187
+
188
+ /**
189
+ * Get product thumbnail srcset
190
+ *
191
+ * @param string $size
192
+ *
193
+ * @return string
194
+ */
195
+ public function getThumbnailSrcset( $size = '' )
196
+ {
197
+ $size = ( empty($size) ? 'dgwt-wcas-product-suggestion' : $size );
198
+ $imageID = $this->wcProduct->get_image_id();
199
+ $srcset = ( function_exists( 'wp_get_attachment_image_srcset' ) ? (string) wp_get_attachment_image_srcset( $imageID, $size ) : '' );
200
+ return apply_filters(
201
+ 'dgwt/wcas/product/thumbnail_srcset',
202
+ $srcset,
203
+ $this->productID,
204
+ $this
205
+ );
206
+ }
207
+
208
+ /**
209
+ * Get product thumbnail sizes (for srcset)
210
+ *
211
+ * @param string $size
212
+ *
213
+ * @return string
214
+ */
215
+ public function getThumbnailSizes( $size = '' )
216
+ {
217
+ $size = ( empty($size) ? 'dgwt-wcas-product-suggestion' : $size );
218
+ $imageID = $this->wcProduct->get_image_id();
219
+ $sizes = ( function_exists( 'wp_get_attachment_image_sizes' ) ? (string) wp_get_attachment_image_sizes( $imageID, $size ) : false );
220
+ return apply_filters(
221
+ 'dgwt/wcas/product/thumbnail_sizes',
222
+ $sizes,
223
+ $this->productID,
224
+ $this
225
+ );
226
  }
227
 
228
  /**
467
  /**
468
  * Get terms form specific taxonomy
469
  *
470
+ * @param string $taxonomy
471
+ * @param string $format Output format
472
  *
473
+ * @return string|array
474
  *
475
  */
476
  public function getTerms( $taxonomy = 'product_cat', $format = 'array' )
includes/Scripts.php CHANGED
@@ -67,6 +67,7 @@ class Scripts
67
  'is_premium' => ( dgoraAsfwFs()->is_premium() ? true : false ),
68
  'mobile_breakpoint' => $layout->breakpoint,
69
  'mobile_overlay_wrapper' => $layout->mobile_overlay_wrapper,
 
70
  'debounce_wait_ms' => apply_filters( 'dgwt/wcas/scripts/debounce_wait_ms', 400 ),
71
  'send_ga_events' => apply_filters( 'dgwt/wcas/scripts/send_ga_events', true ),
72
  'enable_ga_site_search_module' => apply_filters( 'dgwt/wcas/scripts/enable_ga_site_search_module', false ),
67
  'is_premium' => ( dgoraAsfwFs()->is_premium() ? true : false ),
68
  'mobile_breakpoint' => $layout->breakpoint,
69
  'mobile_overlay_wrapper' => $layout->mobile_overlay_wrapper,
70
+ 'mobile_overlay_delay' => apply_filters( 'dgwt/wcas/scripts/overlay_delay_ms', 0 ),
71
  'debounce_wait_ms' => apply_filters( 'dgwt/wcas/scripts/debounce_wait_ms', 400 ),
72
  'send_ga_events' => apply_filters( 'dgwt/wcas/scripts/send_ga_events', true ),
73
  'enable_ga_site_search_module' => apply_filters( 'dgwt/wcas/scripts/enable_ga_site_search_module', false ),
includes/Settings.php CHANGED
@@ -378,27 +378,30 @@ class Settings
378
  'class' => 'dgwt-wcas-sgs-header',
379
  ),
380
  1100 => array(
381
- 'name' => 'show_matching_categories',
382
- 'label' => __( 'Show categories', 'ajax-search-for-woocommerce' ),
383
- 'type' => 'checkbox',
384
- 'class' => 'js-dgwt-wcas-settings-margin js-dgwt-wcas-options-toggle-sibling',
385
- 'default' => 'on',
 
386
  ),
387
  1150 => array(
388
- 'name' => 'show_categories_images',
389
- 'label' => __( 'show images', 'ajax-search-for-woocommerce' ),
390
- 'type' => 'checkbox',
391
- 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
392
- 'default' => 'off',
393
- 'desc' => __( 'show images', 'ajax-search-for-woocommerce' ),
394
- 'move_dest' => 'show_matching_categories',
 
395
  ),
396
  1300 => array(
397
- 'name' => 'show_matching_tags',
398
- 'label' => __( 'Show tags', 'ajax-search-for-woocommerce' ),
399
- 'type' => 'checkbox',
400
- 'class' => 'js-dgwt-wcas-settings-margin js-dgwt-wcas-adv-settings',
401
- 'default' => 'off',
 
402
  ),
403
  1600 => array(
404
  'name' => 'show_matching_posts',
@@ -503,14 +506,14 @@ class Settings
503
  'default' => 'off',
504
  ),
505
  250 => array(
506
- 'name' => 'search_in_product_categories',
507
  'label' => __( 'Search in categories', 'ajax-search-for-woocommerce' ),
508
  'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
509
  'type' => 'checkbox',
510
  'default' => 'off',
511
  ),
512
  275 => array(
513
- 'name' => 'search_in_product_tags',
514
  'label' => __( 'Search in tags', 'ajax-search-for-woocommerce' ),
515
  'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
516
  'type' => 'checkbox',
378
  'class' => 'dgwt-wcas-sgs-header',
379
  ),
380
  1100 => array(
381
+ 'name' => 'show_product_tax_product_cat',
382
+ 'label' => __( 'Show categories', 'ajax-search-for-woocommerce' ),
383
+ 'type' => 'checkbox',
384
+ 'class' => 'js-dgwt-wcas-settings-margin js-dgwt-wcas-options-toggle-sibling',
385
+ 'default' => 'on',
386
+ 'input_data' => 'data-option-trigger="show_matching_categories"',
387
  ),
388
  1150 => array(
389
+ 'name' => 'show_product_tax_product_cat_images',
390
+ 'label' => __( 'show images', 'ajax-search-for-woocommerce' ),
391
+ 'type' => 'checkbox',
392
+ 'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
393
+ 'default' => 'off',
394
+ 'desc' => __( 'show images', 'ajax-search-for-woocommerce' ),
395
+ 'move_dest' => 'show_product_tax_product_cat',
396
+ 'input_data' => 'data-option-trigger="show_categories_images"',
397
  ),
398
  1300 => array(
399
+ 'name' => 'show_product_tax_product_tag',
400
+ 'label' => __( 'Show tags', 'ajax-search-for-woocommerce' ),
401
+ 'type' => 'checkbox',
402
+ 'class' => 'js-dgwt-wcas-settings-margin js-dgwt-wcas-adv-settings',
403
+ 'default' => 'off',
404
+ 'input_data' => 'data-option-trigger="show_matching_tags"',
405
  ),
406
  1600 => array(
407
  'name' => 'show_matching_posts',
506
  'default' => 'off',
507
  ),
508
  250 => array(
509
+ 'name' => 'search_in_product_tax_product_cat',
510
  'label' => __( 'Search in categories', 'ajax-search-for-woocommerce' ),
511
  'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
512
  'type' => 'checkbox',
513
  'default' => 'off',
514
  ),
515
  275 => array(
516
+ 'name' => 'search_in_product_tax_product_tag',
517
  'label' => __( 'Search in tags', 'ajax-search-for-woocommerce' ),
518
  'class' => 'js-dgwt-wcas-adv-settings dgwt-wcas-premium-only',
519
  'type' => 'checkbox',
languages/ajax-search-for-woocommerce.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: PACKAGE VERSION\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2021-07-19 13:08+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: Damian Góra <support@fibosearch.com>\n"
9
  "Language-Team: \n"
@@ -61,7 +61,7 @@ msgid ""
61
  "using PHP version "
62
  msgstr ""
63
 
64
- #: includes/Settings.php:732 includes/Settings.php:794
65
  msgid "-- Disabled"
66
  msgstr ""
67
 
@@ -100,8 +100,7 @@ msgstr ""
100
 
101
  #: includes/Admin/Troubleshooting.php:1004
102
  #, php-format
103
- msgid ""
104
- "Add a constant <code>%s</code> to your <code>wp-config.phps</code> file."
105
  msgstr ""
106
 
107
  #: partials/admin/indexer-header.php:54
@@ -125,7 +124,7 @@ msgstr ""
125
  msgid "Add FiboSearch as a menu item."
126
  msgstr ""
127
 
128
- #: includes/Admin/SettingsAPI.php:525 includes/Admin/SettingsAPI.php:626
129
  msgid "Add new rule"
130
  msgstr ""
131
 
@@ -148,7 +147,7 @@ msgstr ""
148
  msgid "AJAX (live) search form for WooCommerce"
149
  msgstr ""
150
 
151
- #: includes/Settings.php:825
152
  msgid "AJAX Search for WooCommerce rebrands to FiboSearch"
153
  msgstr ""
154
 
@@ -212,7 +211,7 @@ msgstr ""
212
  msgid "As a widget - go to the %s and choose “FiboSearch bar”"
213
  msgstr ""
214
 
215
- #: includes/Admin/SettingsAPI.php:584
216
  #, php-format
217
  msgid "Attributes: %s"
218
  msgstr ""
@@ -221,7 +220,7 @@ msgstr ""
221
  msgid "Autocomplete"
222
  msgstr ""
223
 
224
- #: includes/Integrations/Brands.php:190 includes/Integrations/Brands.php:212
225
  #, php-format
226
  msgid "Based on the plugin %s"
227
  msgstr ""
@@ -234,15 +233,15 @@ msgstr ""
234
  msgid "Blocked search endpoint test"
235
  msgstr ""
236
 
237
- #: includes/Settings.php:541
238
  msgid "Border color"
239
  msgstr ""
240
 
241
- #: includes/Helpers.php:982
242
  msgid "Brand"
243
  msgstr ""
244
 
245
- #: includes/Helpers.php:989
246
  msgid "Brands"
247
  msgstr ""
248
 
@@ -251,11 +250,11 @@ msgid "Build ID"
251
  msgstr ""
252
 
253
  #: partials/admin/indexer-header-demo.php:15
254
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:682
255
  msgid "Build index"
256
  msgstr ""
257
 
258
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:631
259
  msgid "Canceling..."
260
  msgstr ""
261
 
@@ -282,11 +281,11 @@ msgstr ""
282
  msgid "Colors"
283
  msgstr ""
284
 
285
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:641
286
  msgid "Completed. Works."
287
  msgstr ""
288
 
289
- #: includes/Admin/SettingsAPI.php:723
290
  msgid "Contact"
291
  msgstr ""
292
 
@@ -305,7 +304,7 @@ msgid ""
305
  "variables, try to solve it in an alternative way. Follow steps below:"
306
  msgstr ""
307
 
308
- #: includes/Helpers.php:998
309
  msgid "continue reading"
310
  msgstr ""
311
 
@@ -321,7 +320,7 @@ msgstr ""
321
  msgid "Custom location of wp-load.php file"
322
  msgstr ""
323
 
324
- #: includes/Settings.php:692
325
  msgid "daily"
326
  msgstr ""
327
 
@@ -329,6 +328,10 @@ msgstr ""
329
  msgid "DB"
330
  msgstr ""
331
 
 
 
 
 
332
  #: widget.php:38 includes/EmbeddingViaMenu.php:186
333
  msgid "Default"
334
  msgstr ""
@@ -337,7 +340,7 @@ msgstr ""
337
  msgid "Defender plugin by WPMU DEV blocks AJAX calls of the live search"
338
  msgstr ""
339
 
340
- #: includes/Settings.php:453
341
  msgid "Details panel"
342
  msgstr ""
343
 
@@ -363,7 +366,7 @@ msgstr ""
363
  msgid "Elementor search results template"
364
  msgstr ""
365
 
366
- #: includes/Settings.php:679
367
  msgid "Enable Scheduler"
368
  msgstr ""
369
 
@@ -386,25 +389,25 @@ msgstr ""
386
  msgid "Error type: <strong>%s</strong>"
387
  msgstr ""
388
 
389
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:646
390
  msgid "Errors"
391
  msgstr ""
392
 
393
- #: includes/Settings.php:643 includes/Settings.php:754
394
  msgid "Exclude"
395
  msgstr ""
396
 
397
- #: includes/Settings.php:639 includes/Settings.php:750
398
  msgid ""
399
  "Exclude the product group from the search results or allow search only among "
400
  "the indicated product group"
401
  msgstr ""
402
 
403
- #: includes/Settings.php:605
404
  msgid "Exclude “out of stock” products"
405
  msgstr ""
406
 
407
- #: includes/Settings.php:632 includes/Settings.php:743
408
  msgid "Exclude/include products"
409
  msgstr ""
410
 
@@ -443,15 +446,15 @@ msgid ""
443
  "connection is required."
444
  msgstr ""
445
 
446
- #: includes/Settings.php:638 includes/Settings.php:749
447
  msgid "Filtering mode"
448
  msgstr ""
449
 
450
- #: includes/Settings.php:650 includes/Settings.php:761
451
  msgid "Filters"
452
  msgstr ""
453
 
454
- #: includes/Settings.php:651 includes/Settings.php:762
455
  msgid ""
456
  "Filters that specify the product group that will be affected by the above "
457
  "mode"
@@ -474,11 +477,11 @@ msgstr ""
474
  msgid "Flatsome Theme"
475
  msgstr ""
476
 
477
- #: includes/Settings.php:611
478
  msgid "Fuzziness"
479
  msgstr ""
480
 
481
- #: includes/Settings.php:727 includes/Settings.php:789
482
  msgid "Fuzzy matching"
483
  msgstr ""
484
 
@@ -572,7 +575,7 @@ msgstr ""
572
  msgid "Group results"
573
  msgstr ""
574
 
575
- #: includes/Settings.php:735 includes/Settings.php:797
576
  msgid "Hard"
577
  msgstr ""
578
 
@@ -598,7 +601,7 @@ msgstr ""
598
  msgid "Hide details"
599
  msgstr ""
600
 
601
- #: includes/Settings.php:534
602
  msgid "Highlight color"
603
  msgstr ""
604
 
@@ -666,12 +669,12 @@ msgstr ""
666
  msgid "Impreza Theme"
667
  msgstr ""
668
 
669
- #: includes/Helpers.php:997
670
  msgctxt "in categories fe. in Books > Crime stories"
671
  msgid "in"
672
  msgstr ""
673
 
674
- #: includes/Settings.php:680
675
  msgid ""
676
  "In most cases, you don't need to use the scheduler because the search index "
677
  "updates when you edit products. If you use import tools or custom code to "
@@ -679,7 +682,7 @@ msgid ""
679
  "helpful."
680
  msgstr ""
681
 
682
- #: includes/Settings.php:644 includes/Settings.php:755
683
  msgid "Include"
684
  msgstr ""
685
 
@@ -716,7 +719,7 @@ msgstr ""
716
  msgid "Increase sales"
717
  msgstr ""
718
 
719
- #: includes/Settings.php:708
720
  msgid "Increases sales conversions"
721
  msgstr ""
722
 
@@ -732,7 +735,7 @@ msgstr ""
732
  msgid "Index completeness test"
733
  msgstr ""
734
 
735
- #: includes/Settings.php:771 includes/Settings.php:805
736
  msgid "Index status"
737
  msgstr ""
738
 
@@ -777,7 +780,7 @@ msgid ""
777
  "can!"
778
  msgstr ""
779
 
780
- #: includes/Settings.php:688
781
  msgid "Interval"
782
  msgstr ""
783
 
@@ -910,15 +913,15 @@ msgstr ""
910
  msgid "Multilingual slugs"
911
  msgstr ""
912
 
913
- #: includes/Admin/SettingsAPI.php:730
914
  msgid "My Account"
915
  msgstr ""
916
 
917
- #: includes/Settings.php:833
918
  msgid "New plugin name"
919
  msgstr ""
920
 
921
- #: includes/Settings.php:820
922
  msgid "News"
923
  msgstr ""
924
 
@@ -926,11 +929,11 @@ msgstr ""
926
  msgid "NGINX configuration may blocks search requests"
927
  msgstr ""
928
 
929
- #: includes/Settings.php:357 includes/Helpers.php:999
930
  msgid "No results"
931
  msgstr ""
932
 
933
- #: includes/Admin/SettingsAPI.php:523 includes/Admin/SettingsAPI.php:622
934
  msgid "No rules"
935
  msgstr ""
936
 
@@ -946,11 +949,11 @@ msgstr ""
946
  msgid "Non-products in autocomplete"
947
  msgstr ""
948
 
949
- #: includes/Settings.php:734 includes/Settings.php:796
950
  msgid "Normal"
951
  msgstr ""
952
 
953
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:652
954
  msgid "Not exist"
955
  msgstr ""
956
 
@@ -994,7 +997,7 @@ msgstr ""
994
  msgid "Pro"
995
  msgstr ""
996
 
997
- #: includes/Settings.php:660
998
  msgid "Pro features"
999
  msgstr ""
1000
 
@@ -1006,11 +1009,11 @@ msgstr ""
1006
  msgid "Processing asynchronous tests..."
1007
  msgstr ""
1008
 
1009
- #: includes/Admin/SettingsAPI.php:579
1010
  msgid "Product categories"
1011
  msgstr ""
1012
 
1013
- #: includes/Admin/SettingsAPI.php:581
1014
  msgid "Product tags"
1015
  msgstr ""
1016
 
@@ -1022,7 +1025,7 @@ msgstr ""
1022
  msgid "Products search"
1023
  msgstr ""
1024
 
1025
- #: includes/Settings.php:550
1026
  msgid "Products search scope"
1027
  msgstr ""
1028
 
@@ -1036,7 +1039,7 @@ msgstr ""
1036
  msgid "px"
1037
  msgstr ""
1038
 
1039
- #: includes/Settings.php:827
1040
  msgid "Read more"
1041
  msgstr ""
1042
 
@@ -1056,7 +1059,7 @@ msgstr ""
1056
  #: includes/Admin/Troubleshooting.php:998
1057
  #: includes/Admin/Troubleshooting.php:1081
1058
  #: includes/Admin/Troubleshooting.php:1119
1059
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:676
1060
  msgid "Rebuild index"
1061
  msgstr ""
1062
 
@@ -1148,7 +1151,7 @@ msgstr ""
1148
  msgid "Response body"
1149
  msgstr ""
1150
 
1151
- #: includes/Settings.php:709
1152
  msgid ""
1153
  "returns suggestions based on likely relevance, even though a search keyword "
1154
  "may not exactly match. E.g if you type “ipho<b>m</b>e” you get the same "
@@ -1188,11 +1191,11 @@ msgstr ""
1188
  msgid "Sample tag <strong>name</strong>"
1189
  msgstr ""
1190
 
1191
- #: includes/Settings.php:699
1192
  msgid "Schedule time"
1193
  msgstr ""
1194
 
1195
- #: includes/Settings.php:673
1196
  msgid "Scheduling indexing"
1197
  msgstr ""
1198
 
@@ -1221,7 +1224,7 @@ msgstr ""
1221
  msgid "Search for posts and pages"
1222
  msgstr ""
1223
 
1224
- #: includes/Settings.php:224 includes/Helpers.php:1002
1225
  msgid "Search for products..."
1226
  msgstr ""
1227
 
@@ -1234,7 +1237,12 @@ msgstr ""
1234
  msgid "Search icon color"
1235
  msgstr ""
1236
 
1237
- #: includes/Settings.php:577 partials/admin/features.php:23
 
 
 
 
 
1238
  msgid "Search in attributes"
1239
  msgstr ""
1240
 
@@ -1242,7 +1250,7 @@ msgstr ""
1242
  msgid "Search in attributes and variation products SKUs (option)"
1243
  msgstr ""
1244
 
1245
- #: includes/Integrations/Brands.php:195
1246
  msgid "Search in brands"
1247
  msgstr ""
1248
 
@@ -1250,28 +1258,28 @@ msgstr ""
1250
  msgid "Search in brands (WooCommerce Brands or YITH WooCommerce Brands)"
1251
  msgstr ""
1252
 
1253
- #: includes/Settings.php:584 partials/admin/features.php:24
1254
  msgid "Search in categories"
1255
  msgstr ""
1256
 
1257
- #: includes/Settings.php:598 includes/Settings.php:718
1258
  #: partials/admin/features.php:22
1259
  msgid "Search in custom fields"
1260
  msgstr ""
1261
 
1262
- #: includes/Settings.php:556
1263
  msgid "Search in description"
1264
  msgstr ""
1265
 
1266
- #: includes/Settings.php:562
1267
  msgid "Search in short description"
1268
  msgstr ""
1269
 
1270
- #: includes/Settings.php:568
1271
  msgid "Search in SKU"
1272
  msgstr ""
1273
 
1274
- #: includes/Settings.php:591 partials/admin/features.php:25
1275
  msgid "Search in tags"
1276
  msgstr ""
1277
 
@@ -1307,11 +1315,11 @@ msgstr ""
1307
  msgid "Searchable"
1308
  msgstr ""
1309
 
1310
- #: includes/Settings.php:570
1311
  msgid "searching also in variable products SKU"
1312
  msgstr ""
1313
 
1314
- #: includes/Settings.php:571
1315
  #, php-format
1316
  msgid ""
1317
  "Searching in variable products SKU is available only in <a target=\"_blank\" "
@@ -1322,16 +1330,15 @@ msgstr ""
1322
  msgid "See a comparison of all free and premium features!"
1323
  msgstr ""
1324
 
1325
- #: includes/Settings.php:406 includes/Helpers.php:1000
1326
- #: includes/Helpers.php:1001
1327
  msgid "See all products..."
1328
  msgstr ""
1329
 
1330
- #: includes/Admin/SettingsAPI.php:577
1331
  msgid "Select filter type"
1332
  msgstr ""
1333
 
1334
- #: includes/Settings.php:721
1335
  msgid "select the custom fields you want to add to the search scope"
1336
  msgstr ""
1337
 
@@ -1351,11 +1358,16 @@ msgstr ""
1351
  msgid "Settings"
1352
  msgstr ""
1353
 
 
 
 
 
 
1354
  #: partials/admin/settings.php:32 partials/admin/settings.php:34
1355
  msgid "Show advanced settings"
1356
  msgstr ""
1357
 
1358
- #: includes/Integrations/Brands.php:217
1359
  msgid "Show brands"
1360
  msgstr ""
1361
 
@@ -1368,20 +1380,22 @@ msgstr ""
1368
  msgid "Show details"
1369
  msgstr ""
1370
 
1371
- #: includes/Settings.php:459
1372
  msgid "Show Details panel"
1373
  msgstr ""
1374
 
1375
- #: includes/Settings.php:423 includes/Settings.php:427
1376
- #: includes/Integrations/Brands.php:226 includes/Integrations/Brands.php:230
 
 
1377
  msgid "show images"
1378
  msgstr ""
1379
 
1380
- #: includes/Settings.php:446
1381
  msgid "Show pages"
1382
  msgstr ""
1383
 
1384
- #: includes/Settings.php:439
1385
  msgid "Show posts"
1386
  msgstr ""
1387
 
@@ -1409,7 +1423,7 @@ msgstr ""
1409
  msgid "Show submit button"
1410
  msgstr ""
1411
 
1412
- #: includes/Settings.php:432
1413
  msgid "Show tags"
1414
  msgstr ""
1415
 
@@ -1417,15 +1431,15 @@ msgstr ""
1417
  msgid "Show vendors next to products"
1418
  msgstr ""
1419
 
1420
- #: includes/Admin/SettingsAPI.php:726
1421
  msgid "Showcase"
1422
  msgstr ""
1423
 
1424
- #: includes/Settings.php:733 includes/Settings.php:795
1425
  msgid "Soft"
1426
  msgstr ""
1427
 
1428
- #: includes/Helpers.php:995
1429
  msgid "Sold by:"
1430
  msgstr ""
1431
 
@@ -1460,7 +1474,7 @@ msgid ""
1460
  "to execute the following file: %s"
1461
  msgstr ""
1462
 
1463
- #: includes/Settings.php:666
1464
  msgid "Speed up search!"
1465
  msgstr ""
1466
 
@@ -1481,7 +1495,7 @@ msgstr ""
1481
  msgid "Status"
1482
  msgstr ""
1483
 
1484
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:673
1485
  msgid "Stop process"
1486
  msgstr ""
1487
 
@@ -1497,24 +1511,24 @@ msgstr ""
1497
  msgid "Sucuri Security firewall may block AJAX calls of the live search"
1498
  msgstr ""
1499
 
1500
- #: includes/Settings.php:513
1501
  msgid "Suggestion background"
1502
  msgstr ""
1503
 
1504
- #: includes/Settings.php:520
1505
  msgid "Suggestion selected"
1506
  msgstr ""
1507
 
1508
- #: includes/Settings.php:507
1509
  msgid "Suggestions colors"
1510
  msgstr ""
1511
 
1512
- #: includes/Settings.php:617 includes/Settings.php:623
1513
  #: partials/admin/features.php:29 includes/Admin/Promo/Upgrade.php:50
1514
  msgid "Synonyms"
1515
  msgstr ""
1516
 
1517
- #: includes/Settings.php:626
1518
  msgid ""
1519
  "Synonyms should be separated by a comma. Each new synonyms group is entered "
1520
  "on a new line. You can use a phrase instead of a single word. <br /> <br />"
@@ -1526,7 +1540,7 @@ msgstr ""
1526
  msgid "Taxonomies"
1527
  msgstr ""
1528
 
1529
- #: includes/Settings.php:527
1530
  msgid "Text color"
1531
  msgstr ""
1532
 
@@ -1534,7 +1548,7 @@ msgstr ""
1534
  msgid "The .htaccess file(s) may blocking AJAX calls of the live search"
1535
  msgstr ""
1536
 
1537
- #: includes/Settings.php:460
1538
  msgid ""
1539
  "The Details panel is an additional container for extended information. The "
1540
  "details are changed dynamically when a user mouse over one of the "
@@ -1590,12 +1604,12 @@ msgstr ""
1590
  msgid "the next index rebuild: %s"
1591
  msgstr ""
1592
 
1593
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:645
1594
  msgid "The search index could not be built."
1595
  msgstr ""
1596
 
1597
  #: partials/admin/indexer-header-demo.php:11
1598
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:651
1599
  msgid "The search index does not exist yet. Build it now."
1600
  msgstr ""
1601
 
@@ -1603,13 +1617,13 @@ msgstr ""
1603
  msgid "The search index structure isn't completely"
1604
  msgstr ""
1605
 
1606
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:639
1607
  msgid ""
1608
  "The search index was built successfully, but some non-critical errors "
1609
  "occurred."
1610
  msgstr ""
1611
 
1612
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:637
1613
  msgid "The search index was built successfully."
1614
  msgstr ""
1615
 
@@ -1635,7 +1649,7 @@ msgid ""
1635
  "The server returns an incorrect response for the search engine's AJAX calls"
1636
  msgstr ""
1637
 
1638
- #: includes/Settings.php:624
1639
  msgid ""
1640
  "The synonyms feature allows your users to find more relevant results. If "
1641
  "your products have alternative names and users often misspell them, consider "
@@ -1688,8 +1702,8 @@ msgid ""
1688
  "every time"
1689
  msgstr ""
1690
 
1691
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:619
1692
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:625
1693
  msgid "This process will continue in the background. You can leave this page!"
1694
  msgstr ""
1695
 
@@ -1743,7 +1757,7 @@ msgstr ""
1743
  msgid "Troubleshooting"
1744
  msgstr ""
1745
 
1746
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:679
1747
  msgid "Try to build the index again."
1748
  msgstr ""
1749
 
@@ -1785,23 +1799,23 @@ msgstr ""
1785
  msgid "Valid search results test"
1786
  msgstr ""
1787
 
1788
- #: includes/Helpers.php:985
1789
  msgid "Vendor"
1790
  msgstr ""
1791
 
1792
- #: includes/Helpers.php:992
1793
  msgid "Vendors"
1794
  msgstr ""
1795
 
1796
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:624
1797
  msgid "Wait... Indexing in progress"
1798
  msgstr ""
1799
 
1800
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:618
1801
  msgid "Wait... Preparing indexing in progress"
1802
  msgstr ""
1803
 
1804
- #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:630
1805
  msgid "Wait... The index build process is canceling"
1806
  msgstr ""
1807
 
@@ -1833,7 +1847,7 @@ msgid ""
1833
  "from a different WordPress."
1834
  msgstr ""
1835
 
1836
- #: includes/Settings.php:693
1837
  msgid "weekly"
1838
  msgstr ""
1839
 
3
  msgstr ""
4
  "Project-Id-Version: PACKAGE VERSION\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2021-10-13 09:44+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: Damian Góra <support@fibosearch.com>\n"
9
  "Language-Team: \n"
61
  "using PHP version "
62
  msgstr ""
63
 
64
+ #: includes/Settings.php:735 includes/Settings.php:797
65
  msgid "-- Disabled"
66
  msgstr ""
67
 
100
 
101
  #: includes/Admin/Troubleshooting.php:1004
102
  #, php-format
103
+ msgid "Add a constant <code>%s</code> to your <code>wp-config.php</code> file."
 
104
  msgstr ""
105
 
106
  #: partials/admin/indexer-header.php:54
124
  msgid "Add FiboSearch as a menu item."
125
  msgstr ""
126
 
127
+ #: includes/Admin/SettingsAPI.php:526 includes/Admin/SettingsAPI.php:627
128
  msgid "Add new rule"
129
  msgstr ""
130
 
147
  msgid "AJAX (live) search form for WooCommerce"
148
  msgstr ""
149
 
150
+ #: includes/Settings.php:828
151
  msgid "AJAX Search for WooCommerce rebrands to FiboSearch"
152
  msgstr ""
153
 
211
  msgid "As a widget - go to the %s and choose “FiboSearch bar”"
212
  msgstr ""
213
 
214
+ #: includes/Admin/SettingsAPI.php:585
215
  #, php-format
216
  msgid "Attributes: %s"
217
  msgstr ""
220
  msgid "Autocomplete"
221
  msgstr ""
222
 
223
+ #: includes/Integrations/Brands.php:192 includes/Integrations/Brands.php:214
224
  #, php-format
225
  msgid "Based on the plugin %s"
226
  msgstr ""
233
  msgid "Blocked search endpoint test"
234
  msgstr ""
235
 
236
+ #: includes/Settings.php:544
237
  msgid "Border color"
238
  msgstr ""
239
 
240
+ #: includes/Integrations/Brands.php:323
241
  msgid "Brand"
242
  msgstr ""
243
 
244
+ #: includes/Integrations/Brands.php:322
245
  msgid "Brands"
246
  msgstr ""
247
 
250
  msgstr ""
251
 
252
  #: partials/admin/indexer-header-demo.php:15
253
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:681
254
  msgid "Build index"
255
  msgstr ""
256
 
257
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:630
258
  msgid "Canceling..."
259
  msgstr ""
260
 
281
  msgid "Colors"
282
  msgstr ""
283
 
284
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:640
285
  msgid "Completed. Works."
286
  msgstr ""
287
 
288
+ #: includes/Admin/SettingsAPI.php:724
289
  msgid "Contact"
290
  msgstr ""
291
 
304
  "variables, try to solve it in an alternative way. Follow steps below:"
305
  msgstr ""
306
 
307
+ #: includes/Helpers.php:991
308
  msgid "continue reading"
309
  msgstr ""
310
 
320
  msgid "Custom location of wp-load.php file"
321
  msgstr ""
322
 
323
+ #: includes/Settings.php:695
324
  msgid "daily"
325
  msgstr ""
326
 
328
  msgid "DB"
329
  msgstr ""
330
 
331
+ #: partials/admin/debug/debug.php:21
332
+ msgid "Debug page"
333
+ msgstr ""
334
+
335
  #: widget.php:38 includes/EmbeddingViaMenu.php:186
336
  msgid "Default"
337
  msgstr ""
340
  msgid "Defender plugin by WPMU DEV blocks AJAX calls of the live search"
341
  msgstr ""
342
 
343
+ #: includes/Settings.php:456
344
  msgid "Details panel"
345
  msgstr ""
346
 
366
  msgid "Elementor search results template"
367
  msgstr ""
368
 
369
+ #: includes/Settings.php:682
370
  msgid "Enable Scheduler"
371
  msgstr ""
372
 
389
  msgid "Error type: <strong>%s</strong>"
390
  msgstr ""
391
 
392
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:645
393
  msgid "Errors"
394
  msgstr ""
395
 
396
+ #: includes/Settings.php:646 includes/Settings.php:757
397
  msgid "Exclude"
398
  msgstr ""
399
 
400
+ #: includes/Settings.php:642 includes/Settings.php:753
401
  msgid ""
402
  "Exclude the product group from the search results or allow search only among "
403
  "the indicated product group"
404
  msgstr ""
405
 
406
+ #: includes/Settings.php:608
407
  msgid "Exclude “out of stock” products"
408
  msgstr ""
409
 
410
+ #: includes/Settings.php:635 includes/Settings.php:746
411
  msgid "Exclude/include products"
412
  msgstr ""
413
 
446
  "connection is required."
447
  msgstr ""
448
 
449
+ #: includes/Settings.php:641 includes/Settings.php:752
450
  msgid "Filtering mode"
451
  msgstr ""
452
 
453
+ #: includes/Settings.php:653 includes/Settings.php:764
454
  msgid "Filters"
455
  msgstr ""
456
 
457
+ #: includes/Settings.php:654 includes/Settings.php:765
458
  msgid ""
459
  "Filters that specify the product group that will be affected by the above "
460
  "mode"
477
  msgid "Flatsome Theme"
478
  msgstr ""
479
 
480
+ #: includes/Settings.php:614
481
  msgid "Fuzziness"
482
  msgstr ""
483
 
484
+ #: includes/Settings.php:730 includes/Settings.php:792
485
  msgid "Fuzzy matching"
486
  msgstr ""
487
 
575
  msgid "Group results"
576
  msgstr ""
577
 
578
+ #: includes/Settings.php:738 includes/Settings.php:800
579
  msgid "Hard"
580
  msgstr ""
581
 
601
  msgid "Hide details"
602
  msgstr ""
603
 
604
+ #: includes/Settings.php:537
605
  msgid "Highlight color"
606
  msgstr ""
607
 
669
  msgid "Impreza Theme"
670
  msgstr ""
671
 
672
+ #: includes/Helpers.php:990
673
  msgctxt "in categories fe. in Books > Crime stories"
674
  msgid "in"
675
  msgstr ""
676
 
677
+ #: includes/Settings.php:683
678
  msgid ""
679
  "In most cases, you don't need to use the scheduler because the search index "
680
  "updates when you edit products. If you use import tools or custom code to "
682
  "helpful."
683
  msgstr ""
684
 
685
+ #: includes/Settings.php:647 includes/Settings.php:758
686
  msgid "Include"
687
  msgstr ""
688
 
719
  msgid "Increase sales"
720
  msgstr ""
721
 
722
+ #: includes/Settings.php:711
723
  msgid "Increases sales conversions"
724
  msgstr ""
725
 
735
  msgid "Index completeness test"
736
  msgstr ""
737
 
738
+ #: includes/Settings.php:774 includes/Settings.php:808
739
  msgid "Index status"
740
  msgstr ""
741
 
780
  "can!"
781
  msgstr ""
782
 
783
+ #: includes/Settings.php:691
784
  msgid "Interval"
785
  msgstr ""
786
 
913
  msgid "Multilingual slugs"
914
  msgstr ""
915
 
916
+ #: includes/Admin/SettingsAPI.php:731
917
  msgid "My Account"
918
  msgstr ""
919
 
920
+ #: includes/Settings.php:836
921
  msgid "New plugin name"
922
  msgstr ""
923
 
924
+ #: includes/Settings.php:823
925
  msgid "News"
926
  msgstr ""
927
 
929
  msgid "NGINX configuration may blocks search requests"
930
  msgstr ""
931
 
932
+ #: includes/Settings.php:357 includes/Helpers.php:992
933
  msgid "No results"
934
  msgstr ""
935
 
936
+ #: includes/Admin/SettingsAPI.php:524 includes/Admin/SettingsAPI.php:623
937
  msgid "No rules"
938
  msgstr ""
939
 
949
  msgid "Non-products in autocomplete"
950
  msgstr ""
951
 
952
+ #: includes/Settings.php:737 includes/Settings.php:799
953
  msgid "Normal"
954
  msgstr ""
955
 
956
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:651
957
  msgid "Not exist"
958
  msgstr ""
959
 
997
  msgid "Pro"
998
  msgstr ""
999
 
1000
+ #: includes/Settings.php:663
1001
  msgid "Pro features"
1002
  msgstr ""
1003
 
1009
  msgid "Processing asynchronous tests..."
1010
  msgstr ""
1011
 
1012
+ #: includes/Admin/SettingsAPI.php:580
1013
  msgid "Product categories"
1014
  msgstr ""
1015
 
1016
+ #: includes/Admin/SettingsAPI.php:582
1017
  msgid "Product tags"
1018
  msgstr ""
1019
 
1025
  msgid "Products search"
1026
  msgstr ""
1027
 
1028
+ #: includes/Settings.php:553
1029
  msgid "Products search scope"
1030
  msgstr ""
1031
 
1039
  msgid "px"
1040
  msgstr ""
1041
 
1042
+ #: includes/Settings.php:830
1043
  msgid "Read more"
1044
  msgstr ""
1045
 
1059
  #: includes/Admin/Troubleshooting.php:998
1060
  #: includes/Admin/Troubleshooting.php:1081
1061
  #: includes/Admin/Troubleshooting.php:1119
1062
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:675
1063
  msgid "Rebuild index"
1064
  msgstr ""
1065
 
1151
  msgid "Response body"
1152
  msgstr ""
1153
 
1154
+ #: includes/Settings.php:712
1155
  msgid ""
1156
  "returns suggestions based on likely relevance, even though a search keyword "
1157
  "may not exactly match. E.g if you type “ipho<b>m</b>e” you get the same "
1191
  msgid "Sample tag <strong>name</strong>"
1192
  msgstr ""
1193
 
1194
+ #: includes/Settings.php:702
1195
  msgid "Schedule time"
1196
  msgstr ""
1197
 
1198
+ #: includes/Settings.php:676
1199
  msgid "Scheduling indexing"
1200
  msgstr ""
1201
 
1224
  msgid "Search for posts and pages"
1225
  msgstr ""
1226
 
1227
+ #: includes/Settings.php:224 includes/Helpers.php:995
1228
  msgid "Search for products..."
1229
  msgstr ""
1230
 
1237
  msgid "Search icon color"
1238
  msgstr ""
1239
 
1240
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomies.php:196
1241
+ #, php-format
1242
+ msgid "Search in %s"
1243
+ msgstr ""
1244
+
1245
+ #: includes/Settings.php:580 partials/admin/features.php:23
1246
  msgid "Search in attributes"
1247
  msgstr ""
1248
 
1250
  msgid "Search in attributes and variation products SKUs (option)"
1251
  msgstr ""
1252
 
1253
+ #: includes/Integrations/Brands.php:197
1254
  msgid "Search in brands"
1255
  msgstr ""
1256
 
1258
  msgid "Search in brands (WooCommerce Brands or YITH WooCommerce Brands)"
1259
  msgstr ""
1260
 
1261
+ #: includes/Settings.php:587 partials/admin/features.php:24
1262
  msgid "Search in categories"
1263
  msgstr ""
1264
 
1265
+ #: includes/Settings.php:601 includes/Settings.php:721
1266
  #: partials/admin/features.php:22
1267
  msgid "Search in custom fields"
1268
  msgstr ""
1269
 
1270
+ #: includes/Settings.php:559
1271
  msgid "Search in description"
1272
  msgstr ""
1273
 
1274
+ #: includes/Settings.php:565
1275
  msgid "Search in short description"
1276
  msgstr ""
1277
 
1278
+ #: includes/Settings.php:571
1279
  msgid "Search in SKU"
1280
  msgstr ""
1281
 
1282
+ #: includes/Settings.php:594 partials/admin/features.php:25
1283
  msgid "Search in tags"
1284
  msgstr ""
1285
 
1315
  msgid "Searchable"
1316
  msgstr ""
1317
 
1318
+ #: includes/Settings.php:573
1319
  msgid "searching also in variable products SKU"
1320
  msgstr ""
1321
 
1322
+ #: includes/Settings.php:574
1323
  #, php-format
1324
  msgid ""
1325
  "Searching in variable products SKU is available only in <a target=\"_blank\" "
1330
  msgid "See a comparison of all free and premium features!"
1331
  msgstr ""
1332
 
1333
+ #: includes/Settings.php:406 includes/Helpers.php:993 includes/Helpers.php:994
 
1334
  msgid "See all products..."
1335
  msgstr ""
1336
 
1337
+ #: includes/Admin/SettingsAPI.php:578
1338
  msgid "Select filter type"
1339
  msgstr ""
1340
 
1341
+ #: includes/Settings.php:724
1342
  msgid "select the custom fields you want to add to the search scope"
1343
  msgstr ""
1344
 
1358
  msgid "Settings"
1359
  msgstr ""
1360
 
1361
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomies.php:230
1362
+ #, php-format
1363
+ msgid "Show %s"
1364
+ msgstr ""
1365
+
1366
  #: partials/admin/settings.php:32 partials/admin/settings.php:34
1367
  msgid "Show advanced settings"
1368
  msgstr ""
1369
 
1370
+ #: includes/Integrations/Brands.php:219
1371
  msgid "Show brands"
1372
  msgstr ""
1373
 
1380
  msgid "Show details"
1381
  msgstr ""
1382
 
1383
+ #: includes/Settings.php:462
1384
  msgid "Show Details panel"
1385
  msgstr ""
1386
 
1387
+ #: includes/Settings.php:424 includes/Settings.php:428
1388
+ #: includes/Integrations/Brands.php:229 includes/Integrations/Brands.php:233
1389
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomies.php:241
1390
+ #: includes/Engines/TNTSearchMySQL/Indexer/Taxonomies.php:245
1391
  msgid "show images"
1392
  msgstr ""
1393
 
1394
+ #: includes/Settings.php:449
1395
  msgid "Show pages"
1396
  msgstr ""
1397
 
1398
+ #: includes/Settings.php:442
1399
  msgid "Show posts"
1400
  msgstr ""
1401
 
1423
  msgid "Show submit button"
1424
  msgstr ""
1425
 
1426
+ #: includes/Settings.php:434
1427
  msgid "Show tags"
1428
  msgstr ""
1429
 
1431
  msgid "Show vendors next to products"
1432
  msgstr ""
1433
 
1434
+ #: includes/Admin/SettingsAPI.php:727
1435
  msgid "Showcase"
1436
  msgstr ""
1437
 
1438
+ #: includes/Settings.php:736 includes/Settings.php:798
1439
  msgid "Soft"
1440
  msgstr ""
1441
 
1442
+ #: includes/Helpers.php:988
1443
  msgid "Sold by:"
1444
  msgstr ""
1445
 
1474
  "to execute the following file: %s"
1475
  msgstr ""
1476
 
1477
+ #: includes/Settings.php:669
1478
  msgid "Speed up search!"
1479
  msgstr ""
1480
 
1495
  msgid "Status"
1496
  msgstr ""
1497
 
1498
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:672
1499
  msgid "Stop process"
1500
  msgstr ""
1501
 
1511
  msgid "Sucuri Security firewall may block AJAX calls of the live search"
1512
  msgstr ""
1513
 
1514
+ #: includes/Settings.php:516
1515
  msgid "Suggestion background"
1516
  msgstr ""
1517
 
1518
+ #: includes/Settings.php:523
1519
  msgid "Suggestion selected"
1520
  msgstr ""
1521
 
1522
+ #: includes/Settings.php:510
1523
  msgid "Suggestions colors"
1524
  msgstr ""
1525
 
1526
+ #: includes/Settings.php:620 includes/Settings.php:626
1527
  #: partials/admin/features.php:29 includes/Admin/Promo/Upgrade.php:50
1528
  msgid "Synonyms"
1529
  msgstr ""
1530
 
1531
+ #: includes/Settings.php:629
1532
  msgid ""
1533
  "Synonyms should be separated by a comma. Each new synonyms group is entered "
1534
  "on a new line. You can use a phrase instead of a single word. <br /> <br />"
1540
  msgid "Taxonomies"
1541
  msgstr ""
1542
 
1543
+ #: includes/Settings.php:530
1544
  msgid "Text color"
1545
  msgstr ""
1546
 
1548
  msgid "The .htaccess file(s) may blocking AJAX calls of the live search"
1549
  msgstr ""
1550
 
1551
+ #: includes/Settings.php:463
1552
  msgid ""
1553
  "The Details panel is an additional container for extended information. The "
1554
  "details are changed dynamically when a user mouse over one of the "
1604
  msgid "the next index rebuild: %s"
1605
  msgstr ""
1606
 
1607
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:644
1608
  msgid "The search index could not be built."
1609
  msgstr ""
1610
 
1611
  #: partials/admin/indexer-header-demo.php:11
1612
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:650
1613
  msgid "The search index does not exist yet. Build it now."
1614
  msgstr ""
1615
 
1617
  msgid "The search index structure isn't completely"
1618
  msgstr ""
1619
 
1620
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:638
1621
  msgid ""
1622
  "The search index was built successfully, but some non-critical errors "
1623
  "occurred."
1624
  msgstr ""
1625
 
1626
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:636
1627
  msgid "The search index was built successfully."
1628
  msgstr ""
1629
 
1649
  "The server returns an incorrect response for the search engine's AJAX calls"
1650
  msgstr ""
1651
 
1652
+ #: includes/Settings.php:627
1653
  msgid ""
1654
  "The synonyms feature allows your users to find more relevant results. If "
1655
  "your products have alternative names and users often misspell them, consider "
1702
  "every time"
1703
  msgstr ""
1704
 
1705
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:618
1706
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:624
1707
  msgid "This process will continue in the background. You can leave this page!"
1708
  msgstr ""
1709
 
1757
  msgid "Troubleshooting"
1758
  msgstr ""
1759
 
1760
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:678
1761
  msgid "Try to build the index again."
1762
  msgstr ""
1763
 
1799
  msgid "Valid search results test"
1800
  msgstr ""
1801
 
1802
+ #: includes/Helpers.php:981
1803
  msgid "Vendor"
1804
  msgstr ""
1805
 
1806
+ #: includes/Helpers.php:985
1807
  msgid "Vendors"
1808
  msgstr ""
1809
 
1810
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:623
1811
  msgid "Wait... Indexing in progress"
1812
  msgstr ""
1813
 
1814
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:617
1815
  msgid "Wait... Preparing indexing in progress"
1816
  msgstr ""
1817
 
1818
+ #: includes/Engines/TNTSearchMySQL/Indexer/Builder.php:629
1819
  msgid "Wait... The index build process is canceling"
1820
  msgstr ""
1821
 
1847
  "from a different WordPress."
1848
  msgstr ""
1849
 
1850
+ #: includes/Settings.php:696
1851
  msgid "weekly"
1852
  msgstr ""
1853
 
partials/admin/search-preview.php CHANGED
@@ -64,7 +64,7 @@ $labelSeeAll = Helpers::getLabel( 'show_more' );
64
 
65
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-brand dgwt-wcas-suggestion-headline">
66
  <span class="dgwt-wcas-st">
67
- <?php echo Helpers::getLabel( 'brand_plu' ); ?>
68
  </span>
69
  </div>
70
 
@@ -73,14 +73,14 @@ $labelSeeAll = Helpers::getLabel( 'show_more' );
73
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
74
  </span>
75
  <span class="dgwt-wcas-st">
76
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'brand' ); ?></span>
77
  <?php _e( 'Sample brand <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
78
  </span>
79
  </div>
80
 
81
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-cat dgwt-wcas-suggestion-headline">
82
  <span class="dgwt-wcas-st">
83
- <?php echo Helpers::getLabel( 'product_cat_plu' ); ?>
84
  </span>
85
  </div>
86
 
@@ -89,20 +89,20 @@ $labelSeeAll = Helpers::getLabel( 'show_more' );
89
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
90
  </span>
91
  <span class="dgwt-wcas-st">
92
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'category' ); ?></span>
93
  <?php _e( 'Sample category <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
94
  </span>
95
  </div>
96
 
97
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-tag dgwt-wcas-suggestion-headline">
98
  <span class="dgwt-wcas-st">
99
- <?php echo Helpers::getLabel( 'product_tag_plu' ); ?>
100
  </span>
101
  </div>
102
 
103
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-tag">
104
  <span class="dgwt-wcas-st">
105
- <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tag' ); ?></span>
106
  <?php _e( 'Sample tag <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
107
  </span>
108
  </div>
64
 
65
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-brand dgwt-wcas-suggestion-headline">
66
  <span class="dgwt-wcas-st">
67
+ <?php echo Helpers::getLabel( 'tax_' . DGWT_WCAS()->brands->getBrandTaxonomy() . '_plu' ); ?>
68
  </span>
69
  </div>
70
 
73
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
74
  </span>
75
  <span class="dgwt-wcas-st">
76
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_' . DGWT_WCAS()->brands->getBrandTaxonomy() ); ?></span>
77
  <?php _e( 'Sample brand <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
78
  </span>
79
  </div>
80
 
81
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-cat dgwt-wcas-suggestion-headline">
82
  <span class="dgwt-wcas-st">
83
+ <?php echo Helpers::getLabel( 'tax_product_cat_plu' ); ?>
84
  </span>
85
  </div>
86
 
89
  <img src="<?php echo DGWT_WCAS_URL; ?>assets/img/product-preview.png">
90
  </span>
91
  <span class="dgwt-wcas-st">
92
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_product_cat' ); ?></span>
93
  <?php _e( 'Sample category <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
94
  </span>
95
  </div>
96
 
97
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-headline-tag dgwt-wcas-suggestion-headline">
98
  <span class="dgwt-wcas-st">
99
+ <?php echo Helpers::getLabel( 'tax_product_tag_plu' ); ?>
100
  </span>
101
  </div>
102
 
103
  <div class="dgwt-wcas-suggestion dgwt-wcas-suggestion-tag">
104
  <span class="dgwt-wcas-st">
105
+ <span class="dgwt-wcas-st--direct-headline"><?php echo Helpers::getLabel( 'tax_product_tag' ); ?></span>
106
  <?php _e( 'Sample tag <strong>name</strong>', 'ajax-search-for-woocommerce' ); ?>
107
  </span>
108
  </div>
partials/details-panel/product-variation.php CHANGED
@@ -11,7 +11,12 @@ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
11
 
12
  <a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo wp_strip_all_tags($vars->name); ?>">
13
  <div class="dgwt-wcas-details-main-image">
14
- <img src="<?php echo esc_url( $vars->imageSrc ); ?>" alt="<?php echo wp_strip_all_tags( $vars->name ); ?>">
 
 
 
 
 
15
  </div>
16
  </a>
17
 
11
 
12
  <a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo wp_strip_all_tags($vars->name); ?>">
13
  <div class="dgwt-wcas-details-main-image">
14
+ <img
15
+ src="<?php echo esc_url( $vars->imageSrc ); ?>"
16
+ <?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'srcset="' . esc_attr( $vars->imageSrcset ) . '"' : '' ?>
17
+ <?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'sizes="' . esc_attr( $vars->imageSizes ) . '"' : '' ?>
18
+ alt="<?php echo wp_strip_all_tags( $vars->name ); ?>"
19
+ >
20
  </div>
21
  </a>
22
 
partials/details-panel/product.php CHANGED
@@ -11,7 +11,12 @@ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
11
 
12
  <a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo wp_strip_all_tags($vars->name); ?>">
13
  <div class="dgwt-wcas-details-main-image">
14
- <img src="<?php echo esc_url( $vars->imageSrc ); ?>" alt="<?php echo wp_strip_all_tags( $vars->name ); ?>">
 
 
 
 
 
15
  </div>
16
  </a>
17
 
11
 
12
  <a href="<?php echo esc_url( $vars->link ); ?>" title="<?php echo wp_strip_all_tags($vars->name); ?>">
13
  <div class="dgwt-wcas-details-main-image">
14
+ <img
15
+ src="<?php echo esc_url( $vars->imageSrc ); ?>"
16
+ <?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'srcset="' . esc_attr( $vars->imageSrcset ) . '"' : '' ?>
17
+ <?php echo ( ! empty( $vars->imageSrcset ) && ! empty( $vars->imageSizes ) ) ? 'sizes="' . esc_attr( $vars->imageSizes ) . '"' : '' ?>
18
+ alt="<?php echo wp_strip_all_tags( $vars->name ); ?>"
19
+ >
20
  </div>
21
  </a>
22
 
partials/themes/divi.php CHANGED
@@ -5,8 +5,15 @@ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
5
  exit;
6
  }
7
 
 
 
 
 
8
  add_action( 'wp_footer', function () {
9
  echo '<div id="wcas-divi-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="980" ]' ) . '</div>';
 
 
 
10
  ?>
11
  <script>
12
  (function ($) {
@@ -78,16 +85,16 @@ add_action( 'wp_footer', function () {
78
  });
79
 
80
  // Open overlay automatically
81
- $('#et_top_search #et_search_icon').on('click', function(){
82
- if($(window).width() <= 980){
83
  var $handler = $('.et_search_outer .js-dgwt-wcas-enable-mobile-form');
84
- if($handler.length){
85
  $handler[0].click();
86
  }
87
 
88
  setTimeout(function () {
89
  var $closeBtn = $('.et_close_search_field');
90
- if($closeBtn.length){
91
  $closeBtn[0].click();
92
  }
93
  }, 1100)
@@ -121,13 +128,13 @@ add_action( 'wp_footer', function () {
121
  }(jQuery));
122
  </script>
123
  <?php
124
- } );
125
 
126
  add_action( 'wp_head', function () {
127
  ?>
128
  <style>
129
  #wcas-divi-search {
130
- display: none!important;
131
  }
132
 
133
  /* Custom header */
5
  exit;
6
  }
7
 
8
+ add_filter( 'dgwt/wcas/scripts/mobile_breakpoint', function () {
9
+ return 980;
10
+ } );
11
+
12
  add_action( 'wp_footer', function () {
13
  echo '<div id="wcas-divi-search" style="display: block;">' . do_shortcode( '[wcas-search-form layout="classic" mobile_overlay="1" mobile_breakpoint="980" ]' ) . '</div>';
14
+ } );
15
+
16
+ add_action( 'wp_footer', function () {
17
  ?>
18
  <script>
19
  (function ($) {
85
  });
86
 
87
  // Open overlay automatically
88
+ $('#et_top_search #et_search_icon').on('click', function () {
89
+ if ($(window).width() <= 980) {
90
  var $handler = $('.et_search_outer .js-dgwt-wcas-enable-mobile-form');
91
+ if ($handler.length) {
92
  $handler[0].click();
93
  }
94
 
95
  setTimeout(function () {
96
  var $closeBtn = $('.et_close_search_field');
97
+ if ($closeBtn.length) {
98
  $closeBtn[0].click();
99
  }
100
  }, 1100)
128
  }(jQuery));
129
  </script>
130
  <?php
131
+ }, 100 );
132
 
133
  add_action( 'wp_head', function () {
134
  ?>
135
  <style>
136
  #wcas-divi-search {
137
+ display: none !important;
138
  }
139
 
140
  /* Custom header */
partials/themes/electro.php CHANGED
@@ -77,6 +77,12 @@ add_action( 'wp_footer', function () {
77
  max-width: 800px;
78
  }
79
 
 
 
 
 
 
 
80
  /** Mobile: Default Handled Header */
81
  .handheld-header-links .site-search .dgwt-wcas-search-wrapp {
82
  max-width: 100%;
77
  max-width: 800px;
78
  }
79
 
80
+ .navbar-search {
81
+ flex-basis: 0;
82
+ flex-grow: 1;
83
+ margin-bottom: 0;
84
+ }
85
+
86
  /** Mobile: Default Handled Header */
87
  .handheld-header-links .site-search .dgwt-wcas-search-wrapp {
88
  max-width: 100%;
partials/themes/generatepress.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Exit if accessed directly
3
+ if ( ! defined( 'DGWT_WCAS_FILE' ) ) {
4
+ exit;
5
+ }
6
+
7
+ add_action( 'template_redirect', function () {
8
+ remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );
9
+
10
+ add_action( 'generate_menu_bar_items', function () {
11
+ echo '<div class="dgwt-wcas-menu-bar-item">';
12
+ echo do_shortcode( '[fibosearch layout="icon"]' );
13
+ echo '</div>';
14
+ } );
15
+
16
+ // If generate_is_using_flexbox() === false
17
+ add_filter( 'generate_navigation_search_menu_item_output', function ( $html ) {
18
+ return '<li class="dgwt-wcas-menu-search-item">' . do_shortcode( '[fibosearch layout="icon"]' ) . '</li>';
19
+ } );
20
+
21
+ // If generate_is_using_flexbox() === false
22
+ add_action( 'generate_inside_mobile_menu_bar', function () {
23
+ echo '<div class="dgwt-wcas-search-item">';
24
+ echo do_shortcode( '[fibosearch layout="icon"]' );
25
+ echo '</div>';
26
+ } );
27
+ } );
28
+
29
+ add_action( 'wp_head', function () {
30
+ $settings = false;
31
+ if ( function_exists( 'generate_get_color_defaults' ) ) {
32
+ $settings = wp_parse_args(
33
+ get_option( 'generate_settings', array() ),
34
+ generate_get_color_defaults()
35
+ );
36
+ }
37
+ ?>
38
+ <style>
39
+ .dgwt-wcas-menu-bar-item, .dgwt-wcas-menu-search-item, .dgwt-wcas-search-item {
40
+ padding-left: 20px;
41
+ padding-right: 20px;
42
+ }
43
+
44
+ .menu-bar-items .dgwt-wcas-ico-magnifier-handler,
45
+ .dgwt-wcas-menu-search-item .dgwt-wcas-ico-magnifier-handler,
46
+ .dgwt-wcas-search-item .dgwt-wcas-ico-magnifier-handler {
47
+ max-width: 16px;
48
+ }
49
+
50
+ .mobile-bar-items .search-item {
51
+ display: none;
52
+ }
53
+
54
+ #mobile-menu .dgwt-wcas-menu-search-item {
55
+ display: none;
56
+ }
57
+
58
+ #masthead .dgwt-wcas-search-item, .dgwt-wcas-menu-search-item {
59
+ padding-top: 20px;
60
+ }
61
+
62
+ <?php if ($settings) { ?>
63
+
64
+ .dgwt-wcas-search-icon path {
65
+ fill: <?php echo esc_attr($settings['navigation_text_color']); ?>;
66
+ }
67
+
68
+ .dgwt-wcas-search-icon:hover path {
69
+ fill: <?php echo esc_attr($settings['navigation_text_hover_color']); ?>;
70
+ }
71
+
72
+ <?php } ?>
73
+ </style>
74
+ <?php
75
+ } );
partials/themes/open-shop.php CHANGED
@@ -12,6 +12,10 @@ add_action( 'wp_footer', function () {
12
  if (wcasThemeSearch !== null) {
13
  wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
14
  }
 
 
 
 
15
  document.querySelector('#wcas-theme-search').remove();
16
  </script>
17
  <style>
@@ -59,6 +63,10 @@ add_action( 'wp_footer', function () {
59
  if (wcasThemeSearchInStickyHeader !== null) {
60
  wcasThemeSearchInStickyHeader.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
61
  }
 
 
 
 
62
  document.querySelector('#wcas-theme-search-sticky').remove();
63
 
64
  (function ($) {
12
  if (wcasThemeSearch !== null) {
13
  wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
14
  }
15
+ wcasThemeSearch = document.querySelector('.below-header .thmk-woocommerce-search-wrap');
16
+ if (wcasThemeSearch !== null) {
17
+ wcasThemeSearch.replaceWith(document.querySelector('#wcas-theme-search > div'));
18
+ }
19
  document.querySelector('#wcas-theme-search').remove();
20
  </script>
21
  <style>
63
  if (wcasThemeSearchInStickyHeader !== null) {
64
  wcasThemeSearchInStickyHeader.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
65
  }
66
+ wcasThemeSearchInStickyHeader = document.querySelector('.search-wrapper .thmk-woocommerce-search-wrap');
67
+ if (wcasThemeSearchInStickyHeader !== null) {
68
+ wcasThemeSearchInStickyHeader.replaceWith(document.querySelector('#wcas-theme-search-sticky > div'));
69
+ }
70
  document.querySelector('#wcas-theme-search-sticky').remove();
71
 
72
  (function ($) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: woocommerce search, ajax search, search by sku, product search, woocommerc
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
  Requires PHP: 7.0
7
- Stable tag: 1.13.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -142,15 +142,39 @@ You can read more and compare Pro and Free features here: [Full comparison - Pro
142
 
143
  == Changelog ==
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  = 1.13.0, July 27, 2021 =
146
- * ADD: Integration with "eStore" theme
147
  * ADD: Allow to open search result in new tab with Ctrl+left mouse key
148
 
149
  * FIX: Disappearing suggestions and details panel on click when there were more search bars.
150
- * FIX: Improved integration with "Avada" theme
151
- * FIX: Improved mobile search in new version of "Rehub" theme
152
  * FIX: Unable to use context menu and middle mouse button on search results
153
- * FIX: "Eletro" theme - Support cases when the search overlay is disabled
154
 
155
  * REFACTOR: Clean up composer files
156
 
4
  Requires at least: 5.0
5
  Tested up to: 5.8
6
  Requires PHP: 7.0
7
+ Stable tag: 1.14.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
142
 
143
  == Changelog ==
144
 
145
+ = 1.14.0, October 19, 2021 =
146
+ * ADD: Integration with “GeneratePress” theme
147
+ * ADD: Possibility to set a delay for initialization of mobile overlay
148
+ * ADD: New filter to manipulate the results score
149
+ * ADD: Details Panel - support for responsive images including retina images (2x), sizes, and srcset
150
+ * ADD: Possibility to insert custom HTML in 5 places in the search suggestion
151
+ * ADD: New filter and action hooks
152
+
153
+ * FIX: Prevent hiding search results on click an Enter key when submit is disabled via a filter
154
+ * FIX: No results on the search page when WPML is active with “Language name added as a parameter” option
155
+ * FIX: Support for version v1.3.1 of Open Shop theme
156
+ * FIX: Integrating with Divi theme - delay in starting JS scripts
157
+ * FIX: Integrating with Divi theme - force search overlay for mobile devices
158
+ * FIX: Unnecessary HTML tags in the search input after selecting a suggestion
159
+ * FIX: Hide mobile overlay after submitting a form or clicking a result. Fixes screen after clicking iPhone back arrow
160
+ * FIX: Troubleshooting module. Fixed false negative in “OutOfStockRelationships test”. An order of arrays was taken into account for the diff function. It was replaced by full diff
161
+ * FIX: Unclosed tag &lt;a/&gt;
162
+ * FIX: Typo on Troubleshooting tab
163
+ * FIX: Clear “alt” attribute in the product thumbnail
164
+
165
+ * REFACTOR: Escape search terms the way WordPress core does
166
+ * REFACTOR: Replacing image with thumbnails in DgoraWcas\Post class to keep a consistent style compared with DgoraWcas\Product
167
+
168
+
169
  = 1.13.0, July 27, 2021 =
170
+ * ADD: Integration with eStore theme
171
  * ADD: Allow to open search result in new tab with Ctrl+left mouse key
172
 
173
  * FIX: Disappearing suggestions and details panel on click when there were more search bars.
174
+ * FIX: Improved integration with Avada theme
175
+ * FIX: Improved mobile search in new version of Rehub theme
176
  * FIX: Unable to use context menu and middle mouse button on search results
177
+ * FIX: Eletro theme - Support cases when the search overlay is disabled
178
 
179
  * REFACTOR: Clean up composer files
180