YITH WooCommerce Ajax Search - Version 1.8.3

Version Description

  • Released on 3 Nov 2020 =
  • New: Support for Wordpress 5.6
  • New: Support for WooCommerce 4.7
  • Update: Plugin framework
  • Dev: Removed deprecated jQuery functions
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Search
Version 1.8.3
Comparing to
See all releases

Code changes from version 1.8.2 to 1.8.3

README.txt CHANGED
@@ -3,8 +3,8 @@
3
  Contributors: yithemes
4
  Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
5
  Requires at least: 4.0.0
6
- Tested up to: 5.5
7
- Stable tag: 1.8.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,13 @@ If you have created your own language pack for YITH WooCommerce Ajax Search, or
138
  2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
139
 
140
  == Changelog ==
 
 
 
 
 
 
 
141
  = 1.8.2 - Released on 6 Oct 2020 =
142
  * New: Support for WooCommerce 4.6
143
  * Update: Plugin framework
3
  Contributors: yithemes
4
  Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
5
  Requires at least: 4.0.0
6
+ Tested up to: 5.6
7
+ Stable tag: 1.8.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
138
  2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
139
 
140
  == Changelog ==
141
+
142
+ = 1.8.3 - Released on 3 Nov 2020 =
143
+ * New: Support for Wordpress 5.6
144
+ * New: Support for WooCommerce 4.7
145
+ * Update: Plugin framework
146
+ * Dev: Removed deprecated jQuery functions
147
+
148
  = 1.8.2 - Released on 6 Oct 2020 =
149
  * New: Support for WooCommerce 4.6
150
  * Update: Plugin framework
assets/js/devbridge-jquery-autocomplete.js CHANGED
@@ -81,7 +81,7 @@
81
  },
82
  paramName: 'query',
83
  transformResult: function (response) {
84
- return typeof response === 'string' ? $.parseJSON(response) : response;
85
  },
86
  showNoSuggestionNotice: false,
87
  noSuggestionNotice: 'No results'
@@ -207,7 +207,7 @@
207
 
208
  $.extend(options, suppliedOptions);
209
 
210
- that.isLocal = $.isArray(options.lookup);
211
 
212
  if (that.isLocal) {
213
  options.lookup = that.verifySuggestionsFormat(options.lookup);
@@ -484,14 +484,14 @@
484
  if (that.isLocal) {
485
  response = that.getSuggestionsLocal(q);
486
  } else {
487
- if ($.isFunction(serviceUrl)) {
488
  serviceUrl = serviceUrl.call(that.element, q);
489
  }
490
  cacheKey = serviceUrl + '?' + $.param(params || {});
491
  response = that.cachedResponse[cacheKey];
492
  }
493
 
494
- if (response && $.isArray(response.suggestions)) {
495
  that.suggestions = response.suggestions;
496
  that.suggest();
497
  } else if (!that.isBadQuery(q)) {
@@ -584,7 +584,7 @@
584
  container.children().first().addClass(classSelected);
585
  }
586
 
587
- if ($.isFunction(beforeRender)) {
588
  beforeRender.call(that.element, container);
589
  }
590
 
@@ -793,7 +793,7 @@
793
  that.suggestions = [];
794
  that.selection = suggestion;
795
 
796
- if ($.isFunction(onSelectCallback)) {
797
  onSelectCallback.call(that.element, suggestion);
798
  }
799
  },
81
  },
82
  paramName: 'query',
83
  transformResult: function (response) {
84
+ return typeof response === 'string' ? JSON.parse(response) : response;
85
  },
86
  showNoSuggestionNotice: false,
87
  noSuggestionNotice: 'No results'
207
 
208
  $.extend(options, suppliedOptions);
209
 
210
+ that.isLocal = Array.isArray(options.lookup);
211
 
212
  if (that.isLocal) {
213
  options.lookup = that.verifySuggestionsFormat(options.lookup);
484
  if (that.isLocal) {
485
  response = that.getSuggestionsLocal(q);
486
  } else {
487
+ if ( typeof serviceUrl === 'function' ) {
488
  serviceUrl = serviceUrl.call(that.element, q);
489
  }
490
  cacheKey = serviceUrl + '?' + $.param(params || {});
491
  response = that.cachedResponse[cacheKey];
492
  }
493
 
494
+ if (response && Array.isArray(response.suggestions)) {
495
  that.suggestions = response.suggestions;
496
  that.suggest();
497
  } else if (!that.isBadQuery(q)) {
584
  container.children().first().addClass(classSelected);
585
  }
586
 
587
+ if (typeof beforeRender === 'function') {
588
  beforeRender.call(that.element, container);
589
  }
590
 
793
  that.suggestions = [];
794
  that.selection = suggestion;
795
 
796
+ if (typeof onSelectCallback === 'function') {
797
  onSelectCallback.call(that.element, suggestion);
798
  }
799
  },
