jQuery(document).ready(function ($){
"use strict";
function NectarSocial(){
this.$body=$('body');
this.$window=$(window);
this.$wpAdminBar=$('#wpadminbar');
this.usingMobileBrowser=(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true:false;
this.mouseEvents();
this.nectarLove();
if($('body').find('.nectar-social.fixed').length > 0){
this.fixedStyle();
}}
NectarSocial.prototype.mouseEvents=function(){
this.$body.on('click', '#single-below-header .nectar-social a', function (){
return false;
});
$('body.single-product .nectar-social').addClass('woo');
this.$body.on('click', '.facebook-share:not(.inactive)', this.facebookShare);
this.$body.on('click', '.nectar-social:not(".woo") .twitter-share:not(.inactive)', this.twitterShare);
this.$body.on('click', '.nectar-social.woo .twitter-share', this.wooTwitterShare);
this.$body.on('click', '.nectar-social:not(".woo") .linkedin-share:not(.inactive)', this.linkedInShare);
this.$body.on('click', '.nectar-social.woo .linkedin-share', this.woolinkedInShare);
this.$body.on('click', '.nectar-social:not(".woo") .pinterest-share:not(.inactive)', this.pinterestShare);
this.$body.on('click', '.nectar-social.woo .pinterest-share', this.wooPinterestShare);
this.$body.on('click', '.nectar-social.fixed > a', function (){
return false;
});
if(!this.usingMobileBrowser){
var $socialTimeout;
this.$body.on('mouseenter', '.nectar-social.hover .share-btn', function (){
clearTimeout($socialTimeout);
if($(this).parents('[id*="-meta"]').length > 0){
$(this).parents('[id*="-meta"]').addClass('social-hovered');
}
if($(this).parents('#single-below-header').length > 0){
$(this).parents('#single-below-header').addClass('social-hovered');
}
$(this).parent().addClass('visible');
});
this.$body.on('mouseleave', '.nectar-social.hover', function (){
var $that=$(this);
$socialTimeout=setTimeout(function (){
$that.removeClass('visible');
if($that.parents('[id*="-meta"]').length > 0){
$that.parents('[id*="-meta"]').removeClass('social-hovered');
}
if($that.parents('#single-below-header').length > 0){
$that.parents('#single-below-header').removeClass('social-hovered');
}}, 200);
});
}else{
this.$body.on('click', '.nectar-social.hover .share-btn', function (){
if($(this).parents('[id*="-meta"]').length > 0){
$(this).parents('[id*="-meta"]').addClass('social-hovered');
}
if($(this).parents('#single-below-header').length > 0){
$(this).parents('#single-below-header').addClass('social-hovered');
}
$(this).parent().addClass('visible');
return false;
});
}};
NectarSocial.prototype.facebookShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(windowLocation), "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.twitterShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
var $pageTitle;
if($(".section-title h1").length > 0){
$pageTitle=encodeURIComponent($(".section-title h1").text());
}else{
$pageTitle=encodeURIComponent($(document).find("title").text());
}
window.open('https://twitter.com/intent/tweet?text=' + $pageTitle + ' ' + windowLocation, "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.wooTwitterShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
window.open('https://twitter.com/intent/tweet?text=' + $("h1.product_title").text() + ' ' + encodeURIComponent(windowLocation), "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.linkedInShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
var $pageTitle;
if($(".section-title h1").length > 0){
$pageTitle=encodeURIComponent($(".section-title h1").text());
}else{
$pageTitle=encodeURIComponent($(document).find("title").text());
}
window.open('https://www.linkedin.com/sharing/share-offsite/?mini=true&url=' + encodeURIComponent(windowLocation) + '&title=' + $pageTitle + '', "linkedInWindow", "height=480,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.woolinkedInShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
window.open('https://www.linkedin.com/sharing/share-offsite/?mini=true&url=' + encodeURIComponent(windowLocation) + '&title=' + $("h1.product_title").text(), "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.pinterestShare=function(){
var windowLocation=window.location.href.replace(window.location.hash, '');
var $sharingImg=($('.single-portfolio').length > 0&&$('div[data-featured-img]').attr('data-featured-img')!='empty') ? $('div[data-featured-img]').attr('data-featured-img'):$('#ajax-content-wrap img').first().attr('src');
if($sharingImg){
$sharingImg=encodeURIComponent($sharingImg);
}
var $pageTitle;
if($(".section-title h1").length > 0){
$pageTitle=encodeURIComponent($(".section-title h1").text());
}else{
$pageTitle=encodeURIComponent($(document).find("title").text());
}
window.open('https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(windowLocation) + '&media=' + $sharingImg + '&description=' + $pageTitle, "pinterestWindow", "height=640,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.wooPinterestShare=function (){
var $imgToShare=($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src'):$('.single-product-main-image img').first().attr('src');
if($imgToShare){
$imgToShare=encodeURIComponent($imgToShare);
}
var windowLocation=window.location.href.replace(window.location.hash, '');
window.open('https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(windowLocation) + '&media=' + $imgToShare + '&description=' + $('h1.product_title').text(), "pinterestWindow", "height=640,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0");
return false;
};
NectarSocial.prototype.nectarLove=function(){
this.$body.on('click', '.nectar-love', function (){
var $loveLink=$(this),
$id=$(this).attr('id'),
$that=$(this);
if($loveLink.hasClass('loved')||$(this).hasClass('inactive')){
return false;
}
var $dataToPass={
action: 'nectar-love',
loves_id: $id,
love_nonce: window.nectarLove.loveNonce
};
$.post(window.nectarLove.ajaxurl, $dataToPass, function (data){
$loveLink.find('.nectar-love-count').html(data);
$loveLink.addClass('loved').attr('title', 'You already love this!');
$that.find('.icon-salient-heart-2').addClass('loved');
});
$(this).addClass('inactive');
return false;
});
};
NectarSocial.prototype.fixedStyle=function(){
$('.wpb_wrapper .nectar-social.fixed').each(function(i){
if(i!==0){
$(this).remove();
}else{
var $fixedMarkup=$(this).clone();
$('body').append($fixedMarkup);
$(this).remove();
}});
function showFixedSharing(){
if($(window).scrollTop() > 150){
$('.nectar-social.fixed').addClass('visible');
$(window).off('scroll', showFixedSharing);
$(window).on('scroll', hideFixedSharing);
}}
function hideFixedSharing(){
if($(window).scrollTop() < 150){
$('.nectar-social.fixed').removeClass('visible');
$(window).off('scroll', hideFixedSharing);
$(window).on('scroll', showFixedSharing);
}}
if($('.nectar-social.fixed').length > 0){
if($(window).width() < 1000){
if($(window).scrollTop() > 150){
$(window).on('scroll', hideFixedSharing);
}else{
$(window).on('scroll', showFixedSharing);
}}
$(window).on('smartresize',function (){
if($(window).width() > 1000){
$('.nectar-social.fixed').addClass('visible');
}else if($(window).scrollTop() < 150){
$(window).off('scroll', hideFixedSharing);
$(window).on('scroll', showFixedSharing);
$('.nectar-social.fixed').removeClass('visible');
}else{
$(window).off('scroll', showFixedSharing);
$(window).on('scroll', hideFixedSharing);
}});
}};
var nectarSocialInit=new NectarSocial();
window.NectarSocial=NectarSocial;
});
!function(e){"function"==typeof define&&define.amd?define([],e):"undefined"!=typeof module&&null!==module&&module.exports?module.exports=e:e()}(function(){var i=Object.assign||window.jQuery&&jQuery.extend,p=8,a=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){return window.setTimeout(function(){e()},25)};!function(){if("function"==typeof window.CustomEvent)return;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}();var o={textarea:!0,input:!0,select:!0,button:!0},u={move:"mousemove",cancel:"mouseup dragstart",end:"mouseup"},r={move:"touchmove",cancel:"touchend",end:"touchend"},d=/\s+/,c={bubbles:!0,cancelable:!0},t="function"==typeof Symbol?Symbol("events"):{};function m(e){return e[t]||(e[t]={})}function v(e,t,n,o,i){t=t.split(d);var a,c=m(e),u=t.length;function r(e){n(e,o)}for(;u--;)(c[a=t[u]]||(c[a]=[])).push([n,r]),e.addEventListener(a,r)}function f(e,t,n,o){t=t.split(d);var i,a,c,u=m(e),r=t.length;if(u)for(;r--;)if(a=u[i=t[r]])for(c=a.length;c--;)a[c][0]===n&&(e.removeEventListener(i,a[c][1]),a.splice(c,1))}function g(e,t,n){var o=new CustomEvent(t,c);n&&i(o,n),e.dispatchEvent(o)}function n(e){var n=e,o=!1,i=!1;function t(e){o?(n(),a(t),o=!(i=!0)):i=!1}this.kick=function(e){o=!0,i||t()},this.end=function(e){var t=n;e&&(i?(n=o?function(){t(),e()}:e,o=!0):e())}}function h(){}function s(e){e.preventDefault()}function l(e,t){var n,o;if(e.identifiedTouch)return e.identifiedTouch(t);for(n=-1,o=e.length;++n<o;)if(e[n].identifier===t)return e[n]}function X(e,t){var n=l(e.changedTouches,t.identifier);if(n&&(n.pageX!==t.pageX||n.pageY!==t.pageY))return n}function Y(e,t){T(e,t,e,w)}function y(e,t){w()}function w(){f(document,u.move,Y),f(document,u.cancel,y)}function b(e){f(document,r.move,e.touchmove),f(document,r.cancel,e.touchend)}function T(e,t,n,o){var i,a,c,u,r,d,m,v,f,s=n.pageX-t.pageX,l=n.pageY-t.pageY;s*s+l*l<p*p||(a=t,c=n,u=s,r=l,d=o,m=(i=e).targetTouches,v=i.timeStamp-a.timeStamp,f={altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,startX:a.pageX,startY:a.pageY,distX:u,distY:r,deltaX:u,deltaY:r,pageX:c.pageX,pageY:c.pageY,velocityX:u/v,velocityY:r/v,identifier:a.identifier,targetTouches:m,finger:m?m.length:1,enableMove:function(){this.moveEnabled=!0,this.enableMove=h,i.preventDefault()}},g(a.target,"movestart",f),d(a))}function E(e,t){var n=t.timer;t.touch=e,t.timeStamp=e.timeStamp,n.kick()}function S(e,t){var n=t.target,o=t.event,i=t.timer;f(document,u.move,E),f(document,u.end,S),K(n,o,i,function(){setTimeout(function(){f(n,"click",s)},0)})}function k(e,t){var n,o=t.target,i=t.event,a=t.timer;l(e.changedTouches,i.identifier)&&(n=t,f(document,r.move,n.activeTouchmove),f(document,r.end,n.activeTouchend),K(o,i,a))}function K(e,t,n,o){n.end(function(){return g(e,"moveend",t),o&&o()})}if(v(document,"mousedown",function(e){var t;1!==(t=e).which||t.ctrlKey||t.altKey||o[e.target.tagName.toLowerCase()]||(v(document,u.move,Y,e),v(document,u.cancel,y,e))}),v(document,"touchstart",function(e){if(!o[e.target.tagName.toLowerCase()]){var t=e.changedTouches[0],n={target:t.target,pageX:t.pageX,pageY:t.pageY,identifier:t.identifier,touchmove:function(e,t){var n,o,i;(i=X(n=e,o=t))&&T(n,o,i,b)},touchend:function(e,t){var n;n=t,l(e.changedTouches,n.identifier)&&b(n)}};v(document,r.move,n.touchmove,n),v(document,r.cancel,n.touchend,n)}}),v(document,"movestart",function(e){if(!e.defaultPrevented&&e.moveEnabled){var a={startX:e.startX,startY:e.startY,pageX:e.pageX,pageY:e.pageY,distX:e.distX,distY:e.distY,deltaX:e.deltaX,deltaY:e.deltaY,velocityX:e.velocityX,velocityY:e.velocityY,identifier:e.identifier,targetTouches:e.targetTouches,finger:e.finger},c={target:e.target,event:a,timer:new n(function(e){var t,n,o,i;t=a,n=c.touch,o=c.timeStamp,i=o-t.timeStamp,t.distX=n.pageX-t.startX,t.distY=n.pageY-t.startY,t.deltaX=n.pageX-t.pageX,t.deltaY=n.pageY-t.pageY,t.velocityX=.3*t.velocityX+.7*t.deltaX/i,t.velocityY=.3*t.velocityY+.7*t.deltaY/i,t.pageX=n.pageX,t.pageY=n.pageY,g(c.target,"move",a)}),touch:void 0,timeStamp:e.timeStamp};void 0===e.identifier?(v(e.target,"click",s),v(document,u.move,E,c),v(document,u.end,S,c)):(c.activeTouchmove=function(e,t){var n,o,i,a,c;n=e,i=(o=t).event,a=o.timer,(c=X(n,i))&&(n.preventDefault(),i.targetTouches=n.targetTouches,o.touch=c,o.timeStamp=n.timeStamp,a.kick())},c.activeTouchend=function(e,t){k(e,t)},v(document,r.move,c.activeTouchmove,c),v(document,r.end,c.activeTouchend,c))}}),window.jQuery){var j="startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY".split(" ");jQuery.event.special.movestart={setup:function(){return v(this,"movestart",e),!1},teardown:function(){return f(this,"movestart",e),!1},add:q},jQuery.event.special.move={setup:function(){return v(this,"movestart",C),!1},teardown:function(){return f(this,"movestart",C),!1},add:q},jQuery.event.special.moveend={setup:function(){return v(this,"movestart",Q),!1},teardown:function(){return f(this,"movestart",Q),!1},add:q}}function e(e){e.enableMove()}function C(e){e.enableMove()}function Q(e){e.enableMove()}function q(e){var o=e.handler;e.handler=function(e){for(var t,n=j.length;n--;)e[t=j[n]]=e.originalEvent[t];o.apply(this,arguments)}}});
!function(g){g.fn.twentytwenty=function(m){m=g.extend({default_offset_pct:.5,orientation:"horizontal",before_label:"Before",after_label:"After",no_overlay:!1,move_slider_on_hover:!1,move_with_handle_only:!0,click_to_move:!1},m);return this.each(function(){var e=m.default_offset_pct,s=g(this),r=m.orientation,t="vertical"===r?"down":"left",n="vertical"===r?"up":"right";s.wrap("<div class='twentytwenty-wrapper twentytwenty-"+r+"'></div>"),m.no_overlay||s.append("<div class='twentytwenty-overlay'></div>");var c=s.find("img:first"),d=s.find("img:last");s.append("<div class='twentytwenty-handle'></div>");var l=s.find(".twentytwenty-handle");l.append("<span class='twentytwenty-"+t+"-arrow'></span>"),l.append("<span class='twentytwenty-"+n+"-arrow'></span>"),s.addClass("twentytwenty-container"),c.addClass("twentytwenty-before"),d.addClass("twentytwenty-after");var i=s.find(".twentytwenty-overlay");i.append("<div class='twentytwenty-before-label'></div>"),i.append("<div class='twentytwenty-after-label'></div>");var a=function(t){var e,n,i,a,o=(e=t,n=c.width(),i=c.height(),{w:n+"px",h:i+"px",cw:e*n+"px",ch:e*i+"px"});l.css("vertical"===r?"top":"left","vertical"===r?o.ch:o.cw),a=o,"vertical"===r?(c.css("clip","rect(0,"+a.w+","+a.ch+",0)"),d.css("clip","rect("+a.ch+","+a.w+","+a.h+",0)")):(c.css("clip","rect(0,"+a.cw+","+a.h+",0)"),d.css("clip","rect(0,"+a.w+","+a.h+","+a.cw+")")),s.css("height",a.h)},o=function(t,e){var n,i,a;return n="vertical"===r?(e-v)/p:(t-w)/f,i=0,a=1,Math.max(i,Math.min(a,n))};g(window).on("resize.twentytwenty",function(t){a(e)});var w=0,v=0,f=0,p=0,y=function(t){(t.distX>t.distY&&t.distX<-t.distY||t.distX<t.distY&&t.distX>-t.distY)&&"vertical"!==r?t.preventDefault():(t.distX<t.distY&&t.distX<-t.distY||t.distX>t.distY&&t.distX>-t.distY)&&"vertical"===r&&t.preventDefault(),s.addClass("active"),w=s.offset().left,v=s.offset().top,f=c.width(),p=c.height()},h=function(t){s.hasClass("active")&&(e=o(t.pageX,t.pageY),a(e))},u=function(){s.removeClass("active")},_=m.move_with_handle_only?l:s;_.on("movestart",y),_.on("move",h),_.on("moveend",u),m.move_slider_on_hover&&(s.on("mouseenter",y),s.on("mousemove",h),s.on("mouseleave",u)),l.on("touchmove",function(t){t.preventDefault()}),s.find("img").on("mousedown",function(t){t.preventDefault()}),m.click_to_move&&s.on("click",function(t){w=s.offset().left,v=s.offset().top,f=c.width(),p=c.height(),e=o(t.pageX,t.pageY),a(e)}),g(window).trigger("resize.twentytwenty")})}}(jQuery);