Version Description
Released on 01 June 2020 =
New: Show product count in dropdown filter
New: Support for WooCommerce 4.2
Update: plugin framework
Fix: Reset filter show category page instead of shop
Dev: yit_get_filter_args hook for filter the filter url arg
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Ajax Product Filter |
Version | 3.11.0 |
Comparing to | |
See all releases |
Code changes from version 3.10.0 to 3.11.0
- README.txt +9 -1
- assets/css/admin.css +2 -1
- assets/js/yith-wcan-admin.js +2 -2
- assets/js/yith-wcan-frontend.min.js +1 -17
- includes/functions.yith-wcan.php +10 -10
- init.php +3 -3
- plugin-fw/assets/css/yith-fields.css +7 -2
- plugin-fw/assets/js/yit-plugin-panel.js +16 -4
- plugin-fw/assets/js/yit-plugin-panel.min.js +5 -1
- plugin-fw/assets/js/yith-colorpicker.min.js +1 -1
- plugin-fw/assets/js/yith-fields.js +727 -728
- plugin-fw/assets/js/yith-fields.min.js +30 -1
- plugin-fw/init.php +2 -2
- plugin-fw/lib/yit-plugin-panel-wc.php +29 -20
- plugin-fw/templates/fields/select-images.php +3 -3
- plugin-fw/templates/fields/toggle-element-fixed.php +11 -3
- widgets/class.yith-wcan-navigation-widget.php +8 -0
- widgets/class.yith-wcan-reset-navigation-widget.php +2 -2
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.4
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -159,6 +159,14 @@ If you want to see a demonstration version of the premium plugin, you can see it
|
|
159 |
|
160 |
== Changelog ==
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
= 3.10.0 - Released on 30 April 2020 =
|
163 |
|
164 |
* New: Support for WooCommerce 4.1
|
4 |
Tags: woocommerce ajax product filter download, woocommerce, widget, ajax, ajax filtered nav, ajax navigation, ajax filtered navigation, woocommerce layered navigation, woocommerce layered nav, product filter, product filters, ajax product filter, woocommerce ajax product filter, woocommerce filters, sidebar filter, sidebar ajax filter, ajax price filter, price filter, product sorting, woocommerce filter, taxonomy filter, attribute filter, attributes filter, woocommerce product sort, ajax sort, woocommerce ajax product filter, advanced product filters, ajax product filters, filters, woocommerce ajax product filters, woocommerce product filters, woocommerce product filters, category filter, attribute filters, woocommerce products filter, woocommerce price filter, yit, yith, yithemes
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.4
|
7 |
+
Stable tag: 3.11.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
159 |
|
160 |
== Changelog ==
|
161 |
|
162 |
+
= 3.11.0 - Released on 01 June 2020 =
|
163 |
+
|
164 |
+
* New: Show product count in dropdown filter
|
165 |
+
* New: Support for WooCommerce 4.2
|
166 |
+
* Update: plugin framework
|
167 |
+
* Fix: Reset filter show category page instead of shop
|
168 |
+
* Dev: yit_get_filter_args hook for filter the filter url arg
|
169 |
+
|
170 |
= 3.10.0 - Released on 30 April 2020 =
|
171 |
|
172 |
* New: Support for WooCommerce 4.1
|
assets/css/admin.css
CHANGED
@@ -34,6 +34,7 @@ div.yit-wcan-widget-tag-list.tags{
|
|
34 |
p#yit-wcan-style.yit-wcan-style-color,
|
35 |
p#yit-wcan-style.yit-wcan-style-multicolor,
|
36 |
p#yit-wcan-show-count.yit-wcan-show-count-list,
|
|
|
37 |
p#yit-wcan-show-count.yit-wcan-show-count-categories,
|
38 |
p#yit-wcan-show-count.yit-wcan-show-count-brands,
|
39 |
p#yit-wcan-show-count.yit-wcan-show-count-tags{
|
@@ -44,4 +45,4 @@ label.yith-wcan-reset-table{
|
|
44 |
width: 50%;
|
45 |
display: inline-block;
|
46 |
vertical-align: top;
|
47 |
-
}
|
34 |
p#yit-wcan-style.yit-wcan-style-color,
|
35 |
p#yit-wcan-style.yit-wcan-style-multicolor,
|
36 |
p#yit-wcan-show-count.yit-wcan-show-count-list,
|
37 |
+
p#yit-wcan-show-count.yit-wcan-show-count-select,
|
38 |
p#yit-wcan-show-count.yit-wcan-show-count-categories,
|
39 |
p#yit-wcan-show-count.yit-wcan-show-count-brands,
|
40 |
p#yit-wcan-show-count.yit-wcan-show-count-tags{
|
45 |
width: 50%;
|
46 |
display: inline-block;
|
47 |
vertical-align: top;
|
48 |
+
}
|
assets/js/yith-wcan-admin.js
CHANGED
@@ -57,7 +57,7 @@ jQuery(function ($) {
|
|
57 |
style.hide();
|
58 |
}
|
59 |
|
60 |
-
if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' || data.value == 'categories' ){
|
61 |
show_count.show();
|
62 |
} else {
|
63 |
show_count.hide();
|
@@ -122,4 +122,4 @@ jQuery(function ($) {
|
|
122 |
e.preventDefault();
|
123 |
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag_wrapper').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
|
124 |
});
|
125 |
-
});
|
57 |
style.hide();
|
58 |
}
|
59 |
|
60 |
+
if( data.value == 'list' || data.value == 'tags' || data.value == 'brands' || data.value == 'categories' || data.value == 'select' ){
|
61 |
show_count.show();
|
62 |
} else {
|
63 |
show_count.hide();
|
122 |
e.preventDefault();
|
123 |
$(this).parents( '.yith-wcan-select-option').next('.yith_wcan_select_tag_wrapper').find('.yith_wcan_tag_list_checkbox').attr( 'checked', false );
|
124 |
});
|
125 |
+
});
|
assets/js/yith-wcan-frontend.min.js
CHANGED
@@ -1,17 +1 @@
|
|
1 |
-
jQuery(function(a){function y(
|
2 |
-
function u(a,p){return a.replace(new RegExp("[?&]"+p+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+p+"=[^&]*&"),"$1")}var A=/(?!(\[))(\.)[^.#[]*/g,B=/(#)[^.#[]*/,C=/^[\w]+/,D=/^[\w]+$/,v=function(d,p){if(D.test(d))var b=[{tag:d}];else{b=d;for(var e={sel:[],val:[]},n=[],c=!1,k="",m=[],l=0,g=b.length;l<g;l++){var f=b.charAt(l);if(c)if("\\"===f&&l+1<b.length)m.push(b.charAt(++l));else if(k===f)k="",m.push(f);else if(("'"===f||'"'===f)&&""===k)k=f,m.push(f);else if("]"===f&&""===k)e.val.push(m.join("")),
|
3 |
-
m=[],c=!1;else{if("]"!==f||""!==k)""===k&&","===f?(e.val.push(m.join("")),m=[]):m.push(f)}else"\\"===f&&l+1<b.length?c&&m.push(b.charAt(++l)):"["===f&&""===k?c=!0:" "===f||"+"===f?(e.sel=e.sel.join(""),n.push(e),"+"===f&&n.push({sel:"+",val:""}),e={sel:[],val:[]}):" "!==f&&"]"!==f&&e.sel.push(f)}if(0!=e.sel.length||0!=e.val.length)e.sel=e.sel.join(""),n.push(e);for(l=0;l<n.length;l++){e=n[l].sel;if("+"===e)h.tag=e;else{var h=[];h.tag=C.exec(e);h.id=B.exec(e);h.id&&a.isArray(h.id)&&(h.id=h.id[0].substr(1));
|
4 |
-
h.tag||(h.tag="div");h.vars=[];for(b=0;b<n[l].val.length;b++)k=n[l].val[b].indexOf("="),c=n[l].val[b].substr(0,k),k=n[l].val[b].substr(k+1),k=k.replace(/^[\s]*["']*|["']*[\s]*$/g,""),"text"===c?h.text=k:h.vars.push([c,k]);e=e.match(A);c=[];if(e){for(b=0;b<e.length;b++)c.push(e[b].substr(1));h.className=c.join(" ")}}n[l]=h}b=n}e=[];"undefined"===typeof p&&(p=1);n=[];c=[];k=[];m=document.createElement("div");for(g=l=0;g<b.length;g++){if("+"==b[g].tag)c=k.slice(),--l;else{for(f=0;f<p;f++)if("input"==
|
5 |
-
b[g].tag){h=[];h.push("<"+b[g].tag);b[g].id&&h.push("id='"+b[g].id+"'");b[g].className&&(h.push("class='"+b[g].className),g+1===b.length&&h.push(lastClass),h.push("'"));if(b[g].vars)for(var q=0;q<b[g].vars.length;q++)h.push(b[g].vars[q][0]+"='"+b[g].vars[q][1]+"'");b[g].text&&h.push("value='"+b[g].text+"'");h.push("/>");k[f]=c[f];c[f]?(c[f].innerHTML+=h.join(" "),c[f]=c[f].lastChild):(m.innerHTML=h.join(" "),c[f]=m.removeChild(m.firstChild))}else{h=document.createElement(b[g].tag);if(b[g].vars)for(q=
|
6 |
-
0;q<b[g].vars.length;q++)console.log(b[g].tag,b[g].vars[q]),h.setAttribute(b[g].vars[q][0],b[g].vars[q][1]);b[g].id&&(h.id=b[g].id);b[g].className&&(h.className=b[g].className);b[g].text&&h.appendChild(document.createTextNode(b[g].text));k[f]=c[f];c[f]=c[f]?c[f].appendChild(h):h}l++||Array.prototype.push.apply(n,c)}e=a.merge(e,c)}return a(n)},w=function(d,p,b){for(var e=d.match(/%[^%]*%/g)||[],n=[],c=0;c<p.length;c++){for(var k=d,m=0;m<e.length;m++){var l=e[m].substr(1,e[m].length-2);k=k.replace(e[m],
|
7 |
-
p[c][l])}n=a.merge(n,v(k,b))}return a(n)};a.jseldom=function(d){if(2==arguments.length&&a.isPlainObject(arguments[1]))return w.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!a.isArray(arguments[1]))return v.apply(this,arguments);if(2==arguments.length)return w.apply(this,arguments)};var r=!1,x=function(){var d=a("#yith-wcan-reset-all-categories").find("a.yith-wcan-reset-categories-link"),p=a("#yith-wcan-reset-all-tags").find("a.yith-wcan-reset-tags-link");
|
8 |
-
d.add(p).on("click",function(b){a(this).yith_wcan_ajax_filters(b,this)})};a.fn.yith_wcan_ajax_filters=function(d,p){d.preventDefault();var b=p.href,e=a(p),n=e.hasClass("yith-wcan-reset-navigation");if("undefined"==typeof b&&e.parents().hasClass("price_slider_wrapper")){e.parents("form");var c=window.location,k=c.origin+c.pathname,m=k!=c.href,l=a(".price_slider_amount #min_price").val(),g=a(".price_slider_amount #max_price").val();b=c.href;1==m&&(b=u(b,"min_price"),b=u(b,"max_price"));b=b+(k==b?"?":
|
9 |
-
"&")+a.param({min_price:l,max_price:g})}"select"==e.data("type")&&(e.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),e.parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300));a(yith_wcan.container).not(".ywcps-products").html("").addClass("yith-wcan-loading");a(document).trigger("yith-wcan-ajax-loading");"undefined"!=typeof yith_wcan_frontend&&a(yith_wcan.container).not(".ywcps-products").css("backgroundImage",
|
10 |
-
"url("+yith_wcan_frontend.loader_url+")");c=!1;"both"==yith_wcan.scroll_top_mode?c=!0:"mobile"==yith_wcan.scroll_top_mode&&1==yith_wcan.is_mobile?c=!0:"desktop"==yith_wcan.scroll_top_mode&&1!=yith_wcan.is_mobile&&(c=!0);1==c&&a(window).scrollTop(a(yith_wcan.scroll_top).offset().top);a(yith_wcan.pagination).hide();a(yith_wcan.result_count).hide();0!=r&&(r.abort(),r=!1);r=a.ajax({url:b,success:function(c){r=!1;a(yith_wcan.container).not(".ywcps-products").removeClass("yith-wcan-loading");0<a(c).find(yith_wcan.container).not(".ywcps-products").length?
|
11 |
-
a(".yit-wcan-container").html(a(c).find(yith_wcan.container).not(".ywcps-products")):a(".yit-wcan-container").html(a(c).find(".woocommerce-info"));0<a(c).find(yith_wcan.pagination).length?(0==a(yith_wcan.pagination).length&&a.jseldom(yith_wcan.pagination).insertAfter(a(yith_wcan.container).not(".ywcps-products")),a(yith_wcan.pagination).html(a(c).find(yith_wcan.pagination).html()).show()):a(yith_wcan.pagination).empty();a("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />');
|
12 |
-
0<a(c).find(yith_wcan.result_count).length&&a(yith_wcan.result_count).html(a(c).find(yith_wcan.result_count).html()).show();var f=function(b){var d=b.attr("id");d=a(c).find("#"+d);0==d.length?b.hide():(b.html(d.html()),b.show())};a(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var b=a(this);f(b)});1==yith_wcan.yootheme.is_enabled&&a(".widget-yith-woo-ajax-navigation").add(".widget-yith-woo-ajax-navigation-sort-by").add(".widget-yith-woo-ajax-reset-navigation").add(".widget-yith-wcan-stock-on-sale").add(".widget-yith-wcan-list-price-filter").each(function(){var b=
|
13 |
-
a(this);f(b)});if(1==yith_wcan.avada.is_enabled){var d=a(yith_wcan.avada.sort_count);d.html(a(c).find(yith_wcan.avada.sort_count).html());""==e.text()?d.hide():d.show()}1!=yith_wcan.change_browser_url||navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",b);a(document).trigger("ready");a(document).trigger("yith-wcan-ajax-filtered",[c]);a(window).trigger("scroll");if(n){if("undefined"!=typeof a.fn.slider){d=parseInt(a(yith_wcan.wc_price_slider.min_price).data("min"));
|
14 |
-
var g=parseInt(a(yith_wcan.wc_price_slider.max_price).data("max"));a(yith_wcan.wc_price_slider.wrapper).slider("values",[d,g]);a(document.body).trigger("price_slider_slide",[d,g])}a(document).trigger("yith-wcan-ajax-reset-filtered")}x()}})};a(yith_wcan.container).not(".ywcps-products").wrap('<div class="yit-wcan-container"></div>');a(document).on("yith-wcan-wrapped",function(){x()});a(document).trigger("yith-wcan-wrapped");a(document).on("click",".yith-wcan a",function(d){a(this).yith_wcan_ajax_filters(d,
|
15 |
-
this)});var t=function(){a("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},0,function(){a(this).css("display","none")});a("a.yit-wcan-select-open").removeClass("active")};a(document).on("click","a.yit-wcan-select-open.active",function(a){a.preventDefault();z(this)});a(document).on("click","a.yit-wcan-select-open:not(.active)",function(d){d.preventDefault();a("a.yit-wcan-select-open.active").trigger("click");y(this)});a(document).on("ready yith-wcan-ajax-filtered",
|
16 |
-
function(){a("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");t();a("div.yith-wcan-select-wrapper").each(function(){var d="";a(this).find("ul.yith-wcan-select li.chosen").each(function(){d+=a(this).text()+", "});d=d.substring(0,d.length-2);""!=d&&a(this).parent().find("a.yit-wcan-select-open").text(d)})});a(document).on("ready",t);a("body").on("click",function(d){a(d.target).hasClass("yit-wcan-select-open")||t()});if(1==yith_wcan.flatsome.is_enabled&&1==yith_wcan.flatsome.lazy_load_enabled)a(document).on("yith-wcan-ajax-filtered",
|
17 |
-
function(d,p){var b=a(document);jQuery(".lazy-load",b).each(function(a,b){var c=jQuery(b);c.waypoint(function(a){if(!c.hasClass("lazy-load-active")){a=c.data("src");var b=c.data("srcset");a&&c.attr("src",a);b&&c.attr("srcset",b);c.imagesLoaded(function(){c.addClass("lazy-load-active").removeClass("lazy-load")})}},{offset:"140%"})})});window.addEventListener("popstate",function(a){window.location.reload(!0)})});
|
1 |
+
jQuery(function(y){var u=/(?!(\[))(\.)[^.#[]*/g,w=/(#)[^.#[]*/,v=/^[\w]+/,f=/^[\w]+$/,l=function(t,a){var e=f.test(t)?[{tag:t}]:function(t){for(var a={sel:[],val:[]},e=[],i=!1,n="",c=[],s=0,r=t.length;s<r;s++){var o=t.charAt(s);i?"\\"===o&&s+1<t.length?c.push(t.charAt(++s)):n===o?(n="",c.push(o)):"'"!==o&&'"'!==o||""!==n?"]"===o&&""===n?(a.val.push(c.join("")),i=!(c=[])):"]"===o&&""===n||(""===n&&","===o?(a.val.push(c.join("")),c=[]):c.push(o)):(n=o,c.push(o)):"\\"===o&&s+1<t.length?i&&c.push(t.charAt(++s)):"["===o&&""===n?i=!0:" "===o||"+"===o?(a.sel=a.sel.join(""),e.push(a),"+"===o&&e.push({sel:"+",val:""}),a={sel:[],val:[]}):" "!==o&&"]"!==o&&a.sel.push(o)}for(0==a.sel.length&&0==a.val.length||(a.sel=a.sel.join(""),e.push(a)),s=0;s<e.length;s++){if("+"===(a=e[s].sel))l.tag=a;else{var l=[];for(l.tag=v.exec(a),l.id=w.exec(a),l.id&&y.isArray(l.id)&&(l.id=l.id[0].substr(1)),l.tag||(l.tag="div"),l.vars=[],t=0;t<e[s].val.length;t++)n=e[s].val[t].indexOf("="),i=e[s].val[t].substr(0,n),n=(n=e[s].val[t].substr(n+1)).replace(/^[\s]*[\"\']*|[\"\']*[\s]*$/g,""),"text"===i?l.text=n:l.vars.push([i,n]);if(i=[],a=a.match(u)){for(t=0;t<a.length;t++)i.push(a[t].substr(1));l.className=i.join(" ")}}e[s]=l}return e}(t),i=[];void 0===a&&(a=1);for(var n=[],c=[],s=[],r=document.createElement("div"),o=0,l=0;l<e.length;l++){if("+"==e[l].tag)c=s.slice(),--o;else{for(var d=0;d<a;d++)if("input"==e[l].tag){var h=[];if(h.push("<"+e[l].tag),e[l].id&&h.push("id='"+e[l].id+"'"),e[l].className&&(h.push("class='"+e[l].className),l+1===e.length&&h.push(lastClass),h.push("'")),e[l].vars)for(var p=0;p<e[l].vars.length;p++)h.push(e[l].vars[p][0]+"='"+e[l].vars[p][1]+"'");e[l].text&&h.push("value='"+e[l].text+"'"),h.push("/>"),s[d]=c[d],c[d]?(c[d].innerHTML+=h.join(" "),c[d]=c[d].lastChild):(r.innerHTML=h.join(" "),c[d]=r.removeChild(r.firstChild))}else{if(h=document.createElement(e[l].tag),e[l].vars)for(p=0;p<e[l].vars.length;p++)console.log(e[l].tag,e[l].vars[p]),h.setAttribute(e[l].vars[p][0],e[l].vars[p][1]);e[l].id&&(h.id=e[l].id),e[l].className&&(h.className=e[l].className),e[l].text&&h.appendChild(document.createTextNode(e[l].text)),s[d]=c[d],c[d]=c[d]?c[d].appendChild(h):h}o++||Array.prototype.push.apply(n,c)}i=y.merge(i,c)}return y(n)},a=function(t,a,e){for(var i=t.match(/%[^%]*%/g)||[],n=[],c=0;c<a.length;c++){for(var s=t,r=0;r<i.length;r++)var o=i[r].substr(1,i[r].length-2),s=s.replace(i[r],a[c][o]);n=y.merge(n,l(s,e))}return y(n)},h=!(y.jseldom=function(t){return 2==arguments.length&&y.isPlainObject(arguments[1])?a.apply(this,[t,[arguments[1]]]):1==arguments.length||2==arguments.length&&!y.isArray(arguments[1])?l.apply(this,arguments):2==arguments.length?a.apply(this,arguments):void 0}),p=function(){var t=y("#yith-wcan-reset-all-categories").find("a.yith-wcan-reset-categories-link"),a=y("#yith-wcan-reset-all-tags").find("a.yith-wcan-reset-tags-link");t.add(a).on("click",function(t){y(this).yith_wcan_ajax_filters(t,this)})};y.fn.yith_wcan_ajax_filters=function(t,a){t.preventDefault();var e,i,n,c,s,r=a.href,o=y(a),l=o.hasClass("yith-wcan-reset-navigation");void 0===r&&o.parents().hasClass("price_slider_wrapper")&&(o.parents("form"),n=(i=(e=window.location).origin+e.pathname)!=e.href,e.search,c=y(".price_slider_amount #min_price").val(),s=y(".price_slider_amount #max_price").val(),new RegExp("^min_price","i"),new RegExp("^max_price","i"),r=e.href,1==n&&(r=g(r,"min_price"),r=g(r,"max_price")),r=r+(i==r?"?":"&")+y.param({min_price:c,max_price:s})),"select"==o.data("type")&&(o.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),o.parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300)),y(yith_wcan.container).not(".ywcps-products").html("").addClass("yith-wcan-loading"),y(document).trigger("yith-wcan-ajax-loading"),"undefined"!=typeof yith_wcan_frontend&&y(yith_wcan.container).not(".ywcps-products").css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");var d=!1;("both"==yith_wcan.scroll_top_mode||"mobile"==yith_wcan.scroll_top_mode&&1==yith_wcan.is_mobile||"desktop"==yith_wcan.scroll_top_mode&&1!=yith_wcan.is_mobile)&&(d=!0),1==d&&y(window).scrollTop(y(yith_wcan.scroll_top).offset().top),y(yith_wcan.pagination).hide(),y(yith_wcan.result_count).hide(),0!=h&&(h.abort(),h=!1),h=y.ajax({url:r,success:function(i){h=!1,y(yith_wcan.container).not(".ywcps-products").removeClass("yith-wcan-loading"),0<y(i).find(yith_wcan.container).not(".ywcps-products").length?y(".yit-wcan-container").html(y(i).find(yith_wcan.container).not(".ywcps-products")):y(".yit-wcan-container").html(y(i).find(".woocommerce-info")),0<y(i).find(yith_wcan.pagination).length?(0==y(yith_wcan.pagination).length&&y.jseldom(yith_wcan.pagination).insertAfter(y(yith_wcan.container).not(".ywcps-products")),y(yith_wcan.pagination).html(y(i).find(yith_wcan.pagination).html()).show()):y(yith_wcan.pagination).empty(),y("div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)").addClass("buttons_added").append('<input type="button" value="+" class="plus" />').prepend('<input type="button" value="-" class="minus" />'),0<y(i).find(yith_wcan.result_count).length&&y(yith_wcan.result_count).html(y(i).find(yith_wcan.result_count).html()).show();var t,a,e,n=function(t){var a=t.attr("id"),e=y(i).find("#"+a);0==e.length?t.hide():(t.html(e.html()),t.show())};y(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var t=y(this);n(t)}),1==yith_wcan.yootheme.is_enabled&&y(".widget-yith-woo-ajax-navigation").add(".widget-yith-woo-ajax-navigation-sort-by").add(".widget-yith-woo-ajax-reset-navigation").add(".widget-yith-wcan-stock-on-sale").add(".widget-yith-wcan-list-price-filter").each(function(){var t=y(this);n(t)}),1==yith_wcan.avada.is_enabled&&((t=y(yith_wcan.avada.sort_count)).html(y(i).find(yith_wcan.avada.sort_count).html()),""==o.text()?t.hide():t.show()),1!=yith_wcan.change_browser_url||navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:i.pageTitle},"",r),y(document).trigger("ready"),y(document).trigger("yith-wcan-ajax-filtered",[i]),y(window).trigger("scroll"),l&&("undefined"!=typeof y.fn.slider&&(a=parseInt(y(yith_wcan.wc_price_slider.min_price).data("min")),e=parseInt(y(yith_wcan.wc_price_slider.max_price).data("max")),y(yith_wcan.wc_price_slider.wrapper).slider("values",[a,e]),y(document.body).trigger("price_slider_slide",[a,e])),y(document).trigger("yith-wcan-ajax-reset-filtered")),p()}})},y(yith_wcan.container).not(".ywcps-products").wrap('<div class="yit-wcan-container"></div>'),y(document).on("yith-wcan-wrapped",function(){p()}),y(document).trigger("yith-wcan-wrapped"),y(document).on("click",".yith-wcan a",function(t){y(this).yith_wcan_ajax_filters(t,this)});var e=function(){y("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},0,function(){y(this).css("display","none")}),y("a.yit-wcan-select-open").removeClass("active")};function g(t,a){return t.replace(new RegExp("[?&]"+a+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+a+"=[^&]*&"),"$1")}y(document).on("click","a.yit-wcan-select-open.active",function(t){var a;t.preventDefault(),y(a=this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300,function(){y(this).css("display","none")}),y(a).parent().find("a.yit-wcan-select-open").removeClass("active")}),y(document).on("click","a.yit-wcan-select-open:not(.active)",function(t){var a;t.preventDefault(),y("a.yit-wcan-select-open.active").trigger("click"),y(a=this).parent().find("div.yith-wcan-select-wrapper").css("z-index","1").animate({visibility:"visible",opacity:1},{duration:300,start:function(){y(this).css("display","block")}}),y(a).parent().find("a.yit-wcan-select-open").addClass("active")}),y(document).on("ready yith-wcan-ajax-filtered",function(){y("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen").length;e(),y("div.yith-wcan-select-wrapper").each(function(){var t="";y(this).find("ul.yith-wcan-select li.chosen").each(function(){t+=y(this).text()+", "});""!=(t=t.substring(0,t.length-2))&&y(this).parent().find("a.yit-wcan-select-open").text(t)})}),y(document).on("ready",e),y("body").on("click",function(t){y(t.target).hasClass("yit-wcan-select-open")||e()}),1==yith_wcan.flatsome.is_enabled&&1==yith_wcan.flatsome.lazy_load_enabled&&y(document).on("yith-wcan-ajax-filtered",function(t,a){var e=y(document);jQuery(".lazy-load",e).each(function(t,a){var i=jQuery(a);i.waypoint(function(t){var a,e;i.hasClass("lazy-load-active")||(a=i.data("src"),e=i.data("srcset"),a&&i.attr("src",a),e&&i.attr("srcset",e),i.imagesLoaded(function(){i.addClass("lazy-load-active").removeClass("lazy-load")}))},{offset:"140%"})})}),window.addEventListener("popstate",function(t){window.location.reload(!0)})});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.yith-wcan.php
CHANGED
@@ -290,13 +290,13 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
|
|
290 |
$exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
|
291 |
$include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
|
292 |
$reordered = false;
|
293 |
-
|
294 |
-
$args = array(
|
295 |
-
'taxonomy' => $taxonomy,
|
296 |
-
'hide_empty' => true,
|
297 |
'exclude' => $exclude
|
298 |
);
|
299 |
-
|
300 |
$args = apply_filters( 'yit_get_terms_args', $args, $instance );
|
301 |
|
302 |
switch ( $case ) {
|
@@ -320,7 +320,7 @@ if ( ! function_exists( 'yit_get_terms' ) ) {
|
|
320 |
|
321 |
default:
|
322 |
$args['include'] = $include;
|
323 |
-
|
324 |
if ( 'parent' == $instance['display'] ) {
|
325 |
$args['parent'] = false;
|
326 |
}
|
@@ -515,7 +515,7 @@ if ( ! function_exists( 'yit_get_filter_args' ) ) {
|
|
515 |
$filter_value['source_tax'] = $queried_object->taxonomy;
|
516 |
}
|
517 |
|
518 |
-
return $filter_value;
|
519 |
}
|
520 |
}
|
521 |
|
@@ -577,7 +577,7 @@ if ( ! function_exists( 'yit_get_woocommerce_layered_nav_link' ) ) {
|
|
577 |
$return = get_post_type_archive_link( 'product' );
|
578 |
return apply_filters( 'yith_wcan_untrailingslashit', false ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
|
579 |
}
|
580 |
-
|
581 |
return $return;
|
582 |
}
|
583 |
}
|
@@ -793,7 +793,7 @@ if( ! function_exists( 'yith_wcan_wp_get_terms' ) ) {
|
|
793 |
* get_terms function support for old WordPress Version
|
794 |
*
|
795 |
* @param array $args
|
796 |
-
*
|
797 |
* @return bool
|
798 |
*/
|
799 |
function yith_wcan_wp_get_terms( $args ) {
|
@@ -810,7 +810,7 @@ if( ! function_exists( 'yith_wcan_wp_get_terms' ) ) {
|
|
810 |
if( version_compare( $wp_version, '4.6', '<' ) ){
|
811 |
$terms = get_terms( $args['taxonomy'], $args );
|
812 |
}
|
813 |
-
|
814 |
else {
|
815 |
$terms = get_terms( $args );
|
816 |
}
|
290 |
$exclude = apply_filters( 'yith_wcan_exclude_terms', array(), $instance );
|
291 |
$include = apply_filters( 'yith_wcan_include_terms', array(), $instance );
|
292 |
$reordered = false;
|
293 |
+
|
294 |
+
$args = array(
|
295 |
+
'taxonomy' => $taxonomy,
|
296 |
+
'hide_empty' => true,
|
297 |
'exclude' => $exclude
|
298 |
);
|
299 |
+
|
300 |
$args = apply_filters( 'yit_get_terms_args', $args, $instance );
|
301 |
|
302 |
switch ( $case ) {
|
320 |
|
321 |
default:
|
322 |
$args['include'] = $include;
|
323 |
+
|
324 |
if ( 'parent' == $instance['display'] ) {
|
325 |
$args['parent'] = false;
|
326 |
}
|
515 |
$filter_value['source_tax'] = $queried_object->taxonomy;
|
516 |
}
|
517 |
|
518 |
+
return apply_filters( 'yit_get_filter_args', $filter_value );
|
519 |
}
|
520 |
}
|
521 |
|
577 |
$return = get_post_type_archive_link( 'product' );
|
578 |
return apply_filters( 'yith_wcan_untrailingslashit', false ) && is_string( $return ) ? untrailingslashit( $return ) : $return;
|
579 |
}
|
580 |
+
|
581 |
return $return;
|
582 |
}
|
583 |
}
|
793 |
* get_terms function support for old WordPress Version
|
794 |
*
|
795 |
* @param array $args
|
796 |
+
*
|
797 |
* @return bool
|
798 |
*/
|
799 |
function yith_wcan_wp_get_terms( $args ) {
|
810 |
if( version_compare( $wp_version, '4.6', '<' ) ){
|
811 |
$terms = get_terms( $args['taxonomy'], $args );
|
812 |
}
|
813 |
+
|
814 |
else {
|
815 |
$terms = get_terms( $args );
|
816 |
}
|
init.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
|
5 |
* Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
-
* Version: 3.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-navigation
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* WC requires at least: 3.8
|
13 |
-
* WC tested up to: 4.
|
14 |
*
|
15 |
* @author Your Inspiration Themes
|
16 |
* @package YITH WooCommerce Ajax Navigation
|
@@ -67,7 +67,7 @@ load_plugin_textdomain( 'yith-woocommerce-ajax-navigation', false, dirname( plug
|
|
67 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
68 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
69 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
70 |
-
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.
|
71 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
72 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
73 |
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: https://wordpress.org/plugins/yith-woocommerce-ajax-navigation/
|
5 |
* Description:<code><strong>YITH WooCommerce AJAX Product Filter</strong></code> allows your users to find the product they are looking for as quickly as possible. Thanks to the plugin you will be able to set up one or more search filters for your WooCommerce products, improve the user experience and give the impression of being in a big and reliable store. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>
|
6 |
+
* Version: 3.11.0
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-ajax-navigation
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* WC requires at least: 3.8
|
13 |
+
* WC tested up to: 4.2
|
14 |
*
|
15 |
* @author Your Inspiration Themes
|
16 |
* @package YITH WooCommerce Ajax Navigation
|
67 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
68 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
69 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
70 |
+
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '3.11.0' );
|
71 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
72 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
73 |
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -1209,6 +1209,10 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1209 |
font-size : 13px;
|
1210 |
}
|
1211 |
|
|
|
|
|
|
|
|
|
1212 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
1213 |
content : "\e900";
|
1214 |
font-family : 'yith-icon' !important;
|
@@ -1427,8 +1431,9 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1427 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1428 |
border : 1px solid #d8d8d8;
|
1429 |
background-color : #fff;
|
1430 |
-
width :
|
1431 |
height : 24px;
|
|
|
1432 |
}
|
1433 |
|
1434 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
@@ -1465,7 +1470,7 @@ span.select2.select2-container.select2-container--default.yith-plugin-fw-select2
|
|
1465 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1466 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1467 |
background-color : #98aa36;
|
1468 |
-
left
|
1469 |
}
|
1470 |
|
1471 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
1209 |
font-size : 13px;
|
1210 |
}
|
1211 |
|
1212 |
+
.wc-wp-version-gte-53 .yith-plugin-ui .select2-container .select2-selection--single .select2-selection__arrow{
|
1213 |
+
background-image: none;
|
1214 |
+
}
|
1215 |
+
|
1216 |
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
1217 |
content : "\e900";
|
1218 |
font-family : 'yith-icon' !important;
|
1431 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1432 |
border : 1px solid #d8d8d8;
|
1433 |
background-color : #fff;
|
1434 |
+
width : 58px;
|
1435 |
height : 24px;
|
1436 |
+
line-height :14px;
|
1437 |
}
|
1438 |
|
1439 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1470 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1471 |
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1472 |
background-color : #98aa36;
|
1473 |
+
left: 38px;
|
1474 |
}
|
1475 |
|
1476 |
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
plugin-fw/assets/js/yit-plugin-panel.js
CHANGED
@@ -15,13 +15,21 @@ jQuery( function ( $ ) {
|
|
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 |
|
20 |
dependencies_handler( field, dep, value.toString(), type );
|
21 |
|
22 |
-
$( dep ).on(
|
23 |
dependencies_handler( field, dep, value.toString(), type );
|
24 |
-
} ).
|
|
|
25 |
} );
|
26 |
|
27 |
//Handle dependencies.
|
@@ -44,6 +52,10 @@ jQuery( function ( $ ) {
|
|
44 |
}
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
47 |
values = values.split( ',' );
|
48 |
|
49 |
for ( var i = 0; i < values.length; i++ ) {
|
@@ -178,4 +190,4 @@ jQuery( function ( $ ) {
|
|
178 |
wrap.prepend( notices );
|
179 |
}
|
180 |
|
181 |
-
} );
|
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.
|
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( ',' );
|
60 |
|
61 |
for ( var i = 0; i < values.length; i++ ) {
|
190 |
wrap.prepend( notices );
|
191 |
}
|
192 |
|
193 |
+
} );
|
plugin-fw/assets/js/yit-plugin-panel.min.js
CHANGED
@@ -1 +1,5 @@
|
|
1 |
-
jQuery(function(
|
|
|
|
|
|
|
|
1 |
+
jQuery(function(b){function h(a,c,d,f){var e=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var g=b(c).val();"checkbox"==b(c).attr("type")&&(g=b(c).is(":checked")?"yes":"no");"select-images"===b(c+"-wrapper").data("type")&&(g=b(c+"-wrapper").find("select").first().val());d=d.split(",");for(c=0;c<d.length;c++)if(g!=d[c])e=!1;else{e=!0;break}}d=b(a);a=b(a+"-container").closest("tr");1>a.length&&(a=d.closest(".yith-plugin-fw-panel-wc-row"));f=f.split("-");for(var h in f)if(g=f[h],
|
2 |
+
e)switch(g){case "disable":a.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();break;case "fadeInOut":case "fadeIn":a.show(500);break;case "fadeOut":a.show();break;default:a.show(),a.fadeTo("slow",1).addClass("fade-in")}else switch(g){case "disable":a.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;case "fadeInOut":case "fadeOut":a.hide(500);break;case "fadeIn":a.hide();break;default:a.hasClass("fade-in")?a.fadeTo("slow",0,function(){b(this).hide().removeClass("fade-in")}):
|
3 |
+
(a.hide(),a.css({opacity:"0"}))}}b("[data-dep-target]").each(function(){var a=b(this),c="#"+a.data("dep-target"),d="#"+a.data("dep-id"),f=a.data("dep-value"),e=a.data("dep-type");a="change";"select-images"===b(d+"-wrapper").data("type")&&(a="yith_select_images_value_changed");h(c,d,f.toString(),e);b(d).on(a,function(){h(c,d,f.toString(),e)}).trigger(a)});b(".rm_connectedlist").each(function(){var a=b(this).find("ul"),c=b(this).find(":hidden");a.sortable({connectWith:a,update:function(d,f){var e={};
|
4 |
+
a.each(function(){var a={};b(this).children().each(function(){a[b(this).data("option")]=b(this).text()});e[b(this).data("list")]=a});c.val(JSON.stringify(e).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});b(document).ready(function(){b(".google-analytic-generate").click(function(){var a=b("#"+b(this).data("textarea")).data("codemirrorInstance"),c=b("#"+b(this).data("input")).val(),d=b(this).data("basename");a.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\nga('create', '"+
|
5 |
+
(c+"', '"+d+"');\nga('send', 'pageview');\n"),a.getCursor("start"),a.getCursor("end"))})});b(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var k=b(".wrap.yith-plugin-ui").first(),l=b("div.updated, div.error, div.notice");l.addClass("inline");k.length&&k.prepend(l)});
|
plugin-fw/assets/js/yith-colorpicker.min.js
CHANGED
@@ -8,4 +8,4 @@
|
|
8 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
* Licensed under the GPLv2 license or later.
|
10 |
*/
|
11 |
-
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",
|
8 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
* Licensed under the GPLv2 license or later.
|
10 |
*/
|
11 |
+
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",i='<div class="wp-picker-holder" />',a='<div class="wp-picker-container" />',e='<input type="button" class="button button-small" />',r='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var n=this,l=n.element;if(t.extend(n.options,l.data()),"hue"===n.options.type)return n._createHueOnly();n.close=t.proxy(n.close,n),n.initialValue=l.val(),l.addClass("wp-color-picker"),l.parent("label").length||(l.wrap("<label></label>"),n.wrappingLabelText=t('<span class="screen-reader-text"></span>').insertBefore(l).text(wpColorPickerL10n.defaultLabel)),n.wrappingLabel=l.parent(),n.wrappingLabel.wrap(a),n.wrap=n.wrappingLabel.parent(),n.toggler=t(r).insertBefore(n.wrappingLabel).css({backgroundColor:n.initialValue}),n.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),n.pickerContainer=t(i).insertAfter(n.wrappingLabel),n.button=t(e),n.options.defaultColor?(n.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),n.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(n.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),n.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),n.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(n.button),n.inputWrapper=l.closest(".wp-picker-input-wrap"),l.iris({target:n.pickerContainer,hide:n.options.hide,width:n.options.width,mode:n.options.mode,palettes:n.options.palettes,change:function(i,a){n.options.alpha?(n.toggler.css({"background-image":"url("+o+")"}),n.toggler.css({position:"relative"}),0==n.toggler.find("span.color-alpha").length&&n.toggler.append('<span class="color-alpha" />'),n.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:a.color.toString()})):n.toggler.css({backgroundColor:a.color.toString()}),t.isFunction(n.options.change)&&n.options.change.call(this,i,a)}}),l.val(n.initialValue),n._addListeners(),n.options.hide||n.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(i){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?o.toggler.find("span.color-alpha").css("backgroundColor",""):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,i))}),o.button.on("click",function(i){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?o.toggler.find("span.color-alpha").css("backgroundColor",""):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,i),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,i=o.element,a=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),e={aContainer:a,aSlider:a.find(".iris-slider-offset-alpha")};void 0!==i.data("custom-width")?o.options.customWidth=parseInt(i.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=i.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&i.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(e,function(t,i){o.controls[t]=i}),o.controls.square.css({"margin-right":"0"});var r=o.picker.width()-o.controls.square.width()-20,n=r/6,l=r/2-n;t.each(["aContainer","strip"],function(t,i){o.controls[i].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,i){t._color._alpha=parseFloat(i.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,i=t.element;if(this.options.alpha){var a=t.controls,e=parseInt(100*t._color._alpha),r=t._color.toRgb(),n=["rgb("+r.r+","+r.g+","+r.b+") 0%","rgba("+r.r+","+r.g+","+r.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");a.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(a.aSlider.slider("value",e),t._color._alpha<1?(a.strip.attr("style",a.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),i.width(parseInt(l+s))):i.width(l))}!!i.data("reset-alpha")&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),i.trigger("change")},_addInputListeners:function(t){var o=this,i=function(i){var a=new Color(t.val()),e=t.val();t.removeClass("iris-error"),a.error?""!==e&&t.addClass("iris-error"):a.toString()!==o._color.toString()&&("keyup"===i.type&&e.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",a.toString()))};t.on("change",i).on("keyup",o._debounce(i,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -1,734 +1,733 @@
|
|
1 |
( function ( $ ) {
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
/**
|
733 |
* Dimensions
|
734 |
*/
|
1 |
( function ( $ ) {
|
2 |
|
3 |
+
/* global yith_framework_fw_fields*/
|
4 |
+
|
5 |
+
var yith_fields_init = function () {
|
6 |
+
var $datepicker = $( '.yith-plugin-fw-datepicker' ),
|
7 |
+
$colorpicker = $( '.yith-plugin-fw-colorpicker' ),
|
8 |
+
$upload = {
|
9 |
+
imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
|
10 |
+
uploadButtonHandler: '.yith-plugin-fw-upload-button',
|
11 |
+
imgUrlHandler : '.yith-plugin-fw-upload-img-url',
|
12 |
+
resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
|
13 |
+
imgUrl : $( '.yith-plugin-fw-upload-img-url' )
|
14 |
+
},
|
15 |
+
$wpAddMedia = $( '.add_media' ),
|
16 |
+
$imageGallery = {
|
17 |
+
sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
|
18 |
+
buttonHandler: '.yith-plugin-fw .image-gallery-button'
|
19 |
+
},
|
20 |
+
$sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
|
21 |
+
$slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
|
22 |
+
$codemirror = $( '.codemirror' ),
|
23 |
+
$icons = $( '.yit-icons-manager-wrapper' ),
|
24 |
+
$checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
|
25 |
+
|
26 |
+
/* Datepicker */
|
27 |
+
$datepicker.each( function () {
|
28 |
+
var args = $( this ).data();
|
29 |
+
|
30 |
+
// set animation to false to prevent style 'glitches' when removing class on closing
|
31 |
+
args.showAnim = false;
|
32 |
+
args.beforeShow = function ( input, instance ) {
|
33 |
+
instance.dpDiv.addClass( 'yith-plugin-fw-datepicker-div' );
|
34 |
+
};
|
35 |
+
args.onClose = function ( selectedDate, instance ) {
|
36 |
+
instance.dpDiv.removeClass( 'yith-plugin-fw-datepicker-div' );
|
37 |
+
};
|
38 |
+
|
39 |
+
$( this ).datepicker( args );
|
40 |
+
} );
|
41 |
+
|
42 |
+
/* Colorpicker */
|
43 |
+
$colorpicker.wpColorPicker( {
|
44 |
+
palettes: false,
|
45 |
+
width : 200,
|
46 |
+
mode : 'hsl',
|
47 |
+
clear : function () {
|
48 |
+
var input = $( this );
|
49 |
+
input.val( input.data( 'default-color' ) );
|
50 |
+
input.change();
|
51 |
+
}
|
52 |
+
} );
|
53 |
+
|
54 |
+
|
55 |
+
$colorpicker.each( function () {
|
56 |
+
var select_label = $( this ).data( 'variations-label' ),
|
57 |
+
wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
|
58 |
+
wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
|
59 |
+
wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
|
60 |
+
wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
|
61 |
+
|
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 |
+
} );
|
76 |
+
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
+
}
|
78 |
+
} );
|
79 |
+
|
80 |
+
|
81 |
+
/* Upload */
|
82 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
83 |
+
var _custom_media = true;
|
84 |
+
// preview
|
85 |
+
$upload.imgUrl.change( function () {
|
86 |
+
var url = $( this ).val(),
|
87 |
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
|
88 |
+
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
+
|
90 |
+
if ( preview.length < 1 ) {
|
91 |
+
preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
|
92 |
+
}
|
93 |
+
|
94 |
+
if ( re.test( url ) ) {
|
95 |
+
preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
|
96 |
+
} else {
|
97 |
+
preview.html( '' );
|
98 |
+
}
|
99 |
+
} ).trigger( 'change' );
|
100 |
+
|
101 |
+
$( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
|
102 |
+
e.preventDefault();
|
103 |
+
|
104 |
+
var t = $( this ),
|
105 |
+
custom_uploader,
|
106 |
+
id = t.attr( 'id' ).replace( /-button$/, '' );
|
107 |
+
|
108 |
+
//If the uploader object has already been created, reopen the dialog
|
109 |
+
if ( custom_uploader ) {
|
110 |
+
custom_uploader.open();
|
111 |
+
return;
|
112 |
+
}
|
113 |
+
|
114 |
+
var custom_uploader_states = [
|
115 |
+
// Main states.
|
116 |
+
new wp.media.controller.Library( {
|
117 |
+
library : wp.media.query(),
|
118 |
+
multiple : false,
|
119 |
+
title : 'Choose Image',
|
120 |
+
priority : 20,
|
121 |
+
filterable: 'uploaded'
|
122 |
+
} )
|
123 |
+
];
|
124 |
+
|
125 |
+
// Create the media frame.
|
126 |
+
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
+
// Set the title of the modal.
|
128 |
+
title : 'Choose Image',
|
129 |
+
library : {
|
130 |
+
type: ''
|
131 |
+
},
|
132 |
+
button : {
|
133 |
+
text: 'Choose Image'
|
134 |
+
},
|
135 |
+
multiple: false,
|
136 |
+
states : custom_uploader_states
|
137 |
+
} );
|
138 |
+
|
139 |
+
//When a file is selected, grab the URL and set it as the text field's value
|
140 |
+
custom_uploader.on( 'select', function () {
|
141 |
+
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
142 |
+
|
143 |
+
$( "#" + id ).val( attachment.url );
|
144 |
+
// Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
|
145 |
+
if ( $( "#" + id + "-yith-attachment-id" ) ) {
|
146 |
+
$( "#" + id + "-yith-attachment-id" ).val( attachment.id );
|
147 |
+
}
|
148 |
+
$upload.imgUrl.trigger( 'change' );
|
149 |
+
} );
|
150 |
+
|
151 |
+
//Open the uploader dialog
|
152 |
+
custom_uploader.open();
|
153 |
+
} );
|
154 |
+
|
155 |
+
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
+
var t = $( this ),
|
157 |
+
id = t.attr( 'id' ),
|
158 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
159 |
+
default_value = $( '#' + id ).data( 'default' );
|
160 |
+
|
161 |
+
$( "#" + input_id ).val( default_value );
|
162 |
+
$upload.imgUrl.trigger( 'change' );
|
163 |
+
} );
|
164 |
+
}
|
165 |
+
|
166 |
+
$wpAddMedia.on( 'click', function () {
|
167 |
+
_custom_media = false;
|
168 |
+
} );
|
169 |
+
|
170 |
+
/* Image Gallery */
|
171 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
172 |
+
$( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
|
173 |
+
var $t = $( this ),
|
174 |
+
$container = $t.closest( '.image-gallery' ),
|
175 |
+
$image_gallery_ids = $container.find( '.image_gallery_ids' ),
|
176 |
+
attachment_ids = $image_gallery_ids.val(),
|
177 |
+
$gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
|
178 |
+
|
179 |
+
// Create the media frame.
|
180 |
+
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
+
// Set the title of the modal.
|
182 |
+
title : $t.data( 'choose' ),
|
183 |
+
button: {
|
184 |
+
text: $t.data( 'update' )
|
185 |
+
},
|
186 |
+
states: [
|
187 |
+
new wp.media.controller.Library( {
|
188 |
+
title : $t.data( 'choose' ),
|
189 |
+
filterable: 'all',
|
190 |
+
multiple : true
|
191 |
+
} )
|
192 |
+
]
|
193 |
+
} );
|
194 |
+
|
195 |
+
// When an image is selected, run a callback.
|
196 |
+
image_gallery_frame.on( 'select', function () {
|
197 |
+
var selection = image_gallery_frame.state().get( 'selection' );
|
198 |
+
selection.map( function ( attachment ) {
|
199 |
+
attachment = attachment.toJSON();
|
200 |
+
|
201 |
+
if ( attachment.id ) {
|
202 |
+
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
|
203 |
+
$gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
|
204 |
+
}
|
205 |
+
} );
|
206 |
+
|
207 |
+
$image_gallery_ids.val( attachment_ids );
|
208 |
+
} );
|
209 |
+
|
210 |
+
image_gallery_frame.open();
|
211 |
+
|
212 |
+
} );
|
213 |
+
|
214 |
+
// Image ordering
|
215 |
+
$imageGallery.sliderWrapper.each( function () {
|
216 |
+
var $t = $( this );
|
217 |
+
$t.sortable( {
|
218 |
+
items : 'li.image',
|
219 |
+
cursor : 'move',
|
220 |
+
scrollSensitivity : 40,
|
221 |
+
forcePlaceholderSize: true,
|
222 |
+
forceHelperSize : false,
|
223 |
+
helper : 'clone',
|
224 |
+
opacity : 0.65,
|
225 |
+
start : function ( event, ui ) {
|
226 |
+
ui.item.css( 'background-color', '#f6f6f6' );
|
227 |
+
},
|
228 |
+
stop : function ( event, ui ) {
|
229 |
+
ui.item.removeAttr( 'style' );
|
230 |
+
},
|
231 |
+
update : function ( event, ui ) {
|
232 |
+
var attachment_ids = '';
|
233 |
+
|
234 |
+
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
235 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
236 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
237 |
+
} );
|
238 |
+
|
239 |
+
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
240 |
+
}
|
241 |
+
} );
|
242 |
+
} );
|
243 |
+
|
244 |
+
// Remove images
|
245 |
+
$imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
|
246 |
+
var $wrapper = $( this ).closest( '.image-gallery' ),
|
247 |
+
$gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
|
248 |
+
$image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
|
249 |
+
attachment_ids = '';
|
250 |
+
|
251 |
+
$( this ).closest( 'li.image' ).remove();
|
252 |
+
|
253 |
+
$gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
254 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
255 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
256 |
+
} );
|
257 |
+
|
258 |
+
$image_gallery_ids.val( attachment_ids );
|
259 |
+
} );
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
/* Sidebars */
|
264 |
+
$sidebars.each( function () {
|
265 |
+
var $images = $( this ).find( 'img' );
|
266 |
+
$images.on( 'click', function () {
|
267 |
+
var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
|
268 |
+
$left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
|
269 |
+
$right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
|
270 |
+
type = $( this ).data( 'type' );
|
271 |
+
|
272 |
+
$( this ).parent().children( ':radio' ).attr( 'checked', false );
|
273 |
+
$( this ).prev( ':radio' ).attr( 'checked', true );
|
274 |
+
|
275 |
+
if ( typeof type != 'undefined' ) {
|
276 |
+
switch ( type ) {
|
277 |
+
case 'left':
|
278 |
+
$left.show();
|
279 |
+
$right.hide();
|
280 |
+
break;
|
281 |
+
case 'right':
|
282 |
+
$right.show();
|
283 |
+
$left.hide();
|
284 |
+
break;
|
285 |
+
case 'double':
|
286 |
+
$left.show();
|
287 |
+
$right.show();
|
288 |
+
break;
|
289 |
+
default:
|
290 |
+
$left.hide();
|
291 |
+
$right.hide();
|
292 |
+
break;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
} );
|
296 |
+
} );
|
297 |
+
|
298 |
+
/* Slider */
|
299 |
+
$slider.each( function () {
|
300 |
+
var val = $( this ).data( 'val' ),
|
301 |
+
minValue = $( this ).data( 'min' ),
|
302 |
+
maxValue = $( this ).data( 'max' ),
|
303 |
+
step = $( this ).data( 'step' ),
|
304 |
+
labels = $( this ).data( 'labels' );
|
305 |
+
|
306 |
+
$( this ).slider( {
|
307 |
+
value: val,
|
308 |
+
min : minValue,
|
309 |
+
max : maxValue,
|
310 |
+
range: 'min',
|
311 |
+
step : step,
|
312 |
+
|
313 |
+
create: function () {
|
314 |
+
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
315 |
+
},
|
316 |
+
|
317 |
+
|
318 |
+
slide: function ( event, ui ) {
|
319 |
+
$( this ).find( 'input' ).val( ui.value );
|
320 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
321 |
+
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
322 |
+
}
|
323 |
+
} );
|
324 |
+
} );
|
325 |
+
|
326 |
+
/* codemirror */
|
327 |
+
$codemirror.each( function ( i, v ) {
|
328 |
+
var editor = CodeMirror.fromTextArea( v, {
|
329 |
+
lineNumbers : 1,
|
330 |
+
mode : 'javascript',
|
331 |
+
showCursorWhenSelecting: true
|
332 |
+
} );
|
333 |
+
|
334 |
+
$( v ).data( 'codemirrorInstance', editor );
|
335 |
+
} );
|
336 |
+
|
337 |
+
/* Select All - Deselect All */
|
338 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
|
339 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
340 |
+
$targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
|
341 |
+
} );
|
342 |
+
|
343 |
+
$( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
|
344 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
345 |
+
$targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
|
346 |
+
} );
|
347 |
+
|
348 |
+
|
349 |
+
$icons.each( function () {
|
350 |
+
var $container = $( this ),
|
351 |
+
$preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
|
352 |
+
$text = $container.find( '.yit-icons-manager-icon-text' );
|
353 |
+
|
354 |
+
$container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
|
355 |
+
var $target = $( event.target ).closest( 'li' ),
|
356 |
+
font = $target.data( 'font' ),
|
357 |
+
icon = $target.data( 'icon' ),
|
358 |
+
key = $target.data( 'key' ),
|
359 |
+
name = $target.data( 'name' );
|
360 |
+
|
361 |
+
$preview.attr( 'data-font', font );
|
362 |
+
$preview.attr( 'data-icon', icon );
|
363 |
+
$preview.attr( 'data-key', key );
|
364 |
+
$preview.attr( 'data-name', name );
|
365 |
+
|
366 |
+
$text.val( font + ':' + name );
|
367 |
+
|
368 |
+
$container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
|
369 |
+
$target.addClass( 'active' );
|
370 |
+
} );
|
371 |
+
|
372 |
+
$container.on( 'click', '.yit-icons-manager-action-set-default', function () {
|
373 |
+
$container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
|
374 |
+
} );
|
375 |
+
} );
|
376 |
+
|
377 |
+
/** Select Images */
|
378 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
|
379 |
+
var item = $( this ),
|
380 |
+
key = item.data( 'key' ),
|
381 |
+
wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
|
382 |
+
items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
|
383 |
+
select = wrapper.find( 'select' ).first();
|
384 |
+
|
385 |
+
if ( select.length ) {
|
386 |
+
select.val( key ).trigger('yith_select_images_value_changed');
|
387 |
+
items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
|
388 |
+
item.addClass( 'yith-plugin-fw-select-images__item--selected' );
|
389 |
+
}
|
390 |
+
} );
|
391 |
+
|
392 |
+
$( document.body ).trigger( 'wc-enhanced-select-init' );
|
393 |
+
|
394 |
+
$( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
|
395 |
+
{
|
396 |
+
cursor : 'move',
|
397 |
+
axis : 'y',
|
398 |
+
scrollSensitivity : 40,
|
399 |
+
forcePlaceholderSize: true,
|
400 |
+
helper : 'clone',
|
401 |
+
|
402 |
+
stop: function ( event, ui ) {
|
403 |
+
var keys = jQuery( '.ui-sortable-handle' ),
|
404 |
+
i = 0,
|
405 |
+
array_keys = new Array();
|
406 |
+
for ( i = 0; i < keys.length; i++ ) {
|
407 |
+
array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
|
408 |
+
}
|
409 |
+
if ( array_keys.length > 0 ) {
|
410 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
411 |
+
toggle.saveToggleElement( null, array_keys );
|
412 |
+
}
|
413 |
+
}
|
414 |
+
}
|
415 |
+
);
|
416 |
+
|
417 |
+
$( document.body ).trigger( 'yith-framework-enhanced-select-init' );
|
418 |
+
};
|
419 |
+
|
420 |
+
$( document ).on( 'yith_fields_init', yith_fields_init ).trigger( 'yith_fields_init' );
|
421 |
+
|
422 |
+
/* on-off */
|
423 |
+
$( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
|
424 |
+
var input = $( this ).prev( 'input' ),
|
425 |
+
checked = input.prop( 'checked' );
|
426 |
+
|
427 |
+
if ( checked ) {
|
428 |
+
input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
|
429 |
+
} else {
|
430 |
+
input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
|
431 |
+
}
|
432 |
+
|
433 |
+
input.change();
|
434 |
+
} );
|
435 |
+
|
436 |
+
|
437 |
+
/** Toggle **/
|
438 |
+
|
439 |
+
|
440 |
+
|
441 |
+
//TOGGLE ELEMENT
|
442 |
+
$.fn.saveToggleElement = function ( spinner, array_keys ) {
|
443 |
+
var toggle = $( this ),
|
444 |
+
action = 'yith_plugin_fw_save_toggle_element',
|
445 |
+
formdata = toggle.serializeToggleElement(),
|
446 |
+
wrapper = toggle.find( '.yith-toggle_wrapper' ),
|
447 |
+
id = wrapper.attr( 'id' ),
|
448 |
+
current_tab = $.urlParam( 'tab' );
|
449 |
+
|
450 |
+
formdata.append( 'security', wrapper.data( 'nonce' ) );
|
451 |
+
|
452 |
+
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
453 |
+
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
454 |
+
}
|
455 |
+
|
456 |
+
if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
|
457 |
+
action = 'yith_plugin_fw_save_toggle_element_metabox';
|
458 |
+
post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
|
459 |
+
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
460 |
+
metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
|
461 |
+
url = yith_framework_fw_fields.ajax_url +
|
462 |
+
'?action=' + action +
|
463 |
+
"&post_ID=" + post_id +
|
464 |
+
'&yit_metaboxes_nonce=' + yit_metaboxes_nonce +
|
465 |
+
"&toggle_id=" + id +
|
466 |
+
"&metabox_tab=" + metabox_tab;
|
467 |
+
} else {
|
468 |
+
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
+
}
|
470 |
+
|
471 |
+
$.ajax( {
|
472 |
+
type : "POST",
|
473 |
+
url : url,
|
474 |
+
data : formdata,
|
475 |
+
contentType: false,
|
476 |
+
processData: false,
|
477 |
+
success : function ( result ) {
|
478 |
+
if ( spinner ) {
|
479 |
+
spinner.removeClass( 'show' );
|
480 |
+
}
|
481 |
+
|
482 |
+
$( document ).trigger( 'yith_save_toggle_element_done', [result, toggle] );
|
483 |
+
}
|
484 |
+
} );
|
485 |
+
};
|
486 |
+
|
487 |
+
$.fn.serializeToggleElement = function () {
|
488 |
+
var obj = $( this );
|
489 |
+
/* ADD FILE TO PARAM AJAX */
|
490 |
+
var formData = new FormData();
|
491 |
+
var params = $( obj ).find( ":input" ).serializeArray();
|
492 |
+
|
493 |
+
$.each( params, function ( i, val ) {
|
494 |
+
el_name = val.name;
|
495 |
+
formData.append( val.name, val.value );
|
496 |
+
} );
|
497 |
+
|
498 |
+
return formData;
|
499 |
+
};
|
500 |
+
|
501 |
+
$.fn.formatToggleTitle = function () {
|
502 |
+
var toggle_el = $( this ),
|
503 |
+
fields = toggle_el.find( ':input' ),
|
504 |
+
title = toggle_el.find( 'span.title' ).data( 'title_format' ),
|
505 |
+
subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
|
506 |
+
regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
|
507 |
+
|
508 |
+
if ( typeof title != 'undefined' ) {
|
509 |
+
var res = title.match( regExp );
|
510 |
+
}
|
511 |
+
|
512 |
+
if ( typeof subtitle != 'undefined' ) {
|
513 |
+
var ressub = subtitle.match( regExp );
|
514 |
+
}
|
515 |
+
|
516 |
+
$.each( fields, function ( i, field ) {
|
517 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
518 |
+
$field_id = $( field ).attr( 'id' );
|
519 |
+
$field_array = $field_id.split( '_' );
|
520 |
+
$field_array.pop();
|
521 |
+
$field_id = $field_array.join( '_' );
|
522 |
+
$field_val = $( field ).val();
|
523 |
+
|
524 |
+
if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
|
525 |
+
title = title.replace( '%%' + $field_id + '%%', $field_val );
|
526 |
+
}
|
527 |
+
if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
|
528 |
+
subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
|
529 |
+
}
|
530 |
+
}
|
531 |
+
} );
|
532 |
+
|
533 |
+
if ( '' !== title ) {
|
534 |
+
toggle_el.find( 'span.title' ).html( title );
|
535 |
+
}
|
536 |
+
|
537 |
+
if ( '' !== subtitle ) {
|
538 |
+
toggle_el.find( '.subtitle' ).html( subtitle );
|
539 |
+
}
|
540 |
+
|
541 |
+
$( document ).trigger( 'yith-toggle-element-item-title', [toggle_el] );
|
542 |
+
};
|
543 |
+
|
544 |
+
$.urlParam = function ( name ) {
|
545 |
+
var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
|
546 |
+
.exec( window.location.search );
|
547 |
+
|
548 |
+
return ( results !== null ) ? results[ 1 ] || 0 : false;
|
549 |
+
};
|
550 |
+
|
551 |
+
$( document ).on( 'click', '.yith-toggle-title', function ( event ) {
|
552 |
+
var _toggle = $( event.target ),
|
553 |
+
_section = _toggle.closest( '.yith-toggle-row' ),
|
554 |
+
_content = _section.find( '.yith-toggle-content' );
|
555 |
+
|
556 |
+
if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'yith-icon-drag' ) ) {
|
557 |
+
return false;
|
558 |
+
}
|
559 |
+
|
560 |
+
if ( _section.is( '.yith-toggle-row-opened' ) ) {
|
561 |
+
_content.slideUp( 400 );
|
562 |
+
} else {
|
563 |
+
_content.slideDown( 400 );
|
564 |
+
}
|
565 |
+
_section.toggleClass( 'yith-toggle-row-opened' );
|
566 |
+
} );
|
567 |
+
|
568 |
+
/**Add new box toggle**/
|
569 |
+
$( document ).on( 'click', '.yith-add-box-button', function ( event ) {
|
570 |
+
event.preventDefault();
|
571 |
+
var $this = $( this ),
|
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();
|
580 |
+
if ( closed_label !== '' ) {
|
581 |
+
if ( $this.html() === closed_label ) {
|
582 |
+
$this.html( label ).removeClass( 'closed' );
|
583 |
+
} else {
|
584 |
+
$this.html( closed_label ).addClass( 'closed' );
|
585 |
+
}
|
586 |
+
}
|
587 |
+
|
588 |
+
$( document ).trigger( 'yith_fields_init' );
|
589 |
+
$( document ).trigger( 'yith-add-box-button-toggle', [$this] );
|
590 |
+
}
|
591 |
+
} );
|
592 |
+
|
593 |
+
$( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
|
594 |
+
|
595 |
+
event.preventDefault();
|
596 |
+
var add_box = $( this ).parents( '.yith-add-box' ),
|
597 |
+
id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
|
598 |
+
spinner = add_box.find( '.spinner' ),
|
599 |
+
toggle_element = $( this ).parents( '.toggle-element' ),
|
600 |
+
fields = add_box.find( ':input' ),
|
601 |
+
counter = toggle_element.find( '.yith-toggle-row' ).length,
|
602 |
+
hidden_obj = $( '<input type="hidden">' );
|
603 |
+
|
604 |
+
hidden_obj.val( counter );
|
605 |
+
|
606 |
+
$( document ).trigger( 'yith-toggle-change-counter', [hidden_obj, add_box] );
|
607 |
+
|
608 |
+
counter = hidden_obj.val();
|
609 |
+
var template = wp.template( 'yith-toggle-element-item-' + id ),
|
610 |
+
toggle_el = $( template( { index: counter } ) );
|
611 |
+
|
612 |
+
spinner.addClass( 'show' );
|
613 |
+
|
614 |
+
$.each( fields, function ( i, field ) {
|
615 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
616 |
+
|
617 |
+
$field_id = $( field ).attr( 'id' );
|
618 |
+
$field_val = $( field ).val();
|
619 |
+
|
620 |
+
if ( 'radio' == $( field ).attr( 'type' ) ) {
|
621 |
+
$field_id = $field_id.replace( 'new_', '' );
|
622 |
+
$field_id = $field_id.replace( '-' + $field_val, '' );
|
623 |
+
$field_id = $field_id + '_dataindex-' + $field_val;
|
624 |
+
} else {
|
625 |
+
$field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
|
626 |
+
}
|
627 |
+
|
628 |
+
if ( $( field ).is( ':checked' ) ) {
|
629 |
+
$( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
|
630 |
+
}
|
631 |
+
|
632 |
+
if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
|
633 |
+
$( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
|
634 |
+
}
|
635 |
+
|
636 |
+
$( toggle_el ).find( '#' + $field_id ).val( $field_val );
|
637 |
+
|
638 |
+
}
|
639 |
+
|
640 |
+
} );
|
641 |
+
|
642 |
+
$( toggle_el ).formatToggleTitle();
|
643 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
644 |
+
$( document ).trigger( 'yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid] );
|
645 |
+
|
646 |
+
var delayInMilliseconds = 1000; //1 second
|
647 |
+
setTimeout( function () {
|
648 |
+
if ( form_is_valid.val() === 'yes' ) {
|
649 |
+
$( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
|
650 |
+
$( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
|
651 |
+
$( add_box ).html( '' );
|
652 |
+
$( add_box ).prev( '.yith-add-box-button' ).trigger( 'click' );
|
653 |
+
toggle_element.saveToggleElement();
|
654 |
+
|
655 |
+
var delayInMilliseconds = 2000; //1 second
|
656 |
+
setTimeout( function () {
|
657 |
+
$( toggle_element ).find( '.highlight' ).removeClass( 'highlight' );
|
658 |
+
}, delayInMilliseconds );
|
659 |
+
|
660 |
+
|
661 |
+
$( document ).trigger( 'yith_fields_init' );
|
662 |
+
}
|
663 |
+
}, delayInMilliseconds );
|
664 |
+
|
665 |
+
|
666 |
+
} );
|
667 |
+
|
668 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
|
669 |
+
event.preventDefault();
|
670 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
671 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' ),
|
672 |
+
spinner = toggle_row.find( '.spinner' );
|
673 |
+
toggle_row.formatToggleTitle();
|
674 |
+
|
675 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
676 |
+
$( document ).trigger( 'yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid] );
|
677 |
+
if ( form_is_valid.val() === 'yes' ) {
|
678 |
+
spinner.addClass( 'show' );
|
679 |
+
toggle.saveToggleElement( spinner );
|
680 |
+
}
|
681 |
+
} );
|
682 |
+
|
683 |
+
//register remove the dome and save the toggle
|
684 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
|
685 |
+
event.preventDefault();
|
686 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
687 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' );
|
688 |
+
toggle_row.remove();
|
689 |
+
toggle.saveToggleElement();
|
690 |
+
} );
|
691 |
+
|
692 |
+
//register onoff status
|
693 |
+
$( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
|
694 |
+
event.preventDefault();
|
695 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
696 |
+
toggle.saveToggleElement();
|
697 |
+
} );
|
698 |
+
|
699 |
+
// Radio
|
700 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
701 |
+
$( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
|
702 |
+
} );
|
703 |
+
|
704 |
+
$( document ).on( 'click', '.yith-password-eye', function () {
|
705 |
+
var $this = $( this ),
|
706 |
+
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
707 |
+
if ( inp.attr( 'type' ) === "password" ) {
|
708 |
+
inp.attr( 'type', 'text' );
|
709 |
+
$this.addClass( 'yith-password-eye-closed' );
|
710 |
+
} else {
|
711 |
+
inp.attr( 'type', 'password' );
|
712 |
+
$this.removeClass( 'yith-password-eye-closed' );
|
713 |
+
}
|
714 |
+
} );
|
715 |
+
|
716 |
+
$( document.body ).on( 'yith-plugin-fw-init-radio', function () {
|
717 |
+
$( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
|
718 |
+
$( this ).val( $( this ).attr( 'value' ) );
|
719 |
+
$( this ).addClass( 'yith-plugin-fw-radio--initialized' );
|
720 |
+
} );
|
721 |
+
} ).trigger( 'yith-plugin-fw-init-radio' );
|
722 |
+
|
723 |
+
/**
|
724 |
+
* Select2 - add class to stylize it with the new plugin-fw style
|
725 |
+
*/
|
726 |
+
$( document ).on( 'select2:open', function ( e ) {
|
727 |
+
if ( $( e.target ).closest( '.yith-plugin-ui' ).length ) {
|
728 |
+
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
729 |
+
}
|
730 |
+
} );
|
|
|
731 |
/**
|
732 |
* Dimensions
|
733 |
*/
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1,30 @@
|
|
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@?^=%&:/~+#-_.]*.(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$/,"");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"),l=i.attr("id").replace(/-button-reset$/,""),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),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(){e(this).closest(".yith-plugin-fw-radio").val(e(this).val()).trigger("change")}),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.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).attr("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),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(a){a(document).on("yith_fields_init",function(){var b=a(".yith-plugin-fw-datepicker"),c=a(".yith-plugin-fw-colorpicker"),d=a(".yith-plugin-fw-upload-img-url"),e=a(".add_media"),f=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),h=a(".yith-plugin-fw-sidebar-layout"),k=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),l=a(".codemirror"),n=a(".yit-icons-manager-wrapper");a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();b.showAnim=
|
2 |
+
!1;b.beforeShow=function(a,b){b.dpDiv.addClass("yith-plugin-fw-datepicker-div")};b.onClose=function(a,b){b.dpDiv.removeClass("yith-plugin-fw-datepicker-div")};a(this).datepicker(b)});c.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});c.each(function(){var b=a(this).data("variations-label"),g=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),c=a(this).closest(".yith-single-colorpicker"),m=g.find(".wp-picker-input-wrap"),
|
3 |
+
d=c.find(".wp-picker-input-wrap");m.length&&g.find("a.wp-color-result").attr("title",b);c.length&&c.find("a.wp-color-result").attr("title",b);m.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),m.find(".wp-picker-default").wrap(b));d.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),d.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(d.change(function(){var b=
|
4 |
+
a(this).val(),g=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>g.length&&(g=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)/.test(b)?g.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):g.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var g=a(this).attr("id").replace(/-button$/,"");
|
5 |
+
if(!c){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b});c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+g).val(b.url);a("#"+g+"-yith-attachment-id")&&a("#"+g+"-yith-attachment-id").val(b.id);d.trigger("change")})}c.open()}),a(document).on("click",
|
6 |
+
".yith-plugin-fw-upload-button-reset",function(b){var c=a(this);b=c.attr("id");c=c.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+c).val(b);d.trigger("change")}));e.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var c=a(this);b=c.closest(".image-gallery");var d=b.find(".image_gallery_ids"),m=d.val(),p=b.find("ul.slides-wrapper"),e=wp.media.frames.image_gallery=wp.media({title:c.data("choose"),
|
7 |
+
button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),filterable:"all",multiple:!0})]});e.on("select",function(){e.state().get("selection").map(function(a){a=a.toJSON();a.id&&(m=m?m+","+a.id:a.id,p.append('<li class="image" data-attachment_id="'+a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+c.data("delete")+'">x</a></li></ul></li>'))});d.val(m)});e.open()}),f.each(function(){var b=a(this);b.sortable({items:"li.image",
|
8 |
+
cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(c,d){var g="";b.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");g=g+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(g)}})}),f.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),c=a(this).closest(".image-gallery ul.slides-wrapper");
|
9 |
+
b=b.find(".image_gallery_ids");var d="";a(this).closest("li.image").remove();c.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");d=d+b+","});b.val(d)}));h.each(function(){a(this).find("img").on("click",function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),c=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var d=a(this).data("type");a(this).parent().children(":radio").attr("checked",
|
10 |
+
!1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof d)switch(d){case "left":c.show();b.hide();break;case "right":b.show();c.hide();break;case "double":c.show();b.show();break;default:c.hide(),b.hide()}})});k.each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,
|
11 |
+
c){a(this).find("input").val(c.value);a(this).find(".ui-slider-handle").text(c.value);a(this).siblings(".feedback").find("strong").text(c.value+f)}})});l.each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",
|
12 |
+
function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});n.each(function(){var b=a(this),c=b.find(".yit-icons-manager-icon-preview").first(),d=b.find(".yit-icons-manager-icon-text");b.on("click",".yit-icons-manager-list li",function(e){e=a(e.target).closest("li");var g=e.data("font"),f=e.data("icon"),m=e.data("key"),h=e.data("name");c.attr("data-font",g);c.attr("data-icon",f);c.attr("data-key",m);c.attr("data-name",h);d.val(g+":"+h);b.find(".yit-icons-manager-list li").removeClass("active");
|
13 |
+
e.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",function(){var b=a(this),c=b.data("key"),d=b.closest(".yith-plugin-fw-select-images__wrapper"),e=d.find(".yith-plugin-fw-select-images__item");d=d.find("select").first();d.length&&(d.val(c).trigger("yith_select_images_value_changed"),e.removeClass("yith-plugin-fw-select-images__item--selected"),
|
14 |
+
b.addClass("yith-plugin-fw-select-images__item--selected"))});a(document.body).trigger("wc-enhanced-select-init");a(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(b,c){var d=jQuery(".ui-sortable-handle"),e,g=[];for(e=0;e<d.length;e++)g[e]=a(d[e]).data("item_key");0<g.length&&a(this).closest(".toggle-element").saveToggleElement(null,g)}});a(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init");
|
15 |
+
a(document).on("click",".yith-plugin-fw-onoff-container span",function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a.fn.saveToggleElement=function(b,c){var d=a(this),e="yith_plugin_fw_save_toggle_element",f=d.serializeToggleElement(),h=d.find(".yith-toggle_wrapper"),k=h.attr("id"),l=a.urlParam("tab");f.append("security",h.data("nonce"));"undefined"!=
|
16 |
+
typeof c&&0<c.length&&f.append("yith_toggle_elements_order_keys",c);d.closest(".metaboxes-tab.yith-plugin-ui").length?(e="yith_plugin_fw_save_toggle_element_metabox",post_id=a(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=a(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=a(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+e+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+k+"&metabox_tab="+
|
17 |
+
metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+e+"&tab="+l+"&toggle_id="+k;a.ajax({type:"POST",url:url,data:f,contentType:!1,processData:!1,success:function(c){b&&b.removeClass("show");a(document).trigger("yith_save_toggle_element_done",[c,d])}})};a.fn.serializeToggleElement=function(){var b=a(this),c=new FormData;b=a(b).find(":input").serializeArray();a.each(b,function(a,b){el_name=b.name;c.append(b.name,b.value)});return c};a.fn.formatToggleTitle=function(){var b=a(this),c=b.find(":input"),
|
18 |
+
d=b.find("span.title").data("title_format"),e=b.find(".subtitle").data("subtitle_format"),f=RegExp("[^%%]+(?=[%%])","g");if("undefined"!=typeof d)var h=d.match(f);if("undefined"!=typeof e)var k=e.match(f);a.each(c,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=a(c).val(),null!=h&&"undefined"!=typeof h&&-1!==h.indexOf($field_id)&&(d=d.replace("%%"+$field_id+"%%",$field_val)),
|
19 |
+
null!=k&&"undefined"!=typeof k&&-1!==k.indexOf($field_id)&&(e=e.replace("%%"+$field_id+"%%",$field_val)))});""!==d&&b.find("span.title").html(d);""!==e&&b.find(".subtitle").html(e);a(document).trigger("yith-toggle-element-item-title",[b])};a.urlParam=function(a){a=(new RegExp("[?&]"+a+"=([^&#]*)")).exec(window.location.search);return null!==a?a[1]||0:!1};a(document).on("click",".yith-toggle-title",function(b){b=a(b.target);var c=b.closest(".yith-toggle-row"),d=c.find(".yith-toggle-content");if(b.hasClass("yith-plugin-fw-onoff")||
|
20 |
+
b.hasClass("yith-icon-drag"))return!1;c.is(".yith-toggle-row-opened")?d.slideUp(400):d.slideDown(400);c.toggleClass("yith-toggle-row-opened")});a(document).on("click",".yith-add-box-button",function(b){b.preventDefault();b=a(this);var c=b.data("box_id"),d=b.data("closed_label"),e=b.data("opened_label"),f=b.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+f);""!==c&&(a("#"+c).html(template({index:"box_id"})).slideToggle(),""!==d&&(b.html()===d?
|
21 |
+
b.html(e).removeClass("closed"):b.html(d).addClass("closed")),a(document).trigger("yith_fields_init"),a(document).trigger("yith-add-box-button-toggle",[b]))});a(document).on("click",".yith-add-box-buttons .yith-save-button",function(b){b.preventDefault();var c=a(this).parents(".yith-add-box"),d=a(this).closest(".yith-toggle_wrapper").attr("id");b=c.find(".spinner");var e=a(this).parents(".toggle-element"),f=c.find(":input"),h=e.find(".yith-toggle-row").length,k=a('<input type="hidden">');k.val(h);
|
22 |
+
a(document).trigger("yith-toggle-change-counter",[k,c]);h=k.val();d=wp.template("yith-toggle-element-item-"+d);var l=a(d({index:h}));b.addClass("show");a.each(f,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_val=a(c).val(),"radio"==a(c).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_","")+"_"+h,a(c).is(":checked")&&a(l).find("#"+
|
23 |
+
$field_id).prop("checked",!0),(a(c).hasClass("yith-post-search")||a(c).hasClass("yith-term-search"))&&a(l).find("#"+$field_id).html(a("#"+a(c).attr("id")).html()),a(l).find("#"+$field_id).val($field_val))});a(l).formatToggleTitle();var n=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-add",[c,l,n]);setTimeout(function(){"yes"===n.val()&&(a(e).find(".yith-toggle-elements").append(l),a(c).find(".yith-plugin-fw-datepicker").datepicker("destroy"),a(c).html(""),
|
24 |
+
a(c).prev(".yith-add-box-button").trigger("click"),e.saveToggleElement(),setTimeout(function(){a(e).find(".highlight").removeClass("highlight")},2E3),a(document).trigger("yith_fields_init"))},1E3)});a(document).on("click",".yith-toggle-row .yith-save-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");var c=a(this).closest(".yith-toggle-row"),d=c.find(".spinner");c.formatToggleTitle();var e=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-update",
|
25 |
+
[b,c,e]);"yes"===e.val()&&(d.addClass("show"),b.saveToggleElement(d))});a(document).on("click",".yith-toggle-row .yith-delete-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");a(this).closest(".yith-toggle-row").remove();b.saveToggleElement()});a(document).on("click",".yith-toggle-onoff",function(b){b.preventDefault();a(this).closest(".toggle-element").saveToggleElement()});a(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){a(this).closest(".yith-plugin-fw-radio").val(a(this).val()).trigger("change")});
|
26 |
+
a(document).on("click",".yith-password-eye",function(){var b=a(this),c=a(this).closest(".yith-password-wrapper").find("input");"password"===c.attr("type")?(c.attr("type","text"),b.addClass("yith-password-eye-closed")):(c.attr("type","password"),b.removeClass("yith-password-eye-closed"))});a(document.body).on("yith-plugin-fw-init-radio",function(){a(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){a(this).val(a(this).attr("value"));a(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio");
|
27 |
+
a(document).on("select2:open",function(b){a(b.target).closest(".yith-plugin-ui").length&&a(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var f={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",
|
28 |
+
wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var b=f;a(document).on("click",b.selectors.units.single,b.unitChange);a(document).on("click",b.selectors.linked.button,b.linkedChange);a(document).on("change keyup",b.selectors.dimensions.number,b.numberChange)},unitChange:function(b){b=a(this).closest(f.selectors.units.single);var c=b.closest(f.selectors.units.wrapper),d=c.find(f.selectors.units.single);
|
29 |
+
c=c.find(f.selectors.units.value).first();var e=b.data("value");d.removeClass(f.selectors.units.selectedClass);b.addClass(f.selectors.units.selectedClass);c.val(e)},linkedChange:function(){var b=a(this).closest(f.selectors.linked.button),c=b.closest(f.selectors.wrapper);b=b.find(f.selectors.linked.value);"yes"===b.val()?(c.removeClass(f.selectors.linked.wrapperActiveClass),b.val("no")):(c.addClass(f.selectors.linked.wrapperActiveClass),b.val("yes"),c.find(f.selectors.dimensions.number).first().trigger("change"))},
|
30 |
+
numberChange:function(b){b=a(this).closest(f.selectors.dimensions.number);var c=b.closest(f.selectors.wrapper);c.hasClass(f.selectors.linked.wrapperActiveClass)&&c.find(f.selectors.dimensions.number).val(b.val())}};f.init()})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
-
* Version: 3.4.
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
-
* @version 3.4.
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.4.22
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|
8 |
*
|
9 |
* @author Your Inspiration Themes
|
10 |
+
* @version 3.4.20
|
11 |
*/
|
12 |
/**
|
13 |
* This file belongs to the YIT Plugin Framework.
|
plugin-fw/lib/yit-plugin-panel-wc.php
CHANGED
@@ -303,6 +303,14 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
303 |
$yit_options = $this->get_main_array_options();
|
304 |
$option_key = $this->get_current_option_key();
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
if ( version_compare( WC()->version, '2.4.0', '>=' ) ) {
|
307 |
if ( !empty( $yit_options[ $option_key ] ) ) {
|
308 |
foreach ( $yit_options[ $option_key ] as $option ) {
|
@@ -327,7 +335,7 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
327 |
}
|
328 |
}
|
329 |
|
330 |
-
|
331 |
|
332 |
do_action( 'yit_panel_wc_after_update' );
|
333 |
|
@@ -460,25 +468,26 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
|
|
460 |
delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
|
461 |
}
|
462 |
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
|
|
482 |
|
483 |
/**
|
484 |
* Maybe unserialize panel data
|
303 |
$yit_options = $this->get_main_array_options();
|
304 |
$option_key = $this->get_current_option_key();
|
305 |
|
306 |
+
foreach ( $yit_options as $key => $options_list ){
|
307 |
+
foreach ( $options_list as $value ){
|
308 |
+
if( ! empty( $value['yith-type'] ) && 'toggle-element-fixed' == $value['yith-type'] && isset( $value['save_single_options'] ) && true === $value['save_single_options'] ){
|
309 |
+
$yit_options[ $key ] = array_merge( $yit_options[ $key ] , $value['elements'] );
|
310 |
+
}
|
311 |
+
}
|
312 |
+
}
|
313 |
+
|
314 |
if ( version_compare( WC()->version, '2.4.0', '>=' ) ) {
|
315 |
if ( !empty( $yit_options[ $option_key ] ) ) {
|
316 |
foreach ( $yit_options[ $option_key ] as $option ) {
|
335 |
}
|
336 |
}
|
337 |
|
338 |
+
woocommerce_update_options( $yit_options[ $option_key ] );
|
339 |
|
340 |
do_action( 'yit_panel_wc_after_update' );
|
341 |
|
468 |
delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
|
469 |
}
|
470 |
|
471 |
+
/**
|
472 |
+
* Add the WooCommerce body class in plugin panel page
|
473 |
+
*
|
474 |
+
* @param string $admin_body_classes The body classes.
|
475 |
+
* @return string Filtered body classes
|
476 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
477 |
+
* @since 2.0
|
478 |
+
*/
|
479 |
+
public static function admin_body_class( $admin_body_classes ) {
|
480 |
+
global $pagenow;
|
481 |
+
|
482 |
+
$assets_screen_ids = (array) apply_filters( 'yith_plugin_fw_wc_panel_screen_ids_for_assets', array() );
|
483 |
+
|
484 |
+
if ( ( 'admin.php' == $pagenow && ( strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false || in_array( get_current_screen()->id, $assets_screen_ids ) ) ) ) {
|
485 |
+
$admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
|
486 |
+
$admin_body_classes = substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes . ' woocommerce ' : $admin_body_classes;
|
487 |
+
}
|
488 |
+
|
489 |
+
return $admin_body_classes;
|
490 |
+
}
|
491 |
|
492 |
/**
|
493 |
* Maybe unserialize panel data
|
plugin-fw/templates/fields/select-images.php
CHANGED
@@ -17,7 +17,7 @@ extract( $field );
|
|
17 |
$class = isset( $class ) ? $class : 'yith-plugin-fw-select-images';
|
18 |
$wrapper_id = $id . '-wrapper';
|
19 |
?>
|
20 |
-
<div id="<?php echo $wrapper_id ?>" class="yith-plugin-fw-select-images__wrapper">
|
21 |
|
22 |
<select id="<?php echo $id ?>"
|
23 |
name="<?php echo $name ?>"
|
@@ -41,7 +41,7 @@ $wrapper_id = $id . '-wrapper';
|
|
41 |
$selected_class = 'yith-plugin-fw-select-images__item--selected';
|
42 |
$current_class = $key === $value ? $selected_class : '';
|
43 |
?>
|
44 |
-
<li class="yith-plugin-fw-select-images__item <?php echo $current_class ?>" data-key="<?php echo $key ?>" <?php echo $img_data; ?>>
|
45 |
<?php if ( $label ) : ?>
|
46 |
<div class="yith-plugin-fw-select-images__item__label"><?php echo $label ?></div>
|
47 |
<?php endif; ?>
|
@@ -50,4 +50,4 @@ $wrapper_id = $id . '-wrapper';
|
|
50 |
<?php endif; ?>
|
51 |
<?php endforeach; ?>
|
52 |
</ul>
|
53 |
-
</div>
|
17 |
$class = isset( $class ) ? $class : 'yith-plugin-fw-select-images';
|
18 |
$wrapper_id = $id . '-wrapper';
|
19 |
?>
|
20 |
+
<div id="<?php echo $wrapper_id ?>" class="yith-plugin-fw-select-images__wrapper" data-type="select-images">
|
21 |
|
22 |
<select id="<?php echo $id ?>"
|
23 |
name="<?php echo $name ?>"
|
41 |
$selected_class = 'yith-plugin-fw-select-images__item--selected';
|
42 |
$current_class = $key === $value ? $selected_class : '';
|
43 |
?>
|
44 |
+
<li class="yith-plugin-fw-select-images__item <?php echo $current_class ?>" data-type="select-images-item" data-key="<?php echo $key ?>" <?php echo $img_data; ?>>
|
45 |
<?php if ( $label ) : ?>
|
46 |
<div class="yith-plugin-fw-select-images__item__label"><?php echo $label ?></div>
|
47 |
<?php endif; ?>
|
50 |
<?php endif; ?>
|
51 |
<?php endforeach; ?>
|
52 |
</ul>
|
53 |
+
</div>
|
plugin-fw/templates/fields/toggle-element-fixed.php
CHANGED
@@ -10,6 +10,7 @@ $defaults = array(
|
|
10 |
'custom_attributes' => '',
|
11 |
'elements' => [],
|
12 |
'onoff_field' => true,
|
|
|
13 |
|
14 |
);
|
15 |
$field = wp_parse_args( $field, $defaults );
|
@@ -48,10 +49,17 @@ $value = get_option( $name, [] );
|
|
48 |
<?php foreach ( $elements as $element ):
|
49 |
// build correct name and id
|
50 |
$field_id = $element['id'];
|
51 |
-
$element['name'] = "{$name}[{$field_id}]";
|
52 |
$element['id'] = "{$id}_{$field_id}";
|
53 |
// get value
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
?>
|
56 |
<div class="yith-toggle-content-row <?php echo $element['type'] ?>">
|
57 |
<label for="<?php echo $element['id']; ?>"><?php echo $element['title']; ?></label>
|
@@ -65,4 +73,4 @@ $value = get_option( $name, [] );
|
|
65 |
</div>
|
66 |
</div>
|
67 |
</div>
|
68 |
-
</div>
|
10 |
'custom_attributes' => '',
|
11 |
'elements' => [],
|
12 |
'onoff_field' => true,
|
13 |
+
'save_single_options' => false,
|
14 |
|
15 |
);
|
16 |
$field = wp_parse_args( $field, $defaults );
|
49 |
<?php foreach ( $elements as $element ):
|
50 |
// build correct name and id
|
51 |
$field_id = $element['id'];
|
52 |
+
$element['name'] = false === $save_single_options ? "{$name}[{$field_id}]" : $field_id;
|
53 |
$element['id'] = "{$id}_{$field_id}";
|
54 |
// get value
|
55 |
+
$element['value'] = '';
|
56 |
+
if( false === $save_single_options ){
|
57 |
+
$element['value'] = isset( $value[ $field_id ] ) ? $value[ $field_id ] : ( isset( $element['default'] ) ? $element['default'] : '' );
|
58 |
+
}
|
59 |
+
|
60 |
+
else {
|
61 |
+
$element['value'] = get_option( $field_id, $element['default'] );
|
62 |
+
}
|
63 |
?>
|
64 |
<div class="yith-toggle-content-row <?php echo $element['type'] ?>">
|
65 |
<label for="<?php echo $element['id']; ?>"><?php echo $element['title']; ?></label>
|
73 |
</div>
|
74 |
</div>
|
75 |
</div>
|
76 |
+
</div>
|
widgets/class.yith-wcan-navigation-widget.php
CHANGED
@@ -366,12 +366,20 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
|
|
366 |
|
367 |
$link = esc_url( urldecode( apply_filters( 'woocommerce_layered_nav_link', $link ) ) );
|
368 |
|
|
|
|
|
|
|
|
|
369 |
echo '<li ' . $class . '>';
|
370 |
|
371 |
echo ( $this->found || $option_is_set ) ? '<a ' . $rel_nofollow . ' data-type="select" href="' . $link . '">' : '<span>';
|
372 |
|
373 |
echo $term->name;
|
374 |
|
|
|
|
|
|
|
|
|
375 |
echo ( $this->found || $option_is_set ) ? '</a>' : '</span>';
|
376 |
|
377 |
echo '</li>';
|
366 |
|
367 |
$link = esc_url( urldecode( apply_filters( 'woocommerce_layered_nav_link', $link ) ) );
|
368 |
|
369 |
+
$show_count = $count != 0 && ! empty( $instance['show_count'] ) && ! $instance['show_count'];
|
370 |
+
|
371 |
+
$show_count = apply_filters( "{$this->id}-show_product_count", $show_count, $instance );
|
372 |
+
|
373 |
echo '<li ' . $class . '>';
|
374 |
|
375 |
echo ( $this->found || $option_is_set ) ? '<a ' . $rel_nofollow . ' data-type="select" href="' . $link . '">' : '<span>';
|
376 |
|
377 |
echo $term->name;
|
378 |
|
379 |
+
if ( $this->found && apply_filters( 'yith_wcan_force_show_count', $show_count ) ) {
|
380 |
+
echo ' <small class="count">' . $count . '</small><div class="clear"></div>';
|
381 |
+
}
|
382 |
+
|
383 |
echo ( $this->found || $option_is_set ) ? '</a>' : '</span>';
|
384 |
|
385 |
echo '</li>';
|
widgets/class.yith-wcan-reset-navigation-widget.php
CHANGED
@@ -60,7 +60,7 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
|
|
60 |
if( yit_is_filtered_uri() && ( isset( $_GET['min_price'] ) || isset( $_GET['max_price'] ) ) && is_product_taxonomy() ){
|
61 |
$queried_object = get_queried_object();
|
62 |
|
63 |
-
if( $queried_object instanceof WP_Term ){
|
64 |
$link = get_term_link( $queried_object );
|
65 |
}
|
66 |
}
|
@@ -146,4 +146,4 @@ if ( ! class_exists( 'YITH_WCAN_Reset_Navigation_Widget' ) ) {
|
|
146 |
}
|
147 |
|
148 |
}
|
149 |
-
}
|
60 |
if( yit_is_filtered_uri() && ( isset( $_GET['min_price'] ) || isset( $_GET['max_price'] ) ) && is_product_taxonomy() ){
|
61 |
$queried_object = get_queried_object();
|
62 |
|
63 |
+
if( $queried_object instanceof WP_Term && ! isset( $_GET[ $queried_object->taxonomy ] ) ){
|
64 |
$link = get_term_link( $queried_object );
|
65 |
}
|
66 |
}
|
146 |
}
|
147 |
|
148 |
}
|
149 |
+
}
|