assets/js/devbridge-jquery-autocomplete.min.js CHANGED
@@ -1,22 +1 @@
1
- (function(d){"function"===typeof define&&define.amd?define(["jquery"],d):d(jQuery)})(function(d){function g(a,b){var c=function(){},c={autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:g.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,
2
- preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(a){return"string"===typeof a?d.parseJSON(a):a},showNoSuggestionNotice:!1,noSuggestionNotice:"No results"};this.element=a;this.el=d(a);this.suggestions=[];this.badQueries=[];this.selectedIndex=-1;this.currentValue=this.element.value;this.intervalId=0;this.cachedResponse={};this.onChange=this.onChangeInterval=null;this.isLocal=!1;this.suggestionsContainer=null;this.options=
3
- d.extend({},c,b);this.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"};this.hint=null;this.hintValue="";this.selection=null;this.initialize();this.setOptions(b)}var h=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");b.className=a;b.style.position="absolute";b.style.display="none";return b}}}();g.utils=h;d.Autocomplete=g;g.formatResult=function(a,b){var c=
4
- "("+h.escapeRegExChars(b)+")";return a.value.replace(new RegExp(c,"gi"),"<strong>$1</strong>")};g.prototype={killerFn:null,initialize:function(){var a=this,b="."+a.classes.suggestion,c=a.classes.selected,e=a.options,f;a.element.setAttribute("autocomplete","off");a.killerFn=function(b){0===d(b.target).closest("."+a.options.containerClass).length&&(a.killSuggestions(),a.disableKillerFn())};a.suggestionsContainer=g.utils.createNode(e.containerClass);f=d(a.suggestionsContainer);f.appendTo(e.appendTo);
5
- "auto"!==e.width&&f.width(e.width);f.on("mouseover.autocomplete",b,function(){a.activate(d(this).data("index"))});f.on("mouseout.autocomplete",function(){a.selectedIndex=-1;f.children("."+c).removeClass(c)});f.on("click.autocomplete",b,function(){a.select(d(this).data("index"))});a.fixPosition();a.fixPositionCapture=function(){a.visible&&a.fixPosition()};d(window).on("resize.autocomplete",a.fixPositionCapture);a.el.on("keydown.autocomplete",function(b){a.onKeyPress(b)});a.el.on("keyup.autocomplete",
6
- function(b){a.onKeyUp(b)});a.el.on("blur.autocomplete",function(){a.onBlur()});a.el.on("focus.autocomplete",function(){a.onFocus()});a.el.on("change.autocomplete",function(b){a.onKeyUp(b)})},onFocus:function(){this.fixPosition();if(this.options.minChars<=this.el.val().length)this.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(a){var b=this.options;d.extend(b,a);if(this.isLocal=d.isArray(b.lookup))b.lookup=this.verifySuggestionsFormat(b.lookup);d(this.suggestionsContainer).css({"max-height":b.maxHeight+
7
- "px",width:b.width+"px","z-index":b.zIndex})},clearCache:function(){this.cachedResponse={};this.badQueries=[]},clear:function(){this.clearCache();this.currentValue="";this.suggestions=[]},disable:function(){this.disabled=!0;this.currentRequest&&this.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var a;"body"===this.options.appendTo&&(a=this.el.offset(),a={top:a.top+this.el.outerHeight()+"px",left:a.left+"px"},"auto"===this.options.width&&(a.width=this.el.outerWidth()-
8
- 2+"px"),d(this.suggestionsContainer).css(a))},enableKillerFn:function(){d(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){d(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions();a.intervalId=window.setInterval(function(){a.hide();a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a=this.el.val().length,b=this.element.selectionStart;return"number"===
9
- typeof b?b===a:document.selection?(b=document.selection.createRange(),b.moveStart("character",-a),a===b.text.length):!0},onKeyPress:function(a){if(!this.disabled&&!this.visible&&40===a.which&&this.currentValue)this.suggest();else if(!this.disabled&&this.visible){switch(a.which){case 27:this.el.val(this.currentValue);this.hide();break;case 39:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case 9:if(this.hint&&this.options.onHint){this.selectHint();return}case 13:if(-1===
10
- this.selectedIndex){this.hide();return}this.select(this.selectedIndex);if(9===a.which&&!1===this.options.tabDisabled)return;break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}a.stopImmediatePropagation();a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case 38:case 40:return}clearInterval(b.onChangeInterval);if(b.currentValue!==b.el.val())if(b.findBestHint(),0<b.options.deferRequestBy)b.onChangeInterval=setInterval(function(){b.onValueChange()},
11
- b.options.deferRequestBy);else b.onValueChange()}},onValueChange:function(){var a=this.options,b=this.el.val(),c=this.getQuery(b);this.selection&&(this.selection=null,(a.onInvalidateSelection||d.noop).call(this.element));clearInterval(this.onChangeInterval);this.currentValue=b;this.selectedIndex=-1;if(a.triggerSelectOnValidInput&&(b=this.findSuggestionIndex(c),-1!==b)){this.select(b);return}c.length<a.minChars?this.hide():this.getSuggestions(c)},findSuggestionIndex:function(a){var b=-1,c=a.toLowerCase();
12
- d.each(this.suggestions,function(a,d){if(d.value.toLowerCase()===c)return b=a,!1});return b},getQuery:function(a){var b=this.options.delimiter;if(!b)return a;a=a.split(b);return d.trim(a[a.length-1])},getSuggestionsLocal:function(a){var b=this.options,c=a.toLowerCase(),e=b.lookupFilter,f=parseInt(b.lookupLimit,10),b={suggestions:d.grep(b.lookup,function(b){return e(b,a,c)})};f&&b.suggestions.length>f&&(b.suggestions=b.suggestions.slice(0,f));return b},getSuggestions:function(a){var b,c=this,e=c.options,
13
- f=e.serviceUrl,k,g;e.params[e.paramName]=a;k=e.ignoreParams?null:e.params;c.isLocal?b=c.getSuggestionsLocal(a):(d.isFunction(f)&&(f=f.call(c.element,a)),g=f+"?"+d.param(k||{}),b=c.cachedResponse[g]);b&&d.isArray(b.suggestions)?(c.suggestions=b.suggestions,c.suggest()):c.isBadQuery(a)||!1===e.onSearchStart.call(c.element,e.params)||(c.currentRequest&&c.currentRequest.abort(),c.currentRequest=d.ajax({url:f,data:k,type:e.type,dataType:e.dataType}).done(function(b){c.currentRequest=null;b=e.transformResult(b);
14
- c.processResponse(b,a,g);e.onSearchComplete.call(c.element,a,b.suggestions)}).fail(function(b,d,f){e.onSearchError.call(c.element,a,b,d,f)}))},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){this.visible=!1;this.selectedIndex=-1;d(this.suggestionsContainer).hide();this.signalHint(null)},suggest:function(){if(0===this.suggestions.length)this.options.showNoSuggestionNotice?this.noSuggestions():
15
- this.hide();else{var a=this.options,b=a.formatResult,c=this.getQuery(this.currentValue),e=this.classes.suggestion,f=this.classes.selected,g=d(this.suggestionsContainer),h=a.beforeRender,l="",m;if(a.triggerSelectOnValidInput&&(m=this.findSuggestionIndex(c),-1!==m)){this.select(m);return}d.each(this.suggestions,function(a,d){l+='<div class="'+e+'" data-index="'+a+'">'+b(d,c)+"</div>"});this.adjustContainerWidth();g.html(l);a.autoSelectFirst&&(this.selectedIndex=0,g.children().first().addClass(f));d.isFunction(h)&&
16
- h.call(this.element,g);g.show();this.visible=!0;this.findBestHint()}},noSuggestions:function(){var a=d(this.suggestionsContainer),b;b=""+('<div class="autocomplete-no-suggestion">'+this.options.noSuggestionNotice+"</div>");this.adjustContainerWidth();a.html(b);a.show();this.visible=!0},adjustContainerWidth:function(){var a=this.options,b=d(this.suggestionsContainer);"auto"===a.width&&(a=this.el.outerWidth()-2,b.width(0<a?a:300))},findBestHint:function(){var a=this.el.val().toLowerCase(),b=null;a&&
17
- (d.each(this.suggestions,function(c,d){var f=0===d.value.toLowerCase().indexOf(a);f&&(b=d);return!f}),this.signalHint(b))},signalHint:function(a){var b="";a&&(b=this.currentValue+a.value.substr(this.currentValue.length));this.hintValue!==b&&(this.hintValue=b,this.hint=a,(this.options.onHint||d.noop)(b))},verifySuggestionsFormat:function(a){return a.length&&"string"===typeof a[0]?d.map(a,function(a){return{value:a,data:null}}):a},processResponse:function(a,b,c){var d=this.options;a.suggestions=this.verifySuggestionsFormat(a.suggestions);
18
- d.noCache||(this.cachedResponse[c]=a,d.preventBadQueries&&0===a.suggestions.length&&this.badQueries.push(b));b===this.getQuery(this.currentValue)&&(this.suggestions=a.suggestions,this.suggest())},activate:function(a){var b=this.classes.selected,c=d(this.suggestionsContainer),e=c.children();c.children("."+b).removeClass(b);this.selectedIndex=a;return-1!==this.selectedIndex&&e.length>this.selectedIndex?(a=e.get(this.selectedIndex),d(a).addClass(b),a):null},selectHint:function(){var a=d.inArray(this.hint,
19
- this.suggestions);this.select(a)},select:function(a){this.hide();this.onSelect(a)},moveUp:function(){-1!==this.selectedIndex&&(0===this.selectedIndex?(d(this.suggestionsContainer).children().first().removeClass(this.classes.selected),this.selectedIndex=-1,this.el.val(this.currentValue),this.findBestHint()):this.adjustScroll(this.selectedIndex-1))},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(a){var b=this.activate(a),
20
- c,e;b&&(b=b.offsetTop,c=d(this.suggestionsContainer).scrollTop(),e=c+this.options.maxHeight-25,b<c?d(this.suggestionsContainer).scrollTop(b):b>e&&d(this.suggestionsContainer).scrollTop(b-this.options.maxHeight+25),this.el.val(this.getValue(this.suggestions[a].value)),this.signalHint(null))},onSelect:function(a){var b=this.options.onSelect;a=this.suggestions[a];this.currentValue=this.getValue(a.value);this.currentValue!==this.el.val()&&this.el.val(this.currentValue);this.signalHint(null);this.suggestions=
21
- [];this.selection=a;d.isFunction(b)&&b.call(this.element,a)},getValue:function(a){var b=this.options.delimiter,c;if(!b)return a;c=this.currentValue;b=c.split(b);return 1===b.length?a:c.substr(0,c.length-b[b.length-1].length)+a},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete");this.disableKillerFn();d(window).off("resize.autocomplete",this.fixPositionCapture);d(this.suggestionsContainer).remove()}};d.fn.autocomplete=function(a,b){return 0===arguments.length?this.first().data("autocomplete"):
22
- this.each(function(){var c=d(this),e=c.data("autocomplete");if("string"===typeof a){if(e&&"function"===typeof e[a])e[a](b)}else e&&e.dispose&&e.dispose(),e=new g(this,a),c.data("autocomplete",e)})}});
1
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(c){"use strict";var s={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}},n=27,i=9,o=13,l=38,a=39,u=40;function r(e,t){var n=function(){},s=this,i={autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:r.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:n,onSearchComplete:n,onSearchError:n,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(e,t,n){return-1!==e.value.toLowerCase().indexOf(n)},paramName:"query",transformResult:function(e){return"string"==typeof e?JSON.parse(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results"};s.element=e,s.el=c(e),s.suggestions=[],s.badQueries=[],s.selectedIndex=-1,s.currentValue=s.element.value,s.intervalId=0,s.cachedResponse={},s.onChangeInterval=null,s.onChange=null,s.isLocal=!1,s.suggestionsContainer=null,s.options=c.extend({},i,t),s.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},s.hint=null,s.hintValue="",s.selection=null,s.initialize(),s.setOptions(t)}r.utils=s,(c.Autocomplete=r).formatResult=function(e,t){var n="("+s.escapeRegExChars(t)+")";return e.value.replace(new RegExp(n,"gi"),"<strong>$1</strong>")},r.prototype={killerFn:null,initialize:function(){var e,t=this,n="."+t.classes.suggestion,s=t.classes.selected,i=t.options;t.element.setAttribute("autocomplete","off"),t.killerFn=function(e){0===c(e.target).closest("."+t.options.containerClass).length&&(t.killSuggestions(),t.disableKillerFn())},t.suggestionsContainer=r.utils.createNode(i.containerClass),(e=c(t.suggestionsContainer)).appendTo(i.appendTo),"auto"!==i.width&&e.width(i.width),e.on("mouseover.autocomplete",n,function(){t.activate(c(this).data("index"))}),e.on("mouseout.autocomplete",function(){t.selectedIndex=-1,e.children("."+s).removeClass(s)}),e.on("click.autocomplete",n,function(){t.select(c(this).data("index"))}),t.fixPosition(),t.fixPositionCapture=function(){t.visible&&t.fixPosition()},c(window).on("resize.autocomplete",t.fixPositionCapture),t.el.on("keydown.autocomplete",function(e){t.onKeyPress(e)}),t.el.on("keyup.autocomplete",function(e){t.onKeyUp(e)}),t.el.on("blur.autocomplete",function(){t.onBlur()}),t.el.on("focus.autocomplete",function(){t.onFocus()}),t.el.on("change.autocomplete",function(e){t.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition(),e.options.minChars<=e.el.val().length&&e.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(e){var t=this,n=t.options;c.extend(n,e),t.isLocal=Array.isArray(n.lookup),t.isLocal&&(n.lookup=t.verifySuggestionsFormat(n.lookup)),c(t.suggestionsContainer).css({"max-height":n.maxHeight+"px",width:n.width+"px","z-index":n.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,e.currentRequest&&e.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var e,t,n=this;"body"===n.options.appendTo&&(t={top:(e=n.el.offset()).top+n.el.outerHeight()+"px",left:e.left+"px"},"auto"===n.options.width&&(t.width=n.el.outerWidth()-2+"px"),c(n.suggestionsContainer).css(t))},enableKillerFn:function(){c(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){c(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var e=this;e.stopKillSuggestions(),e.intervalId=window.setInterval(function(){e.hide(),e.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var e,t=this.el.val().length,n=this.element.selectionStart;return"number"==typeof n?n===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(e){var t=this;if(t.disabled||t.visible||e.which!==u||!t.currentValue){if(!t.disabled&&t.visible){switch(e.which){case n:t.el.val(t.currentValue),t.hide();break;case a:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case i:if(t.hint&&t.options.onHint)return void t.selectHint();case o:if(-1===t.selectedIndex)return void t.hide();if(t.select(t.selectedIndex),e.which===i&&!1===t.options.tabDisabled)return;break;case l:t.moveUp();break;case u:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else t.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case l:case u:return}clearInterval(t.onChangeInterval),t.currentValue!==t.el.val()&&(t.findBestHint(),0<t.options.deferRequestBy?t.onChangeInterval=setInterval(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){var e,t=this,n=t.options,s=t.el.val(),i=t.getQuery(s);t.selection&&(t.selection=null,(n.onInvalidateSelection||c.noop).call(t.element)),clearInterval(t.onChangeInterval),t.currentValue=s,t.selectedIndex=-1,n.triggerSelectOnValidInput&&-1!==(e=t.findSuggestionIndex(i))?t.select(e):i.length<n.minChars?t.hide():t.getSuggestions(i)},findSuggestionIndex:function(e){var n=-1,s=e.toLowerCase();return c.each(this.suggestions,function(e,t){if(t.value.toLowerCase()===s)return n=e,!1}),n},getQuery:function(e){var t,n=this.options.delimiter;return n?(t=e.split(n),c.trim(t[t.length-1])):e},getSuggestionsLocal:function(t){var e=this.options,n=t.toLowerCase(),s=e.lookupFilter,i=parseInt(e.lookupLimit,10),o={suggestions:c.grep(e.lookup,function(e){return s(e,t,n)})};return i&&o.suggestions.length>i&&(o.suggestions=o.suggestions.slice(0,i)),o},getSuggestions:function(s){var e,t,n,i=this,o=i.options,l=o.serviceUrl;if(o.params[o.paramName]=s,t=o.ignoreParams?null:o.params,(e=i.isLocal?i.getSuggestionsLocal(s):("function"==typeof l&&(l=l.call(i.element,s)),n=l+"?"+c.param(t||{}),i.cachedResponse[n]))&&Array.isArray(e.suggestions))i.suggestions=e.suggestions,i.suggest();else if(!i.isBadQuery(s)){if(!1===o.onSearchStart.call(i.element,o.params))return;i.currentRequest&&i.currentRequest.abort(),i.currentRequest=c.ajax({url:l,data:t,type:o.type,dataType:o.dataType}).done(function(e){var t;i.currentRequest=null,t=o.transformResult(e),i.processResponse(t,s,n),o.onSearchComplete.call(i.element,s,t.suggestions)}).fail(function(e,t,n){o.onSearchError.call(i.element,s,e,t,n)})}},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,n=t.length;n--;)if(0===e.indexOf(t[n]))return!0;return!1},hide:function(){this.visible=!1,this.selectedIndex=-1,c(this.suggestionsContainer).hide(),this.signalHint(null)},suggest:function(){var e,t,n,s,i,o,l,a,u,r;0!==this.suggestions.length?(t=(e=this).options,n=t.formatResult,s=e.getQuery(e.currentValue),i=e.classes.suggestion,o=e.classes.selected,l=c(e.suggestionsContainer),a=t.beforeRender,u="",t.triggerSelectOnValidInput&&-1!==(r=e.findSuggestionIndex(s))?e.select(r):(c.each(e.suggestions,function(e,t){u+='<div class="'+i+'" data-index="'+e+'">'+n(t,s)+"</div>"}),this.adjustContainerWidth(),l.html(u),t.autoSelectFirst&&(e.selectedIndex=0,l.children().first().addClass(o)),"function"==typeof a&&a.call(e.element,l),l.show(),e.visible=!0,e.findBestHint())):this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var e=c(this.suggestionsContainer),t="";t+='<div class="autocomplete-no-suggestion">'+this.options.noSuggestionNotice+"</div>",this.adjustContainerWidth(),e.html(t),e.show(),this.visible=!0},adjustContainerWidth:function(){var e,t=this.options,n=c(this.suggestionsContainer);"auto"===t.width&&(e=this.el.outerWidth()-2,n.width(0<e?e:300))},findBestHint:function(){var s=this.el.val().toLowerCase(),i=null;s&&(c.each(this.suggestions,function(e,t){var n=0===t.value.toLowerCase().indexOf(s);return n&&(i=t),!n}),this.signalHint(i))},signalHint:function(e){var t="",n=this;e&&(t=n.currentValue+e.value.substr(n.currentValue.length)),n.hintValue!==t&&(n.hintValue=t,n.hint=e,(this.options.onHint||c.noop)(t))},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?c.map(e,function(e){return{value:e,data:null}}):e},processResponse:function(e,t,n){var s=this,i=s.options;e.suggestions=s.verifySuggestionsFormat(e.suggestions),i.noCache||(s.cachedResponse[n]=e,i.preventBadQueries&&0===e.suggestions.length&&s.badQueries.push(t)),t===s.getQuery(s.currentValue)&&(s.suggestions=e.suggestions,s.suggest())},activate:function(e){var t,n=this,s=n.classes.selected,i=c(n.suggestionsContainer),o=i.children();return i.children("."+s).removeClass(s),n.selectedIndex=e,-1!==n.selectedIndex&&o.length>n.selectedIndex?(t=o.get(n.selectedIndex),c(t).addClass(s),t):null},selectHint:function(){var e=c.inArray(this.hint,this.suggestions);this.select(e)},select:function(e){this.hide(),this.onSelect(e)},moveUp:function(){var e=this;if(-1!==e.selectedIndex)return 0===e.selectedIndex?(c(e.suggestionsContainer).children().first().removeClass(e.classes.selected),e.selectedIndex=-1,e.el.val(e.currentValue),void e.findBestHint()):void e.adjustScroll(e.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var t,n,s,i=this,o=i.activate(e);o&&(t=o.offsetTop,s=(n=c(i.suggestionsContainer).scrollTop())+i.options.maxHeight-25,t<n?c(i.suggestionsContainer).scrollTop(t):s<t&&c(i.suggestionsContainer).scrollTop(t-i.options.maxHeight+25),i.el.val(i.getValue(i.suggestions[e].value)),i.signalHint(null))},onSelect:function(e){var t=this,n=t.options.onSelect,s=t.suggestions[e];t.currentValue=t.getValue(s.value),t.currentValue!==t.el.val()&&t.el.val(t.currentValue),t.signalHint(null),t.suggestions=[],t.selection=s,"function"==typeof n&&n.call(t.element,s)},getValue:function(e){var t,n,s=this.options.delimiter;return!s||1===(n=(t=this.currentValue).split(s)).length?e:t.substr(0,t.length-n[n.length-1].length)+e},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),this.disableKillerFn(),c(window).off("resize.autocomplete",this.fixPositionCapture),c(this.suggestionsContainer).remove()}},c.fn.autocomplete=function(n,s){var i="autocomplete";return 0===arguments.length?this.first().data(i):this.each(function(){var e=c(this),t=e.data(i);"string"==typeof n?t&&"function"==typeof t[n]&&t[n](s):(t&&t.dispose&&t.dispose(),t=new r(this,n),e.data(i,t))})}});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/frontend.js CHANGED
@@ -6,7 +6,7 @@
6
  * @version 1.1.1
7
  */
8
 
9
- jQuery(document).ready(function ($) {
10
  "use strict";
11
 
12
  var el = $('.yith-s'),
6
  * @version 1.1.1
7
  */
8
 
9
+ jQuery(function ($) {
10
  "use strict";
11
 
12
  var el = $('.yith-s'),
assets/js/frontend.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){"use strict";var o=a(".yith-s"),e="undefined"!=typeof woocommerce_params&&void 0!==woocommerce_params.ajax_loader_url?woocommerce_params.ajax_loader_url:yith_wcas_params.loading,t=""==o.data("loader-icon")?e:o.data("loader-icon"),r=a("#yith-searchsubmit"),n=o.data("min-chars"),c=yith_wcas_params.ajax_url;-1==c.indexOf("?")&&(c+="?"),r.on("click",function(){return""!=a(this).closest("form").find(".yith-s").val()}),0==o.length&&(o=a("#yith-s")),o.each(function(){var o=a(this),e=void 0===o.data("append-to")?o.closest(".yith-ajaxsearchform-container"):o.closest(o.data("append-to"));o.yithautocomplete({minChars:n,appendTo:e,triggerSelectOnValidInput:!1,serviceUrl:c+"action=yith_ajax_search_products",onSearchStart:function(){o.css({"background-image":"url("+t+")","background-repeat":"no-repeat","background-position":"center right"})},onSelect:function(a){-1!=a.id&&(window.location.href=a.url)},onSearchComplete:function(){o.css("background-image","none")}})})});
1
+ jQuery(function(e){"use strict";var a=e(".yith-s"),o="undefined"!=typeof woocommerce_params&&void 0!==woocommerce_params.ajax_loader_url?woocommerce_params.ajax_loader_url:yith_wcas_params.loading,t=""==a.data("loader-icon")?o:a.data("loader-icon"),r=e("#yith-searchsubmit"),n=a.data("min-chars"),c=yith_wcas_params.ajax_url;-1==c.indexOf("?")&&(c+="?"),r.on("click",function(){return""!=e(this).closest("form").find(".yith-s").val()}),0==a.length&&(a=e("#yith-s")),a.each(function(){var a=e(this),o=void 0===a.data("append-to")?a.closest(".yith-ajaxsearchform-container"):a.closest(a.data("append-to"));a.yithautocomplete({minChars:n,appendTo:o,triggerSelectOnValidInput:!1,serviceUrl:c+"action=yith_ajax_search_products",onSearchStart:function(){a.css({"background-image":"url("+t+")","background-repeat":"no-repeat","background-position":"center right"})},onSelect:function(a){-1!=a.id&&(window.location.href=a.url)},onSearchComplete:function(){a.css("background-image","none")}})})});
assets/js/yith-autocomplete.js CHANGED
@@ -82,7 +82,7 @@
82
  },
83
  paramName: 'query',
84
  transformResult: function (response) {
85
- return typeof response === 'string' ? $.parseJSON(response) : response;
86
  },
87
  showNoSuggestionNotice: false,
88
  noSuggestionNotice: 'No results'
@@ -207,7 +207,7 @@
207
 
208
  $.extend(options, suppliedOptions);
209
 
210
- that.isLocal = $.isArray(options.lookup);
211
 
212
  if (that.isLocal) {
213
  options.lookup = that.verifySuggestionsFormat(options.lookup);
@@ -484,14 +484,15 @@
484
  if (that.isLocal) {
485
  response = that.getSuggestionsLocal(q);
486
  } else {
487
- if ($.isFunction(serviceUrl)) {
 
488
  serviceUrl = serviceUrl.call(that.element, q);
489
  }
490
  cacheKey = serviceUrl + '?' + $.param(params || {});
491
  response = that.cachedResponse[cacheKey];
492
  }
493
 
494
- if (response && $.isArray(response.suggestions)) {
495
  that.suggestions = response.suggestions;
496
  that.suggest();
497
  } else if (!that.isBadQuery(q)) {
@@ -584,7 +585,7 @@
584
  container.children().first().addClass(classSelected);
585
  }
586
 
587
- if ($.isFunction(beforeRender)) {
588
  beforeRender.call(that.element, container);
589
  }
590
 
@@ -793,7 +794,7 @@
793
  that.suggestions = [];
794
  that.selection = suggestion;
795
 
796
- if ($.isFunction(onSelectCallback)) {
797
  onSelectCallback.call(that.element, suggestion);
798
  }
799
  },
82
  },
83
  paramName: 'query',
84
  transformResult: function (response) {
85
+ return typeof response === 'string' ? JSON.parse(response) : response;
86
  },
87
  showNoSuggestionNotice: false,
88
  noSuggestionNotice: 'No results'
207
 
208
  $.extend(options, suppliedOptions);
209
 
210
+ that.isLocal = Array.isArray(options.lookup);
211
 
212
  if (that.isLocal) {
213
  options.lookup = that.verifySuggestionsFormat(options.lookup);
484
  if (that.isLocal) {
485
  response = that.getSuggestionsLocal(q);
486
  } else {
487
+
488
+ if (typeof serviceUrl === 'function') {
489
  serviceUrl = serviceUrl.call(that.element, q);
490
  }
491
  cacheKey = serviceUrl + '?' + $.param(params || {});
492
  response = that.cachedResponse[cacheKey];
493
  }
494
 
495
+ if (response && Array.isArray(response.suggestions)) {
496
  that.suggestions = response.suggestions;
497
  that.suggest();
498
  } else if (!that.isBadQuery(q)) {
585
  container.children().first().addClass(classSelected);
586
  }
587
 
588
+ if (typeof beforeRender === 'function') {
589
  beforeRender.call(that.element, container);
590
  }
591
 
794
  that.suggestions = [];
795
  that.selection = suggestion;
796
 
797
+ if (typeof onSelectCallback === 'function') {
798
  onSelectCallback.call(that.element, suggestion);
799
  }
800
  },
assets/js/yith-autocomplete.min.js CHANGED
@@ -1,22 +1 @@
1
- (function(d){"function"===typeof define&&define.amd?define(["jquery"],d):d(jQuery)})(function(d){function g(a,b){var c=function(){},c={autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:g.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,
2
- preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:"query",transformResult:function(a){return"string"===typeof a?d.parseJSON(a):a},showNoSuggestionNotice:!1,noSuggestionNotice:"No results"};this.element=a;this.el=d(a);this.suggestions=[];this.badQueries=[];this.selectedIndex=-1;this.currentValue=this.element.value;this.intervalId=0;this.cachedResponse={};this.onChange=this.onChangeInterval=null;this.isLocal=!1;this.suggestionsContainer=null;this.options=
3
- d.extend({},c,b);this.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"};this.hint=null;this.hintValue="";this.selection=null;this.initialize();this.setOptions(b)}var h=function(){return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(a){var b=document.createElement("div");b.className=a;b.style.position="absolute";b.style.display="none";return b}}}();g.utils=h;d.YithAutocomplete=g;g.formatResult=function(a,
4
- b){var c="("+h.escapeRegExChars(b)+")";return a.value.replace(new RegExp(c,"gi"),"<strong>$1</strong>")};g.prototype={killerFn:null,initialize:function(){var a=this,b="."+a.classes.suggestion,c=a.classes.selected,e=a.options,f;a.element.setAttribute("autocomplete","off");a.killerFn=function(b){0===d(b.target).closest("."+a.options.containerClass).length&&(a.killSuggestions(),a.disableKillerFn())};a.suggestionsContainer=g.utils.createNode(e.containerClass);f=d(a.suggestionsContainer);f.appendTo(e.appendTo);
5
- "auto"!==e.width&&f.width(e.width);f.on("mouseover.autocomplete",b,function(){a.activate(d(this).data("index"))});f.on("mouseout.autocomplete",function(){a.selectedIndex=-1;f.children("."+c).removeClass(c)});f.on("click.autocomplete",b,function(){a.select(d(this).data("index"))});a.fixPosition();a.fixPositionCapture=function(){a.visible&&a.fixPosition()};d(window).on("resize.autocomplete",a.fixPositionCapture);a.el.on("keydown.autocomplete",function(b){a.onKeyPress(b)});a.el.on("keyup.autocomplete",
6
- function(b){a.onKeyUp(b)});a.el.on("blur.autocomplete",function(){a.onBlur()});a.el.on("focus.autocomplete",function(){a.onFocus()});a.el.on("change.autocomplete",function(b){a.onKeyUp(b)})},onFocus:function(){this.fixPosition();if(this.options.minChars<=this.el.val().length)this.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(a){var b=this.options;d.extend(b,a);if(this.isLocal=d.isArray(b.lookup))b.lookup=this.verifySuggestionsFormat(b.lookup);d(this.suggestionsContainer).css({"max-height":b.maxHeight+
7
- "px",width:b.width+"px","z-index":b.zIndex})},clearCache:function(){this.cachedResponse={};this.badQueries=[]},clear:function(){this.clearCache();this.currentValue="";this.suggestions=[]},disable:function(){this.disabled=!0;this.currentRequest&&this.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var a;"body"===this.options.appendTo&&(a=this.el.offset(),a={top:a.top+this.el.outerHeight()+"px",left:a.left+"px"},"auto"===this.options.width&&(a.width=this.el.outerWidth()-
8
- 2+"px"),d(this.suggestionsContainer).css(a))},enableKillerFn:function(){d(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){d(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions();a.intervalId=window.setInterval(function(){a.hide();a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a=this.el.val().length,b=this.element.selectionStart;return"number"===
9
- typeof b?b===a:document.selection?(b=document.selection.createRange(),b.moveStart("character",-a),a===b.text.length):!0},onKeyPress:function(a){if(!this.disabled&&!this.visible&&40===a.which&&this.currentValue)this.suggest();else if(!this.disabled&&this.visible){switch(a.which){case 27:this.el.val(this.currentValue);this.hide();break;case 39:if(this.hint&&this.options.onHint&&this.isCursorAtEnd()){this.selectHint();break}return;case 9:if(this.hint&&this.options.onHint){this.selectHint();return}case 13:if(-1===
10
- this.selectedIndex){this.hide();return}this.select(this.selectedIndex);if(9===a.which&&!1===this.options.tabDisabled)return;break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}a.stopImmediatePropagation();a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case 38:case 40:return}clearInterval(b.onChangeInterval);if(b.currentValue!==b.el.val())if(b.findBestHint(),0<b.options.deferRequestBy)b.onChangeInterval=setInterval(function(){b.onValueChange()},
11
- b.options.deferRequestBy);else b.onValueChange()}},onValueChange:function(){var a=this.options,b=this.el.val(),c=this.getQuery(b);this.selection&&(this.selection=null,(a.onInvalidateSelection||d.noop).call(this.element));clearInterval(this.onChangeInterval);this.currentValue=b;this.selectedIndex=-1;if(a.triggerSelectOnValidInput&&(b=this.findSuggestionIndex(c),-1!==b)){this.select(b);return}c.length<a.minChars?this.hide():this.getSuggestions(c)},findSuggestionIndex:function(a){var b=-1,c=a.toLowerCase();
12
- d.each(this.suggestions,function(a,d){if(d.value.toLowerCase()===c)return b=a,!1});return b},getQuery:function(a){var b=this.options.delimiter;if(!b)return a;a=a.split(b);return d.trim(a[a.length-1])},getSuggestionsLocal:function(a){var b=this.options,c=a.toLowerCase(),e=b.lookupFilter,f=parseInt(b.lookupLimit,10),b={suggestions:d.grep(b.lookup,function(b){return e(b,a,c)})};f&&b.suggestions.length>f&&(b.suggestions=b.suggestions.slice(0,f));return b},getSuggestions:function(a){var b,c=this,e=c.options,
13
- f=e.serviceUrl,k,g;e.params[e.paramName]=a;k=e.ignoreParams?null:e.params;c.isLocal?b=c.getSuggestionsLocal(a):(d.isFunction(f)&&(f=f.call(c.element,a)),g=f+"?"+d.param(k||{}),b=c.cachedResponse[g]);b&&d.isArray(b.suggestions)?(c.suggestions=b.suggestions,c.suggest()):c.isBadQuery(a)||!1===e.onSearchStart.call(c.element,e.params)||(c.currentRequest&&c.currentRequest.abort(),c.currentRequest=d.ajax({url:f,data:k,type:e.type,dataType:e.dataType}).done(function(b){c.currentRequest=null;b=e.transformResult(b);
14
- c.processResponse(b,a,g);e.onSearchComplete.call(c.element,a,b.suggestions)}).fail(function(b,d,f){e.onSearchError.call(c.element,a,b,d,f)}))},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){this.visible=!1;this.selectedIndex=-1;d(this.suggestionsContainer).hide();this.signalHint(null)},suggest:function(){if(0===this.suggestions.length)this.options.showNoSuggestionNotice?this.noSuggestions():
15
- this.hide();else{var a=this.options,b=a.formatResult,c=this.getQuery(this.currentValue),e=this.classes.suggestion,f=this.classes.selected,g=d(this.suggestionsContainer),h=a.beforeRender,l="",m;if(a.triggerSelectOnValidInput&&(m=this.findSuggestionIndex(c),-1!==m)){this.select(m);return}d.each(this.suggestions,function(a,d){l+='<div class="'+e+'" data-index="'+a+'">'+b(d,c)+"</div>"});this.adjustContainerWidth();g.html(l);a.autoSelectFirst&&(this.selectedIndex=0,g.children().first().addClass(f));d.isFunction(h)&&
16
- h.call(this.element,g);g.show();this.visible=!0;this.findBestHint()}},noSuggestions:function(){var a=d(this.suggestionsContainer),b;b=""+('<div class="autocomplete-no-suggestion">'+this.options.noSuggestionNotice+"</div>");this.adjustContainerWidth();a.html(b);a.show();this.visible=!0},adjustContainerWidth:function(){var a=this.options,b=d(this.suggestionsContainer);"auto"===a.width&&(a=this.el.outerWidth()-2,b.width(0<a?a:300))},findBestHint:function(){var a=this.el.val().toLowerCase(),b=null;a&&
17
- (d.each(this.suggestions,function(c,d){var f=0===d.value.toLowerCase().indexOf(a);f&&(b=d);return!f}),this.signalHint(b))},signalHint:function(a){var b="";a&&(b=this.currentValue+a.value.substr(this.currentValue.length));this.hintValue!==b&&(this.hintValue=b,this.hint=a,(this.options.onHint||d.noop)(b))},verifySuggestionsFormat:function(a){return a.length&&"string"===typeof a[0]?d.map(a,function(a){return{value:a,data:null}}):a},processResponse:function(a,b,c){var d=this.options;a.suggestions=this.verifySuggestionsFormat(a.suggestions);
18
- d.noCache||(this.cachedResponse[c]=a,d.preventBadQueries&&0===a.suggestions.length&&this.badQueries.push(b));b===this.getQuery(this.currentValue)&&(this.suggestions=a.suggestions,this.suggest())},activate:function(a){var b=this.classes.selected,c=d(this.suggestionsContainer),e=c.children();c.children("."+b).removeClass(b);this.selectedIndex=a;return-1!==this.selectedIndex&&e.length>this.selectedIndex?(a=e.get(this.selectedIndex),d(a).addClass(b),a):null},selectHint:function(){var a=d.inArray(this.hint,
19
- this.suggestions);this.select(a)},select:function(a){this.hide();this.onSelect(a)},moveUp:function(){-1!==this.selectedIndex&&(0===this.selectedIndex?(d(this.suggestionsContainer).children().first().removeClass(this.classes.selected),this.selectedIndex=-1,this.el.val(this.currentValue),this.findBestHint()):this.adjustScroll(this.selectedIndex-1))},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(a){var b=this.activate(a),
20
- c,e;b&&(b=b.offsetTop,c=d(this.suggestionsContainer).scrollTop(),e=c+this.options.maxHeight-25,b<c?d(this.suggestionsContainer).scrollTop(b):b>e&&d(this.suggestionsContainer).scrollTop(b-this.options.maxHeight+25),this.el.val(this.getValue(this.suggestions[a].value)),this.signalHint(null))},onSelect:function(a){var b=this.options.onSelect;a=this.suggestions[a];this.currentValue=this.getValue(a.value);this.currentValue!==this.el.val()&&this.el.val(this.currentValue);this.signalHint(null);this.suggestions=
21
- [];this.selection=a;d.isFunction(b)&&b.call(this.element,a)},getValue:function(a){var b=this.options.delimiter,c;if(!b)return a;c=this.currentValue;b=c.split(b);return 1===b.length?a:c.substr(0,c.length-b[b.length-1].length)+a},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete");this.disableKillerFn();d(window).off("resize.autocomplete",this.fixPositionCapture);d(this.suggestionsContainer).remove()}};d.fn.yithautocomplete=function(a,b){return 0===arguments.length?this.first().data("autocomplete"):
22
- this.each(function(){var c=d(this),e=c.data("autocomplete");if("string"===typeof a){if(e&&"function"===typeof e[a])e[a](b)}else e&&e.dispose&&e.dispose(),e=new g(this,a),c.data("autocomplete",e)})}});
1
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(c){"use strict";var s={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}},n=27,i=9,o=13,l=38,a=39,u=40;function r(e,t){function n(){}var s=this,i={autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:r.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:n,onSearchComplete:n,onSearchError:n,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(e,t,n){return-1!==e.value.toLowerCase().indexOf(n)},paramName:"query",transformResult:function(e){return"string"==typeof e?JSON.parse(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results"};s.element=e,s.el=c(e),s.suggestions=[],s.badQueries=[],s.selectedIndex=-1,s.currentValue=s.element.value,s.intervalId=0,s.cachedResponse={},s.onChangeInterval=null,s.onChange=null,s.isLocal=!1,s.suggestionsContainer=null,s.options=c.extend({},i,t),s.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},s.hint=null,s.hintValue="",s.selection=null,s.initialize(),s.setOptions(t)}r.utils=s,(c.YithAutocomplete=r).formatResult=function(e,t){var n="("+s.escapeRegExChars(t)+")";return e.value.replace(new RegExp(n,"gi"),"<strong>$1</strong>")},r.prototype={killerFn:null,initialize:function(){var e,t=this,n="."+t.classes.suggestion,s=t.classes.selected,i=t.options;t.element.setAttribute("autocomplete","off"),t.killerFn=function(e){0===c(e.target).closest("."+t.options.containerClass).length&&(t.killSuggestions(),t.disableKillerFn())},t.suggestionsContainer=r.utils.createNode(i.containerClass),(e=c(t.suggestionsContainer)).appendTo(i.appendTo),"auto"!==i.width&&e.width(i.width),e.on("mouseover.autocomplete",n,function(){t.activate(c(this).data("index"))}),e.on("mouseout.autocomplete",function(){t.selectedIndex=-1,e.children("."+s).removeClass(s)}),e.on("click.autocomplete",n,function(){t.select(c(this).data("index"))}),t.fixPosition(),t.fixPositionCapture=function(){t.visible&&t.fixPosition()},c(window).on("resize.autocomplete",t.fixPositionCapture),t.el.on("keydown.autocomplete",function(e){t.onKeyPress(e)}),t.el.on("keyup.autocomplete",function(e){t.onKeyUp(e)}),t.el.on("blur.autocomplete",function(){t.onBlur()}),t.el.on("focus.autocomplete",function(){t.onFocus()}),t.el.on("change.autocomplete",function(e){t.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition(),e.options.minChars<=e.el.val().length&&e.onValueChange()},onBlur:function(){this.enableKillerFn()},setOptions:function(e){var t=this,n=t.options;c.extend(n,e),t.isLocal=Array.isArray(n.lookup),t.isLocal&&(n.lookup=t.verifySuggestionsFormat(n.lookup)),c(t.suggestionsContainer).css({"max-height":n.maxHeight+"px",width:n.width+"px","z-index":n.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,e.currentRequest&&e.currentRequest.abort()},enable:function(){this.disabled=!1},fixPosition:function(){var e,t,n=this;"body"===n.options.appendTo&&(t={top:(e=n.el.offset()).top+n.el.outerHeight()+"px",left:e.left+"px"},"auto"===n.options.width&&(t.width=n.el.outerWidth()-2+"px"),c(n.suggestionsContainer).css(t))},enableKillerFn:function(){c(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){c(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var e=this;e.stopKillSuggestions(),e.intervalId=window.setInterval(function(){e.hide(),e.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var e,t=this.el.val().length,n=this.element.selectionStart;return"number"==typeof n?n===t:!document.selection||((e=document.selection.createRange()).moveStart("character",-t),t===e.text.length)},onKeyPress:function(e){var t=this;if(t.disabled||t.visible||e.which!==u||!t.currentValue){if(!t.disabled&&t.visible){switch(e.which){case n:t.el.val(t.currentValue),t.hide();break;case a:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case i:if(t.hint&&t.options.onHint)return void t.selectHint();case o:if(-1===t.selectedIndex)return void t.hide();if(t.select(t.selectedIndex),e.which===i&&!1===t.options.tabDisabled)return;break;case l:t.moveUp();break;case u:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else t.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case l:case u:return}clearInterval(t.onChangeInterval),t.currentValue!==t.el.val()&&(t.findBestHint(),0<t.options.deferRequestBy?t.onChangeInterval=setInterval(function(){t.onValueChange()},t.options.deferRequestBy):t.onValueChange())}},onValueChange:function(){var e,t=this,n=t.options,s=t.el.val(),i=t.getQuery(s);t.selection&&(t.selection=null,(n.onInvalidateSelection||c.noop).call(t.element)),clearInterval(t.onChangeInterval),t.currentValue=s,t.selectedIndex=-1,n.triggerSelectOnValidInput&&-1!==(e=t.findSuggestionIndex(i))?t.select(e):i.length<n.minChars?t.hide():t.getSuggestions(i)},findSuggestionIndex:function(e){var n=-1,s=e.toLowerCase();return c.each(this.suggestions,function(e,t){if(t.value.toLowerCase()===s)return n=e,!1}),n},getQuery:function(e){var t,n=this.options.delimiter;return n?(t=e.split(n),c.trim(t[t.length-1])):e},getSuggestionsLocal:function(t){var e=this.options,n=t.toLowerCase(),s=e.lookupFilter,i=parseInt(e.lookupLimit,10),o={suggestions:c.grep(e.lookup,function(e){return s(e,t,n)})};return i&&o.suggestions.length>i&&(o.suggestions=o.suggestions.slice(0,i)),o},getSuggestions:function(s){var e,t,n,i=this,o=i.options,l=o.serviceUrl;if(o.params[o.paramName]=s,t=o.ignoreParams?null:o.params,(e=i.isLocal?i.getSuggestionsLocal(s):("function"==typeof l&&(l=l.call(i.element,s)),n=l+"?"+c.param(t||{}),i.cachedResponse[n]))&&Array.isArray(e.suggestions))i.suggestions=e.suggestions,i.suggest();else if(!i.isBadQuery(s)){if(!1===o.onSearchStart.call(i.element,o.params))return;i.currentRequest&&i.currentRequest.abort(),i.currentRequest=c.ajax({url:l,data:t,type:o.type,dataType:o.dataType}).done(function(e){var t;i.currentRequest=null,t=o.transformResult(e),i.processResponse(t,s,n),o.onSearchComplete.call(i.element,s,t.suggestions)}).fail(function(e,t,n){o.onSearchError.call(i.element,s,e,t,n)})}},isBadQuery:function(e){if(!this.options.preventBadQueries)return!1;for(var t=this.badQueries,n=t.length;n--;)if(0===e.indexOf(t[n]))return!0;return!1},hide:function(){this.visible=!1,this.selectedIndex=-1,c(this.suggestionsContainer).hide(),this.signalHint(null)},suggest:function(){var e,t,n,s,i,o,l,a,u,r;0!==this.suggestions.length?(t=(e=this).options,n=t.formatResult,s=e.getQuery(e.currentValue),i=e.classes.suggestion,o=e.classes.selected,l=c(e.suggestionsContainer),a=t.beforeRender,u="",t.triggerSelectOnValidInput&&-1!==(r=e.findSuggestionIndex(s))?e.select(r):(c.each(e.suggestions,function(e,t){u+='<div class="'+i+'" data-index="'+e+'">'+n(t,s)+"</div>"}),this.adjustContainerWidth(),l.html(u),t.autoSelectFirst&&(e.selectedIndex=0,l.children().first().addClass(o)),"function"==typeof a&&a.call(e.element,l),l.show(),e.visible=!0,e.findBestHint())):this.options.showNoSuggestionNotice?this.noSuggestions():this.hide()},noSuggestions:function(){var e=c(this.suggestionsContainer),t="";t+='<div class="autocomplete-no-suggestion">'+this.options.noSuggestionNotice+"</div>",this.adjustContainerWidth(),e.html(t),e.show(),this.visible=!0},adjustContainerWidth:function(){var e,t=this.options,n=c(this.suggestionsContainer);"auto"===t.width&&(e=this.el.outerWidth()-2,n.width(0<e?e:300))},findBestHint:function(){var s=this.el.val().toLowerCase(),i=null;s&&(c.each(this.suggestions,function(e,t){var n=0===t.value.toLowerCase().indexOf(s);return n&&(i=t),!n}),this.signalHint(i))},signalHint:function(e){var t="",n=this;e&&(t=n.currentValue+e.value.substr(n.currentValue.length)),n.hintValue!==t&&(n.hintValue=t,n.hint=e,(this.options.onHint||c.noop)(t))},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?c.map(e,function(e){return{value:e,data:null}}):e},processResponse:function(e,t,n){var s=this,i=s.options;e.suggestions=s.verifySuggestionsFormat(e.suggestions),i.noCache||(s.cachedResponse[n]=e,i.preventBadQueries&&0===e.suggestions.length&&s.badQueries.push(t)),t===s.getQuery(s.currentValue)&&(s.suggestions=e.suggestions,s.suggest())},activate:function(e){var t,n=this,s=n.classes.selected,i=c(n.suggestionsContainer),o=i.children();return i.children("."+s).removeClass(s),n.selectedIndex=e,-1!==n.selectedIndex&&o.length>n.selectedIndex?(t=o.get(n.selectedIndex),c(t).addClass(s),t):null},selectHint:function(){var e=c.inArray(this.hint,this.suggestions);this.select(e)},select:function(e){this.hide(),this.onSelect(e)},moveUp:function(){var e=this;if(-1!==e.selectedIndex)return 0===e.selectedIndex?(c(e.suggestionsContainer).children().first().removeClass(e.classes.selected),e.selectedIndex=-1,e.el.val(e.currentValue),void e.findBestHint()):void e.adjustScroll(e.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var t,n,s,i=this,o=i.activate(e);o&&(t=o.offsetTop,s=(n=c(i.suggestionsContainer).scrollTop())+i.options.maxHeight-25,t<n?c(i.suggestionsContainer).scrollTop(t):s<t&&c(i.suggestionsContainer).scrollTop(t-i.options.maxHeight+25),i.el.val(i.getValue(i.suggestions[e].value)),i.signalHint(null))},onSelect:function(e){var t=this,n=t.options.onSelect,s=t.suggestions[e];t.currentValue=t.getValue(s.value),t.currentValue!==t.el.val()&&t.el.val(t.currentValue),t.signalHint(null),t.suggestions=[],t.selection=s,"function"==typeof n&&n.call(t.element,s)},getValue:function(e){var t,n,s=this.options.delimiter;return!s||1===(n=(t=this.currentValue).split(s)).length?e:t.substr(0,t.length-n[n.length-1].length)+e},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),this.disableKillerFn(),c(window).off("resize.autocomplete",this.fixPositionCapture),c(this.suggestionsContainer).remove()}},c.fn.yithautocomplete=function(n,s){var i="autocomplete";return 0===arguments.length?this.first().data(i):this.each(function(){var e=c(this),t=e.data(i);"string"==typeof n?t&&"function"==typeof t[n]&&t[n](s):(t&&t.dispose&&t.dispose(),t=new r(this,n),e.data(i,t))})}});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
init.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: YITH WooCommerce Ajax Search
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
5
  * Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
- * Version: 1.8.2
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-search
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 4.6.0
13
  */
14
 
15
  /*
@@ -71,7 +71,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
71
  if ( defined( 'YITH_WCAS_VERSION' ) ) {
72
  return;
73
  } else {
74
- define( 'YITH_WCAS_VERSION', '1.8.2' );
75
  }
76
 
77
  if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
3
  * Plugin Name: YITH WooCommerce Ajax Search
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
5
  * Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
+ * Version: 1.8.3
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-search
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 4.7.0
13
  */
14
 
15
  /*
71
  if ( defined( 'YITH_WCAS_VERSION' ) ) {
72
  return;
73
  } else {
74
+ define( 'YITH_WCAS_VERSION', '1.8.3' );
75
  }
76
 
77
  if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
plugin-fw/assets/css/yith-fields.css CHANGED
@@ -23,9 +23,9 @@
23
  }
24
 
25
  .yith-plugin-fw-field-wrapper .yith-inline-fields > div {
26
- display: inline-block;
27
- vertical-align: middle;
28
- margin-right: 5px;
29
  }
30
 
31
  .yith-plugin-fw-field-wrapper span.desc {
@@ -286,7 +286,7 @@ ul.yit-icons-manager-list li.active {
286
 
287
  .yith-plugin-fw-checkbox-array__row {
288
  margin-bottom : 10px;
289
- display:flex;
290
  }
291
 
292
  .yith-plugin-fw-checkbox-array__row label {
@@ -298,10 +298,11 @@ ul.yit-icons-manager-list li.active {
298
  font-weight : 400 !important;
299
  }
300
 
301
- .yith-plugin-fw-checkbox-array__row label small{
302
- display:block;
303
- line-height: 2em;
304
  }
 
305
  /* ------- Sidebar Layout ------- */
306
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
307
  display : none;
@@ -735,7 +736,7 @@ YITH UI
735
  font-size : 15px;
736
  padding : 7px 20px;
737
  border : 0;
738
- transition: background-color 0.3s linear;
739
  }
740
 
741
  .yith-plugin-ui .nav-tab:first-child {
@@ -745,9 +746,10 @@ YITH UI
745
  .yith-plugin-ui .nav-tab.yith-premium {
746
  background-color : #be421c;
747
  }
 
748
  .yith-plugin-ui .yith-nav-tab-wrapper .yith-plugin-fw-tab-element:hover > a.nav-tab:not(.nav-tab-active),
749
- .yith-plugin-ui .yith-nav-tab-wrapper .nav-tab:not(.nav-tab-active):hover{
750
- background-color:#207a92;
751
  }
752
 
753
  .yith-plugin-ui .nav-tab-active {
@@ -1225,8 +1227,8 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
1225
  font-size : 13px;
1226
  }
1227
 
1228
- .wc-wp-version-gte-53 .yith-plugin-ui .select2-container .select2-selection--single .select2-selection__arrow{
1229
- background-image: none;
1230
  }
1231
 
1232
  .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
@@ -1438,7 +1440,7 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
1438
  background-color : #fff;
1439
  width : 58px;
1440
  height : 24px;
1441
- line-height :14px;
1442
  }
1443
 
1444
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
@@ -1475,7 +1477,7 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
1475
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
1476
  .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
1477
  background-color : #98aa36;
1478
- left: 38px;
1479
  }
1480
 
1481
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
@@ -1924,7 +1926,7 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
1924
  margin-bottom : 40px;
1925
  }
1926
 
1927
- .yith-plugin-ui .yith-add-box-row label,
1928
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label {
1929
  display : table-cell;
1930
  width : 200px;
@@ -2111,15 +2113,15 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2111
  }
2112
 
2113
  .yith-plugin-ui span.description {
2114
- margin-top: 10px;
2115
- line-height: 20px;
2116
- max-width: 40%;
2117
- min-width: min(100%,360px);
2118
  }
2119
 
2120
  .yith-plugin-fw-option-with-description {
2121
  display : table-cell;
2122
- width : auto;
2123
  vertical-align : top;
2124
  }
2125
 
@@ -2175,17 +2177,23 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2175
  */
2176
 
2177
  .yith-plugin-fw-dimensions {
2178
- max-width : 400px;
 
2179
  }
2180
 
2181
  .yith-plugin-fw-dimensions__units {
2182
- text-align : right;
2183
- text-transform : uppercase;
 
 
 
 
 
2184
  }
2185
 
2186
  .yith-plugin-fw-dimensions__unit {
2187
  display : inline-block;
2188
- padding : 5px 3px;
2189
  cursor : pointer;
2190
  font-weight : 700;
2191
  }
@@ -2196,38 +2204,60 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2196
  }
2197
 
2198
  .yith-plugin-fw-dimensions__dimensions {
2199
- display : flex;
2200
- margin-top : 3px;
 
 
2201
  }
2202
 
2203
  .yith-plugin-fw-dimensions__dimension {
2204
  text-align : center;
 
2205
  }
2206
 
2207
- .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2208
- width : 100% !important;
2209
- min-width : 0 !important;
2210
- border-radius : 0 !important;
2211
- border : 1px solid #d8d8d8 !important;
2212
- border-left : none !important;
2213
- height : 38px !important;
 
 
2214
  text-align : center;
 
2215
  }
2216
 
2217
- .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2218
- border-left : 1px solid #d8d8d8 !important;
2219
- border-radius : 6px 0 0 6px !important;
 
 
2220
  }
2221
 
2222
- .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2223
- border-radius : 0 6px 6px 0 !important;
 
 
 
 
 
 
 
 
 
 
 
2224
  }
2225
 
2226
- .yith-plugin-fw-dimensions__dimension__label {
 
 
2227
  text-transform : uppercase;
2228
- font-weight : 700;
2229
- color : #91959b;
2230
- font-size : .8em;
 
2231
  }
2232
 
2233
  .yith-plugin-fw-dimensions__linked {
@@ -2269,32 +2299,32 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2269
 
2270
  .yith-plugin-ui .yith-add-box-row,
2271
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row,
2272
- .yith-plugin-ui .yith-add-box-row label{
2273
- display:block;
2274
  }
2275
 
2276
- .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label{
2277
- display:block;
2278
  }
2279
 
2280
  .yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-option-with-description {
2281
- width: 100%;
2282
  }
2283
 
2284
  .yith-plugin-ui .yith-add-box-row,
2285
  .yith-plugin-ui .yith-add-box-row label {
2286
- display: block;
2287
  }
2288
 
2289
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-plugin-fw-option-with-description,
2290
  .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description {
2291
- display: block;
2292
- padding-top: 20px;
2293
  }
2294
 
2295
 
2296
  .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description span.description {
2297
- max-width: 100%;
2298
  }
2299
  }
2300
 
@@ -2356,76 +2386,86 @@ div#ui-datepicker-div.yith-plugin-fw-datepicker-div {
2356
  #yith-plugin-fw-panel table.form-table th.titledesc,
2357
  .yith-plugin-ui #plugin-fw-wc table.form-table td,
2358
  #yith-plugin-fw-panel table.form-table td.forminp {
2359
- padding: 20px 20px;
2360
  }
2361
 
2362
  .yith-plugin-ui #plugin-fw-wc table.form-table th.titledesc,
2363
  #yith-plugin-fw-panel table.form-table th.titledesc {
2364
- padding-bottom: 0;
2365
  }
2366
  }
2367
 
2368
- @media (max-width: 480px) {
2369
  .yith-plugin-ui .nav-tab {
2370
- font-size: 12px;
2371
  }
 
2372
  .yith-plugin-ui h2 {
2373
- padding: 20px 20px;
2374
  }
 
2375
  .yith-plugin-ui [type="radio"]:checked + label:before, .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
2376
- width: 14px;
2377
- height: 14px;
2378
  }
 
2379
  .yith-plugin-ui [type="radio"]:checked + label:after, .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
2380
- width: 10px;
2381
- height: 10px;
2382
- top: 3px;
2383
- left: 3px;
2384
  }
 
2385
  .yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
2386
- padding-left: 25px;
2387
  }
