Version Description
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Zoom Magnifier |
Version | 1.3.19 |
Comparing to | |
See all releases |
Code changes from version 1.3.18 to 1.3.19
- README.txt +7 -2
- assets/js/yith_magnifier.js +10 -6
- assets/js/yith_magnifier.min.js +1 -1
- init.php +4 -4
- plugin-fw/.gitignore +0 -15
- plugin-fw/assets/js/yith-fields.js +183 -183
- plugin-fw/assets/js/yith-fields.min.js +1 -1
- plugin-fw/assets/js/yith-gutenberg.js +211 -211
- plugin-fw/assets/js/yith-gutenberg.min.js +6 -1
- plugin-fw/init.php +1 -1
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
|
@@ -52,6 +52,11 @@ YITH WooCommerce Zoom Magnifier will add a new tab called "Zoom Magnifier" in "Y
|
|
52 |
|
53 |
== Changelog ==
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
= Version 1.3.18 - Released: Sept 29, 2020 =
|
56 |
|
57 |
* Fix: Loading banner on product page for some images
|
@@ -234,4 +239,4 @@ Full documentation is available [here](https://docs.yithemes.com/yith-woocommerc
|
|
234 |
* New: support to WooCommerce 3.3.3
|
235 |
* Update: plugin framework 3.0.13
|
236 |
* Fix: Wrong documentation link.
|
237 |
-
* Fix: Remove old plugin framework.
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 1.3.19
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
Documentation: https://docs.yithemes.com/yith-woocommerce-zoom-magnifier/
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= Version 1.3.19 - Released: Oct 01, 2020 =
|
56 |
+
|
57 |
+
* New: support for WooCommerce 4.6
|
58 |
+
* Fix: fixed the image loading
|
59 |
+
|
60 |
= Version 1.3.18 - Released: Sept 29, 2020 =
|
61 |
|
62 |
* Fix: Loading banner on product page for some images
|
239 |
* New: support to WooCommerce 3.3.3
|
240 |
* Update: plugin framework 3.0.13
|
241 |
* Fix: Wrong documentation link.
|
242 |
+
* Fix: Remove old plugin framework.
|
assets/js/yith_magnifier.js
CHANGED
@@ -30,6 +30,8 @@
|
|
30 |
// blank image data-uri bypasses webkit log warning (thx doug jones)
|
31 |
var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
32 |
|
|
|
|
|
33 |
$.fn.imagesLoaded = function (callback) {
|
34 |
var $this = this,
|
35 |
deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
|
@@ -96,7 +98,7 @@
|
|
96 |
}
|
97 |
|
98 |
// call doneLoading and clean listeners if all images are loaded
|
99 |
-
if (
|
100 |
setTimeout(doneLoading);
|
101 |
$images.unbind('.imagesLoaded', imgLoadedHandler);
|
102 |
}
|
@@ -215,9 +217,13 @@
|
|
215 |
|
216 |
self._loading();
|
217 |
|
218 |
-
self.
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
221 |
|
222 |
|
223 |
$(document).trigger('yith_magnifier_after_init');
|
@@ -248,7 +254,6 @@
|
|
248 |
|
249 |
$( '#yith_wczm_traffic_light' ).val( 'blocked' );
|
250 |
|
251 |
-
|
252 |
self.options.from_gallery = 'yes';
|
253 |
|
254 |
var t = $(this);
|
@@ -387,7 +392,6 @@
|
|
387 |
} else {
|
388 |
|
389 |
$([self.IMG_zoomImage, self.IMG_smallImage]).imagesLoaded(function () {
|
390 |
-
|
391 |
self._initGallery();
|
392 |
self._initTrap();
|
393 |
});
|
30 |
// blank image data-uri bypasses webkit log warning (thx doug jones)
|
31 |
var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
32 |
|
33 |
+
|
34 |
+
|
35 |
$.fn.imagesLoaded = function (callback) {
|
36 |
var $this = this,
|
37 |
deferred = $.isFunction($.Deferred) ? $.Deferred() : 0,
|
98 |
}
|
99 |
|
100 |
// call doneLoading and clean listeners if all images are loaded
|
101 |
+
if (loaded.length) {
|
102 |
setTimeout(doneLoading);
|
103 |
$images.unbind('.imagesLoaded', imgLoadedHandler);
|
104 |
}
|
217 |
|
218 |
self._loading();
|
219 |
|
220 |
+
self.element.imagesLoaded(function () {
|
221 |
+
self.options.onLoad();
|
222 |
+
self._initZoom();
|
223 |
+
self._initGallery();
|
224 |
+
|
225 |
+
});
|
226 |
+
|
227 |
|
228 |
|
229 |
$(document).trigger('yith_magnifier_after_init');
|
254 |
|
255 |
$( '#yith_wczm_traffic_light' ).val( 'blocked' );
|
256 |
|
|
|
257 |
self.options.from_gallery = 'yes';
|
258 |
|
259 |
var t = $(this);
|
392 |
} else {
|
393 |
|
394 |
$([self.IMG_zoomImage, self.IMG_smallImage]).imagesLoaded(function () {
|
|
|
395 |
self._initGallery();
|
396 |
self._initTrap();
|
397 |
});
|
assets/js/yith_magnifier.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t,i,o){"use strict";void 0===i.fn.imagesLoaded&&function(t,i){var o="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";t.fn.imagesLoaded=function(i){var e=this,n=t.isFunction(t.Deferred)?t.Deferred():0,a=t.isFunction(n.notify),s=e.find("img").add(e.filter("img")),r=[],h=[],m=[];function l(){var o=t(h),a=t(m);n&&(m.length?n.reject(s,o,a):n.resolve(s)),t.isFunction(i)&&i.call(e,s,o,a)}function c(t){g(t.target,"error"===t.type)}function g(i,e){i.src!==o&&-1===t.inArray(i,r)&&(r.push(i),e?m.push(i):h.push(i),t.data(i,"imagesLoaded",{isBroken:e,src:i.src}),a&&n.notifyWith(t(i),[e,s,t(h),t(m)]),s.length===r.length&&(setTimeout(l),s.unbind(".imagesLoaded",c)))}return t.isPlainObject(i)&&t.each(i,function(t,o){"callback"===t?i=o:n&&n[t](o)}),s.length?s.bind("load.imagesLoaded error.imagesLoaded",c).each(function(i,e){var n=e.src,a=t.data(e,"imagesLoaded");a&&a.src===n?g(e,a.isBroken):e.complete&&void 0!==e.naturalWidth?g(e,0===e.naturalWidth||0===e.naturalHeight):(e.readyState||e.complete)&&(e.src=o,e.src=n)}):l(),n?n.promise(e):e}}(jQuery),i.yith_magnifier=function(t,o){this.t=o,this.element=i(o),this._init(t)},i.yith_magnifier.defaults={zoomWidth:"auto",zoomHeight:"auto",position:"right",tint:!1,tintOpacity:.5,lensOpacity:.5,softFocus:!1,smoothMove:3,showTitle:!0,titleOpacity:.5,adjustX:0,adjustY:0,phoneBehavior:"inside",loadingLabel:"Loading...",enableSlider:!0,slider:"carouFredSel",sliderOptions:{},from_gallery:"no",onLoad:function(){return!1},onEnter:function(){return!1},onLeave:function(){return!1},onMove:function(){return!1},onClick:function(){return!1},elements:{zoom:i(".yith_magnifier_zoom"),zoomImage:i(".yith_magnifier_zoom img").first(),gallery:i(".yith_magnifier_gallery li a")}},i.yith_magnifier.prototype={_init:function(t){var o=this;i(document).trigger("yith_magnifier_before_init"),i.each(i.yith_magnifier.defaults.elements,function(t,e){i.yith_magnifier.defaults.elements[t]=i(e,o)}),o.options=i.extend(!0,{},i.yith_magnifier.defaults,t),o.isPhone=o._isPhone(),o._loading(),o.element.imagesLoaded(function(){o.options.onLoad(),o._initZoom(),o._initGallery()}),i(document).trigger("yith_magnifier_after_init")},_initGallery:function(){var t=this,o=t.options.elements,e=o.gallery,n=o.zoom,a=o.zoomImage;e.length>0?(e.on("click",function(o){if(o.preventDefault(),"free"==i("#yith_wczm_traffic_light").val()){i("#yith_wczm_traffic_light").val("blocked"),t.options.from_gallery="yes";var e=i(this);t.destroy(),n.attr("href",this.href),a.attr("src",e.data("small")).attr("srcset",e.data("small")).attr("src-orig",e.data("small")).attr("title","").attr("title",e.attr("title")),i.data(t.t,"yith_magnifier",new i.yith_magnifier(t.options,t.element)),i("#yith_wczm_traffic_light").val("free")}}),t.options.enableSlider&&e.closest("ul").trigger("yith_magnifier_slider_destroy")):e.on("click",function(t){return t.preventDefault(),!1})},_loading:function(){if(this.options.disableRightClick&&i(document).on("contextmenu",function(t){return!1}),void 0===this.mouseTrap){var t=this.options.elements.zoom.width();this.options.loadingLabel&&i('<div class="yith_magnifier_loading">'+this.options.loadingLabel+"</div>").css({width:t,"text-align":"center",opacity:.5}).appendTo(this.options.elements.zoom.parent())}},_initZoom:function(){if("free"==i("#yith_wczm_traffic_light").val()){i("#yith_wczm_traffic_light").val("blocked");var t=this;t.zoom=t.options.elements.zoom,t.zoomImage=t.options.elements.zoomImage;var o="yith_magnifier_zoom_wrap";if(t.options.zoom_wrap_additional_css){if(i("."+o).length)return;o+=" "+t.options.zoom_wrap_additional_css}t.zoom.wrap('<div class="'+o+'"></div>'),t.IMG_zoomImage=new Image;var e=i(".woocommerce-variation-add-to-cart .variation_id").val();if(i.isNumeric(e)&&0!=e&&"no"==t.options.from_gallery&&"1"==yith_wc_zoom_magnifier_storage_object.zoom_condition){var n={action:"yith_wc_zoom_magnifier_get_main_image",product_id:e,context:"frontend"};i.ajax({data:n,url:yith_wc_zoom_magnifier_storage_object.ajax_url,type:"post",error:function(t){console.log("ERROR - Yith_WC_Zoom_Magnifier"),console.log(t),i("#yith_wczm_traffic_light").val("free")},success:function(o){t.zoom.attr("href",o.url),t.IMG_zoomImage.src=o.url,t.IMG_smallImage=new Image,t.IMG_smallImage.src=t.zoomImage.attr("src"),o.gallery&&(i(".yith_magnifier_gallery").length?i(".yith_magnifier_gallery").closest(".thumbnails").replaceWith(o.gallery):i(".images").append(o.gallery),t.options.elements.gallery=i(".yith_magnifier_gallery li a")),i.browser&&i.browser.msie&&8==i.browser.version?i(t.IMG_zoomImage).load(function(){t._initGallery(),t._initTrap()}):i([t.IMG_zoomImage,t.IMG_smallImage]).imagesLoaded(function(){t._initGallery(),t._initTrap()}),i(document).on("click","a.yith_expand",function(o){o.preventDefault(),i().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){i(".yith_expand").css("display","inline")}}),i.prettyPhoto.open(t.zoom[0].href,"",""),i(".yith_expand").css("display","none"),i(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),i(document).trigger("yith_magnifier_after_init_zoom"),i("#yith_wczm_traffic_light").val("free")}})}else t.IMG_zoomImage.src=t.zoom.attr("href"),t.IMG_smallImage=new Image,t.IMG_smallImage.src=t.zoomImage.attr("src"),i.browser&&i.browser.msie&&8==i.browser.version?i(t.IMG_zoomImage).load(function(){t._initTrap()}):i([t.IMG_zoomImage,t.IMG_smallImage]).imagesLoaded(function(){t._initTrap()}),i(document).on("click","a.yith_expand",function(o){o.preventDefault(),i().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){i(".yith_expand").css("display","inline")}}),i.prettyPhoto.open(t.zoom[0].href,"",""),i(".yith_expand").css("display","none"),i(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),i(document).trigger("yith_magnifier_after_init_zoom"),i("#yith_wczm_traffic_light").val("free")}},_initTrap:function(){var t=this,o=t.IMG_zoomImage;t.IMG_smallImage;t.mx=0,t.my=0,t.controlTimer=0,t.lens=null,t.tint=null,t.softFocus=null,t.zoomDiv=null,t.cw=0,t.ch=0,t.zw=0,t.destU=0,t.destV=0,t.currU=0,t.currV=0,t.mouseTrap=null;var e=t.options.elements.zoom,n=t.options.elements.zoomImage;if(i(".yith_magnifier_loading").remove(),this.element.find(".yith_magnifier_mousetrap")&&this.element.find(".yith_magnifier_mousetrap").remove(),this.mouseTrap=i('<div class="yith_magnifier_mousetrap pp_woocommerce" />').css({width:"100%",height:"100%",top:0,left:0}).appendTo(e.parent()),"undefined"!=typeof ywzm_data&&i('<a href="#" class="yith_expand" title="'+ywzm_data.expand_label+'" style="display: inline;">Expand</a>').appendTo(this.mouseTrap),!t.isPhone||"disable"!=t.options.phoneBehavior){var a="ontouchstart"in document.documentElement;this.mouseTrap.on("touchmove mousemove",this,function(i){t.options.onMove(),t.mx=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageX:i.pageX,t.my=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageY:i.pageY}).on("touchend mouseleave",this,function(i){return clearTimeout(t.controlTimer),t.lens&&t.lens.fadeOut(299),t.tint&&t.tint.fadeOut(299),t.softFocus&&t.softFocus.fadeOut(299),t.zoomDiv.fadeOut(300,function(){t._onLeave()}),!1}).on("touchstart click",this,function(i){t.options.onClick()}).on("touchstart mouseenter",this,function(s){if("free"==i("#yith_wczm_traffic_light").val()){t.options.onEnter(),a&&s.preventDefault(),t.mx=void 0!==s.originalEvent.touches?s.originalEvent.touches[0].pageX:s.pageX,t.my=void 0!==s.originalEvent.touches?s.originalEvent.touches[0].pageY:s.pageY,t.zw=s.data,t.zoomDiv&&(t.zoomDiv.stop(!0,!1),t.zoomDiv.remove());var r=t.options.adjustX,h=t.options.adjustY,m=n.outerWidth(),l=n.outerHeight(),c=t.options.zoomWidth,g=t.options.zoomHeight;"auto"==t.options.zoomWidth&&(c=m),"auto"==t.options.zoomHeight&&(g=l);var d=e.parent();switch(t.options.position){case"top":h-=g;break;case"right":r+=m;break;case"bottom":h+=l;break;case"left":r-=c;break;case"inside":c=m,g=l;break;default:(d=i("#"+t.options.position)).length?(c=d.innerWidth(),g=d.innerHeight()):(d=e,r+=m,h+=l)}t.isPhone&&"inside"==t.options.phoneBehavior&&(c=m,g=l,r=0,h=0),t.zoomDiv=i('<div class="yith_magnifier_zoom_magnifier" />').css({left:r,top:h,width:c,height:g,"background-repeat":"no-repeat",backgroundImage:"url("+o.src+")"}).appendTo(d),n.attr("title")&&t.options.showTitle&&i('<div class="yith_magnifier_title">'+n.attr("title")+"</div>").appendTo(t.zoomDiv),t.isPhone?"disable"!=t.options.phoneBehavior?t.zoomDiv.fadeIn(500):t.lens.fadeOut(299):t.zoomDiv.fadeIn(500),t.lens&&(t.lens.remove(),t.lens=null),o.width<=1?t.cw=n.outerWidth()/o.naturalWidth*t.zoomDiv.width():t.cw=n.outerWidth()/o.width*t.zoomDiv.width(),o.height<=1?t.ch=n.outerHeight()/o.naturalHeight*t.zoomDiv.height():t.ch=n.outerHeight()/o.height*t.zoomDiv.height(),t.lens=i('<div class="yith_magnifier_lens" />').css({width:t.cw,height:t.ch}).appendTo(e),t.mouseTrap.css("cursor",t.lens.css("cursor"));var u=!1;return t.options.tint&&(t.tint=i("<div />").css({display:"none",position:"absolute",left:0,top:0,width:n.outerWidth(),height:n.outerHeight(),backgroundColor:t.options.tint,opacity:t.options.tintOpacity}).appendTo(e),t.lens.append(i("<img />",{src:n.attr("src")})),u=!0,t.tint.fadeIn(500)),t.options.softFocus&&(t.softFocus=i("<div />").css({position:"absolute",display:"none",top:"1px",left:"1px",width:n.outerWidth(),height:n.outerHeight(),opacity:.5}).appendTo(e),t.softFocus.append(i("<img />",{src:n.attr("src")})),0==t.lens.find("img").length&&t.lens.append(i("<img />",{src:n.attr("src")})),u=!0,t.softFocus.fadeIn(500)),u||t.lens.css("opacity",t.options.lensOpacity),"inside"!==t.options.position&&t.lens.fadeIn(500),void t.zw._controlLoop()}})}},_controlLoop:function(){var t=this;if(this.lens){var i=this.mx-this.zoomImage.offset().left-.5*this.cw>>0,o=this.my-this.zoomImage.offset().top-.5*this.ch>>0;i<0?i=0:i>this.zoomImage.outerWidth()-this.cw&&(i=this.zoomImage.outerWidth()-this.cw),o<0?o=0:o>this.zoomImage.outerHeight()-this.ch&&(o=this.zoomImage.outerHeight()-this.ch),this.lens.css({left:i-2,top:o-1}),this.lens.find("img").css({width:this.zoomImage.outerWidth(),height:this.zoomImage.outerHeight(),marginLeft:-i+"px ",marginTop:-o+"px"}),this.IMG_zoomImage.width<=1?this.destU=i/this.zoomImage.outerWidth()*this.IMG_zoomImage.naturalWidth>>0:this.destU=i/this.zoomImage.outerWidth()*this.IMG_zoomImage.width>>0,this.IMG_zoomImage.height<=1?this.destV=o/this.zoomImage.outerHeight()*this.IMG_zoomImage.naturalHeight>>0:this.destV=o/this.zoomImage.outerHeight()*this.IMG_zoomImage.height>>0,this.currU+=(this.destU-this.currU)/this.options.smoothMove,this.currV+=(this.destV-this.currV)/this.options.smoothMove,this.zoomDiv.css("background-position",-(this.currU>>0)+"px "+-(this.currV>>0)+"px")}this.controlTimer=setTimeout(function(){t._controlLoop()},30)},_onLeave:function(){this.options.onLeave(),this.zoomDiv&&(this.zoomDiv.remove(),this.zoomDiv=null),this._removeElements()},_removeElements:function(){this.lens&&(this.lens.remove(),this.lens=null),this.tint&&(this.tint.remove(),this.tint=null),this.softFocus&&(this.softFocus.remove(),this.softFocus=null),this.element.find(".yith_magnifier_loading").length>0&&this.element.find(".yith_magnifier_loading").remove()},_isPhone:function(){var t=navigator.userAgent.toLowerCase();return t.match(/iphone/i)||t.match(/ipod/i)||t.match(/android/i)},destroy:function(){this.zoom&&this.zoom.unwrap(),this.mouseTrap&&(this.mouseTrap.unbind(),this.mouseTrap.remove(),this.mouseTrap=null),this.zoomDiv&&(this.zoomDiv.remove(),this.zoomDiv=null),this.options.disableRightClick&&i(document).unbind(),this._removeElements(),this.options.elements.gallery.unbind(),this.element.removeData("yith_magnifier")}},i.fn.yith_magnifier=function(t){if("string"==typeof t){var o=Array.prototype.slice.call(arguments,1);this.each(function(){var e=i.data(this,"yith_magnifier");e?i.isFunction(e[t])&&"_"!==t.charAt(0)?e[t].apply(e,o):i.error("no such method '"+t+"' for yith_magnifier instance"):i.error("cannot call methods on yith_magnifier prior to initialization; attempted to call method '"+t+"'")})}else this.each(function(){i.data(this,"yith_magnifier")?i.error("yith_magnifier already istantiated."):i.data(this,"yith_magnifier",new i.yith_magnifier(t,this))});return this}}(window,jQuery);
|
1 |
+
!function(t,i,o){"use strict";void 0===i.fn.imagesLoaded&&function(t,i){var o="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";t.fn.imagesLoaded=function(i){var e=this,n=t.isFunction(t.Deferred)?t.Deferred():0,a=t.isFunction(n.notify),s=e.find("img").add(e.filter("img")),r=[],m=[],h=[];function l(){var o=t(m),a=t(h);n&&(h.length?n.reject(s,o,a):n.resolve(s)),t.isFunction(i)&&i.call(e,s,o,a)}function c(t){d(t.target,"error"===t.type)}function d(i,e){i.src!==o&&-1===t.inArray(i,r)&&(r.push(i),e?h.push(i):m.push(i),t.data(i,"imagesLoaded",{isBroken:e,src:i.src}),a&&n.notifyWith(t(i),[e,s,t(m),t(h)]),r.length&&(setTimeout(l),s.unbind(".imagesLoaded",c)))}return t.isPlainObject(i)&&t.each(i,function(t,o){"callback"===t?i=o:n&&n[t](o)}),s.length?s.bind("load.imagesLoaded error.imagesLoaded",c).each(function(i,e){var n=e.src,a=t.data(e,"imagesLoaded");a&&a.src===n?d(e,a.isBroken):e.complete&&void 0!==e.naturalWidth?d(e,0===e.naturalWidth||0===e.naturalHeight):(e.readyState||e.complete)&&(e.src=o,e.src=n)}):l(),n?n.promise(e):e}}(jQuery),i.yith_magnifier=function(t,o){this.t=o,this.element=i(o),this._init(t)},i.yith_magnifier.defaults={zoomWidth:"auto",zoomHeight:"auto",position:"right",tint:!1,tintOpacity:.5,lensOpacity:.5,softFocus:!1,smoothMove:3,showTitle:!0,titleOpacity:.5,adjustX:0,adjustY:0,phoneBehavior:"inside",loadingLabel:"Loading...",enableSlider:!0,slider:"carouFredSel",sliderOptions:{},from_gallery:"no",onLoad:function(){return!1},onEnter:function(){return!1},onLeave:function(){return!1},onMove:function(){return!1},onClick:function(){return!1},elements:{zoom:i(".yith_magnifier_zoom"),zoomImage:i(".yith_magnifier_zoom img").first(),gallery:i(".yith_magnifier_gallery li a")}},i.yith_magnifier.prototype={_init:function(t){var o=this;i(document).trigger("yith_magnifier_before_init"),i.each(i.yith_magnifier.defaults.elements,function(t,e){i.yith_magnifier.defaults.elements[t]=i(e,o)}),o.options=i.extend(!0,{},i.yith_magnifier.defaults,t),o.isPhone=o._isPhone(),o._loading(),o.element.imagesLoaded(function(){o.options.onLoad(),o._initZoom(),o._initGallery()}),i(document).trigger("yith_magnifier_after_init")},_initGallery:function(){var t=this,o=t.options.elements,e=o.gallery,n=o.zoom,a=o.zoomImage;e.length>0?(e.on("click",function(o){if(o.preventDefault(),o.stopImmediatePropagation(),"free"==i("#yith_wczm_traffic_light").val()){i("#yith_wczm_traffic_light").val("blocked"),t.options.from_gallery="yes";var e=i(this);t.destroy(),n.attr("href",this.href),a.attr("src",e.data("small")).attr("srcset",e.data("small")).attr("src-orig",e.data("small")).attr("title","").attr("title",e.attr("title")),i.data(t.t,"yith_magnifier",new i.yith_magnifier(t.options,t.element)),i("#yith_wczm_traffic_light").val("free")}}),t.options.enableSlider&&e.closest("ul").trigger("yith_magnifier_slider_destroy")):e.on("click",function(t){return t.preventDefault(),!1})},_loading:function(){if(this.options.disableRightClick&&i(document).on("contextmenu",function(t){return!1}),void 0===this.mouseTrap){var t=this.options.elements.zoom.width();this.options.loadingLabel&&i('<div class="yith_magnifier_loading">'+this.options.loadingLabel+"</div>").css({width:t,"text-align":"center",opacity:.5}).appendTo(this.options.elements.zoom.parent())}},_initZoom:function(){if("free"==i("#yith_wczm_traffic_light").val()){i("#yith_wczm_traffic_light").val("blocked");var t=this;t.zoom=t.options.elements.zoom,t.zoomImage=t.options.elements.zoomImage;var o="yith_magnifier_zoom_wrap";if(t.options.zoom_wrap_additional_css){if(i("."+o).length)return;o+=" "+t.options.zoom_wrap_additional_css}t.zoom.wrap('<div class="'+o+'"></div>'),t.IMG_zoomImage=new Image;var e=i(".woocommerce-variation-add-to-cart .variation_id").val();if(i.isNumeric(e)&&0!=e&&"no"==t.options.from_gallery&&"1"==yith_wc_zoom_magnifier_storage_object.zoom_condition){var n={action:"yith_wc_zoom_magnifier_get_main_image",product_id:e,context:"frontend"};i.ajax({data:n,url:yith_wc_zoom_magnifier_storage_object.ajax_url,type:"post",error:function(t){console.log("ERROR - Yith_WC_Zoom_Magnifier"),console.log(t),i("#yith_wczm_traffic_light").val("free")},success:function(o){t.zoom.attr("href",o.url),t.IMG_zoomImage.src=o.url,t.IMG_smallImage=new Image,t.IMG_smallImage.src=t.zoomImage.attr("src"),o.gallery&&(i(".yith_magnifier_gallery").length?i(".yith_magnifier_gallery").closest(".thumbnails").replaceWith(o.gallery):i(".images").append(o.gallery),t.options.elements.gallery=i(".yith_magnifier_gallery li a")),i.browser&&i.browser.msie&&8==i.browser.version?i(t.IMG_zoomImage).load(function(){t._initGallery(),t._initTrap()}):i([t.IMG_zoomImage,t.IMG_smallImage]).imagesLoaded(function(){t._initGallery(),t._initTrap()}),i(document).on("click","a.yith_expand",function(o){o.preventDefault(),i().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){i(".yith_expand").css("display","inline")}}),i.prettyPhoto.open(t.zoom[0].href,"",""),i(".yith_expand").css("display","none"),i(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),i(document).trigger("yith_magnifier_after_init_zoom"),i("#yith_wczm_traffic_light").val("free")}})}else t.IMG_zoomImage.src=t.zoom.attr("href"),t.IMG_smallImage=new Image,t.IMG_smallImage.src=t.zoomImage.attr("src"),i.browser&&i.browser.msie&&8==i.browser.version?i(t.IMG_zoomImage).load(function(){t._initTrap()}):i([t.IMG_zoomImage,t.IMG_smallImage]).imagesLoaded(function(){t._initTrap()}),i(document).on("click","a.yith_expand",function(o){o.preventDefault(),i().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){i(".yith_expand").css("display","inline")}}),i.prettyPhoto.open(t.zoom[0].href,"",""),i(".yith_expand").css("display","none"),i(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),i(document).trigger("yith_magnifier_after_init_zoom"),i("#yith_wczm_traffic_light").val("free")}},_initTrap:function(){var t=this,o=t.IMG_zoomImage;t.IMG_smallImage;t.mx=0,t.my=0,t.controlTimer=0,t.lens=null,t.tint=null,t.softFocus=null,t.zoomDiv=null,t.cw=0,t.ch=0,t.zw=0,t.destU=0,t.destV=0,t.currU=0,t.currV=0,t.mouseTrap=null;var e=t.options.elements.zoom,n=t.options.elements.zoomImage;if(i(".yith_magnifier_loading").remove(),this.element.find(".yith_magnifier_mousetrap")&&this.element.find(".yith_magnifier_mousetrap").remove(),this.mouseTrap=i('<div class="yith_magnifier_mousetrap pp_woocommerce" />').css({width:"100%",height:"100%",top:0,left:0}).appendTo(e.parent()),"undefined"!=typeof ywzm_data&&i('<a href="#" class="yith_expand" title="'+ywzm_data.expand_label+'" style="display: inline;">Expand</a>').appendTo(this.mouseTrap),!t.isPhone||"disable"!=t.options.phoneBehavior){var a="ontouchstart"in document.documentElement;this.mouseTrap.on("touchmove mousemove",this,function(i){t.options.onMove(),t.mx=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageX:i.pageX,t.my=void 0!==i.originalEvent.touches?i.originalEvent.touches[0].pageY:i.pageY}).on("touchend mouseleave",this,function(i){return clearTimeout(t.controlTimer),t.lens&&t.lens.fadeOut(299),t.tint&&t.tint.fadeOut(299),t.softFocus&&t.softFocus.fadeOut(299),t.zoomDiv.fadeOut(300,function(){t._onLeave()}),!1}).on("touchstart click",this,function(i){t.options.onClick()}).on("touchstart mouseenter",this,function(s){if("free"==i("#yith_wczm_traffic_light").val()){t.options.onEnter(),a&&s.preventDefault(),t.mx=void 0!==s.originalEvent.touches?s.originalEvent.touches[0].pageX:s.pageX,t.my=void 0!==s.originalEvent.touches?s.originalEvent.touches[0].pageY:s.pageY,t.zw=s.data,t.zoomDiv&&(t.zoomDiv.stop(!0,!1),t.zoomDiv.remove());var r=t.options.adjustX,m=t.options.adjustY,h=n.outerWidth(),l=n.outerHeight(),c=t.options.zoomWidth,d=t.options.zoomHeight;"auto"==t.options.zoomWidth&&(c=h),"auto"==t.options.zoomHeight&&(d=l);var g=e.parent();switch(t.options.position){case"top":m-=d;break;case"right":r+=h;break;case"bottom":m+=l;break;case"left":r-=c;break;case"inside":c=h,d=l;break;default:(g=i("#"+t.options.position)).length?(c=g.innerWidth(),d=g.innerHeight()):(g=e,r+=h,m+=l)}t.isPhone&&"inside"==t.options.phoneBehavior&&(c=h,d=l,r=0,m=0),t.zoomDiv=i('<div class="yith_magnifier_zoom_magnifier" />').css({left:r,top:m,width:c,height:d,"background-repeat":"no-repeat",backgroundImage:"url("+o.src+")"}).appendTo(g),n.attr("title")&&t.options.showTitle&&i('<div class="yith_magnifier_title">'+n.attr("title")+"</div>").appendTo(t.zoomDiv),t.isPhone?"disable"!=t.options.phoneBehavior?t.zoomDiv.fadeIn(500):t.lens.fadeOut(299):t.zoomDiv.fadeIn(500),t.lens&&(t.lens.remove(),t.lens=null),o.width<=1?t.cw=n.outerWidth()/o.naturalWidth*t.zoomDiv.width():t.cw=n.outerWidth()/o.width*t.zoomDiv.width(),o.height<=1?t.ch=n.outerHeight()/o.naturalHeight*t.zoomDiv.height():t.ch=n.outerHeight()/o.height*t.zoomDiv.height(),t.lens=i('<div class="yith_magnifier_lens" />').css({width:t.cw,height:t.ch}).appendTo(e),t.mouseTrap.css("cursor",t.lens.css("cursor"));var u=!1;return t.options.tint&&(t.tint=i("<div />").css({display:"none",position:"absolute",left:0,top:0,width:n.outerWidth(),height:n.outerHeight(),backgroundColor:t.options.tint,opacity:t.options.tintOpacity}).appendTo(e),t.lens.append(i("<img />",{src:n.attr("src")})),u=!0,t.tint.fadeIn(500)),t.options.softFocus&&(t.softFocus=i("<div />").css({position:"absolute",display:"none",top:"1px",left:"1px",width:n.outerWidth(),height:n.outerHeight(),opacity:.5}).appendTo(e),t.softFocus.append(i("<img />",{src:n.attr("src")})),0==t.lens.find("img").length&&t.lens.append(i("<img />",{src:n.attr("src")})),u=!0,t.softFocus.fadeIn(500)),u||t.lens.css("opacity",t.options.lensOpacity),"inside"!==t.options.position&&t.lens.fadeIn(500),void t.zw._controlLoop()}})}},_controlLoop:function(){var t=this;if(this.lens){var i=this.mx-this.zoomImage.offset().left-.5*this.cw>>0,o=this.my-this.zoomImage.offset().top-.5*this.ch>>0;i<0?i=0:i>this.zoomImage.outerWidth()-this.cw&&(i=this.zoomImage.outerWidth()-this.cw),o<0?o=0:o>this.zoomImage.outerHeight()-this.ch&&(o=this.zoomImage.outerHeight()-this.ch),this.lens.css({left:i-2,top:o-1}),this.lens.find("img").css({width:this.zoomImage.outerWidth(),height:this.zoomImage.outerHeight(),marginLeft:-i+"px ",marginTop:-o+"px"}),this.IMG_zoomImage.width<=1?this.destU=i/this.zoomImage.outerWidth()*this.IMG_zoomImage.naturalWidth>>0:this.destU=i/this.zoomImage.outerWidth()*this.IMG_zoomImage.width>>0,this.IMG_zoomImage.height<=1?this.destV=o/this.zoomImage.outerHeight()*this.IMG_zoomImage.naturalHeight>>0:this.destV=o/this.zoomImage.outerHeight()*this.IMG_zoomImage.height>>0,this.currU+=(this.destU-this.currU)/this.options.smoothMove,this.currV+=(this.destV-this.currV)/this.options.smoothMove,this.zoomDiv.css("background-position",-(this.currU>>0)+"px "+-(this.currV>>0)+"px")}this.controlTimer=setTimeout(function(){t._controlLoop()},30)},_onLeave:function(){this.options.onLeave(),this.zoomDiv&&(this.zoomDiv.remove(),this.zoomDiv=null),this._removeElements()},_removeElements:function(){this.lens&&(this.lens.remove(),this.lens=null),this.tint&&(this.tint.remove(),this.tint=null),this.softFocus&&(this.softFocus.remove(),this.softFocus=null),this.element.find(".yith_magnifier_loading").length>0&&this.element.find(".yith_magnifier_loading").remove()},_isPhone:function(){var t=navigator.userAgent.toLowerCase();return t.match(/iphone/i)||t.match(/ipod/i)||t.match(/android/i)},destroy:function(){this.zoom&&this.zoom.unwrap(),this.mouseTrap&&(this.mouseTrap.unbind(),this.mouseTrap.remove(),this.mouseTrap=null),this.zoomDiv&&(this.zoomDiv.remove(),this.zoomDiv=null),this.options.disableRightClick&&i(document).unbind(),this._removeElements(),this.options.elements.gallery.unbind(),this.element.removeData("yith_magnifier")}},i.fn.yith_magnifier=function(t){if("string"==typeof t){var o=Array.prototype.slice.call(arguments,1);this.each(function(){var e=i.data(this,"yith_magnifier");e?i.isFunction(e[t])&&"_"!==t.charAt(0)?e[t].apply(e,o):i.error("no such method '"+t+"' for yith_magnifier instance"):i.error("cannot call methods on yith_magnifier prior to initialization; attempted to call method '"+t+"'")})}else this.each(function(){i.data(this,"yith_magnifier")?i.error("yith_magnifier already istantiated."):i.data(this,"yith_magnifier",new i.yith_magnifier(t,this))});return this}}(window,jQuery);
|
init.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-zoom-magnifier
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 3.3.0
|
12 |
-
* WC tested up to: 4.
|
13 |
**/
|
14 |
|
15 |
/* Copyright 2013-2018 Your Inspiration Themes (email : plugins@yithemes.com)
|
@@ -78,8 +78,8 @@ register_activation_hook ( __FILE__, 'yith_plugin_registration_hook' );
|
|
78 |
|
79 |
defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
|
80 |
defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
|
81 |
-
defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.
|
82 |
-
defined ( 'YITH_YWZM_JS_VERSION' ) || define ( 'YITH_YWZM_JS_VERSION', '1.3.
|
83 |
|
84 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
85 |
defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
|
3 |
* Plugin Name: YITH WooCommerce Zoom Magnifier
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Zoom Magnifier</strong></code> allows you to add a zoom effect to product images and a thumbnail slider for the product image gallery. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 1.3.19
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-zoom-magnifier
|
10 |
* Domain Path: /languages/
|
11 |
* WC requires at least: 3.3.0
|
12 |
+
* WC tested up to: 4.6
|
13 |
**/
|
14 |
|
15 |
/* Copyright 2013-2018 Your Inspiration Themes (email : plugins@yithemes.com)
|
78 |
|
79 |
defined ( 'YITH_YWZM_FREE_INIT' ) || define ( 'YITH_YWZM_FREE_INIT', plugin_basename ( __FILE__ ) );
|
80 |
defined ( 'YITH_YWZM_SLUG' ) || define ( 'YITH_YWZM_SLUG', 'yith-woocommerce-zoom-magnifier' );
|
81 |
+
defined ( 'YITH_YWZM_VERSION' ) || define ( 'YITH_YWZM_VERSION', '1.3.19' );
|
82 |
+
defined ( 'YITH_YWZM_JS_VERSION' ) || define ( 'YITH_YWZM_JS_VERSION', '1.3.19' );
|
83 |
|
84 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
85 |
defined ( 'YITH_YWZM_DIR' ) || define ( 'YITH_YWZM_DIR', plugin_dir_path ( __FILE__ ) );
|
plugin-fw/.gitignore
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
# OS X metadata
|
2 |
-
.DS_Store
|
3 |
-
|
4 |
-
# Editors
|
5 |
-
.idea/
|
6 |
-
settings.json
|
7 |
-
.vscode
|
8 |
-
|
9 |
-
# Node
|
10 |
-
node_modules/
|
11 |
-
package-lock.json
|
12 |
-
|
13 |
-
# Composer
|
14 |
-
vendor/
|
15 |
-
composer.lock
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -41,15 +41,15 @@
|
|
41 |
|
42 |
/* Colorpicker */
|
43 |
$colorpicker.wpColorPicker( {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
|
55 |
$colorpicker.each( function () {
|
@@ -64,15 +64,15 @@
|
|
64 |
|
65 |
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
66 |
var button = $( '<span/>' ).attr( {
|
67 |
-
|
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 |
-
|
75 |
-
|
76 |
wrap2.find( '.wp-picker-default' ).wrap( button );
|
77 |
}
|
78 |
} );
|
@@ -84,7 +84,7 @@
|
|
84 |
// preview
|
85 |
$upload.imgUrl.change( function () {
|
86 |
var url = $( this ).val(),
|
87 |
-
|
88 |
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
89 |
|
90 |
if ( preview.length < 1 ) {
|
@@ -103,7 +103,7 @@
|
|
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 ) {
|
@@ -114,27 +114,27 @@
|
|
114 |
var custom_uploader_states = [
|
115 |
// Main states.
|
116 |
new wp.media.controller.Library( {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
];
|
124 |
|
125 |
// Create the media frame.
|
126 |
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
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 () {
|
@@ -154,8 +154,8 @@
|
|
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 );
|
@@ -178,19 +178,19 @@
|
|
178 |
|
179 |
// Create the media frame.
|
180 |
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
|
195 |
// When an image is selected, run a callback.
|
196 |
image_gallery_frame.on( 'select', function () {
|
@@ -215,30 +215,30 @@
|
|
215 |
$imageGallery.sliderWrapper.each( function () {
|
216 |
var $t = $( this );
|
217 |
$t.sortable( {
|
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 |
// Remove images
|
@@ -304,23 +304,23 @@
|
|
304 |
labels = $( this ).data( 'labels' );
|
305 |
|
306 |
$( this ).slider( {
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
} );
|
325 |
|
326 |
/* codemirror */
|
@@ -459,29 +459,29 @@
|
|
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 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
} else {
|
468 |
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
469 |
}
|
470 |
|
471 |
$.ajax( {
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
};
|
486 |
|
487 |
$.fn.serializeToggleElement = function () {
|
@@ -696,22 +696,22 @@
|
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
|
704 |
-
|
705 |
-
|
706 |
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
|
714 |
-
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
@@ -732,70 +732,70 @@
|
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
|
801 |
} )( jQuery );
|
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 () {
|
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 |
} );
|
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 ) {
|
103 |
|
104 |
var t = $( this ),
|
105 |
custom_uploader,
|
106 |
+
id = t.attr( 'id' ).replace( /-button$/, '' ).replace(/(\[|\])/g, '\\$1');
|
107 |
|
108 |
//If the uploader object has already been created, reopen the dialog
|
109 |
if ( custom_uploader ) {
|
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 () {
|
154 |
|
155 |
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
156 |
var t = $( this ),
|
157 |
+
id = t.attr( 'id' ).replace(/(\[|\])/g, '\\$1'),
|
158 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ).replace(/(\[|\])/g, '\\$1'),
|
159 |
default_value = $( '#' + id ).data( 'default' );
|
160 |
|
161 |
$( "#" + input_id ).val( default_value );
|
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 () {
|
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
|
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 */
|
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 () {
|
696 |
toggle.saveToggleElement();
|
697 |
} );
|
698 |
|
699 |
+
// Radio
|
700 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
701 |
+
var _radioContainer = $( this ).closest( '.yith-plugin-fw-radio' ),
|
702 |
+
_value = $( this ).val();
|
703 |
|
704 |
+
_radioContainer.val( _value ).data( 'value', _value ).trigger( 'change' );
|
705 |
+
} );
|
706 |
|
707 |
+
$( document.body ).on( 'yith-plugin-fw-init-radio', function () {
|
708 |
+
$( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
|
709 |
+
$( this ).val( $( this ).data( 'value' ) );
|
710 |
+
$( this ).addClass( 'yith-plugin-fw-radio--initialized' );
|
711 |
+
} );
|
712 |
+
} ).trigger( 'yith-plugin-fw-init-radio' );
|
713 |
|
714 |
+
// Password Eye field
|
715 |
$( document ).on( 'click', '.yith-password-eye', function () {
|
716 |
var $this = $( this ),
|
717 |
inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
|
732 |
$( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
|
733 |
}
|
734 |
} );
|
735 |
+
/**
|
736 |
+
* Dimensions
|
737 |
+
*/
|
738 |
+
var fw_dimensions = {
|
739 |
+
selectors : {
|
740 |
+
wrapper : '.yith-plugin-fw-dimensions',
|
741 |
+
units : {
|
742 |
+
wrapper : '.yith-plugin-fw-dimensions__units',
|
743 |
+
single : '.yith-plugin-fw-dimensions__unit',
|
744 |
+
value : '.yith-plugin-fw-dimensions__unit__value',
|
745 |
+
selectedClass: 'yith-plugin-fw-dimensions__unit--selected'
|
746 |
+
},
|
747 |
+
linked : {
|
748 |
+
button : '.yith-plugin-fw-dimensions__linked',
|
749 |
+
value : '.yith-plugin-fw-dimensions__linked__value',
|
750 |
+
wrapperActiveClass: 'yith-plugin-fw-dimensions--linked-active'
|
751 |
+
},
|
752 |
+
dimensions: {
|
753 |
+
number: '.yith-plugin-fw-dimensions__dimension__number'
|
754 |
+
}
|
755 |
+
},
|
756 |
+
init : function () {
|
757 |
+
var self = fw_dimensions;
|
758 |
+
$( document ).on( 'click', self.selectors.units.single, self.unitChange );
|
759 |
+
$( document ).on( 'click', self.selectors.linked.button, self.linkedChange );
|
760 |
+
$( document ).on( 'change keyup', self.selectors.dimensions.number, self.numberChange );
|
761 |
+
},
|
762 |
+
unitChange : function ( e ) {
|
763 |
+
var unit = $( this ).closest( fw_dimensions.selectors.units.single ),
|
764 |
+
wrapper = unit.closest( fw_dimensions.selectors.units.wrapper ),
|
765 |
+
units = wrapper.find( fw_dimensions.selectors.units.single ),
|
766 |
+
valueField = wrapper.find( fw_dimensions.selectors.units.value ).first(),
|
767 |
+
value = unit.data( 'value' );
|
768 |
+
|
769 |
+
units.removeClass( fw_dimensions.selectors.units.selectedClass );
|
770 |
+
unit.addClass( fw_dimensions.selectors.units.selectedClass );
|
771 |
+
valueField.val( value );
|
772 |
+
},
|
773 |
+
linkedChange: function () {
|
774 |
+
var button = $( this ).closest( fw_dimensions.selectors.linked.button ),
|
775 |
+
mainWrapper = button.closest( fw_dimensions.selectors.wrapper ),
|
776 |
+
valueField = button.find( fw_dimensions.selectors.linked.value ),
|
777 |
+
value = valueField.val();
|
778 |
+
|
779 |
+
if ( 'yes' === value ) {
|
780 |
+
mainWrapper.removeClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
781 |
+
valueField.val( 'no' );
|
782 |
+
} else {
|
783 |
+
mainWrapper.addClass( fw_dimensions.selectors.linked.wrapperActiveClass );
|
784 |
+
valueField.val( 'yes' );
|
785 |
+
|
786 |
+
mainWrapper.find( fw_dimensions.selectors.dimensions.number ).first().trigger( 'change' );
|
787 |
+
}
|
788 |
+
},
|
789 |
+
numberChange: function ( e ) {
|
790 |
+
var number = $( this ).closest( fw_dimensions.selectors.dimensions.number ),
|
791 |
+
mainWrapper = number.closest( fw_dimensions.selectors.wrapper );
|
792 |
+
if ( mainWrapper.hasClass( fw_dimensions.selectors.linked.wrapperActiveClass ) ) {
|
793 |
+
var numbers = mainWrapper.find( fw_dimensions.selectors.dimensions.number );
|
794 |
+
|
795 |
+
numbers.val( number.val() );
|
796 |
+
}
|
797 |
+
}
|
798 |
+
};
|
799 |
+
fw_dimensions.init();
|
800 |
|
801 |
} )( jQuery );
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(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).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
1 |
+
!function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-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$/,"").replace(/(\[|\])/g,"\\$1");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id").replace(/(\[|\])/g,"\\$1"),l=i.attr("id").replace(/-button-reset$/,"").replace(/(\[|\])/g,"\\$1"),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i).trigger("yith_select_images_value_changed"),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){var t=e(this).closest(".yith-plugin-fw-radio"),i=e(this).val();t.val(i).data("value",i).trigger("change")}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).data("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.js
CHANGED
@@ -1,211 +1,211 @@
|
|
1 |
-
(function ($) {
|
2 |
-
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
-
var __ = wp.i18n.__,
|
4 |
-
el = wp.element.createElement,
|
5 |
-
Fragment = wp.element.Fragment,
|
6 |
-
PanelBody = wp.components.PanelBody,
|
7 |
-
registerBlockType = wp.blocks.registerBlockType,
|
8 |
-
RichText = wp.editor.RichText,
|
9 |
-
BlockControls = wp.editor.BlockControls,
|
10 |
-
InspectorControls = wp.editor.InspectorControls,
|
11 |
-
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
-
Components = wp.components,
|
13 |
-
RawHTML = wp.element.RawHTML,
|
14 |
-
SelectControl = wp.components.SelectControl,
|
15 |
-
ToggleControl = wp.components.ToggleControl,
|
16 |
-
CheckboxControl = wp.components.CheckboxControl,
|
17 |
-
RangeControl = wp.components.RangeControl,
|
18 |
-
ColorPicker = wp.components.ColorPicker,
|
19 |
-
RadioControl = wp.components.RadioControl,
|
20 |
-
TextControl = wp.components.TextControl,
|
21 |
-
TextareaControl = wp.components.TextareaControl;
|
22 |
-
|
23 |
-
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
-
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
-
);
|
26 |
-
|
27 |
-
function create_shortcode(sc_args, props, callback) {
|
28 |
-
var gt_block = '',
|
29 |
-
gutenberg_preview = '';
|
30 |
-
|
31 |
-
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
-
gt_block = $[props.callback](sc_args, props);
|
33 |
-
}
|
34 |
-
|
35 |
-
else {
|
36 |
-
var sc_name = props.shortcode_name,
|
37 |
-
sc = '[' + sc_name,
|
38 |
-
do_shortcode = null;
|
39 |
-
|
40 |
-
|
41 |
-
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
-
if ($v != '
|
43 |
-
sc += ' ' + $v + '=';
|
44 |
-
var arg = props.attributes[$v],
|
45 |
-
remove_quotes = arg.remove_quotes;
|
46 |
-
|
47 |
-
if( remove_quotes == true ){
|
48 |
-
sc += $k;
|
49 |
-
}
|
50 |
-
|
51 |
-
else {
|
52 |
-
sc += '"' + $k + '"';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
});
|
56 |
-
|
57 |
-
sc += ']';
|
58 |
-
|
59 |
-
var block_id = md5(sc);
|
60 |
-
|
61 |
-
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
-
|
63 |
-
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
-
do_shortcode = (function (block_id) {
|
65 |
-
var ajax_call_date = null;
|
66 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
-
$.ajax({
|
68 |
-
async: true,
|
69 |
-
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
-
method: 'post',
|
71 |
-
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
-
success: function (data) {
|
73 |
-
ajax_call_date = data;
|
74 |
-
if (ajax_call_date != '') {
|
75 |
-
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
-
}
|
78 |
-
}
|
79 |
-
});
|
80 |
-
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
-
return ajax_call_date;
|
82 |
-
})(block_id);
|
83 |
-
}
|
84 |
-
|
85 |
-
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
-
}
|
87 |
-
|
88 |
-
return gt_block;
|
89 |
-
}
|
90 |
-
|
91 |
-
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
-
var attributes = {};
|
93 |
-
|
94 |
-
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
-
new_value = new_value.hex;
|
96 |
-
}
|
97 |
-
|
98 |
-
attributes[attribute_name] = new_value;
|
99 |
-
args.setAttributes(attributes);
|
100 |
-
return args;
|
101 |
-
}
|
102 |
-
|
103 |
-
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
-
registerBlockType("yith/" + $block, {
|
105 |
-
title: $props.title,
|
106 |
-
description: $props.description,
|
107 |
-
category: $props.category,
|
108 |
-
attributes: $props.attributes,
|
109 |
-
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
-
keywords: $props.keywords,
|
111 |
-
edit: function edit(args) {
|
112 |
-
var elements = new Array();
|
113 |
-
|
114 |
-
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
-
var ComponentControl = null,
|
116 |
-
block_type = $attribute_args.blocktype;
|
117 |
-
if (typeof block_type != 'undefined') {
|
118 |
-
switch (block_type) {
|
119 |
-
case 'select':
|
120 |
-
ComponentControl = SelectControl;
|
121 |
-
break;
|
122 |
-
|
123 |
-
case 'text':
|
124 |
-
ComponentControl = TextControl;
|
125 |
-
break;
|
126 |
-
|
127 |
-
case 'textarea':
|
128 |
-
ComponentControl = TextareaControl;
|
129 |
-
break;
|
130 |
-
|
131 |
-
case 'toggle':
|
132 |
-
ComponentControl = ToggleControl;
|
133 |
-
break;
|
134 |
-
|
135 |
-
case 'checkbox':
|
136 |
-
ComponentControl = CheckboxControl;
|
137 |
-
break;
|
138 |
-
|
139 |
-
case 'number':
|
140 |
-
case 'range':
|
141 |
-
ComponentControl = RangeControl;
|
142 |
-
break;
|
143 |
-
|
144 |
-
case 'color':
|
145 |
-
case 'colorpicker':
|
146 |
-
ComponentControl = ColorPicker;
|
147 |
-
break;
|
148 |
-
|
149 |
-
case 'radio':
|
150 |
-
ComponentControl = RadioControl;
|
151 |
-
break;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (ComponentControl != null) {
|
155 |
-
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
-
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
-
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
-
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
-
}
|
160 |
-
|
161 |
-
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
-
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
-
}
|
164 |
-
|
165 |
-
elements.push(
|
166 |
-
el(
|
167 |
-
ComponentControl,
|
168 |
-
{
|
169 |
-
value: args.attributes[$attribute_name],
|
170 |
-
options: $attribute_args.options,
|
171 |
-
label: $attribute_args.label,
|
172 |
-
checked: args.attributes[$attribute_name],
|
173 |
-
selected: args.attributes[$attribute_name],
|
174 |
-
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
-
disableAlpha: $attribute_args.disableAlpha,
|
176 |
-
min: $attribute_args.min,
|
177 |
-
max: $attribute_args.max,
|
178 |
-
multiple: $attribute_args.multiple,
|
179 |
-
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
-
},
|
182 |
-
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
-
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
-
},
|
185 |
-
},
|
186 |
-
)
|
187 |
-
);
|
188 |
-
}
|
189 |
-
}
|
190 |
-
});
|
191 |
-
|
192 |
-
sc = create_shortcode(args, $props, 'edit');
|
193 |
-
|
194 |
-
return [
|
195 |
-
el(
|
196 |
-
Fragment,
|
197 |
-
null,
|
198 |
-
el(
|
199 |
-
InspectorControls,
|
200 |
-
null,
|
201 |
-
elements,
|
202 |
-
),
|
203 |
-
sc,
|
204 |
-
)];
|
205 |
-
},
|
206 |
-
save: function save(args) {
|
207 |
-
return create_shortcode(args, $props, 'save');
|
208 |
-
}
|
209 |
-
});
|
210 |
-
});
|
211 |
-
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
// Get registerBlockType() from wp.blocks in the global scope
|
3 |
+
var __ = wp.i18n.__,
|
4 |
+
el = wp.element.createElement,
|
5 |
+
Fragment = wp.element.Fragment,
|
6 |
+
PanelBody = wp.components.PanelBody,
|
7 |
+
registerBlockType = wp.blocks.registerBlockType,
|
8 |
+
RichText = wp.editor.RichText,
|
9 |
+
BlockControls = wp.editor.BlockControls,
|
10 |
+
InspectorControls = wp.editor.InspectorControls,
|
11 |
+
AlignmentToolbar = wp.editor.AlignmentToolbar,
|
12 |
+
Components = wp.components,
|
13 |
+
RawHTML = wp.element.RawHTML,
|
14 |
+
SelectControl = wp.components.SelectControl,
|
15 |
+
ToggleControl = wp.components.ToggleControl,
|
16 |
+
CheckboxControl = wp.components.CheckboxControl,
|
17 |
+
RangeControl = wp.components.RangeControl,
|
18 |
+
ColorPicker = wp.components.ColorPicker,
|
19 |
+
RadioControl = wp.components.RadioControl,
|
20 |
+
TextControl = wp.components.TextControl,
|
21 |
+
TextareaControl = wp.components.TextareaControl;
|
22 |
+
|
23 |
+
const yith_icon = el('svg', {width: 22, height: 22},
|
24 |
+
el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
|
25 |
+
);
|
26 |
+
|
27 |
+
function create_shortcode(sc_args, props, callback) {
|
28 |
+
var gt_block = '',
|
29 |
+
gutenberg_preview = '';
|
30 |
+
|
31 |
+
if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
|
32 |
+
gt_block = $[props.callback](sc_args, props);
|
33 |
+
}
|
34 |
+
|
35 |
+
else {
|
36 |
+
var sc_name = props.shortcode_name,
|
37 |
+
sc = '[' + sc_name,
|
38 |
+
do_shortcode = null;
|
39 |
+
|
40 |
+
|
41 |
+
$.each(sc_args.attributes, function ($v, $k) {
|
42 |
+
if ( typeof props.attributes != 'undefined' && typeof props.attributes[$v] != 'undefined' ) {
|
43 |
+
sc += ' ' + $v + '=';
|
44 |
+
var arg = props.attributes[$v],
|
45 |
+
remove_quotes = arg.remove_quotes;
|
46 |
+
|
47 |
+
if( remove_quotes == true ){
|
48 |
+
sc += $k;
|
49 |
+
}
|
50 |
+
|
51 |
+
else {
|
52 |
+
sc += '"' + $k + '"';
|
53 |
+
}
|
54 |
+
}
|
55 |
+
});
|
56 |
+
|
57 |
+
sc += ']';
|
58 |
+
|
59 |
+
var block_id = md5(sc);
|
60 |
+
|
61 |
+
gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
|
62 |
+
|
63 |
+
if (callback == 'edit' && props.do_shortcode != false) {
|
64 |
+
do_shortcode = (function (block_id) {
|
65 |
+
var ajax_call_date = null;
|
66 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
|
67 |
+
$.ajax({
|
68 |
+
async: true,
|
69 |
+
url: yith_gutenberg_ajax.ajaxurl,
|
70 |
+
method: 'post',
|
71 |
+
data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
|
72 |
+
success: function (data) {
|
73 |
+
ajax_call_date = data;
|
74 |
+
if (ajax_call_date != '') {
|
75 |
+
$('.yith_block_' + block_id).html(ajax_call_date);
|
76 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
});
|
80 |
+
$(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
|
81 |
+
return ajax_call_date;
|
82 |
+
})(block_id);
|
83 |
+
}
|
84 |
+
|
85 |
+
gt_block = el(RawHTML, null, gutenberg_preview);
|
86 |
+
}
|
87 |
+
|
88 |
+
return gt_block;
|
89 |
+
}
|
90 |
+
|
91 |
+
function onChangeEvent(new_value, attribute_name, args, block_type) {
|
92 |
+
var attributes = {};
|
93 |
+
|
94 |
+
if (block_type == 'colorpicker' || block_type == 'color') {
|
95 |
+
new_value = new_value.hex;
|
96 |
+
}
|
97 |
+
|
98 |
+
attributes[attribute_name] = new_value;
|
99 |
+
args.setAttributes(attributes);
|
100 |
+
return args;
|
101 |
+
}
|
102 |
+
|
103 |
+
$.each(yith_gutenberg, function ($block, $props) {
|
104 |
+
registerBlockType("yith/" + $block, {
|
105 |
+
title: $props.title,
|
106 |
+
description: $props.description,
|
107 |
+
category: $props.category,
|
108 |
+
attributes: $props.attributes,
|
109 |
+
icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
|
110 |
+
keywords: $props.keywords,
|
111 |
+
edit: function edit(args) {
|
112 |
+
var elements = new Array();
|
113 |
+
|
114 |
+
$.each($props.attributes, function ($attribute_name, $attribute_args) {
|
115 |
+
var ComponentControl = null,
|
116 |
+
block_type = $attribute_args.blocktype;
|
117 |
+
if (typeof block_type != 'undefined') {
|
118 |
+
switch (block_type) {
|
119 |
+
case 'select':
|
120 |
+
ComponentControl = SelectControl;
|
121 |
+
break;
|
122 |
+
|
123 |
+
case 'text':
|
124 |
+
ComponentControl = TextControl;
|
125 |
+
break;
|
126 |
+
|
127 |
+
case 'textarea':
|
128 |
+
ComponentControl = TextareaControl;
|
129 |
+
break;
|
130 |
+
|
131 |
+
case 'toggle':
|
132 |
+
ComponentControl = ToggleControl;
|
133 |
+
break;
|
134 |
+
|
135 |
+
case 'checkbox':
|
136 |
+
ComponentControl = CheckboxControl;
|
137 |
+
break;
|
138 |
+
|
139 |
+
case 'number':
|
140 |
+
case 'range':
|
141 |
+
ComponentControl = RangeControl;
|
142 |
+
break;
|
143 |
+
|
144 |
+
case 'color':
|
145 |
+
case 'colorpicker':
|
146 |
+
ComponentControl = ColorPicker;
|
147 |
+
break;
|
148 |
+
|
149 |
+
case 'radio':
|
150 |
+
ComponentControl = RadioControl;
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
|
154 |
+
if (ComponentControl != null) {
|
155 |
+
var helpMessageChecked = helpMessageUncheked = '';
|
156 |
+
if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
|
157 |
+
helpMessageChecked = $attribute_args.helps.checked;
|
158 |
+
helpMessageUncheked = $attribute_args.helps.unchecked;
|
159 |
+
}
|
160 |
+
|
161 |
+
else if (typeof $attribute_args.help != 'undefined') {
|
162 |
+
helpMessageChecked = helpMessageUncheked = $attribute_args.help;
|
163 |
+
}
|
164 |
+
|
165 |
+
elements.push(
|
166 |
+
el(
|
167 |
+
ComponentControl,
|
168 |
+
{
|
169 |
+
value: args.attributes[$attribute_name],
|
170 |
+
options: $attribute_args.options,
|
171 |
+
label: $attribute_args.label,
|
172 |
+
checked: args.attributes[$attribute_name],
|
173 |
+
selected: args.attributes[$attribute_name],
|
174 |
+
help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
|
175 |
+
disableAlpha: $attribute_args.disableAlpha,
|
176 |
+
min: $attribute_args.min,
|
177 |
+
max: $attribute_args.max,
|
178 |
+
multiple: $attribute_args.multiple,
|
179 |
+
onChange: function (new_value, attribute_name = $attribute_name) {
|
180 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
181 |
+
},
|
182 |
+
onChangeComplete: function (new_value, attribute_name = $attribute_name) {
|
183 |
+
args = onChangeEvent(new_value, attribute_name, args, block_type);
|
184 |
+
},
|
185 |
+
},
|
186 |
+
)
|
187 |
+
);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
});
|
191 |
+
|
192 |
+
sc = create_shortcode(args, $props, 'edit');
|
193 |
+
|
194 |
+
return [
|
195 |
+
el(
|
196 |
+
Fragment,
|
197 |
+
null,
|
198 |
+
el(
|
199 |
+
InspectorControls,
|
200 |
+
null,
|
201 |
+
elements,
|
202 |
+
),
|
203 |
+
sc,
|
204 |
+
)];
|
205 |
+
},
|
206 |
+
save: function save(args) {
|
207 |
+
return create_shortcode(args, $props, 'save');
|
208 |
+
}
|
209 |
+
});
|
210 |
+
});
|
211 |
+
})(jQuery);
|
plugin-fw/assets/js/yith-gutenberg.min.js
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(h){function q(g,b,e){var f="";f="";if("undefined"!=typeof b.callback&&"function"==typeof h[b.callback])f=h[b.callback](g,b);else{var c="["+b.shortcode_name;h.each(g.attributes,function(a,d){"undefined"!=typeof b.attributes&&"undefined"!=typeof b.attributes[a]&&(c+=" "+a+"=",c=1==b.attributes[a].remove_quotes?c+d:c+('"'+d+'"'))});c+="]";g=md5(c);f='<span class="yith_block_'+g+'">'+c+"</span>";"edit"==e&&0!=b.do_shortcode&&function(a){var d=null;h(document).trigger("yith_plugin_fw_gutenberg_before_do_shortcode",
|
2 |
+
[c,a]);h.ajax({async:!0,url:yith_gutenberg_ajax.ajaxurl,method:"post",data:{action:"yith_plugin_fw_gutenberg_do_shortcode",shortcode:c},success:function(l){d=l;""!=d&&(h(".yith_block_"+a).html(d),h(document).trigger("yith_plugin_fw_gutenberg_success_do_shortcode",[c,a,d]))}});h(document).trigger("yith_plugin_fw_gutenberg_after_do_shortcode",[c,a,d]);return d}(g);f=m(t,null,f)}return f}function r(g,b,e,f){var c={};if("colorpicker"==f||"color"==f)g=g.hex;c[b]=g;e.setAttributes(c);return e}var m=wp.element.createElement,
|
3 |
+
u=wp.element.Fragment,v=wp.blocks.registerBlockType,w=wp.editor.InspectorControls,t=wp.element.RawHTML,x=wp.components.SelectControl,y=wp.components.ToggleControl,z=wp.components.CheckboxControl,A=wp.components.RangeControl,B=wp.components.ColorPicker,C=wp.components.RadioControl,D=wp.components.TextControl,E=wp.components.TextareaControl,F=m("svg",{width:22,height:22},m("path",{d:"M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"}));
|
4 |
+
h.each(yith_gutenberg,function(g,b){v("yith/"+g,{title:b.title,description:b.description,category:b.category,attributes:b.attributes,icon:"undefined"!=typeof b.icon?b.icon:F,keywords:b.keywords,edit:function(e){var f=[];h.each(b.attributes,function(c,a){var d=null,l=a.blocktype;if("undefined"!=typeof l){switch(l){case "select":d=x;break;case "text":d=D;break;case "textarea":d=E;break;case "toggle":d=y;break;case "checkbox":d=z;break;case "number":case "range":d=A;break;case "color":case "colorpicker":d=
|
5 |
+
B;break;case "radio":d=C}if(null!=d){var n=helpMessageUncheked="";"undefined"!=typeof a.helps&&"undefined"!=typeof a.helps.checked&&"undefined"!=typeof a.helps.unchecked?(n=a.helps.checked,helpMessageUncheked=a.helps.unchecked):"undefined"!=typeof a.help&&(n=helpMessageUncheked=a.help);f.push(m(d,{value:e.attributes[c],options:a.options,label:a.label,checked:e.attributes[c],selected:e.attributes[c],help:e.attributes[c]?n:helpMessageUncheked,disableAlpha:a.disableAlpha,min:a.min,max:a.max,multiple:a.multiple,
|
6 |
+
onChange:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)},onChangeComplete:function(p,k){k=void 0===k?c:k;e=r(p,k,e,l)}}))}}});sc=q(e,b,"edit");return[m(u,null,m(w,null,f),sc)]},save:function(e){return q(e,b,"save")}})})})(jQuery);
|
plugin-fw/init.php
CHANGED
@@ -1,7 +1,7 @@
|
|
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/
|
1 |
<?php
|
2 |
/**
|
3 |
* Framework Name: YIT Plugin Framework
|
4 |
+
* Version: 3.4.31
|
5 |
* Author: YITH
|
6 |
* Text Domain: yith-plugin-fw
|
7 |
* Domain Path: /languages/
|