Version Description
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Zoom Magnifier |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.0 to 2.4.0
- assets/js/yith_magnifier.js +4 -1
- assets/js/yith_magnifier.min.js +1 -1
- init.php +4 -4
- languages/yith-woocommerce-zoom-magnifier.pot +4 -4
- lib/class.yith-wcmg-frontend.php +6 -0
- lib/class.yith-ywzm-plugin-fw-loader.php +1 -1
- license.txt +1 -1
- plugin-fw/templates/fields/list-table.php +2 -2
- readme.txt +6 -1
assets/js/yith_magnifier.js
CHANGED
@@ -249,7 +249,10 @@
|
|
249 |
'click',
|
250 |
function (e) {
|
251 |
e.preventDefault();
|
252 |
-
|
|
|
|
|
|
|
253 |
|
254 |
if ( $( '#yith_wczm_traffic_light' ).val() == 'free' ) {
|
255 |
|
249 |
'click',
|
250 |
function (e) {
|
251 |
e.preventDefault();
|
252 |
+
|
253 |
+
if ( yith_wc_zoom_magnifier_storage_object.stop_immediate_propagation ){
|
254 |
+
e.stopImmediatePropagation();
|
255 |
+
}
|
256 |
|
257 |
if ( $( '#yith_wczm_traffic_light' ).val() == 'free' ) {
|
258 |
|
assets/js/yith_magnifier.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(g,i){"use strict";var u,p;g.fn.imagesLoaded===i&&(u=jQuery,p="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",u.fn.imagesLoaded=function(e){var o=this,n=u.isFunction(u.Deferred)?u.Deferred():0,a=u.isFunction(n.notify),s=o.find("img").add(o.filter("img")),r=[],h=[],m=[];function l(){var t=u(h),i=u(m);n&&(m.length?n.reject(s,t,i):n.resolve(s)),u.isFunction(e)&&e.call(o,s,t,i)}function c(t){d(t.target,"error"===t.type)}function d(t,i){t.src!==p&&-1===u.inArray(t,r)&&(r.push(t),(i?m:h).push(t),u.data(t,"imagesLoaded",{isBroken:i,src:t.src}),a&&n.notifyWith(u(t),[i,s,u(h),u(m)]),s.length===r.length&&(setTimeout(l),s.unbind(".imagesLoaded",c)))}return u.isPlainObject(e)&&u.each(e,function(t,i){"callback"===t?e=i:n&&n[t](i)}),s.length?s.bind("load.imagesLoaded error.imagesLoaded",c).each(function(t,i){var e=i.src,o=u.data(i,"imagesLoaded");o&&o.src===e?d(i,o.isBroken):i.complete&&void 0!==i.naturalWidth?d(i,0===i.naturalWidth||0===i.naturalHeight):(i.readyState||i.complete)&&(i.src=p,i.src=e)}):l(),n?n.promise(o):o}),g.yith_magnifier=function(t,i){this.t=i,this.element=g(i),this._init(t)},g.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:g(".yith_magnifier_zoom"),zoomImage:g(".yith_magnifier_zoom img").first(),gallery:g(".yith_magnifier_gallery li a")}},g.yith_magnifier.prototype={_init:function(t){var e=this;g(document).trigger("yith_magnifier_before_init"),g.each(g.yith_magnifier.defaults.elements,function(t,i){g.yith_magnifier.defaults.elements[t]=g(i,e)}),e.options=g.extend(!0,{},g.yith_magnifier.defaults,t),e.isPhone=e._isPhone(),e._loading(),e.options.onLoad(),e._initZoom(),e._initGallery(),g(document).trigger("yith_magnifier_after_init")},_initGallery:function(){var i=this,t=i.options.elements,e=t.gallery,o=t.zoom,n=t.zoomImage;0<e.length?(e.on("click",function(t){t.preventDefault(),t.stopImmediatePropagation(),"free"==g("#yith_wczm_traffic_light").val()&&(g(".yith_magnifier_gallery .yith_magnifier_thumbnail.active-thumbnail").removeClass("active-thumbnail"),g(".yith_magnifier_gallery .yith_magnifier_thumbnail.active-thumbnail").addClass("inactive-thumbnail"),g(this).removeClass("inactive-thumbnail"),g(this).addClass("active-thumbnail"),g(this).parent().removeClass("inactive-thumbnail"),g(this).parent().addClass("active-thumbnail"),i.options.from_gallery="yes",t=g(this),i.destroy(),o.attr("href",this.href),n.attr("src",t.data("small")).attr("srcset",t.data("small")).attr("src-orig",t.data("small")).attr("title","").attr("title",t.attr("title")),g.data(i.t,"yith_magnifier",new g.yith_magnifier(i.options,i.element)))}),i.options.enableSlider&&e.closest("ul").trigger("yith_magnifier_slider_destroy")):e.on("click",function(t){return t.preventDefault(),!1})},_loading:function(){var t;this.options.disableRightClick&&g(document).on("contextmenu",function(t){return!1}),this.mouseTrap===i&&(t=this.options.elements.zoom.width(),this.options.loadingLabel&&g('<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"==g("#yith_wczm_traffic_light").val()){g("#yith_wczm_traffic_light").val("blocked");var i=this;i.zoom=i.options.elements.zoom,i.zoomImage=i.options.elements.zoomImage;var t="yith_magnifier_zoom_wrap";if(i.options.zoom_wrap_additional_css){if(g("."+t).length)return;t+=" "+i.options.zoom_wrap_additional_css}i.zoom.wrap('<div class="'+t+'"></div>'),i.IMG_zoomImage=new Image;t=g(".woocommerce-variation-add-to-cart .variation_id").val();g.isNumeric(t)&&0!=t&&"no"==i.options.from_gallery?g.ajax({data:{action:"yith_wc_zoom_magnifier_get_main_image",product_id:t,context:"frontend"},url:yith_wc_zoom_magnifier_storage_object.ajax_url,type:"post",error:function(t){console.log("ERROR - Yith_WC_Zoom_Magnifier"),console.log(t),g("#yith_wczm_traffic_light").val("free")},success:function(t){i.zoom.attr("href",t.url),i.IMG_zoomImage.src=t.url,i.IMG_smallImage=new Image,i.IMG_smallImage.src=i.zoomImage.attr("src"),t.gallery&&(g(".yith_magnifier_gallery").length?g(".yith_magnifier_gallery").closest(".thumbnails").replaceWith(t.gallery):g(".images").append(t.gallery),i.options.elements.gallery=g(".yith_magnifier_gallery li a")),g.browser&&g.browser.msie&&8==g.browser.version?g(i.IMG_zoomImage).load(function(){i._initGallery(),i._initTrap()}):g([i.IMG_zoomImage,i.IMG_smallImage]).imagesLoaded(function(){i._initGallery(),i._initTrap()}),g(document).on("click","a.yith_expand",function(t){t.preventDefault(),g().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){g(".yith_expand").css("display","inline")}}),g.prettyPhoto.open(i.zoom[0].href,"",""),g(".yith_expand").css("display","none"),g(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),g(document).trigger("yith_magnifier_after_init_zoom"),g("#yith_wczm_traffic_light").val("free")}}):(i.IMG_zoomImage.src=i.zoom.attr("href"),i.IMG_smallImage=new Image,i.IMG_smallImage.src=i.zoomImage.attr("src"),g.browser&&g.browser.msie&&8==g.browser.version?g(i.IMG_zoomImage).load(function(){i._initTrap()}):g([i.IMG_zoomImage,i.IMG_smallImage]).imagesLoaded(function(){i._initTrap()}),g(document).on("click","a.yith_expand",function(t){t.preventDefault(),g().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){g(".yith_expand").css("display","inline")}}),g.prettyPhoto.open(i.zoom[0].href,"",""),g(".yith_expand").css("display","none"),g(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),g(document).trigger("yith_magnifier_after_init_zoom"),g("#yith_wczm_traffic_light").val("free"))}},_initTrap:function(){var h=this,m=h.IMG_zoomImage;h.IMG_smallImage;h.mx=0,h.my=0,h.controlTimer=0,h.lens=null,h.tint=null,h.softFocus=null,h.zoomDiv=null,h.cw=0,h.ch=0,h.zw=0,h.destU=0,h.destV=0,h.currU=0,h.currV=0,h.mouseTrap=null;var l,c=h.options.elements.zoom,d=h.options.elements.zoomImage;g(".yith_magnifier_loading").remove(),this.element.find(".yith_magnifier_mousetrap")&&this.element.find(".yith_magnifier_mousetrap").remove(),this.mouseTrap=g('<div class="yith_magnifier_mousetrap pp_woocommerce" />').css({width:yith_wc_zoom_magnifier_storage_object.mouse_trap_width,height:yith_wc_zoom_magnifier_storage_object.mouse_trap_height,top:0,left:0}).appendTo(c.parent()),"undefined"!=typeof ywzm_data&&(g('<a href="#" class="yith_expand" style="display: inline;"></a>').appendTo(this.mouseTrap),g(".expand-button-hidden").clone().appendTo(g(".yith_expand")),g(".yith_magnifier_mousetrap .yith_expand .expand-button-hidden").show()),h.isPhone&&"disable"==h.options.phoneBehavior||(l="ontouchstart"in document.documentElement,this.mouseTrap.on("touchmove mousemove",this,function(t){h.options.onMove(),h.mx=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,h.my=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageY}).on("touchend mouseleave",this,function(t){return clearTimeout(h.controlTimer),h.lens&&h.lens.fadeOut(299),h.tint&&h.tint.fadeOut(299),h.softFocus&&h.softFocus.fadeOut(299),h.zoomDiv.fadeOut(300,function(){h._onLeave()}),!1}).on("touchstart click",this,function(t){h.options.onClick()}).on("touchstart mouseenter",this,function(t){if("free"==g("#yith_wczm_traffic_light").val()){h.options.onEnter(),l&&t.preventDefault(),h.mx=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,h.my=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageY,h.zw=t.data,h.zoomDiv&&(h.zoomDiv.stop(!0,!1),h.zoomDiv.remove());var i=h.options.adjustX,e=h.options.adjustY,o=d.outerWidth(),n=d.outerHeight(),a=h.options.zoomWidth,s=h.options.zoomHeight;"auto"==h.options.zoomWidth&&(a=o),"auto"==h.options.zoomHeight&&(s=n);var r=c.parent();switch(h.options.position){case"top":e-=s;break;case"right":i+=o;break;case"bottom":e+=n;break;case"left":i-=a;break;case"inside":a=o,s=n;break;default:(r=g("#"+h.options.position)).length?(a=r.innerWidth(),s=r.innerHeight()):(r=c,i+=o,e+=n)}h.isPhone&&"inside"==h.options.phoneBehavior&&(a=o,s=n,e=i=0),h.zoomDiv=g('<div class="yith_magnifier_zoom_magnifier" />').css({left:i,top:e,width:a,height:s,"background-repeat":"no-repeat",backgroundImage:"url("+m.src+")"}).appendTo(r),d.attr("title")&&h.options.showTitle&&g('<div class="yith_magnifier_title">'+d.attr("title")+"</div>").appendTo(h.zoomDiv),!h.isPhone||"disable"!=h.options.phoneBehavior?h.zoomDiv.fadeIn(500):h.lens.fadeOut(299),h.lens&&(h.lens.remove(),h.lens=null),m.width<=1?h.cw=d.outerWidth()/m.naturalWidth*h.zoomDiv.width():h.cw=d.outerWidth()/m.width*h.zoomDiv.width(),m.height<=1?h.ch=d.outerHeight()/m.naturalHeight*h.zoomDiv.height():h.ch=d.outerHeight()/m.height*h.zoomDiv.height(),h.lens=g('<div class="yith_magnifier_lens" />').css({width:h.cw,height:h.ch}).appendTo(c);t=!1;h.options.tint&&(h.tint=g("<div />").css({display:"none",position:"absolute",left:0,top:0,width:d.outerWidth(),height:d.outerHeight(),backgroundColor:h.options.tint,opacity:h.options.tintOpacity}).appendTo(c),h.lens.append(g("<img />",{src:d.attr("src")})),t=!0,h.tint.fadeIn(500)),h.options.softFocus&&(h.softFocus=g("<div />").css({position:"absolute",display:"none",top:"1px",left:"1px",width:d.outerWidth(),height:d.outerHeight(),opacity:.5}).appendTo(c),h.softFocus.append(g("<img />",{src:d.attr("src")})),0==h.lens.find("img").length&&h.lens.append(g("<img />",{src:d.attr("src")})),t=!0,h.softFocus.fadeIn(500)),t||h.lens.css("opacity",h.options.lensOpacity),"inside"!==h.options.position&&h.lens.fadeIn(500),h.zw._controlLoop()}}))},_controlLoop:function(){var t,i,e=this;this.lens&&(t=this.mx-this.zoomImage.offset().left-.5*this.cw>>0,i=this.my-this.zoomImage.offset().top-.5*this.ch>>0,t<0?t=0:t>this.zoomImage.outerWidth()-this.cw&&(t=this.zoomImage.outerWidth()-this.cw),i<0?i=0:i>this.zoomImage.outerHeight()-this.ch&&(i=this.zoomImage.outerHeight()-this.ch),this.lens.css({left:t-2,top:i-1}),this.lens.find("img").css({width:this.zoomImage.outerWidth(),height:this.zoomImage.outerHeight(),marginLeft:-t+"px ",marginTop:-i+"px"}),this.IMG_zoomImage.width<=1?this.destU=t/this.zoomImage.outerWidth()*this.IMG_zoomImage.naturalWidth>>0:this.destU=t/this.zoomImage.outerWidth()*this.IMG_zoomImage.width>>0,this.IMG_zoomImage.height<=1?this.destV=i/this.zoomImage.outerHeight()*this.IMG_zoomImage.naturalHeight>>0:this.destV=i/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(){e._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),0<this.element.find(".yith_magnifier_loading").length&&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&&g(document).unbind(),this._removeElements(),this.options.elements.gallery.unbind(),this.element.removeData("yith_magnifier")}},g.fn.yith_magnifier=function(i){var e;return"string"==typeof i?(e=Array.prototype.slice.call(arguments,1),this.each(function(){var t=g.data(this,"yith_magnifier");t?g.isFunction(t[i])&&"_"!==i.charAt(0)?t[i].apply(t,e):g.error("no such method '"+i+"' for yith_magnifier instance"):g.error("cannot call methods on yith_magnifier prior to initialization; attempted to call method '"+i+"'")})):this.each(function(){g.data(this,"yith_magnifier")?g.error("yith_magnifier already istantiated."):g.data(this,"yith_magnifier",new g.yith_magnifier(i,this))}),this}}((window,jQuery));
|
1 |
+
!function(g,i){"use strict";var u,p;g.fn.imagesLoaded===i&&(u=jQuery,p="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",u.fn.imagesLoaded=function(e){var o=this,n=u.isFunction(u.Deferred)?u.Deferred():0,a=u.isFunction(n.notify),s=o.find("img").add(o.filter("img")),r=[],h=[],m=[];function l(){var t=u(h),i=u(m);n&&(m.length?n.reject(s,t,i):n.resolve(s)),u.isFunction(e)&&e.call(o,s,t,i)}function c(t){d(t.target,"error"===t.type)}function d(t,i){t.src!==p&&-1===u.inArray(t,r)&&(r.push(t),(i?m:h).push(t),u.data(t,"imagesLoaded",{isBroken:i,src:t.src}),a&&n.notifyWith(u(t),[i,s,u(h),u(m)]),s.length===r.length&&(setTimeout(l),s.unbind(".imagesLoaded",c)))}return u.isPlainObject(e)&&u.each(e,function(t,i){"callback"===t?e=i:n&&n[t](i)}),s.length?s.bind("load.imagesLoaded error.imagesLoaded",c).each(function(t,i){var e=i.src,o=u.data(i,"imagesLoaded");o&&o.src===e?d(i,o.isBroken):i.complete&&void 0!==i.naturalWidth?d(i,0===i.naturalWidth||0===i.naturalHeight):(i.readyState||i.complete)&&(i.src=p,i.src=e)}):l(),n?n.promise(o):o}),g.yith_magnifier=function(t,i){this.t=i,this.element=g(i),this._init(t)},g.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:g(".yith_magnifier_zoom"),zoomImage:g(".yith_magnifier_zoom img").first(),gallery:g(".yith_magnifier_gallery li a")}},g.yith_magnifier.prototype={_init:function(t){var e=this;g(document).trigger("yith_magnifier_before_init"),g.each(g.yith_magnifier.defaults.elements,function(t,i){g.yith_magnifier.defaults.elements[t]=g(i,e)}),e.options=g.extend(!0,{},g.yith_magnifier.defaults,t),e.isPhone=e._isPhone(),e._loading(),e.options.onLoad(),e._initZoom(),e._initGallery(),g(document).trigger("yith_magnifier_after_init")},_initGallery:function(){var i=this,t=i.options.elements,e=t.gallery,o=t.zoom,n=t.zoomImage;0<e.length?(e.on("click",function(t){t.preventDefault(),yith_wc_zoom_magnifier_storage_object.stop_immediate_propagation&&t.stopImmediatePropagation(),"free"==g("#yith_wczm_traffic_light").val()&&(g(".yith_magnifier_gallery .yith_magnifier_thumbnail.active-thumbnail").removeClass("active-thumbnail"),g(".yith_magnifier_gallery .yith_magnifier_thumbnail.active-thumbnail").addClass("inactive-thumbnail"),g(this).removeClass("inactive-thumbnail"),g(this).addClass("active-thumbnail"),g(this).parent().removeClass("inactive-thumbnail"),g(this).parent().addClass("active-thumbnail"),i.options.from_gallery="yes",t=g(this),i.destroy(),o.attr("href",this.href),n.attr("src",t.data("small")).attr("srcset",t.data("small")).attr("src-orig",t.data("small")).attr("title","").attr("title",t.attr("title")),g.data(i.t,"yith_magnifier",new g.yith_magnifier(i.options,i.element)))}),i.options.enableSlider&&e.closest("ul").trigger("yith_magnifier_slider_destroy")):e.on("click",function(t){return t.preventDefault(),!1})},_loading:function(){var t;this.options.disableRightClick&&g(document).on("contextmenu",function(t){return!1}),this.mouseTrap===i&&(t=this.options.elements.zoom.width(),this.options.loadingLabel&&g('<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"==g("#yith_wczm_traffic_light").val()){g("#yith_wczm_traffic_light").val("blocked");var i=this;i.zoom=i.options.elements.zoom,i.zoomImage=i.options.elements.zoomImage;var t="yith_magnifier_zoom_wrap";if(i.options.zoom_wrap_additional_css){if(g("."+t).length)return;t+=" "+i.options.zoom_wrap_additional_css}i.zoom.wrap('<div class="'+t+'"></div>'),i.IMG_zoomImage=new Image;t=g(".woocommerce-variation-add-to-cart .variation_id").val();g.isNumeric(t)&&0!=t&&"no"==i.options.from_gallery?g.ajax({data:{action:"yith_wc_zoom_magnifier_get_main_image",product_id:t,context:"frontend"},url:yith_wc_zoom_magnifier_storage_object.ajax_url,type:"post",error:function(t){console.log("ERROR - Yith_WC_Zoom_Magnifier"),console.log(t),g("#yith_wczm_traffic_light").val("free")},success:function(t){i.zoom.attr("href",t.url),i.IMG_zoomImage.src=t.url,i.IMG_smallImage=new Image,i.IMG_smallImage.src=i.zoomImage.attr("src"),t.gallery&&(g(".yith_magnifier_gallery").length?g(".yith_magnifier_gallery").closest(".thumbnails").replaceWith(t.gallery):g(".images").append(t.gallery),i.options.elements.gallery=g(".yith_magnifier_gallery li a")),g.browser&&g.browser.msie&&8==g.browser.version?g(i.IMG_zoomImage).load(function(){i._initGallery(),i._initTrap()}):g([i.IMG_zoomImage,i.IMG_smallImage]).imagesLoaded(function(){i._initGallery(),i._initTrap()}),g(document).on("click","a.yith_expand",function(t){t.preventDefault(),g().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){g(".yith_expand").css("display","inline")}}),g.prettyPhoto.open(i.zoom[0].href,"",""),g(".yith_expand").css("display","none"),g(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),g(document).trigger("yith_magnifier_after_init_zoom"),g("#yith_wczm_traffic_light").val("free")}}):(i.IMG_zoomImage.src=i.zoom.attr("href"),i.IMG_smallImage=new Image,i.IMG_smallImage.src=i.zoomImage.attr("src"),g.browser&&g.browser.msie&&8==g.browser.version?g(i.IMG_zoomImage).load(function(){i._initTrap()}):g([i.IMG_zoomImage,i.IMG_smallImage]).imagesLoaded(function(){i._initTrap()}),g(document).on("click","a.yith_expand",function(t){t.preventDefault(),g().prettyPhoto({social_tools:!1,theme:"pp_woocommerce",horizontal_padding:20,opacity:.8,deeplinking:!1,callback:function(){g(".yith_expand").css("display","inline")}}),g.prettyPhoto.open(i.zoom[0].href,"",""),g(".yith_expand").css("display","none"),g(".pp_woocommerce .ppt").css({height:0,marginBottom:0})}),g(document).trigger("yith_magnifier_after_init_zoom"),g("#yith_wczm_traffic_light").val("free"))}},_initTrap:function(){var h=this,m=h.IMG_zoomImage;h.IMG_smallImage;h.mx=0,h.my=0,h.controlTimer=0,h.lens=null,h.tint=null,h.softFocus=null,h.zoomDiv=null,h.cw=0,h.ch=0,h.zw=0,h.destU=0,h.destV=0,h.currU=0,h.currV=0,h.mouseTrap=null;var l,c=h.options.elements.zoom,d=h.options.elements.zoomImage;g(".yith_magnifier_loading").remove(),this.element.find(".yith_magnifier_mousetrap")&&this.element.find(".yith_magnifier_mousetrap").remove(),this.mouseTrap=g('<div class="yith_magnifier_mousetrap pp_woocommerce" />').css({width:yith_wc_zoom_magnifier_storage_object.mouse_trap_width,height:yith_wc_zoom_magnifier_storage_object.mouse_trap_height,top:0,left:0}).appendTo(c.parent()),"undefined"!=typeof ywzm_data&&(g('<a href="#" class="yith_expand" style="display: inline;"></a>').appendTo(this.mouseTrap),g(".expand-button-hidden").clone().appendTo(g(".yith_expand")),g(".yith_magnifier_mousetrap .yith_expand .expand-button-hidden").show()),h.isPhone&&"disable"==h.options.phoneBehavior||(l="ontouchstart"in document.documentElement,this.mouseTrap.on("touchmove mousemove",this,function(t){h.options.onMove(),h.mx=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,h.my=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageY}).on("touchend mouseleave",this,function(t){return clearTimeout(h.controlTimer),h.lens&&h.lens.fadeOut(299),h.tint&&h.tint.fadeOut(299),h.softFocus&&h.softFocus.fadeOut(299),h.zoomDiv.fadeOut(300,function(){h._onLeave()}),!1}).on("touchstart click",this,function(t){h.options.onClick()}).on("touchstart mouseenter",this,function(t){if("free"==g("#yith_wczm_traffic_light").val()){h.options.onEnter(),l&&t.preventDefault(),h.mx=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,h.my=("undefined"!=typeof t.originalEvent.touches?t.originalEvent.touches[0]:t).pageY,h.zw=t.data,h.zoomDiv&&(h.zoomDiv.stop(!0,!1),h.zoomDiv.remove());var i=h.options.adjustX,e=h.options.adjustY,o=d.outerWidth(),n=d.outerHeight(),a=h.options.zoomWidth,s=h.options.zoomHeight;"auto"==h.options.zoomWidth&&(a=o),"auto"==h.options.zoomHeight&&(s=n);var r=c.parent();switch(h.options.position){case"top":e-=s;break;case"right":i+=o;break;case"bottom":e+=n;break;case"left":i-=a;break;case"inside":a=o,s=n;break;default:(r=g("#"+h.options.position)).length?(a=r.innerWidth(),s=r.innerHeight()):(r=c,i+=o,e+=n)}h.isPhone&&"inside"==h.options.phoneBehavior&&(a=o,s=n,e=i=0),h.zoomDiv=g('<div class="yith_magnifier_zoom_magnifier" />').css({left:i,top:e,width:a,height:s,"background-repeat":"no-repeat",backgroundImage:"url("+m.src+")"}).appendTo(r),d.attr("title")&&h.options.showTitle&&g('<div class="yith_magnifier_title">'+d.attr("title")+"</div>").appendTo(h.zoomDiv),!h.isPhone||"disable"!=h.options.phoneBehavior?h.zoomDiv.fadeIn(500):h.lens.fadeOut(299),h.lens&&(h.lens.remove(),h.lens=null),m.width<=1?h.cw=d.outerWidth()/m.naturalWidth*h.zoomDiv.width():h.cw=d.outerWidth()/m.width*h.zoomDiv.width(),m.height<=1?h.ch=d.outerHeight()/m.naturalHeight*h.zoomDiv.height():h.ch=d.outerHeight()/m.height*h.zoomDiv.height(),h.lens=g('<div class="yith_magnifier_lens" />').css({width:h.cw,height:h.ch}).appendTo(c);t=!1;h.options.tint&&(h.tint=g("<div />").css({display:"none",position:"absolute",left:0,top:0,width:d.outerWidth(),height:d.outerHeight(),backgroundColor:h.options.tint,opacity:h.options.tintOpacity}).appendTo(c),h.lens.append(g("<img />",{src:d.attr("src")})),t=!0,h.tint.fadeIn(500)),h.options.softFocus&&(h.softFocus=g("<div />").css({position:"absolute",display:"none",top:"1px",left:"1px",width:d.outerWidth(),height:d.outerHeight(),opacity:.5}).appendTo(c),h.softFocus.append(g("<img />",{src:d.attr("src")})),0==h.lens.find("img").length&&h.lens.append(g("<img />",{src:d.attr("src")})),t=!0,h.softFocus.fadeIn(500)),t||h.lens.css("opacity",h.options.lensOpacity),"inside"!==h.options.position&&h.lens.fadeIn(500),h.zw._controlLoop()}}))},_controlLoop:function(){var t,i,e=this;this.lens&&(t=this.mx-this.zoomImage.offset().left-.5*this.cw>>0,i=this.my-this.zoomImage.offset().top-.5*this.ch>>0,t<0?t=0:t>this.zoomImage.outerWidth()-this.cw&&(t=this.zoomImage.outerWidth()-this.cw),i<0?i=0:i>this.zoomImage.outerHeight()-this.ch&&(i=this.zoomImage.outerHeight()-this.ch),this.lens.css({left:t-2,top:i-1}),this.lens.find("img").css({width:this.zoomImage.outerWidth(),height:this.zoomImage.outerHeight(),marginLeft:-t+"px ",marginTop:-i+"px"}),this.IMG_zoomImage.width<=1?this.destU=t/this.zoomImage.outerWidth()*this.IMG_zoomImage.naturalWidth>>0:this.destU=t/this.zoomImage.outerWidth()*this.IMG_zoomImage.width>>0,this.IMG_zoomImage.height<=1?this.destV=i/this.zoomImage.outerHeight()*this.IMG_zoomImage.naturalHeight>>0:this.destV=i/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(){e._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),0<this.element.find(".yith_magnifier_loading").length&&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&&g(document).unbind(),this._removeElements(),this.options.elements.gallery.unbind(),this.element.removeData("yith_magnifier")}},g.fn.yith_magnifier=function(i){var e;return"string"==typeof i?(e=Array.prototype.slice.call(arguments,1),this.each(function(){var t=g.data(this,"yith_magnifier");t?g.isFunction(t[i])&&"_"!==i.charAt(0)?t[i].apply(t,e):g.error("no such method '"+i+"' for yith_magnifier instance"):g.error("cannot call methods on yith_magnifier prior to initialization; attempted to call method '"+i+"'")})):this.each(function(){g.data(this,"yith_magnifier")?g.error("yith_magnifier already istantiated."):g.data(this,"yith_magnifier",new g.yith_magnifier(i,this))}),this}}((window,jQuery));
|
init.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Product Gallery & Image Zoom
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Product Gallery & Image Zoom</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: 2.
|
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: 5.
|
12 |
-
* WC tested up to: 6.
|
13 |
**/
|
14 |
|
15 |
/* Copyright 2013-2018 Your Inspiration Themes (email : plugins@yithemes.com)
|
@@ -78,7 +78,7 @@ 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', '2.
|
82 |
defined ( 'YITH_YWZM_SCRIPT_VERSION' ) || define ( 'YITH_YWZM_SCRIPT_VERSION', '2.1.1' );
|
83 |
|
84 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
3 |
* Plugin Name: YITH WooCommerce Product Gallery & Image Zoom
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-zoom-magnifier/
|
5 |
* Description: <code><strong>YITH WooCommerce Product Gallery & Image Zoom</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: 2.4.0
|
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: 5.9
|
12 |
+
* WC tested up to: 6.1
|
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', '2.4.0' );
|
82 |
defined ( 'YITH_YWZM_SCRIPT_VERSION' ) || define ( 'YITH_YWZM_SCRIPT_VERSION', '2.1.1' );
|
83 |
|
84 |
defined ( 'YITH_YWZM_FILE' ) || define ( 'YITH_YWZM_FILE', __FILE__ );
|
languages/yith-woocommerce-zoom-magnifier.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the YITH WooCommerce Product Gallery & Image Zoom package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: YITH WooCommerce Product Gallery & Image Zoom 2.
|
6 |
"Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: YITH <info@yithemes.com>\n"
|
14 |
"Language: en\n"
|
1 |
+
# Copyright (C) 2022 YITH
|
2 |
# This file is distributed under the same license as the YITH WooCommerce Product Gallery & Image Zoom package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: YITH WooCommerce Product Gallery & Image Zoom 2.4.0\n"
|
6 |
"Report-Msgid-Bugs-To: YITH <plugins@yithemes.com>\n"
|
7 |
+
"POT-Creation-Date: 2022-01-10 13:24:02+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: YITH <info@yithemes.com>\n"
|
14 |
"Language: en\n"
|
lib/class.yith-wcmg-frontend.php
CHANGED
@@ -104,6 +104,11 @@ if ( ! class_exists( 'YITH_WCMG_Frontend' ) ) {
|
|
104 |
true
|
105 |
);
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
wp_localize_script(
|
108 |
'ywzm-magnifier',
|
109 |
'yith_wc_zoom_magnifier_storage_object',
|
@@ -113,6 +118,7 @@ if ( ! class_exists( 'YITH_WCMG_Frontend' ) ) {
|
|
113 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
114 |
'mouse_trap_width' => apply_filters( 'yith_wczm_mouse_trap_with', '100%' ),
|
115 |
'mouse_trap_height' => apply_filters( 'yith_wczm_mouse_trap_height', '100%' ),
|
|
|
116 |
)
|
117 |
)
|
118 |
);
|
104 |
true
|
105 |
);
|
106 |
|
107 |
+
/**
|
108 |
+
* Avoid the stopImmediatePropagation on gallery click if the Featured Audio and Video plugin is enabled
|
109 |
+
*/
|
110 |
+
$stop_immediate_propagation = function_exists( 'YITH_Featured_Audio_Video_Premium_Init') ? false : true;
|
111 |
+
|
112 |
wp_localize_script(
|
113 |
'ywzm-magnifier',
|
114 |
'yith_wc_zoom_magnifier_storage_object',
|
118 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
119 |
'mouse_trap_width' => apply_filters( 'yith_wczm_mouse_trap_with', '100%' ),
|
120 |
'mouse_trap_height' => apply_filters( 'yith_wczm_mouse_trap_height', '100%' ),
|
121 |
+
'stop_immediate_propagation' => $stop_immediate_propagation,
|
122 |
)
|
123 |
)
|
124 |
);
|
lib/class.yith-ywzm-plugin-fw-loader.php
CHANGED
@@ -140,7 +140,7 @@ if ( ! class_exists( 'YITH_YWZM_Plugin_FW_Loader' ) ) {
|
|
140 |
$args = array(
|
141 |
'create_menu_page' => true,
|
142 |
'parent_slug' => '',
|
143 |
-
'page_title' => 'Product Gallery & Image Zoom',
|
144 |
'menu_title' => 'Product Gallery & Image Zoom',
|
145 |
'capability' => 'manage_options',
|
146 |
'parent' => '',
|
140 |
$args = array(
|
141 |
'create_menu_page' => true,
|
142 |
'parent_slug' => '',
|
143 |
+
'page_title' => 'YITH WooCommerce Product Gallery & Image Zoom',
|
144 |
'menu_title' => 'Product Gallery & Image Zoom',
|
145 |
'capability' => 'manage_options',
|
146 |
'parent' => '',
|
license.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright 2015-
|
2 |
|
3 |
This program is free software; you can redistribute it and/or modify
|
4 |
it under the terms of the GNU General Public License as published by
|
1 |
+
Copyright 2015-2022 Your Inspiration Solutions (email : plugins@yithemes.com)
|
2 |
|
3 |
This program is free software; you can redistribute it and/or modify
|
4 |
it under the terms of the GNU General Public License as published by
|
plugin-fw/templates/fields/list-table.php
CHANGED
@@ -11,11 +11,11 @@ defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
|
|
11 |
list ( $field_id, $class, $the_title, $the_post_type, $args, $add_new_button, $add_new_url, $list_table_class, $list_table_class_dir, $search_form, $desc ) = yith_plugin_fw_extract( $field, 'id', 'class', 'title', 'post_type', 'args', 'add_new_button', 'add_new_url', 'list_table_class', 'list_table_class_dir', 'search_form', 'desc' );
|
12 |
|
13 |
$show_button = false;
|
14 |
-
if ( isset( $add_new_button ) && isset( $the_post_type ) ) {
|
15 |
$show_button = true;
|
16 |
$admin_url = admin_url( 'post-new.php' );
|
17 |
$params['post_type'] = $the_post_type;
|
18 |
-
$add_new_url = apply_filters( 'yith_plugin_fw_add_new_post_url', esc_url( add_query_arg( $params, $admin_url ) ), $params, isset( $args ) ? $args : false );
|
19 |
}
|
20 |
|
21 |
if ( isset( $list_table_class, $list_table_class_dir ) && ! class_exists( $list_table_class ) && file_exists( $list_table_class_dir ) ) {
|
11 |
list ( $field_id, $class, $the_title, $the_post_type, $args, $add_new_button, $add_new_url, $list_table_class, $list_table_class_dir, $search_form, $desc ) = yith_plugin_fw_extract( $field, 'id', 'class', 'title', 'post_type', 'args', 'add_new_button', 'add_new_url', 'list_table_class', 'list_table_class_dir', 'search_form', 'desc' );
|
12 |
|
13 |
$show_button = false;
|
14 |
+
if ( isset( $add_new_button ) && ( isset( $the_post_type ) || ( isset( $add_new_url ) ) ) ) {
|
15 |
$show_button = true;
|
16 |
$admin_url = admin_url( 'post-new.php' );
|
17 |
$params['post_type'] = $the_post_type;
|
18 |
+
$add_new_url = $add_new_url ? $add_new_url : apply_filters( 'yith_plugin_fw_add_new_post_url', esc_url( add_query_arg( $params, $admin_url ) ), $params, isset( $args ) ? $args : false );
|
19 |
}
|
20 |
|
21 |
if ( isset( $list_table_class, $list_table_class_dir ) && ! class_exists( $list_table_class ) && file_exists( $list_table_class_dir ) ) {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
-
Stable tag: 2.
|
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/
|
@@ -74,6 +74,11 @@ YITH WooCommerce Product Gallery & Image Zoom will add a new tab called "Product
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
= Version 2.3.0 - Released: December 21, 2021 =
|
78 |
|
79 |
* New: support for WooCommerce 6.0
|
4 |
Tags: zoom, magnifier, slider, carousel, woocommerce
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
+
Stable tag: 2.4.0
|
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/
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= Version 2.4.0 - Released: January 10, 2022 =
|
78 |
+
|
79 |
+
* New: support for WooCommerce 6.1
|
80 |
+
* Update: YITH plugin framework
|
81 |
+
|
82 |
= Version 2.3.0 - Released: December 21, 2021 =
|
83 |
|
84 |
* New: support for WooCommerce 6.0
|