2388
 
2389
  .yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
2390
- font-size: 13px;
2391
  }
 
2392
  .yith-plugin-ui span.description {
2393
- font-size: 12px;
2394
  }
 
2395
  .yith-plugin-ui #plugin-fw-wc table.form-table th,
2396
  #yith-plugin-fw-panel table.form-table th.titledesc,
2397
  .yith-plugin-ui #plugin-fw-wc table.form-table td,
2398
  #yith-plugin-fw-panel table.form-table td.forminp {
2399
- padding: 15px 20px;
2400
  }
2401
 
2402
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
2403
- width: 48px;
2404
- height: 20px;
2405
  }
 
2406
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
2407
- top: 3px;
2408
- left: 3px;
2409
  }
 
2410
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
2411
- left: 30px;
2412
  }
 
2413
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
2414
- font-size: 11px;
2415
- padding: 0px 6px;
2416
- margin-top: 3px;
2417
  }
 
2418
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
2419
- font-size: 11px;
2420
- padding-left: 24px;
2421
- margin-top: 3px;
2422
  }
2423
 
2424
  .yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
2425
- font-size: 14px;
2426
  }
2427
 
2428
  .yith-plugin-ui input {
2429
- font-size: 14px;
2430
  }
2431
  }
23
  }
24
 
25
  .yith-plugin-fw-field-wrapper .yith-inline-fields > div {
26
+ display : inline-block;
27
+ vertical-align : middle;
28
+ margin-right : 5px;
29
  }
30
 
31
  .yith-plugin-fw-field-wrapper span.desc {
286
 
287
  .yith-plugin-fw-checkbox-array__row {
288
  margin-bottom : 10px;
289
+ display : flex;
290
  }
291
 
292
  .yith-plugin-fw-checkbox-array__row label {
298
  font-weight : 400 !important;
299
  }
300
 
301
+ .yith-plugin-fw-checkbox-array__row label small {
302
+ display : block;
303
+ line-height : 2em;
304
  }
305
+
306
  /* ------- Sidebar Layout ------- */
307
  .yith-plugin-fw-sidebar-layout input[type="radio"] {
308
  display : none;
736
  font-size : 15px;
737
  padding : 7px 20px;
738
  border : 0;
739
+ transition : background-color 0.3s linear;
740
  }
741
 
742
  .yith-plugin-ui .nav-tab:first-child {
746
  .yith-plugin-ui .nav-tab.yith-premium {
747
  background-color : #be421c;
748
  }
749
+
750
  .yith-plugin-ui .yith-nav-tab-wrapper .yith-plugin-fw-tab-element:hover > a.nav-tab:not(.nav-tab-active),
751
+ .yith-plugin-ui .yith-nav-tab-wrapper .nav-tab:not(.nav-tab-active):hover {
752
+ background-color : #207a92;
753
  }
754
 
755
  .yith-plugin-ui .nav-tab-active {
1227
  font-size : 13px;
1228
  }
1229
 
1230
+ .wc-wp-version-gte-53 .yith-plugin-ui .select2-container .select2-selection--single .select2-selection__arrow {
1231
+ background-image : none;
1232
  }
1233
 
1234
  .yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
1440
  background-color : #fff;
1441
  width : 58px;
1442
  height : 24px;
1443
+ line-height : 14px;
1444
  }
1445
 
1446
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
1477
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
1478
  .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
1479
  background-color : #98aa36;
1480
+ left : 38px;
1481
  }
1482
 
1483
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
1926
  margin-bottom : 40px;
1927
  }
1928
 
1929
+ .yith-plugin-ui .yith-add-box-row > label,
1930
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label {
1931
  display : table-cell;
1932
  width : 200px;
2113
  }
2114
 
2115
  .yith-plugin-ui span.description {
2116
+ margin-top : 10px;
2117
+ line-height : 20px;
2118
+ max-width : 40%;
2119
+ min-width : min(100%, 360px);
2120
  }
2121
 
2122
  .yith-plugin-fw-option-with-description {
2123
  display : table-cell;
2124
+ width : 90%;
2125
  vertical-align : top;
2126
  }
2127
 
2177
  */
2178
 
2179
  .yith-plugin-fw-dimensions {
2180
+ display : flex;
2181
+ align-items : flex-end;
2182
  }
2183
 
2184
  .yith-plugin-fw-dimensions__units {
2185
+ flex : 1;
2186
+ display : flex;
2187
+ margin-left : 5px;
2188
+ width : calc(100% - 105px);
2189
+ flex-wrap : wrap;
2190
+ min-height : 38px;
2191
+ margin-bottom : -8px;
2192
  }
2193
 
2194
  .yith-plugin-fw-dimensions__unit {
2195
  display : inline-block;
2196
+ padding : 0 3px;
2197
  cursor : pointer;
2198
  font-weight : 700;
2199
  }
2204
  }
2205
 
2206
  .yith-plugin-fw-dimensions__dimensions {
2207
+ display : flex;
2208
+ margin : 0;
2209
+ align-items : flex-end;
2210
+ max-width : 400px;
2211
  }
2212
 
2213
  .yith-plugin-fw-dimensions__dimension {
2214
  text-align : center;
2215
+ flex : 1;
2216
  }
2217
 
2218
+ .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2219
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2220
+ .yith-plugin-ui .yith-plugin-fw-dimensions__dimension > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2221
+ width : 100%;
2222
+ min-width : 0;
2223
+ border-radius : 0;
2224
+ border : 1px solid #d8d8d8;
2225
+ border-left : none;
2226
+ height : 38px;
2227
  text-align : center;
2228
+ padding-right : 0;
2229
  }
2230
 
2231
+ .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2232
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2233
+ .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:first-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2234
+ border-left : 1px solid #d8d8d8;
2235
+ border-radius : 6px 0 0 6px;
2236
  }
2237
 
2238
+ .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2239
+ .woocommerce.yith-plugin-fw-panel .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number,
2240
+ .yith-plugin-ui .yith-plugin-fw-dimensions__dimension:last-child > input[type=number].yith-plugin-fw-dimensions__dimension__number {
2241
+ border-radius : 0 6px 6px 0;
2242
+ }
2243
+
2244
+ .metaboxes-tab .yith-plugin-fw-dimensions__dimension__label,
2245
+ .yith-plugin-ui.metaboxes-tab label.yith-plugin-fw-dimensions__dimension__label {
2246
+ float : none;
2247
+ margin : 0;
2248
+ width : auto;
2249
+ font-weight : inherit;
2250
+ line-height : inherit;
2251
  }
2252
 
2253
+ .yith-plugin-fw-dimensions__dimension__label,
2254
+ .metaboxes-tab .yith-plugin-fw-dimensions__dimension__label,
2255
+ .yith-plugin-ui.metaboxes-tab label.yith-plugin-fw-dimensions__dimension__label {
2256
  text-transform : uppercase;
2257
+ letter-spacing : 2px;
2258
+ font-size : 11px;
2259
+ margin-bottom : 5px;
2260
+ display : inline-block;
2261
  }
2262
 
2263
  .yith-plugin-fw-dimensions__linked {
2299
 
2300
  .yith-plugin-ui .yith-add-box-row,
2301
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row,
2302
+ .yith-plugin-ui .yith-add-box-row label {
2303
+ display : block;
2304
  }
2305
 
2306
+ .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row > label {
2307
+ display : block;
2308
  }
2309
 
2310
  .yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-option-with-description {
2311
+ width : 100%;
2312
  }
2313
 
2314
  .yith-plugin-ui .yith-add-box-row,
2315
  .yith-plugin-ui .yith-add-box-row label {
2316
+ display : block;
2317
  }
2318
 
2319
  .yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-plugin-fw-option-with-description,
2320
  .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description {
2321
+ display : block;
2322
+ padding-top : 20px;
2323
  }
2324
 
2325
 
2326
  .yith-plugin-ui .yith-add-box-row .yith-plugin-fw-option-with-description span.description {
2327
+ max-width : 100%;
2328
  }
2329
  }
2330
 
2386
  #yith-plugin-fw-panel table.form-table th.titledesc,
2387
  .yith-plugin-ui #plugin-fw-wc table.form-table td,
2388
  #yith-plugin-fw-panel table.form-table td.forminp {
2389
+ padding : 20px 20px;
2390
  }
2391
 
2392
  .yith-plugin-ui #plugin-fw-wc table.form-table th.titledesc,
2393
  #yith-plugin-fw-panel table.form-table th.titledesc {
2394
+ padding-bottom : 0;
2395
  }
2396
  }
2397
 
2398
+ @media (max-width : 480px) {
2399
  .yith-plugin-ui .nav-tab {
2400
+ font-size : 12px;
2401
  }
2402
+
2403
  .yith-plugin-ui h2 {
2404
+ padding : 20px 20px;
2405
  }
2406
+
2407
  .yith-plugin-ui [type="radio"]:checked + label:before, .yith-plugin-ui [type="radio"]:not(:checked) + label:before {
2408
+ width : 14px;
2409
+ height : 14px;
2410
  }
2411
+
2412
  .yith-plugin-ui [type="radio"]:checked + label:after, .yith-plugin-ui [type="radio"]:not(:checked) + label:after {
2413
+ width : 10px;
2414
+ height : 10px;
2415
+ top : 3px;
2416
+ left : 3px;
2417
  }
2418
+
2419
  .yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
2420
+ padding-left : 25px;
2421
  }
2422
 
2423
  .yith-plugin-ui [type="radio"]:checked + label, .yith-plugin-ui [type="radio"]:not(:checked) + label {
2424
+ font-size : 13px;
2425
  }
2426
+
2427
  .yith-plugin-ui span.description {
2428
+ font-size : 12px;
2429
  }
2430
+
2431
  .yith-plugin-ui #plugin-fw-wc table.form-table th,
2432
  #yith-plugin-fw-panel table.form-table th.titledesc,
2433
  .yith-plugin-ui #plugin-fw-wc table.form-table td,
2434
  #yith-plugin-fw-panel table.form-table td.forminp {
2435
+ padding : 15px 20px;
2436
  }
2437
 
2438
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
2439
+ width : 48px;
2440
+ height : 20px;
2441
  }
2442
+
2443
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
2444
+ top : 3px;
2445
+ left : 3px;
2446
  }
2447
+
2448
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
2449
+ left : 30px;
2450
  }
2451
+
2452
  .yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after, .yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
2453
+ font-size : 11px;
2454
+ padding : 0px 6px;
2455
+ margin-top : 3px;
2456
  }
2457
+
2458
  .yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
2459
+ font-size : 11px;
2460
+ padding-left : 24px;
2461
+ margin-top : 3px;
2462
  }
2463
 
2464
  .yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
2465
+ font-size : 14px;
2466
  }
2467
 
2468
  .yith-plugin-ui input {
2469
+ font-size : 14px;
2470
  }
2471
  }
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -8,52 +8,28 @@
8
  */
9
 
10
  jQuery( function ( $ ) {
11
- //dependencies handler
12
- $( '[data-dep-target]' ).each( function () {
13
- var t = $( this );
14
-
15
- var field = '#' + t.data( 'dep-target' ),
16
- dep = '#' + t.data( 'dep-id' ),
17
- value = t.data( 'dep-value' ),
18
- type = t.data( 'dep-type' ),
19
- event = 'change',
20
- wrapper = $( dep + '-wrapper' ),
21
- field_type = wrapper.data( 'type' );
22
-
23
- if( field_type === 'select-images' ){
24
- event = 'yith_select_images_value_changed';
25
- }
26
-
27
- dependencies_handler( field, dep, value.toString(), type );
28
-
29
- $( dep ).on( event, function () {
30
- dependencies_handler( field, dep, value.toString(), type );
31
- } ).trigger( event );
32
-
33
- } );
34
-
35
- //Handle dependencies.
36
  function dependencies_handler( id, deps, values, type ) {
37
  var result = true;
38
  //Single dependency
39
  if ( typeof ( deps ) == 'string' ) {
 
40
  if ( deps.substr( 0, 6 ) == ':radio' ) {
41
  deps = deps + ':checked';
42
  }
43
 
44
- var val = $( deps ).val();
 
45
 
46
- if ( $( deps ).attr( 'type' ) == 'checkbox' ) {
47
- var thisCheck = $( deps );
48
- if ( thisCheck.is( ':checked' ) ) {
49
- val = 'yes';
50
- } else {
51
- val = 'no';
52
- }
53
  }
54
 
55
  if( $( deps + '-wrapper' ).data( 'type' ) === 'select-images' ){
56
- val = $( deps + '-wrapper' ).find( 'select' ).first().val();
57
  }
58
 
59
  values = values.split( ',' );
@@ -73,7 +49,7 @@ jQuery( function ( $ ) {
73
 
74
  if ( $current_container.length < 1 ) {
75
  // container for YIT Plugin Panel WooCommerce
76
- $current_container = $current_field.closest( '.yith-plugin-fw-panel-wc-row' );
77
  }
78
 
79
  var types = type.split( '-' ), j;
@@ -97,7 +73,7 @@ jQuery( function ( $ ) {
97
  $current_container.hide();
98
  break;
99
  default:
100
- if ( !$current_container.hasClass( 'fade-in' ) ) {
101
  $current_container.hide();
102
  $current_container.css( { 'opacity': '0' } );
103
  } else {
@@ -131,6 +107,34 @@ jQuery( function ( $ ) {
131
  }
132
  }
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  //connected list
136
  $( '.rm_connectedlist' ).each( function () {
8
  */
9
 
10
  jQuery( function ( $ ) {
11
+ // Handle dependencies.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  function dependencies_handler( id, deps, values, type ) {
13
  var result = true;
14
  //Single dependency
15
  if ( typeof ( deps ) == 'string' ) {
16
+ // ??
17
  if ( deps.substr( 0, 6 ) == ':radio' ) {
18
  deps = deps + ':checked';
19
  }
20
 
21
+ var input_type = $( deps ).data( 'type' ),
22
+ val = $( deps ).val();
23
 
24
+ if ( 'checkbox' === input_type ) {
25
+ val = $( deps ).is( ':checked' ) ? 'yes' : 'no';
26
+ }
27
+ else if ( 'radio' === input_type ) {
28
+ val = $( deps ).find('input[type="radio"]').filter(':checked').val();
 
 
29
  }
30
 
31
  if( $( deps + '-wrapper' ).data( 'type' ) === 'select-images' ){
32
+ val = $( deps + '-wrapper' ).find( 'select' ).first().val();
33
  }
34
 
35
  values = values.split( ',' );
49
 
50
  if ( $current_container.length < 1 ) {
51
  // container for YIT Plugin Panel WooCommerce
52
+ $current_container = $current_field.closest( '.yith-plugin-fw-panel-wc-row, .yith-toggle-content-row' );
53
  }
54
 
55
  var types = type.split( '-' ), j;
73
  $current_container.hide();
74
  break;
75
  default:
76
+ if ( ! $current_container.hasClass( 'fade-in' ) ) {
77
  $current_container.hide();
78
  $current_container.css( { 'opacity': '0' } );
79
  } else {
107
  }
108
  }
109
  }
110
+ function init_dependencies() {
111
+ $( '[data-dep-target]:not( .deps-initialized )' ).each( function () {
112
+ var t = $( this );
113
+
114
+ // init field deps
115
+ t.addClass( 'deps-initialized' );
116
+
117
+ var field = '#' + t.data( 'dep-target' ),
118
+ dep = '#' + t.data( 'dep-id' ),
119
+ value = t.data( 'dep-value' ),
120
+ type = t.data( 'dep-type' ),
121
+ event = 'change',
122
+ wrapper = $( dep + '-wrapper' ),
123
+ field_type = wrapper.data( 'type' );
124
+
125
+ if( field_type === 'select-images' ){
126
+ event = 'yith_select_images_value_changed';
127
+ }
128
+
129
+ $( dep ).on( event, function () {
130
+ dependencies_handler( field, dep, value.toString(), type );
131
+ } ).trigger( event );
132
+ } );
133
+ }
134
+
135
+ init_dependencies();
136
+ // re-init deps after an add toggle action
137
+ $( document ).on( 'yith-add-box-button-toggle', init_dependencies );
138
 
139
  //connected list
140
  $( '.rm_connectedlist' ).each( function () {
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){function e(e,t,i,n){var s=!0;if("string"==typeof t){":radio"==t.substr(0,6)&&(t+=":checked");var r=a(t).val();if("checkbox"==a(t).attr("type"))r=a(t).is(":checked")?"yes":"no";"select-images"===a(t+"-wrapper").data("type")&&(r=a(t+"-wrapper").find("select").first().val()),i=i.split(",");for(var d=0;d<i.length;d++){if(r==i[d]){s=!0;break}s=!1}}var c=a(e),o=a(e+"-container").closest("tr");o.length<1&&(o=c.closest(".yith-plugin-fw-panel-wc-row"));var l,p=n.split("-");for(l in p){var h=p[l];if(s)switch(h){case"disable":o.removeClass("yith-disabled"),c.attr("disabled",!1);break;case"hideme":c.show();break;case"fadeInOut":case"fadeIn":o.show(500);break;case"fadeOut":o.show();break;default:o.show(),o.fadeTo("slow",1).addClass("fade-in")}else switch(h){case"disable":o.addClass("yith-disabled"),c.attr("disabled",!0);break;case"hideme":c.hide();break;case"fadeInOut":case"fadeOut":o.hide(500);break;case"fadeIn":o.hide();break;default:o.hasClass("fade-in")?o.fadeTo("slow",0,function(){a(this).hide().removeClass("fade-in")}):(o.hide(),o.css({opacity:"0"}))}}}a("[data-dep-target]").each(function(){var t=a(this),i="#"+t.data("dep-target"),n="#"+t.data("dep-id"),s=t.data("dep-value"),r=t.data("dep-type"),d="change";"select-images"===a(n+"-wrapper").data("type")&&(d="yith_select_images_value_changed"),e(i,n,s.toString(),r),a(n).on(d,function(){e(i,n,s.toString(),r)}).trigger(d)}),a(".rm_connectedlist").each(function(){var e=a(this).find("ul"),t=a(this).find(":hidden");e.sortable({connectWith:e,update:function(i,n){var s={};e.each(function(){var e={};a(this).children().each(function(){e[a(this).data("option")]=a(this).text()}),s[a(this).data("list")]=e}),t.val(JSON.stringify(s).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}),a(document).ready(function(){a(".google-analytic-generate").click(function(){var e=a("#"+a(this).data("textarea")).data("codemirrorInstance"),t="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";t+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",t+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",t+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",t+="ga('create', '"+a("#"+a(this).data("input")).val()+"', '"+a(this).data("basename")+"');\n",t+="ga('send', 'pageview');\n",e.replaceRange(t,e.getCursor("start"),e.getCursor("end"))})}),a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var t=a(".wrap.yith-plugin-ui").first(),i=a("div.updated, div.error, div.notice");if(i.addClass("inline"),t.length&&t.prepend(i),a(document).find(".yith-nav-sub-tab.nav-tab-active").length){var n=a(document).find(".yith-plugin-fw-wp-page-wrapper");if(n.length||(n=a(document).find("#wpbody-content > .yith-plugin-ui")),n)(t=n.find(".yit-admin-panel-content-wrap")).length?t.addClass("has-subnav"):n.find(".wrap").wrap('<div class="wrap subnav-wrap"></div>')}});
1
+ jQuery(function(a){function e(){a("[data-dep-target]:not( .deps-initialized )").each(function(){var e=a(this);e.addClass("deps-initialized");var t="#"+e.data("dep-target"),i="#"+e.data("dep-id"),n=e.data("dep-value"),d=e.data("dep-type"),s="change";"select-images"===a(i+"-wrapper").data("type")&&(s="yith_select_images_value_changed"),a(i).on(s,function(){!function(e,t,i,n){var d=!0;if("string"==typeof t){":radio"==t.substr(0,6)&&(t+=":checked");var s=a(t).data("type"),r=a(t).val();"checkbox"===s?r=a(t).is(":checked")?"yes":"no":"radio"===s&&(r=a(t).find('input[type="radio"]').filter(":checked").val()),"select-images"===a(t+"-wrapper").data("type")&&(r=a(t+"-wrapper").find("select").first().val()),i=i.split(",");for(var c=0;c<i.length;c++){if(r==i[c]){d=!0;break}d=!1}}var o=a(e),l=a(e+"-container").closest("tr");l.length<1&&(l=o.closest(".yith-plugin-fw-panel-wc-row, .yith-toggle-content-row"));var p,h=n.split("-");for(p in h){var f=h[p];if(d)switch(f){case"disable":l.removeClass("yith-disabled"),o.attr("disabled",!1);break;case"hideme":o.show();break;case"fadeInOut":case"fadeIn":l.show(500);break;case"fadeOut":l.show();break;default:l.show(),l.fadeTo("slow",1).addClass("fade-in")}else switch(f){case"disable":l.addClass("yith-disabled"),o.attr("disabled",!0);break;case"hideme":o.hide();break;case"fadeInOut":case"fadeOut":l.hide(500);break;case"fadeIn":l.hide();break;default:l.hasClass("fade-in")?l.fadeTo("slow",0,function(){a(this).hide().removeClass("fade-in")}):(l.hide(),l.css({opacity:"0"}))}}}(t,i,n.toString(),d)}).trigger(s)})}e(),a(document).on("yith-add-box-button-toggle",e),a(".rm_connectedlist").each(function(){var e=a(this).find("ul"),t=a(this).find(":hidden");e.sortable({connectWith:e,update:function(i,n){var d={};e.each(function(){var e={};a(this).children().each(function(){e[a(this).data("option")]=a(this).text()}),d[a(this).data("list")]=e}),t.val(JSON.stringify(d).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}),a(document).ready(function(){a(".google-analytic-generate").click(function(){var e=a("#"+a(this).data("textarea")).data("codemirrorInstance"),t="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";t+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",t+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",t+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",t+="ga('create', '"+a("#"+a(this).data("input")).val()+"', '"+a(this).data("basename")+"');\n",t+="ga('send', 'pageview');\n",e.replaceRange(t,e.getCursor("start"),e.getCursor("end"))})}),a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var t=a(".wrap.yith-plugin-ui").first(),i=a("div.updated, div.error, div.notice");if(i.addClass("inline"),t.length&&t.prepend(i),a(document).find(".yith-nav-sub-tab.nav-tab-active").length){var n=a(document).find(".yith-plugin-fw-wp-page-wrapper");if(n.length||(n=a(document).find("#wpbody-content > .yith-plugin-ui")),n)(t=n.find(".yit-admin-panel-content-wrap")).length?t.addClass("has-subnav"):n.find(".wrap").wrap('<div class="wrap subnav-wrap"></div>')}});
plugin-fw/assets/js/yith-fields.js CHANGED
@@ -62,14 +62,14 @@
62
  wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
63
  wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
64
 
65
- if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
66
  var button = $( '<span/>' ).attr( {
67
  class: "wp-picker-default-custom"
68
  } );
69
  wrap1.find( '.wp-picker-default' ).wrap( button );
70
  }
71
 
72
- if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
73
  var button = $( '<span/>' ).attr( {
74
  class: "wp-picker-default-custom"
75
  } );
@@ -572,8 +572,8 @@
572
  target_id = $this.data( 'box_id' ),
573
  closed_label = $this.data( 'closed_label' ),
574
  label = $this.data( 'opened_label' ),
575
- id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' );
576
- template = wp.template( 'yith-toggle-element-add-box-content-' + id );
577
 
578
  if ( '' !== target_id ) {
579
  $( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
62
  wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
63
  wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
64
 
65
+ if ( ! wrap1.find( '.wp-picker-default-custom' ).length ) {
66
  var button = $( '<span/>' ).attr( {
67
  class: "wp-picker-default-custom"
68
  } );
69
  wrap1.find( '.wp-picker-default' ).wrap( button );
70
  }
71
 
72
+ if ( ! wrap2.find( '.wp-picker-default-custom' ).length ) {
73
  var button = $( '<span/>' ).attr( {
74
  class: "wp-picker-default-custom"
75
  } );
572
  target_id = $this.data( 'box_id' ),
573
  closed_label = $this.data( 'closed_label' ),
574
  label = $this.data( 'opened_label' ),
575
+ id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' ),
576
+ template = wp.template( 'yith-toggle-element-add-box-content-' + id );
577
 
578
  if ( '' !== target_id ) {
579
  $( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
plugin-fw/assets/js/yith-fields.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
1
+ !function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-default-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-default-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id"),o=wp.template("yith-toggle-element-add-box-content-"+s);""!==a&&(e("#"+a).html(o({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
plugin-fw/assets/js/yith-gutenberg.min.js CHANGED
@@ -1,6 +1 @@
1
- (function(h){function q(g,b,e){var f="";f="";if("undefined"!=typeof b.callback&&"function"==typeof h[b.callback])f=h[b.callback](g,b);else{var c="["+b.shortcode_name;h.each(g.attributes,function(a,d){"undefined"!=typeof b.attributes&&"undefined"!=typeof b.attributes[a]&&(c+=" "+a+"=",c=1==b.attributes[a].remove_quotes?c+d:c+('"'+d+'"'))});c+="]";g=md5(c);f='<span class="yith_block_'+g+'">'+c+"</span>";"edit"==e&&0!=b.do_shortcode&&function(a){var d=null;h(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",
2
- [c,a]);h.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:c},success:function(l){d=l;""!=d&&(h(".yith_block_"+a).html(d),h(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[c,a,d]))}});h(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[c,a,d]);return d}(g);f=m(t,null,f)}return f}function r(g,b,e,f){var c={};if("colorpicker"==f||"color"==f)g=g.hex;c[b]=g;e.setAttributes(c);return e}var m=wp.element.createElement,
3
- u=wp.element.Fragment,v=wp.blocks.registerBlockType,w=wp.editor.InspectorControls,t=wp.element.RawHTML,x=wp.components.SelectControl,y=wp.components.ToggleControl,z=wp.components.CheckboxControl,A=wp.components.RangeControl,B=wp.components.ColorPicker,C=wp.components.RadioControl,D=wp.components.TextControl,E=wp.components.TextareaControl,F=m("svg",{width:22,height:22},m("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));
4
- h.each(yith_gutenberg,function(g,b){v("yith/"+g,{title:b.title,description:b.description,category:b.category,attributes:b.attributes,icon:"undefined"!=typeof b.icon?b.icon:F,keywords:b.keywords,edit:function(e){var f=[];h.each(b.attributes,function(c,a){var d=null,l=a.blocktype;if("undefined"!=typeof l){switch(l){case "select":d=x;break;case "text":d=D;break;case "textarea":d=E;break;case "toggle":d=y;break;case "checkbox":d=z;break;case "number":case "range":d=A;break;case "color":case "colorpicker":d=
5
- B;break;case "radio":d=C}if(null!=d){var n=helpMessageUncheked="";"undefined"!=typeof a.helps&&"undefined"!=typeof a.helps.checked&&"undefined"!=typeof a.helps.unchecked?(n=a.helps.checked,helpMessageUncheked=a.helps.unchecked):"undefined"!=typeof a.help&&(n=helpMessageUncheked=a.help);f.push(m(d,{value:e.attributes[c],options:a.options,label:a.label,checked:e.attributes[c],selected:e.attributes[c],help:e.attributes[c]?n:helpMessageUncheked,disableAlpha:a.disableAlpha,min:a.min,max:a.max,multiple:a.multiple,
6
- onChange:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)},onChangeComplete:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)}}))}}});sc=q(e,b,"edit");return[m(u,null,m(w,null,f),sc)]},save:function(e){return q(e,b,"save")}})})})(jQuery);
1
+ !function(e){wp.i18n.__;var t=wp.element.createElement,o=wp.element.Fragment,n=(wp.components.PanelBody,wp.blocks.registerBlockType),c=(wp.editor.RichText,wp.editor.BlockControls,wp.editor.InspectorControls),r=(wp.editor.AlignmentToolbar,wp.components,wp.element.RawHTML),a=wp.components.SelectControl,i=wp.components.ToggleControl,s=wp.components.CheckboxControl,l=wp.components.RangeControl,p=wp.components.ColorPicker,u=wp.components.RadioControl,d=wp.components.TextControl,h=wp.components.TextareaControl;const C=t("svg",{width:22,height:22},t("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));function b(o,n,c){var a="",i="";if("undefined"!=typeof n.callback&&"function"==typeof e[n.callback])a=e[n.callback](o,n);else{var s="["+n.shortcode_name;e.each(o.attributes,function(e,t){if("undefined"!=typeof n.attributes&&"undefined"!=typeof n.attributes[e]){s+=" "+e+"=";var o=n.attributes[e].remove_quotes;s+=1==o?t:'"'+t+'"'}}),s+="]";var l=md5(s);i='<span class="yith_block_'+l+'">'+s+"</span>","edit"==c&&0!=n.do_shortcode&&function(t){var o=null;return e(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",[s,t]),e.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:s},success:function(n){""!=(o=n)&&(e(".yith_block_"+t).html(o),e(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[s,t,o]))}}),e(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[s,t,o]),o}(l),a=t(r,null,i)}return a}function g(e,t,o,n){var c={};return"colorpicker"!=n&&"color"!=n||(e=e.hex),c[t]=e,o.setAttributes(c),o}e.each(yith_gutenberg,function(r,f){n("yith/"+r,{title:f.title,description:f.description,category:f.category,attributes:f.attributes,icon:"undefined"!=typeof f.icon?f.icon:C,keywords:f.keywords,edit:function(n){var r=new Array;return e.each(f.attributes,function(e,o){var c=null,C=o.blocktype;if(void 0!==C){switch(C){case"select":c=a;break;case"text":c=d;break;case"textarea":c=h;break;case"toggle":c=i;break;case"checkbox":c=s;break;case"number":case"range":c=l;break;case"color":case"colorpicker":c=p;break;case"radio":c=u}if(null!=c){var b=helpMessageUncheked="";"undefined"!=typeof o.helps&&"undefined"!=typeof o.helps.checked&&"undefined"!=typeof o.helps.unchecked?(b=o.helps.checked,helpMessageUncheked=o.helps.unchecked):"undefined"!=typeof o.help&&(b=helpMessageUncheked=o.help),r.push(t(c,{value:n.attributes[e],options:o.options,label:o.label,checked:n.attributes[e],selected:n.attributes[e],help:n.attributes[e]?b:helpMessageUncheked,disableAlpha:o.disableAlpha,min:o.min,max:o.max,multiple:o.multiple,onChange:function(t,o=e){n=g(t,o,n,C)},onChangeComplete:function(t,o=e){n=g(t,o,n,C)}}))}}}),sc=b(n,f,"edit"),[t(o,null,t(c,null,r),sc)]},save:function(e){return b(e,f,"save")}})})}(jQuery);
 
 
 
 
 
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.4.31
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.4.29
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.4.33
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.4.33
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/lib/yit-plugin-licence.php CHANGED
@@ -87,8 +87,8 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
87
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
88
  * @since 3.0.17
89
  */
90
- public static function get_license_activation_url(){
91
- return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_license_activation_url() : false;
92
  }
93
 
94
  /**
87
  * @author Andrea Grillo <andrea.grillo@yithemes.com>
88
  * @since 3.0.17
89
  */
90
+ public static function get_license_activation_url( $plugin_slug = '' ){
91
+ return function_exists( 'YITH_Plugin_Licence' ) ? YITH_Plugin_Licence()->get_license_activation_url( $plugin_slug ) : false;
92
  }
93
 
94
  /**
plugin-fw/templates/fields/dimensions.php CHANGED
@@ -57,25 +57,7 @@ if ( $allow_linked && 'yes' === $linked ) {
57
  <?php echo $custom_attributes ?>
58
  <?php echo isset( $data ) ? yith_plugin_fw_html_data_to_string( $data ) : ''; ?>
59
  >
60
- <div class="yith-plugin-fw-dimensions__units">
61
- <input class='yith-plugin-fw-dimensions__unit__value' type="hidden" name="<?php echo $name ?>[unit]" value="<?php echo isset( $value['unit'] ) ? $value['unit'] : current( array_keys( $units ) ) ?>">
62
- <?php foreach ( $units as $key => $label ) : ?>
63
- <?php
64
- $key = sanitize_title( $key );
65
- $classes = array(
66
- 'yith-plugin-fw-dimensions__unit',
67
- "yith-plugin-fw-dimensions__unit--{$key}-unit",
68
- );
69
- if ( $unit_value === $key ) {
70
- $classes[] = 'yith-plugin-fw-dimensions__unit--selected';
71
- }
72
- $classes = implode( ' ', $classes );
73
- ?>
74
- <span class="<?php echo $classes; ?>" data-value="<?php echo $key; ?>"><?php echo $label; ?></span>
75
- <?php endforeach ?>
76
- </div>
77
-
78
- <ul class="yith-plugin-fw-dimensions__dimensions">
79
  <?php foreach ( $dimensions as $key => $dimension ) : ?>
80
  <?php
81
  $d_id = "{$id}-dimension-" . sanitize_title( $key );
@@ -104,20 +86,37 @@ if ( $allow_linked && 'yes' === $linked ) {
104
  }
105
 
106
  ?>
107
- <li class="yith-plugin-fw-dimensions__dimension yith-plugin-fw-dimensions__dimension--<?php echo sanitize_title( $key ); ?>">
 
108
  <input id="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__number"
109
  type="number" name="<?php echo $d_name; ?>" value="<?php echo $d_value; ?>"
110
  <?php echo $d_attributes; ?>
111
  >
112
- <label for="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__label"><?php echo $d_label; ?></label>
113
- </li>
114
  <?php endforeach ?>
115
 
116
  <?php if ( $allow_linked ): ?>
117
- <li class="yith-plugin-fw-dimensions__linked" title="<?php _ex( 'Link values together', 'Tooltip in the "Dimensions" field', 'yith-plugin-fw' ); ?>">
118
  <input class='yith-plugin-fw-dimensions__linked__value' type="hidden" name="<?php echo $name ?>[linked]" value="<?php echo $linked ?>">
119
  <span class="dashicons dashicons-admin-links"></span>
120
- </li>
121
  <?php endif; ?>
122
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </div>
57
  <?php echo $custom_attributes ?>
58
  <?php echo isset( $data ) ? yith_plugin_fw_html_data_to_string( $data ) : ''; ?>
59
  >
60
+ <div class="yith-plugin-fw-dimensions__dimensions">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  <?php foreach ( $dimensions as $key => $dimension ) : ?>
62
  <?php
63
  $d_id = "{$id}-dimension-" . sanitize_title( $key );
86
  }
87
 
88
  ?>
89
+ <div class="yith-plugin-fw-dimensions__dimension yith-plugin-fw-dimensions__dimension--<?php echo sanitize_title( $key ); ?>">
90
+ <label for="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__label"><?php echo $d_label; ?></label>
91
  <input id="<?php echo $d_id; ?>" class="yith-plugin-fw-dimensions__dimension__number"
92
  type="number" name="<?php echo $d_name; ?>" value="<?php echo $d_value; ?>"
93
  <?php echo $d_attributes; ?>
94
  >
95
+ </div>
 
96
  <?php endforeach ?>
97
 
98
  <?php if ( $allow_linked ): ?>
99
+ <div class="yith-plugin-fw-dimensions__linked" title="<?php _ex( 'Link values together', 'Tooltip in the "Dimensions" field', 'yith-plugin-fw' ); ?>">
100
  <input class='yith-plugin-fw-dimensions__linked__value' type="hidden" name="<?php echo $name ?>[linked]" value="<?php echo $linked ?>">
101
  <span class="dashicons dashicons-admin-links"></span>
102
+ </div>
103
  <?php endif; ?>
104
+ </div>
105
+ <div class="yith-plugin-fw-dimensions__units">
106
+ <input class='yith-plugin-fw-dimensions__unit__value' type="hidden" name="<?php echo $name ?>[unit]" value="<?php echo isset( $value['unit'] ) ? $value['unit'] : current( array_keys( $units ) ) ?>">
107
+ <?php foreach ( $units as $key => $label ) : ?>
108
+ <?php
109
+ $key = sanitize_title( $key );
110
+ $classes = array(
111
+ 'yith-plugin-fw-dimensions__unit',
112
+ "yith-plugin-fw-dimensions__unit--{$key}-unit",
113
+ );
114
+ if ( $unit_value === $key ) {
115
+ $classes[] = 'yith-plugin-fw-dimensions__unit--selected';
116
+ }
117
+ $classes = implode( ' ', $classes );
118
+ ?>
119
+ <span class="<?php echo $classes; ?>" data-value="<?php echo $key; ?>"><?php echo $label; ?></span>
120
+ <?php endforeach ?>
121
+ </div>
122
  </div>
plugin-fw/templates/fields/radio.php CHANGED
@@ -21,7 +21,7 @@ $class = 'yith-plugin-fw-radio ' . $class;
21
  ?>
22
  <div class="<?php echo $class ?>" id="<?php echo $id ?>"
23
  <?php echo $custom_attributes ?>
24
- <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?> data-value="<?php echo $value ?>">
25
  <?php foreach ( $options as $key => $label ) :
26
  $radio_id = sanitize_key( $id . '-' . $key );
27
  ?>
21
  ?>
22
  <div class="<?php echo $class ?>" id="<?php echo $id ?>"
23
  <?php echo $custom_attributes ?>
24
+ <?php if ( isset( $data ) ) echo yith_plugin_fw_html_data_to_string( $data ); ?> data-value="<?php echo $value ?>" data-type="radio">
25
  <?php foreach ( $options as $key => $label ) :
26
  $radio_id = sanitize_key( $id . '-' . $key );
27
  ?>
plugin-fw/templates/fields/select.php CHANGED
@@ -25,6 +25,7 @@ $class = isset( $class ) ? $class : 'yith-plugin-fw-select';
25
  id="<?php echo $id ?>"
26
  name="<?php echo $name ?><?php if ( $multiple ) echo "[]" ?>" <?php if ( isset( $std ) ) : ?>
27
  data-std="<?php echo ( $multiple ) ? implode( ' ,', $std ) : $std ?>"<?php endif ?>
 
28
 
29
  class="<?php echo $class ?>"
30
  <?php echo $placeholder ?>
25
  id="<?php echo $id ?>"
26
  name="<?php echo $name ?><?php if ( $multiple ) echo "[]" ?>" <?php if ( isset( $std ) ) : ?>
27
  data-std="<?php echo ( $multiple ) ? implode( ' ,', $std ) : $std ?>"<?php endif ?>
28
+ data-value="<?php echo ( $multiple ) ? implode( ' ,', $value ) : $value; ?>"
29
 
30
  class="<?php echo $class ?>"
31
  <?php echo $placeholder ?>
plugin-fw/templates/fields/toggle-element.php CHANGED
@@ -70,18 +70,21 @@ if ( empty( $values ) && !$show_add_button && $elements ) {
70
  $element[ 'id' ] = 'new_' . $element[ 'id' ];
71
  $element[ 'name' ] = $name . "[{{{data.index}}}][" . $element[ 'id' ] . "]";
72
  $class_element = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
 
 
 
 
73
 
74
  $is_required = !empty( $element[ 'required' ] );
75
  if ( $is_required ) {
76
  $class_element .= ' yith-plugin-fw--required';
77
  }
78
  ?>
79
- <div class="yith-add-box-row <?php echo $class_element ?> <?php echo '{{{data.index}}}' ?>">
80
 
81
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo( $element[ 'title' ] ); ?></label>
82
  <div class="yith-plugin-fw-option-with-description">
83
- <?php
84
- echo yith_plugin_fw_get_field( $element, true ); ?>
85
  <span class="description"><?php echo !empty( $element[ 'desc' ] ) ? $element[ 'desc' ] : ''; ?></span>
86
  </div>
87
  </div>
@@ -126,16 +129,14 @@ if ( empty( $values ) && !$show_add_button && $elements ) {
126
  <?php
127
  if ( !empty( $onoff_field ) && is_array( $onoff_field ) ):
128
  $action = !empty( $onoff_field[ 'ajax_action' ] ) ? 'data-ajax_action="' . $onoff_field[ 'ajax_action' ] . '"' : '';
129
- $onoff_field[ 'value' ] = isset( $value[ $onoff_id ] ) ? $value[ $onoff_id ] : $onoff_field[ 'default' ];
130
  $onoff_field[ 'type' ] = 'onoff';
131
  $onoff_field[ 'name' ] = $name . "[$i][" . $onoff_id . "]";
132
  $onoff_field[ 'id' ] = $onoff_id . '_' . $i;
133
  unset( $onoff_field[ 'yith-type' ] );
134
  ?>
135
  <span class="yith-toggle-onoff" <?php echo $action; ?> >
136
- <?php
137
- echo yith_plugin_fw_get_field( $onoff_field, true );
138
- ?>
139
  </span>
140
 
141
  <?php if ( $sortable ): ?>
@@ -152,16 +153,21 @@ if ( empty( $values ) && !$show_add_button && $elements ) {
152
  unset( $element[ 'yith-type' ] );
153
  $element[ 'title' ] = $element[ 'name' ];
154
  $element[ 'name' ] = $name . "[$i][" . $element[ 'id' ] . "]";
155
- $element[ 'value' ] = isset( $value[ $element[ 'id' ] ] ) ? $value[ $element[ 'id' ] ] : $element[ 'default' ];
156
  $element[ 'id' ] = $element[ 'id' ] . '_' . $i;
157
  $element[ 'class_row' ] = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
 
 
 
 
158
 
159
  $is_required = !empty( $element[ 'required' ] );
160
  if ( $is_required ) {
161
  $element[ 'class_row' ] .= ' yith-plugin-fw--required';
162
  }
 
163
  ?>
164
- <div class="yith-toggle-content-row <?php echo $element[ 'class_row' ] . ' ' . $element[ 'type' ] ?>">
165
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo $element[ 'title' ]; ?></label>
166
  <div class="yith-plugin-fw-option-with-description">
167
  <?php echo yith_plugin_fw_get_field( $element, true ); ?>
@@ -223,16 +229,14 @@ if ( empty( $values ) && !$show_add_button && $elements ) {
223
  <?php
224
  if ( !empty( $onoff_field ) && is_array( $onoff_field ) ):
225
  $action = !empty( $onoff_field[ 'ajax_action' ] ) ? 'data-ajax_action="' . $onoff_field[ 'ajax_action' ] . '"' : '';
226
- $onoff_field[ 'value' ] = $onoff_field[ 'default' ];
227
  $onoff_field[ 'type' ] = 'onoff';
228
  $onoff_field[ 'name' ] = $name . "[{{{data.index}}}][" . $onoff_id . "]";
229
  $onoff_field[ 'id' ] = $onoff_id;
230
  unset( $onoff_field[ 'yith-type' ] );
231
  ?>
232
  <span class="yith-toggle-onoff" <?php echo $action; ?> >
233
- <?php
234
- echo yith_plugin_fw_get_field( $onoff_field, true );
235
- ?>
236
  </span>
237
 
238
  <?php endif; ?>
@@ -250,12 +254,17 @@ if ( empty( $values ) && !$show_add_button && $elements ) {
250
  $element[ 'name' ] = $name . "[{{{data.index}}}][" . $element[ 'id' ] . "]";
251
  $element[ 'id' ] = $element[ 'id' ] . '_{{{data.index}}}';
252
  $class_element = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
 
 
 
 
253
  $is_required = !empty( $element[ 'required' ] );
254
  if ( $is_required ) {
255
  $class_element .= ' yith-plugin-fw--required';
256
  }
 
257
  ?>
258
- <div class="yith-toggle-content-row <?php echo $class_element . ' ' . $element[ 'type' ] ?>">
259
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo $element[ 'title' ]; ?></label>
260
  <div class="yith-plugin-fw-option-with-description">
261
  <?php echo yith_plugin_fw_get_field( $element, true ); ?>
70
  $element[ 'id' ] = 'new_' . $element[ 'id' ];
71
  $element[ 'name' ] = $name . "[{{{data.index}}}][" . $element[ 'id' ] . "]";
72
  $class_element = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
73
+ // handle deps if any
74
+ ! empty( $element[ 'deps' ]['id'] ) && $element[ 'deps' ]['id'] = 'new_' . $element[ 'deps' ]['id'];
75
+ ! empty( $element[ 'deps' ]['target-id'] ) && $element[ 'deps' ]['target-id'] = 'new_' . $element[ 'deps' ]['target-id'];
76
+ $deps = yith_field_deps_data( $element );
77
 
78
  $is_required = !empty( $element[ 'required' ] );
79
  if ( $is_required ) {
80
  $class_element .= ' yith-plugin-fw--required';
81
  }
82
  ?>
83
+ <div class="yith-add-box-row yith-toggle-content-row <?php echo $class_element ?> <?php echo '{{{data.index}}}' ?>" <?php echo $deps ?>>
84
 
85
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo( $element[ 'title' ] ); ?></label>
86
  <div class="yith-plugin-fw-option-with-description">
87
+ <?php yith_plugin_fw_get_field( $element, true ); ?>
 
88
  <span class="description"><?php echo !empty( $element[ 'desc' ] ) ? $element[ 'desc' ] : ''; ?></span>
89
  </div>
90
  </div>
129
  <?php
130
  if ( !empty( $onoff_field ) && is_array( $onoff_field ) ):
131
  $action = !empty( $onoff_field[ 'ajax_action' ] ) ? 'data-ajax_action="' . $onoff_field[ 'ajax_action' ] . '"' : '';
132
+ $onoff_field[ 'value' ] = isset( $value[ $onoff_id ] ) ? $value[ $onoff_id ] : ( isset( $onoff_field[ 'default' ] ) ? $onoff_field[ 'default' ] : '' );
133
  $onoff_field[ 'type' ] = 'onoff';
134
  $onoff_field[ 'name' ] = $name . "[$i][" . $onoff_id . "]";
135
  $onoff_field[ 'id' ] = $onoff_id . '_' . $i;
136
  unset( $onoff_field[ 'yith-type' ] );
137
  ?>
138
  <span class="yith-toggle-onoff" <?php echo $action; ?> >
139
+ <?php yith_plugin_fw_get_field( $onoff_field, true ); ?>
 
 
140
  </span>
141
 
142
  <?php if ( $sortable ): ?>
153
  unset( $element[ 'yith-type' ] );
154
  $element[ 'title' ] = $element[ 'name' ];
155
  $element[ 'name' ] = $name . "[$i][" . $element[ 'id' ] . "]";
156
+ $element[ 'value' ] = isset( $value[ $element[ 'id' ] ] ) ? $value[ $element[ 'id' ] ] : ( isset( $element[ 'default' ] ) ? $element[ 'default' ] : '' );
157
  $element[ 'id' ] = $element[ 'id' ] . '_' . $i;
158
  $element[ 'class_row' ] = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
159
+ // handle deps if any
160
+ ! empty( $element[ 'deps' ]['id'] ) && $element[ 'deps' ]['id'] = $element[ 'deps' ]['id'] . '_' . $i;
161
+ ! empty( $element[ 'deps' ]['target-id'] ) && $element[ 'deps' ]['target-id'] = $element[ 'deps' ]['target-id'] . '_' . $i;
162
+ $deps = yith_field_deps_data( $element );
163
 
164
  $is_required = !empty( $element[ 'required' ] );
165
  if ( $is_required ) {
166
  $element[ 'class_row' ] .= ' yith-plugin-fw--required';
167
  }
168
+
169
  ?>
170
+ <div class="yith-toggle-content-row <?php echo $element[ 'class_row' ] . ' ' . $element[ 'type' ] ?>" <?php echo $deps; ?>>
171
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo $element[ 'title' ]; ?></label>
172
  <div class="yith-plugin-fw-option-with-description">
173
  <?php echo yith_plugin_fw_get_field( $element, true ); ?>
229
  <?php
230
  if ( !empty( $onoff_field ) && is_array( $onoff_field ) ):
231
  $action = !empty( $onoff_field[ 'ajax_action' ] ) ? 'data-ajax_action="' . $onoff_field[ 'ajax_action' ] . '"' : '';
232
+ $onoff_field[ 'value' ] = isset( $onoff_field[ 'default' ] ) ? $onoff_field[ 'default' ] : '';
233
  $onoff_field[ 'type' ] = 'onoff';
234
  $onoff_field[ 'name' ] = $name . "[{{{data.index}}}][" . $onoff_id . "]";
235
  $onoff_field[ 'id' ] = $onoff_id;
236
  unset( $onoff_field[ 'yith-type' ] );
237
  ?>
238
  <span class="yith-toggle-onoff" <?php echo $action; ?> >
239
+ <?php yith_plugin_fw_get_field( $onoff_field, true ); ?>
 
 
240
  </span>
241
 
242
  <?php endif; ?>
254
  $element[ 'name' ] = $name . "[{{{data.index}}}][" . $element[ 'id' ] . "]";
255
  $element[ 'id' ] = $element[ 'id' ] . '_{{{data.index}}}';
256
  $class_element = isset( $element[ 'class_row' ] ) ? $element[ 'class_row' ] : '';
257
+ // handle deps if any
258
+ ! empty( $element[ 'deps' ]['id'] ) && $element[ 'deps' ]['id'] = $element[ 'deps' ]['id'] . '_{{{data.index}}}';
259
+ ! empty( $element[ 'deps' ]['target-id'] ) && $element[ 'deps' ]['target-id'] = $element[ 'deps' ]['target-id'] . '_{{{data.index}}}';
260
+ $deps = yith_field_deps_data( $element );
261
  $is_required = !empty( $element[ 'required' ] );
262
  if ( $is_required ) {
263
  $class_element .= ' yith-plugin-fw--required';
264
  }
265
+
266
  ?>
267
+ <div class="yith-toggle-content-row <?php echo $class_element . ' ' . $element[ 'type' ] ?>" <?php echo $deps; ?>>
268
  <label for="<?php echo $element[ 'id' ]; ?>"><?php echo $element[ 'title' ]; ?></label>
269
  <div class="yith-plugin-fw-option-with-description">
270
  <?php echo yith_plugin_fw_get_field( $element, true ); ?>
plugin-fw/yit-plugin.php CHANGED
@@ -184,14 +184,14 @@ if( ! function_exists( 'yith_add_action_links' ) ){
184
  * @return mixed
185
  * @use plugin_action_links_{$plugin_file_name}
186
  */
187
- function yith_add_action_links( $links, $panel_page = '', $is_premium = false ) {
188
  $links = is_array( $links ) ? $links : array();
189
  if( ! empty( $panel_page ) ){
190
  $links[] = sprintf( '<a href="%s">%s</a>', admin_url( "admin.php?page={$panel_page}" ), _x( 'Settings', 'Action links', 'yith-plugin-fw' ) );
191
  }
192
 
193
  if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
194
- $links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence()->get_license_activation_url(),__( 'License', 'yith-plugin-fw' ) );
195
  }
196
 
197
  return $links;
184
  * @return mixed
185
  * @use plugin_action_links_{$plugin_file_name}
186
  */
187
+ function yith_add_action_links( $links, $panel_page = '', $is_premium = false, $plugin_slug = '' ) {
188
  $links = is_array( $links ) ? $links : array();
189
  if( ! empty( $panel_page ) ){
190
  $links[] = sprintf( '<a href="%s">%s</a>', admin_url( "admin.php?page={$panel_page}" ), _x( 'Settings', 'Action links', 'yith-plugin-fw' ) );
191
  }
192
 
193
  if( $is_premium && class_exists( 'YIT_Plugin_Licence' ) ){
194
+ $links[] = sprintf( '<a href="%s">%s</a>', YIT_Plugin_Licence()->get_license_activation_url( $plugin_slug ),__( 'License', 'yith-plugin-fw' ) );
195
  }
196
 
197
  return $links;