!function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'':''),I=e(n.theme?'':''),n.theme&&k?(U='"):n.theme?(U='"):U=k?'':'',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel&&document.documentElement.clientWidth||document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight||document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah=document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('
');t&&s.append("

"+t+"

"),o&&s.append("

"+o+"

"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.mouseover(function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"

Please wait...

",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var p=null,b=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}(); jQuery(function(e){if("undefined"==typeof wc_add_to_cart_params)return!1;var t=function(){e(document.body).on("click",".add_to_cart_button",this.onAddToCart).on("click",".remove_from_cart_button",this.onRemoveFromCart).on("added_to_cart",this.updateButton).on("added_to_cart",this.updateCartPage).on("added_to_cart removed_from_cart",this.updateFragments)};t.prototype.onAddToCart=function(t){var a=e(this);if(a.is(".ajax_add_to_cart")){if(!a.attr("data-product_id"))return!0;t.preventDefault(),a.removeClass("added"),a.addClass("loading");var o={};e.each(a.data(),function(t,a){o[t]=a}),e(document.body).trigger("adding_to_cart",[a,o]),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),o,function(t){t&&(t.error&&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?e(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]):window.location=wc_add_to_cart_params.cart_url)})}},t.prototype.onRemoveFromCart=function(t){var a=e(this),o=a.closest(".woocommerce-mini-cart-item");t.preventDefault(),o.block({message:null,overlayCSS:{opacity:.6}}),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),{cart_item_key:a.data("cart_item_key")},function(t){t&&t.fragments?e(document.body).trigger("removed_from_cart",[t.fragments,t.cart_hash,a]):window.location=a.attr("href")}).fail(function(){window.location=a.attr("href")})},t.prototype.updateButton=function(t,a,o,r){(r=void 0!==r&&r)&&(r.removeClass("loading"),r.addClass("added"),wc_add_to_cart_params.is_cart||0!==r.parent().find(".added_to_cart").length||r.after(' '+wc_add_to_cart_params.i18n_view_cart+""),e(document.body).trigger("wc_cart_button_updated",[r]))},t.prototype.updateCartPage=function(){var t=window.location.toString().replace("add-to-cart","added-to-cart");e(".shop_table.cart").load(t+" .shop_table.cart:eq(0) > *",function(){e(".shop_table.cart").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_page_refreshed")}),e(".cart_totals").load(t+" .cart_totals:eq(0) > *",function(){e(".cart_totals").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_totals_refreshed")})},t.prototype.updateFragments=function(t,a){a&&(e.each(a,function(t){e(t).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),e.each(a,function(t,a){e(t).replaceWith(a),e(t).stop(!0).css("opacity","1").unblock()}),e(document.body).trigger("wc_fragments_loaded"))},new t}); !function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(m){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var f="";for(var s in i)i[s]&&(f+="; "+s,!0!==i[s]&&(f+="="+i[s]));return document.cookie=n+"="+r+f}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u 0){ notification_el.slideDown('slow'); clearTimeout(fadenotice); fadenotice=setTimeout(function(){ notification_el.slideUp('slow',function(){ notification_el.html(''); }); },parseInt(xoo_wsc_localize.notification_time)) }} function toggle_sidecart(toggle_type){ var toggle_element=$('.xoo-wsc-modal , body, html'), toggle_class='xoo-wsc-active'; if(toggle_type=='show'){ toggle_element.addClass(toggle_class); } else if(toggle_type=='hide'){ toggle_element.removeClass(toggle_class); }else{ toggle_element.toggleClass('xoo-wsc-active'); } unblock_cart(); } $('body').on('click','.xoo-wsc-basket,.xoo-wsc-sc-cont',toggle_sidecart); if(xoo_wsc_localize.trigger_class){ $('.'+xoo_wsc_localize.trigger_class).on('click',toggle_sidecart); } (function(){ if(xoo_wsc_localize.added_to_cart){ var toggled=false; $(document).on('wc_fragments_refreshed',function(){ if(!toggled){ setTimeout(toggle_sidecart,1,'show'); toggled=true; }}) }}()); $(document).on('added_to_cart',function(event,fragments,hash,atc_btn){ var cart=$('.xoo-wsc-basket'); if(xoo_wsc_localize.show_basket!='always_hide'){ cart.show(); } var opensidecart=function(){ if(xoo_wsc_localize.auto_open_cart==1){ setTimeout(toggle_sidecart,1,'show'); }} if(xoo_wsc_localize.flyto_anim==1){ fly_to_cart(atc_btn,opensidecart); }else{ opensidecart(); } if(!xoo_wsc_localize.apply_coupon_nonce){ create_coupon_nonce(); } update_cartChk(); }); function create_coupon_nonce(){ $.ajax({ url: xoo_wsc_localize.adminurl, type: 'POST', data: { action: 'xoo_wsc_create_nonces' }, success: function(response){ if(response['apply-coupon']){ xoo_wsc_localize.apply_coupon_nonce=response['apply-coupon']; } if(response['remove-coupon']){ xoo_wsc_localize.remove_coupon_nonce=response['remove-coupon']; }} }) } function close_sidecart(e){ $.each(e.target.classList,function(key,value){ if(value!='xoo-wsc-container'&&(value=='xoo-wsc-close'||value=='xoo-wsc-opac'||value=='xoo-wsc-basket'||value=='xoo-wsc-cont')){ $('.xoo-wsc-modal , body, html').removeClass('xoo-wsc-active'); }}) } $('body').on('click','.xoo-wsc-close , .xoo-wsc-opac',function(e){ e.preventDefault(); close_sidecart(e); }); $('body').on('click','.xoo-wsc-cont',function(e){ var link=$.trim($(this).attr('href')); if(link=="#"||!link){ e.preventDefault(); close_sidecart(e); }}); function content_height(){ var header=$('.xoo-wsc-header').outerHeight(), footer=$('.xoo-wsc-footer').outerHeight(), screen=window.innerHeight, $cont=$('.xoo-wsc-container'); if(xoo_wsc_localize.cont_height=="auto_adjust"){ $cont.css({"top": "", "bottom": ""}); var body_height='calc(100% - '+(header+footer)+'px)'; if($cont.outerHeight() > screen){ $cont.css({"top": "0", "bottom": "0"}); }}else{ var body_height=screen-(header+footer); } $('.xoo-wsc-body').css('height',body_height); }; content_height(); $(window).resize(function(){ content_height(); }); function add_to_cart(atc_btn,product_data){ $(document.body).trigger('adding_to_cart', [ atc_btn, product_data ]); $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'xoo_wsc_add_to_cart'), type: 'POST', data: $.param(product_data), success: function(response){ add_to_cart_button_check_icon(atc_btn); if(response.fragments){ $(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash, atc_btn ]); } else if(response.error){ show_notice('error',response.error); toggle_sidecart(); }else{ console.log(response); }} }) } function update_cart(cart_key,new_qty){ block_cart(); var endpoint='xoo_wsc_update_cart'; endpoint +=new_qty > 0 ? '&xoo_wsc_qty_update':''; $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', endpoint), type: 'POST', data: { cart_key: cart_key, new_qty: new_qty }, success: function(response){ if(response.fragments){ var fragments=response.fragments, cart_hash=response.cart_hash; $.each(response.fragments, function(key, value){ $(key).replaceWith(value); $(key).stop(true).css('opacity', '1').unblock(); }); if(wc_cart_fragments_params){ var cart_hash_key=wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash'; sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(fragments)); localStorage.setItem(cart_hash_key, cart_hash); sessionStorage.setItem(cart_hash_key, cart_hash); } $(document.body).trigger('wc_fragments_loaded'); $(document.body).trigger('xoo_wsc_cart_updated'); }else{ show_notice('error',response.error); }} }) } $(document).on('click', '.xoo-wsc-chng' ,function(){ var _this=$(this); var qty_element=_this.siblings('.xoo-wsc-qty'); qty_element.trigger('focusin'); var input_qty=parseFloat(qty_element.val()); var step=parseFloat(qty_element.attr('step')); var min_value=parseFloat(qty_element.attr('min')); var max_value=parseFloat(qty_element.attr('max')); if(_this.hasClass('xoo-wsc-plus')){ var new_qty=input_qty + step; if(new_qty > max_value&&max_value > 0){ alert('Maximum Quantity: '+max_value); return; }} else if(_this.hasClass('xoo-wsc-minus')){ var new_qty=input_qty - step; if(new_qty===0){ _this.parents('.xoo-wsc-product').find('.xoo-wsc-remove').trigger('click'); return; } else if(new_qty < min_value){ return; } else if(input_qty < 0){ alert('Invalid'); return; }} var cart_key=_this.parents('.xoo-wsc-product').data('xoo_wsc'); update_cart(cart_key,new_qty); }) $(document).on('focusin','.xoo-wsc-qty',function(){ focus_qty=$(this).val(); }) $(document).on('change','.xoo-wsc-qty',function(e){ var _this=$(this); var new_qty=parseFloat($(this).val()); var step=parseFloat($(this).attr('step')); var min_value=parseFloat($(this).attr('min')); var max_value=parseFloat($(this).attr('max')); var invalid=false; var cart_key=_this.parents('.xoo-wsc-product').data('xoo_wsc'); if(new_qty===0){ _this.parents('.xoo-wsc-product').find('.xoo-wsc-remove').trigger('click'); return; } else if(isNaN(new_qty)||new_qty < 0){ invalid=true; } else if(new_qty > max_value&&max_value > 0){ alert('Maximum Quantity: '+max_value); invalid=true; } else if(new_qty < min_value){ invalid=true; } else if((new_qty % step)!==0){ alert('Quantity can only be purchased in multiple of '+step); invalid=true; }else{ update_cart(cart_key,new_qty); } if(invalid===true){ $(this).val(focus_qty); }}) $(document).on('click','.xoo-wsc-remove',function(e){ e.preventDefault(); var product_row=$(this).parents('.xoo-wsc-product'); var cart_key=product_row.data('xoo_wsc'); update_cart(cart_key,0); }) $(document).on('submit','form.cart',function(e){ if(xoo_wsc_localize.ajax_atc!=1) return; e.preventDefault(); block_cart(); var form=$(this); var atc_btn=form.find('button[type="submit"]'); add_to_cart_button_loading_icon(atc_btn); var product_data=form.serializeArray(); var has_product_id=false; $.each(product_data,function(key,form_item){ if(form_item.name==='product_id'||form_item.name==='add-to-cart'){ if(form_item.value){ has_product_id=true; return false; }} }) if(!has_product_id){ var is_url=form.attr('action').match(/add-to-cart=([0-9]+)/); var product_id=is_url ? is_url[1]:false; } if(atc_btn.attr('name')&&atc_btn.attr('name')=='add-to-cart'&&atc_btn.attr('value')){ var product_id=atc_btn.attr('value'); } if(product_id){ product_data.push({name: 'add-to-cart', value: product_id}); } product_data.push({name: 'action', value: 'xoo_wsc_add_to_cart'}); add_to_cart(atc_btn,product_data); }) function show_notice(notice_type,notice){ $('.xoo-wsc-notice').html(notice).attr('class','xoo-wsc-notice').addClass('xoo-wsc-nt-'+notice_type); $('.xoo-wsc-notice-box').fadeIn('fast'); clearTimeout(fadenotice); var fadenotice=setTimeout(function(){ $('.xoo-wsc-notice-box').fadeOut('slow'); },2000); }; function add_to_cart_button_loading_icon(atc_btn){ if(xoo_wsc_localize.atc_icons!=1) return; if(atc_btn.find('.xoo-wsc-icon-atc').length!==0){ atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-spinner2 xoo-wsc-icon-atc xoo-wsc-active'); }else{ atc_btn.append(''); }} function add_to_cart_button_check_icon(atc_btn){ if(xoo_wsc_localize.atc_icons!=1) return; atc_btn.find('.xoo-wsc-icon-atc').attr('class','xoo-wsc-icon-checkmark xoo-wsc-icon-atc'); } $(document).on('click','.xoo-wsc-coupon-trigger',function(){ $('.xoo-wsc-coupon').toggleClass('active'); $(this).toggleClass('active'); }) $(document).on('click','.xoo-wsc-coupon-submit',function(e){ var coupon=$('#xoo-wsc-coupon-code'); var coupon_code=(coupon.val()).trim(); if(!coupon_code.length){ return; } $('.xoo-wsc-block-cart').show(); $(this).addClass('active'); var data={ security: xoo_wsc_localize.apply_coupon_nonce, coupon_code: coupon_code } $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'apply_coupon'), type: 'POST', data: data, success: function(response){ show_notice('error',response); $(document.body).trigger('applied_coupon', [ coupon_code ]); $(document.body).trigger('wc_fragment_refresh'); }, complete: function(){ $('.xoo-wsc-block-cart').hide(); }}) }) $(document).on('click','.xoo-wsc-remove-coupon',function(e){ var coupon=$(this).attr('data-coupon'); if(!coupon.length){ e.preventDefault(); } $(this).css("pointer-events","none"); block_cart(); var data={ security: xoo_wsc_localize.remove_coupon_nonce, coupon: coupon } $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'remove_coupon'), type: 'POST', data: data, success: function(response){ show_notice('error',response); $(document.body).trigger('removed_coupon', [ coupon ]); $(document.body).trigger('wc_fragment_refresh'); }, complete: function(){ $('.xoo-wsc-block-cart').hide(); }}) }) $(document).on('click','.xoo-wsc-undo-item',function(){ var cart_key=$(this).data('xoo_ckey'); if(!cart_key) return; block_cart(); $.ajax({ url: xoo_wsc_localize.wc_ajax_url.toString().replace('%%endpoint%%', 'xoo_wsc_undo_item'), type: 'POST', data: { cart_key: cart_key, }, success: function(response){ if(response.fragments){ $(document.body).trigger('added_to_cart', [ response.fragments, response.cart_hash]); } else if(response.error){ show_notice('error',response.error) }else{ console.log(response); } unblock_cart(); }}) }) function fly_to_cart(atc_btn,callback){ var cart=$('.xoo-wsc-basket'); if(cart.length < 1){ cart=$('.xoo-wsc-sc-cont'); } if(atc_btn.parents('form.cart').length!==0){ var imgtodrag=$('.woocommerce-product-gallery'); }else{ var imgtodrag=atc_btn.parents('.product'); } if(imgtodrag.length===0||cart.length===0){ callback(); return; } var imgclone=imgtodrag.clone() .offset({ top: imgtodrag.offset().top, left: imgtodrag.offset().left }) .css({ 'opacity': '1', 'position': 'absolute', 'height': '150px', 'width': '150px', 'z-index': '100' }) .appendTo($('body')) .animate({ 'top': cart.offset().top - 10, 'left': cart.offset().left - 10, 'width': 75, 'height': 75 }, 1000, 'easeInOutExpo'); setTimeout(function (){ cart.effect("shake", { times: 1 }, 200, setTimeout(function(){ callback(); },200)); }, 1500); imgclone.animate({ 'width': 0, 'height': 0 }, function (){ $(this).detach(); }); }}); if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.isLoading=!1};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",f.resetText||d.data("resetText",d[e]()),d[e](f[b]||this.options[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},b.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});return this.$element.trigger(j),j.isDefaultPrevented()?void 0:(this.sliding=!0,f&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),f&&this.cycle(),this)};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);!e&&f.toggle&&"show"==c&&(c=!c),e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(b){a(d).remove(),a(e).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(''}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;(e||"destroy"!=c)&&(e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]())})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(a(c).is("body")?window:c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);{var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})}},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(b.RESET).addClass("affix");var a=this.$window.scrollTop(),c=this.$element.offset();return this.pinnedOffset=c.top-a},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"top"==this.affixed&&(e.top+=d),"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(b.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:c-h-this.$element.height()}))}}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery); (function($){ "use strict"; var k={}, max=Math.max, min=Math.min; k.c={}; k.c.d=$(document); k.c.t=function (e){ return e.originalEvent.touches.length - 1; }; k.o=function (){ var s=this; this.o=null; this.$=null; this.i=null; this.g=null; this.v=null; this.cv=null; this.x=0; this.y=0; this.w=0; this.h=0; this.$c=null; this.c=null; this.t=0; this.isInit=false; this.fgColor=null; this.pColor=null; this.dH=null; this.cH=null; this.eH=null; this.rH=null; this.scale=1; this.relative=false; this.relativeWidth=false; this.relativeHeight=false; this.$div=null; this.run=function (){ var cf=function (e, conf){ var k; for (k in conf){ s.o[k]=conf[k]; } s.init(); s._configure() ._draw(); }; if(this.$.data('kontroled')){ return; } this.$.data('kontroled', true); this.extend(); this.o=$.extend({ min:this.$.data('min')||0, max:this.$.data('max')||100, stopper:true, readOnly:this.$.data('readonly')||(this.$.attr('readonly')=='readonly'), cursor:(this.$.data('cursor')===true&&30) || this.$.data('cursor') || 0, thickness:( this.$.data('thickness') && Math.max(Math.min(this.$.data('thickness'), 1), 0.01) ) || 0.35, lineCap:this.$.data('linecap')||'butt', width:this.$.data('width')||200, height:this.$.data('height')||200, displayInput:this.$.data('displayinput')==null||this.$.data('displayinput'), displayPrevious:this.$.data('displayprevious'), fgColor:this.$.data('fgcolor')||'#87CEEB', inputColor: this.$.data('inputcolor'), font: this.$.data('font')||'Arial', fontWeight: this.$.data('font-weight')||'bold', inline:false, step:this.$.data('step')||1, draw:null, change:null, cancel:null, release:null, error:null }, this.o ); if(! this.o.inputColor){ this.o.inputColor=this.o.fgColor; } if(this.$.is('fieldset')){ this.v={}; this.i=this.$.find('input') this.i.each(function(k){ var $this=$(this); s.i[k]=$this; s.v[k]=$this.val(); $this.bind('change keyup' , function (){ var val={}; val[k]=$this.val(); s.val(val); } ); } ); this.$.find('legend').remove(); }else{ this.i=this.$; this.v=this.$.val(); (this.v=='')&&(this.v=this.o.min); this.$.bind('change keyup' , function (){ s.val(s._validate(s.$.val())); } ); } (! this.o.displayInput)&&this.$.hide(); this.$c=$(document.createElement('canvas')); if(typeof G_vmlCanvasManager!=='undefined'){ G_vmlCanvasManager.initElement(this.$c[0]); } this.c=this.$c[0].getContext ? this.$c[0].getContext('2d'):null; if(! this.c){ this.o.error&&this.o.error(); return; } this.scale=(window.devicePixelRatio||1) / ( this.c.webkitBackingStorePixelRatio || this.c.mozBackingStorePixelRatio || this.c.msBackingStorePixelRatio || this.c.oBackingStorePixelRatio || this.c.backingStorePixelRatio||1 ); this.relativeWidth=((this.o.width % 1!==0) && this.o.width.indexOf('%')); this.relativeHeight=((this.o.height % 1!==0) && this.o.height.indexOf('%')); this.relative=(this.relativeWidth||this.relativeHeight); this.$div=$( '
' ); this.$.wrap(this.$div).before(this.$c); this.$div=this.$.parent(); this._carve(); if(this.v instanceof Object){ this.cv={}; this.copy(this.v, this.cv); }else{ this.cv=this.v; } this.$ .bind("configure", cf) .parent() .bind("configure", cf); this._listen() ._configure() ._xy() .init(); this.isInit=true; this._draw(); return this; }; this._carve=function(){ if(this.relative){ var w=this.relativeWidth ? this.$div.parent().width() * parseInt(this.o.width) / 100 : this.$div.parent().width(), h=this.relativeHeight ? this.$div.parent().height() * parseInt(this.o.height) / 100 : this.$div.parent().height(); this.w=this.h=Math.min(w, h); }else{ this.w=this.o.width; this.h=this.o.height; } this.$div.css({ 'width': this.w + 'px', 'height': this.h + 'px' } ); this.$c.attr({ width: this.w, height: this.h } ); if(this.scale!==1){ this.$c[0].width=this.$c[0].width * this.scale; this.$c[0].height=this.$c[0].height * this.scale; this.$c.width(this.w); this.$c.height(this.h); } return this; } this._draw=function (){ var d=true; s.g=s.c; s.clear(); s.dH && (d=s.dH()); (d!==false)&&s.draw(); }; this._touch=function (e){ var touchMove=function (e){ var v=s.xy2val( e.originalEvent.touches[s.t].pageX, e.originalEvent.touches[s.t].pageY ); s.change(s._validate(v)); s._draw(); }; this.t=k.c.t(e); touchMove(e); k.c.d .bind("touchmove.k", touchMove) .bind("touchend.k" , function (){ k.c.d.unbind('touchmove.k touchend.k'); if(s.rH && (s.rH(s.cv)===false) ){ return; } s.val(s.cv); } ); return this; }; this._mouse=function (e){ var mouseMove=function (e){ var v=s.xy2val(e.pageX, e.pageY); s.change(s._validate(v)); s._draw(); }; mouseMove(e); k.c.d .bind("mousemove.k", mouseMove) .bind("keyup.k" , function (e){ if(e.keyCode===27){ k.c.d.unbind("mouseup.k mousemove.k keyup.k"); if(s.eH && (s.eH()===false) ){ return; } s.cancel(); }} ) .bind("mouseup.k" , function (e){ k.c.d.unbind('mousemove.k mouseup.k keyup.k'); if(s.rH && (s.rH(s.cv)===false) ){ return; } s.val(s.cv); } ); return this; }; this._xy=function (){ var o=this.$c.offset(); this.x=o.left; this.y=o.top; return this; }; this._listen=function (){ if(! this.o.readOnly){ this.$c .bind("mousedown" , function (e){ e.preventDefault(); s._xy()._mouse(e); } ) .bind("touchstart" , function (e){ e.preventDefault(); s._xy()._touch(e); } ); this.listen(); }else{ this.$.attr('readonly', 'readonly'); } if(this.relative){ $(window).resize(function(){ s._carve() .init(); s._draw(); } ); } return this; }; this._configure=function (){ if(this.o.draw){ this.dH=this.o.draw; } if(this.o.change){ this.cH=this.o.change; } if(this.o.cancel){ this.eH=this.o.cancel; } if(this.o.release){ this.rH=this.o.release; } if(this.o.displayPrevious){ this.pColor=this.h2rgba(this.o.fgColor, "0.4"); this.fgColor=this.h2rgba(this.o.fgColor, "0.6"); }else{ this.fgColor=this.o.fgColor; } return this; }; this._clear=function (){ this.$c[0].width=this.$c[0].width; }; this._validate=function(v){ return (~~(((v < 0) ? -0.5:0.5) + (v / this.o.step))) * this.o.step; }; this.listen=function (){}; this.extend=function (){}; this.init=function (){}; this.change=function (v){}; this.val=function (v){}; this.xy2val=function (x, y){}; this.draw=function (){}; this.clear=function (){ this._clear(); }; this.h2rgba=function (h, a){ var rgb; h=h.substring(1,7) rgb=[parseInt(h.substring(0,2),16) ,parseInt(h.substring(2,4),16) ,parseInt(h.substring(4,6),16)]; return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + a + ")"; }; this.copy=function (f, t){ for (var i in f){ t[i]=f[i]; }};}; k.Dial=function (){ k.o.call(this); this.startAngle=null; this.xy=null; this.radius=null; this.lineWidth=null; this.cursorExt=null; this.w2=null; this.PI2=2 * Math.PI; this.extend=function (){ this.o=$.extend({ bgColor:this.$.data('bgcolor')||'#EEEEEE', angleOffset:this.$.data('angleoffset')||0, angleArc:this.$.data('anglearc')||360, inline:true }, this.o ); }; this.val=function (v){ if(null!=v){ this.cv=this.o.stopper ? max(min(v, this.o.max), this.o.min):v; this.v=this.cv; this.$.val(this.v); this._draw(); }else{ return this.v; }}; this.xy2val=function (x, y){ var a, ret; a=Math.atan2( x - (this.x + this.w2) , - (y - this.y - this.w2) ) - this.angleOffset; if(this.angleArc!=this.PI2&&(a < 0)&&(a > -0.5)){ a=0; }else if(a < 0){ a +=this.PI2; } ret=~~(0.5 + (a * (this.o.max - this.o.min) / this.angleArc)) + this.o.min; this.o.stopper && (ret=max(min(ret, this.o.max), this.o.min)); return ret; }; this.listen=function (){ var s=this, mwTimerStop, mwTimerRelease, mw=function (e){ e.preventDefault(); var ori=e.originalEvent ,deltaX=ori.detail||ori.wheelDeltaX ,deltaY=ori.detail||ori.wheelDeltaY ,v=s._validate(s.$.val()) + (deltaX > 0||deltaY > 0 ? s.o.step:deltaX < 0||deltaY < 0 ? -s.o.step:0); v=max(min(v, s.o.max), s.o.min); s.val(v); if(s.rH){ clearTimeout(mwTimerStop); mwTimerStop=setTimeout( function(){ s.rH(v); mwTimerStop=null; }, 100 ); if(! mwTimerRelease){ mwTimerRelease=setTimeout( function(){ if(mwTimerStop){ s.rH(v); } mwTimerRelease=null; }, 200 ); }} } , kval, to, m=1, kv={37:-s.o.step, 38:s.o.step, 39:s.o.step, 40:-s.o.step}; this.$ .bind("keydown" ,function (e){ var kc=e.keyCode; if(kc >=96&&kc <=105){ kc=e.keyCode=kc - 48; } kval=parseInt(String.fromCharCode(kc)); if(isNaN(kval)){ (kc!==13) && (kc!==8) && (kc!==9) && (kc!==189) && e.preventDefault(); if($.inArray(kc,[37,38,39,40]) > -1){ e.preventDefault(); var v=parseInt(s.$.val()) + kv[kc] * m; s.o.stopper && (v=max(min(v, s.o.max), s.o.min)); s.change(v); s._draw(); to=window.setTimeout(function (){ m *=2; } ,30 ); }} } ) .bind("keyup" ,function (e){ if(isNaN(kval)){ if(to){ window.clearTimeout(to); to=null; m=1; s.val(s.$.val()); }}else{ (s.$.val() > s.o.max&&s.$.val(s.o.max)) || (s.$.val() < s.o.min&&s.$.val(s.o.min)); }} ); this.$c.bind("mousewheel DOMMouseScroll", mw); this.$.bind("mousewheel DOMMouseScroll", mw) }; this.init=function (){ if(this.v < this.o.min || this.v > this.o.max ){ this.v=this.o.min; } this.$.val(this.v); this.w2=this.w / 2; this.cursorExt=this.o.cursor / 100; this.xy=this.w2 * this.scale; this.lineWidth=this.xy * this.o.thickness; this.lineCap=this.o.lineCap; this.radius=this.xy - this.lineWidth / 2; this.o.angleOffset && (this.o.angleOffset=isNaN(this.o.angleOffset) ? 0:this.o.angleOffset); this.o.angleArc && (this.o.angleArc=isNaN(this.o.angleArc) ? this.PI2:this.o.angleArc); this.angleOffset=this.o.angleOffset * Math.PI / 180; this.angleArc=this.o.angleArc * Math.PI / 180; this.startAngle=1.5 * Math.PI + this.angleOffset; this.endAngle=1.5 * Math.PI + this.angleOffset + this.angleArc; var s=max( String(Math.abs(this.o.max)).length , String(Math.abs(this.o.min)).length , 2 ) + 2; this.o.displayInput && this.i.css({ 'width':((this.w / 2 + 4) >> 0) + 'px' ,'height':((this.w / 3) >> 0) + 'px' ,'position':'absolute' ,'vertical-align':'middle' ,'margin-top':((this.w / 3) >> 0) + 'px' ,'margin-left':'-' + ((this.w * 3 / 4 + 2) >> 0) + 'px' ,'border':0 ,'background':'none' ,'font':this.o.fontWeight + ' ' + ((this.w / s) >> 0) + 'px ' + this.o.font ,'text-align':'center' ,'color':this.o.inputColor||this.o.fgColor ,'padding':'0px' ,'-webkit-appearance': 'none' } ) || this.i.css({ 'width':'0px' ,'visibility':'hidden' } ); }; this.change=function (v){ if(v==this.cv){ return; } this.cv=v; if(this.cH && (this.cH(v)===false) ){ return; }}; this.angle=function (v){ return (v - this.o.min) * this.angleArc / (this.o.max - this.o.min); }; this.draw=function (){ var c=this.g, a=this.angle(this.cv) , sat=this.startAngle , eat=sat + a , sa, ea , r=1; c.lineWidth=this.lineWidth; c.lineCap=this.lineCap; this.o.cursor && (sat=eat - this.cursorExt) && (eat=eat + this.cursorExt); c.beginPath(); c.strokeStyle=this.o.bgColor; c.arc(this.xy, this.xy, this.radius, this.endAngle - 0.00001, this.startAngle + 0.00001, true); c.stroke(); if(this.o.displayPrevious){ ea=this.startAngle + this.angle(this.v); sa=this.startAngle; this.o.cursor && (sa=ea - this.cursorExt) && (ea=ea + this.cursorExt); c.beginPath(); c.strokeStyle=this.pColor; c.arc(this.xy, this.xy, this.radius, sa - 0.00001, ea + 0.00001, false); c.stroke(); r=(this.cv==this.v); } c.beginPath(); c.strokeStyle=r ? this.o.fgColor:this.fgColor; c.arc(this.xy, this.xy, this.radius, sat - 0.00001, eat + 0.00001, false); c.stroke(); }; this.cancel=function (){ this.val(this.v); };}; $.fn.dial=$.fn.knob=function (o){ return this.each(function (){ var d=new k.Dial(); d.o=o; d.$=$(this); d.run(); } ).parent(); };})(jQuery); !function(t){"use strict";function e(){var e=o.clientHeight,i=t.innerHeight;return i>e?i:e}function i(t){var e=0,i=0;do isNaN(t.offsetTop)||(e+=t.offsetTop),isNaN(t.offsetLeft)||(i+=t.offsetLeft);while(t=t.offsetParent);return{top:e,left:i}}function a(a,n){var r=t.pageYOffset,o=r+e(),s=a.offsetHeight,l=i(a).top,u=l+s,n=n||0;return o>=l+s*n&&u>=r}function n(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function r(t){this.options=n(this.defaults,t),this._init()}var o=t.document.documentElement;r.prototype={defaults:{axis:"y",distance:"60px",duration:"0.55s",delay:"0.15s",viewportFactor:.33},_init:function(){var e=this;this.elems=Array.prototype.slice.call(o.querySelectorAll("[data-scrollReveal]")),this.scrolled=!1,this.elems.forEach(function(t){e.animate(t)});var i=function(){e.scrolled||(e.scrolled=!0,setTimeout(function(){e._scrollPage()},60))},a=function(){function t(){e._scrollPage(),e.resizeTimeout=null}e.resizeTimeout&&clearTimeout(e.resizeTimeout),e.resizeTimeout=setTimeout(t,200)};t.addEventListener("scroll",i,!1),t.addEventListener("resize",a,!1)},_scrollPage:function(){var t=this;this.elems.forEach(function(e){a(e,t.options.viewportFactor)&&t.animate(e)}),this.scrolled=!1},parseLanguage:function(t){function e(t){var e=[],i=["from","the","and","then","but"];return t.forEach(function(t){i.indexOf(t)>-1||e.push(t)}),e}var i,a=t.getAttribute("data-scrollreveal").split(/[, ]+/),n={};return a=e(a),a.forEach(function(t,e){switch(t){case"enter":return i=a[e+1],("top"==i||"bottom"==i)&&(n.axis="y"),void(("left"==i||"right"==i)&&(n.axis="x"));case"after":return void(n.delay=a[e+1]);case"wait":return void(n.delay=a[e+1]);case"move":return void(n.distance=a[e+1]);case"over":return void(n.duration=a[e+1]);case"trigger":return void(n.eventName=a[e+1]);default:return}}),("top"==i||"left"==i)&&(n.distance="-"+this.options.distance),n},genCSS:function(t){var e=this.parseLanguage(t),i=e.distance||this.options.distance,a=e.duration||this.options.duration,n=e.delay||this.options.delay,r=e.axis||this.options.axis,o="-webkit-transition: all "+a+" ease "+n+";-moz-transition: all "+a+" ease "+n+";-o-transition: all "+a+" ease "+n+";-ms-transition: all "+a+" ease "+n+";transition: all "+a+" ease "+n+";",s="-webkit-transform: translate"+r+"("+i+");-moz-transform: translate"+r+"("+i+");-ms-transform: translate"+r+"("+i+");transform: translate"+r+"("+i+");opacity: 0;",l="-webkit-transform: translate"+r+"(0);-moz-transform: translate"+r+"(0);-ms-transform: translate"+r+"(0);transform: translate"+r+"(0);opacity: 1;";return{transition:o,initial:s,target:l,totalDuration:1e3*(parseFloat(a)+parseFloat(n))}},animate:function(t){var e=this.genCSS(t);t.getAttribute("data-sr-init")||(t.setAttribute("style",e.initial),t.setAttribute("data-sr-init",!0)),t.getAttribute("data-sr-complete")||a(t,this.options.viewportFactor)&&(t.setAttribute("style",e.target+e.transition),setTimeout(function(){t.removeAttribute("style"),t.setAttribute("data-sr-complete",!0)},e.totalDuration))}},document.addEventListener("DOMContentLoaded",function(){t.scrollReveal=new r})}(window); jQuery(window).load(function(){ jQuery('.status').fadeOut(); jQuery('.preloader').delay(1000).fadeOut('slow'); jQuery('.carousel').carousel('pause'); jQuery('.navbar-collapse').find('a').on('focus blur', function(){ jQuery(this).parents().toggleClass('link-focus'); } ); jQuery('.carousel-control').click(function(){ this.blur(); } ); } ); var callback_mobile_dropdown=function (){ if(jQuery('.wr-megamenu-container').length <=0&&jQuery('.mega-menu-wrap').length <=0){ var navLi=jQuery('#site-navigation li'); navLi.each(function(){ if(jQuery(this).find('ul').length > 0&&! jQuery(this).hasClass('has_children')){ jQuery(this).addClass('has_children'); jQuery(this).find('a').first().after(''); }} ); jQuery('.dropdownmenu').click(function(){ if(jQuery(this).parent('li').hasClass('this-open')){ jQuery(this).parent('li').removeClass('this-open'); }else{ jQuery(this).parent('li').addClass('this-open'); }} ); navLi.find('a').click(function(){ jQuery('.navbar-toggle').addClass('collapsed'); jQuery('#site-navigation .collapse').removeClass('in'); } ); }}; jQuery(document).ready(callback_mobile_dropdown); jQuery(document).ready(function(){ var current_height=parseInt(jQuery('.header .container').height()); jQuery('.header').css('min-height', current_height); } ); jQuery(document).ready(function(){ var thisOpen=false; jQuery('.contact-form .form-control').each(function(){ if(jQuery(this).val().length > 0){ thisOpen=true; jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); return false; }} ); if(thisOpen===false&&(typeof jQuery('.contact-form textarea')!=='undefined')&&(jQuery('.contact-form textarea').length > 0)&&(typeof jQuery('.contact-form textarea').val()!=='undefined')&&(jQuery('.contact-form textarea').val().length > 0)){ thisOpen=true; jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); } jQuery('.contact-form input, .contact-form textarea').focus(function(){ if(! jQuery('.zerif-g-recaptcha').hasClass('recaptcha-display')){ jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1'); }} ); } ); if(navigator.userAgent.match(/IEMobile\/10\.0/)){ var msViewportStyle=document.createElement('style'); msViewportStyle.appendChild(document.createTextNode('@-ms-viewport{width:auto!important}' ) ); document.querySelector('head').appendChild(msViewportStyle); } jQuery(document).ready(function(){ if(typeof jQuery('#main-nav')!=='undefined'&&typeof jQuery('#main-nav').offset()!=='undefined'){ var top=jQuery('#main-nav').offset().top - parseFloat(jQuery('#main-nav').css('margin-top').replace(/auto/, 0)); } jQuery(window).scroll(function (){ var y=jQuery(this).scrollTop(); if(y >=top){ jQuery('#main-nav').addClass('fixed'); }else{ jQuery('#main-nav').removeClass('fixed'); }} ); } ); jQuery(window).load(function(){ jQuery('#site-navigation a[href*="#"]:not([href="#"]), header.header a[href*="#"]:not([href="#"]), #focus .focus-box .service-icon a[href*="#"]:not([href="#"])').bind('click',function (){ var headerHeight; var navigationHeight; var hash=this.hash; var idName=hash.substring(1); var alink=this; if(jQuery('section [id*=' + idName + ']').length > 0&&jQuery(window).width() >=751){ jQuery('#site-navigation .current').removeClass('current'); jQuery(alink).parent('li').addClass('current'); }else{ jQuery('#site-navigation .current').removeClass('current'); } if(jQuery(window).width() >=751){ headerHeight=jQuery('#main-nav').height(); navigationHeight=0; }else{ headerHeight=0; navigationHeight=jQuery('#site-navigation').height() + jQuery('#mega-menu-wrap-primary').height(); } if(location.pathname.replace(/^\//,'')===this.pathname.replace(/^\//,'')&&location.hostname===this.hostname){ var target=jQuery(this.hash); target=target.length ? target:jQuery('[name=' + this.hash.slice(1) + ']'); if(target.length){ jQuery('html,body').animate({ scrollTop: target.offset().top - headerHeight - navigationHeight + 10 }, 1200 ); if(jQuery('.navbar .navbar-collapse').hasClass('in')){ jQuery('.navbar .navbar-collapse.in').removeClass('in'); } if(jQuery('.navbar li.dropdown').hasClass('open')){ jQuery('.navbar li.dropdown.open').removeClass('open'); } if(jQuery('.mega-menu-toggle').hasClass('mega-menu-open')){ jQuery('.mega-menu-toggle.mega-menu-open').removeClass('mega-menu-open'); } return false; }} } ); } ); jQuery(document).ready(function(){ var headerHeight; var navigationHeight; jQuery('#site-navigation .current').removeClass('current'); jQuery('#site-navigation a[href$="' + window.location.hash + '"]').parent('li').addClass('current'); if(jQuery(window).width() >=751){ headerHeight=jQuery('#main-nav').height(); navigationHeight=0; }else{ headerHeight=0; navigationHeight=jQuery('#site-navigation').height() + jQuery('#mega-menu-wrap-primary').height(); } if(location.pathname.replace(/^\//,'')===window.location.pathname.replace(/^\//,'')&&location.hostname===window.location.hostname){ var target=jQuery(window.location.hash); if(target.length){ jQuery('html,body').animate({ scrollTop: target.offset().top - headerHeight - navigationHeight + 10 }, 1200 ); return false; }} } ); function zerif_lite_scrolled(){ if(jQuery(window).width() >=751){ var zerif_scrollTop=jQuery(window).scrollTop(); var headerHeight=jQuery('#main-nav').outerHeight(); var isInOneSection='no'; jQuery('section, header').each(function(){ var thisID='#' + jQuery(this).attr('id'); var zerif_offset=jQuery(this).offset().top; var thisHeight=jQuery(this).outerHeight(); var thisBegin=zerif_offset - headerHeight; var thisEnd=zerif_offset + thisHeight - headerHeight; if(zerif_scrollTop >=thisBegin&&zerif_scrollTop <=thisEnd){ isInOneSection='yes'; jQuery('#site-navigation .current').removeClass('current'); jQuery('#site-navigation a[href$="' + thisID + '"]').parent('li').addClass('current'); return false; } if(isInOneSection==='no'){ jQuery('#site-navigation .current').removeClass('current'); }} ); }} jQuery(window).on('scroll',zerif_lite_scrolled); jQuery(document).ready(function(){ var jQuerywindow=jQuery(window); jQuery('div[data-type="background"], header[data-type="background"], section[data-type="background"]').each(function(){ var jQuerybgobj=jQuery(this); jQuery(window).scroll(function(){ var yPos=-(jQuerywindow.scrollTop() / jQuerybgobj.data('speed')); var coords='50% ' + yPos + 'px'; jQuerybgobj.css({ backgroundPosition: coords } ); } ); } ); } ); jQuery( function(){ jQuery('.skill1').knob({ 'max':100, 'width': 64, 'readOnly':true, 'inputColor':' #FFFFFF ', 'bgColor':' #222222 ', 'fgColor':' #e96656 ' } ); jQuery('.skill2').knob({ 'max':100, 'width': 64, 'readOnly':true, 'inputColor':' #FFFFFF ', 'bgColor':' #222222 ', 'fgColor':' #34d293 ' } ); jQuery('.skill3').knob({ 'max': 100, 'width': 64, 'readOnly': true, 'inputColor':' #FFFFFF ', 'bgColor':' #222222 ', 'fgColor':' #3ab0e2 ' } ); jQuery('.skill4').knob({ 'max': 100, 'width': 64, 'readOnly': true, 'inputColor':' #FFFFFF ', 'bgColor':' #222222 ', 'fgColor':' #E7AC44 ' } ); } ); jQuery('.navbar-toggle').on('click', function (){ jQuery(this).toggleClass('active'); } ); jQuery(window).load(function(){ setminHeightHeader(); } ); var windowWidth=jQuery(window).width(); jQuery(window).resize(function(){ if(jQuery(window).width()!=windowWidth){ windowWidth=jQuery(window).width(); setminHeightHeader(); }} ); function setminHeightHeader(){ jQuery('#main-nav').css('min-height','75px'); jQuery('.header').css('min-height','75px'); var minHeight=parseInt(jQuery('#main-nav').height()); jQuery('.header').css('min-height', minHeight); } jQuery(window).load(fixFooterBottom); jQuery(window).resize(fixFooterBottom); function fixFooterBottom(){ var header=jQuery('header.header'); var footer=jQuery('footer#footer'); var content=jQuery('.site-content > .container'); content.css('min-height', '1px'); var headerHeight=header.outerHeight(); var footerHeight=footer.outerHeight(); var contentHeight=content.outerHeight(); var windowHeight=jQuery(window).height(); var totalHeight=headerHeight + footerHeight + contentHeight; if(totalHeight < windowHeight){ content.css('min-height', windowHeight - headerHeight - footerHeight); }else{ content.css('min-height','1px'); }} var callback_menu_align=function (){ var headerWrap=jQuery('.header'); var navWrap=jQuery('#site-navigation'); var maxMenuNavWrap=jQuery('#mega-menu-primary'); var logoWrap=jQuery('.responsive-logo'); var containerWrap=jQuery('.container'); var classToAdd='menu-align-center'; if(headerWrap.hasClass(classToAdd)){ headerWrap.removeClass(classToAdd); } var logoWidth=logoWrap.outerWidth(); var menuWidth=navWrap.outerWidth() + maxMenuNavWrap.outerWidth(); var containerWidth=containerWrap.width(); if(menuWidth + logoWidth > containerWidth){ headerWrap.addClass(classToAdd); }else{ if(headerWrap.hasClass(classToAdd)){ headerWrap.removeClass(classToAdd); }} }; jQuery(window).load(callback_menu_align); jQuery(window).resize(callback_menu_align); var isMobile={ Android: function(){ return navigator.userAgent.match(/Android/i); }, BlackBerry: function(){ return navigator.userAgent.match(/BlackBerry/i); }, iOS: function(){ return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function(){ return navigator.userAgent.match(/Opera Mini/i); }, Windows: function(){ return navigator.userAgent.match(/IEMobile/i); }, any: function(){ return (isMobile.Android()||isMobile.BlackBerry()||isMobile.iOS()||isMobile.Opera()||isMobile.Windows()); }}; if(isMobile.any()){ jQuery('.team-member').on('click', function(){ jQuery('.team-member-open').removeClass('team-member-open'); jQuery(this).addClass('team-member-open'); event.stopPropagation(); } ); jQuery('html').click(function(){ jQuery('.team-member-open').removeClass('team-member-open'); } ); jQuery(document).ready(function(){ jQuery('.cbp-rfgrid li').prepend('

'); } ); jQuery('.cbp-rfgrid li').on('click', function(){ if(! jQuery(this).hasClass('cbp-rfgrid-open')){ jQuery('.cbp-rfgrid-tr').css('display','block'); jQuery('.cbp-rfgrid-open').removeClass('cbp-rfgrid-open'); jQuery(this).addClass('cbp-rfgrid-open'); jQuery(this).find('.cbp-rfgrid-tr').css('display','none'); event.stopPropagation(); }} ); jQuery('html').click(function(){ jQuery('.cbp-rfgrid-tr').css('display','block'); jQuery('.cbp-rfgrid-open').removeClass('cbp-rfgrid-open'); } ); } jQuery(window).load(zerif_home_latest_news); jQuery(window).resize(zerif_home_latest_news); function zerif_home_latest_news(){ if(jQuery('#carousel-homepage-latestnews').length > 0){ jQuery('#carousel-homepage-latestnews div.item').height('auto'); if(isMobile.any()||(! isMobile.any()&&jQuery('.container').outerWidth() > 768)){ if(jQuery('#carousel-homepage-latestnews div.item').length < 2){ jQuery('#carousel-homepage-latestnews > a').css('display','none'); } var maxheight=0; jQuery('#carousel-homepage-latestnews div.item').each(function(){ if(jQuery(this).height() > maxheight){ maxheight=jQuery(this).height(); }} ); jQuery('#carousel-homepage-latestnews div.item').height(maxheight); }} } jQuery(document).ready(function(){ if(document.createElement('input').placeholder===undefined){ jQuery('.contact-form input, .contact-form textarea').focus(function (){ if((jQuery(this).attr('placeholder')!=='')&&(jQuery(this).val()===jQuery(this).attr('placeholder'))){ jQuery(this).val('').removeClass('zerif-hasPlaceholder'); }} ).blur(function (){ if((jQuery(this).attr('placeholder')!=='')&&(jQuery(this).val()===''||(jQuery(this).val()===jQuery(this).attr('placeholder')))){ jQuery(this).val(jQuery(this).attr('placeholder')).addClass('zerif-hasPlaceholder'); }} ); jQuery('.contact-form input').blur(); jQuery('.contact-form textarea').blur(); jQuery('form.contact-form').submit(function (){ jQuery(this).find('.zerif-hasPlaceholder').each(function(){ jQuery(this).val(''); }); } ); }} ); jQuery(window).load(parallax_effect); jQuery(window).resize(parallax_effect); function parallax_effect(){ if(jQuery('#parallax_move').length > 0){ var scene=document.getElementById('parallax_move'); var window_width=jQuery(window).outerWidth(); jQuery('#parallax_move').css({ 'width': window_width + 120, 'margin-left': -60, 'margin-top': -60, 'position': 'absolute', } ); var h=jQuery('header#home').outerHeight(); jQuery('#parallax_move').children().each(function(){ jQuery(this).css({ 'height': h + 100, } ); } ); if(! isMobile.any()){ var parallax=new Parallax(scene); }else{ jQuery('#parallax_move').css({ 'z-index': '0', } ); jQuery('#parallax_move .layer').css({ 'position': 'absolute', 'top': '0', 'left': '0', 'z-index': '1', } ); }} } var window_width_old; var exist_class=false; jQuery(document).ready(function(){ if(jQuery('.testimonial-masonry').length > 0){ exist_class=true; window_width_old=jQuery('.container').outerWidth(); if(window_width_old < 970){ jQuery('.testimonial-masonry').zerifgridpinterest({columns: 1,selector: '.feedback-box'}); }else{ jQuery('.testimonial-masonry').zerifgridpinterest({columns: 3,selector: '.feedback-box'}); }} } ); jQuery(window).resize(function(){ if(window_width_old!==jQuery('.container').outerWidth()&&exist_class===true){ window_width_old=jQuery('.container').outerWidth(); if(window_width_old < 970){ jQuery('.testimonial-masonry').zerifgridpinterest({columns: 1,selector: '.feedback-box'}); }else{ jQuery('.testimonial-masonry').zerifgridpinterest({columns: 3,selector: '.feedback-box'}); }} } ); ;(function ($, window, document, undefined){ var defaults={ columns: 3, selector: 'div', excludeParentClass: '', }; function ZerifGridPinterest(element, options){ this.element=element; this.options=$.extend({}, defaults, options); this.defaults=defaults; this.init(); } ZerifGridPinterest.prototype.init=function (){ var self=this, $container=$(this.element); $select_options=$(this.element).children(); self.make_magic($container, $select_options); }; ZerifGridPinterest.prototype.make_magic=function (container){ var self=this; $container=$(container), columns_height=[], prefix='zerif', unique_class=prefix + '_grid_' + self.make_unique(); local_class=prefix + '_grid'; var classname; var substr_index=this.element.className.indexOf(prefix + '_grid_'); if(substr_index > -1){ classname=this.element.className.substr(0, this.element.className.length - unique_class.length - local_class.length - 2); }else{ classname=this.element.className; } var my_id; if(this.element.id===''){ my_id=prefix + '_id_' + self.make_unique(); }else{ my_id=this.element.id; } $container.after('
'); var i; for (i=1; i <=this.options.columns; i++){ columns_height.push(0); var first_cols=''; var last_cols=''; if(i % self.options.columns==1){ first_cols=prefix + '_grid_first'; } if(i % self.options.columns==0){ first_cols=prefix + '_grid_last'; } $('.' + unique_class).append('
'); } if(this.element.className.indexOf(local_class) < 0){ $container.children(this.options.selector).each(function(index){ var min=Math.min.apply(null,columns_height); var this_index=columns_height.indexOf(min) + 1; $(this).attr(prefix + 'grid-attr','this-' + index).appendTo('.' + unique_class + ' .' + prefix + '_grid_column_' + this_index); columns_height[this_index - 1]=$('.' + unique_class + ' .' + prefix + '_grid_column_' + this_index).height(); } ); }else{ var no_boxes=$container.find(this.options.selector).length; var i; for(i=0; i < no_boxes; i++){ var min=Math.min.apply(null,columns_height); var this_index=columns_height.indexOf(min) + 1; $('#' + this.element.id).find('[' + prefix + 'grid-attr="this-' + i + '"]').appendTo('.' + unique_class + ' .' + prefix + '_grid_column_' + this_index); columns_height[this_index - 1]=$('.' + unique_class + ' .' + prefix + '_grid_column_' + this_index).height(); }} $container.remove(); } ZerifGridPinterest.prototype.make_unique=function (){ var text=''; var possible='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for(var i=0; i < 10; i++){ text +=possible.charAt(Math.floor(Math.random() * possible.length)); } return text; } $.fn.zerifgridpinterest=function (options){ return this.each(function (){ var value=''; if(! $.data(this, value)){ $.data(this, value, new ZerifGridPinterest(this, options)); }} ); }})(jQuery); var initHeight=0, initWidth=0; var initViewMode, onlyInit=true; jQuery(document).ready(function(){ initViewMode=type_view(); mobile_bg_fix(); } ); jQuery(window).resize(mobile_bg_fix); function mobile_bg_fix(){ if(isMobile.any()&&jQuery('body.custom-background')){ var viewMode=type_view(); if(initViewMode!==viewMode||onlyInit==true){ jQuery('.mobile-bg-fix-img').css({ 'width':window.innerWidth, 'height': window.innerHeight + 100 } ); initViewMode=viewMode; if(onlyInit==true){ onlyInit=false; bodyClass=jQuery('body.custom-background'); imgURL=bodyClass.css('background-image'); imgSize=bodyClass.css('background-size'); imgPosition=bodyClass.css('background-position'); imgRepeat=bodyClass.css('background-repeat'); jQuery('#mobilebgfix').addClass('mobile-bg-fix-wrap').find('.mobile-bg-fix-img').css({ 'background-size': imgSize, 'background-position': imgPosition, 'background-repeat': imgRepeat, 'background-image': imgURL } ); if(! imgURL){ jQuery('.mobile-bg-fix-wrap .mobile-bg-fix-img-wrap').css('display','none'); }} }} } function type_view(){ var initHeight=window.innerHeight; var initWidth=window.innerWidth; if(initWidth <=initHeight){ return 'portrait'; } return 'landscape'; }; (function ($, window){ var defaults={ allItems: false, }; function ZerifSubmenuOrientation(element, options){ this.element=element; this.options=$.extend({}, defaults, options); this.defaults=defaults; this.init(); } ZerifSubmenuOrientation.prototype.init=function (){ var self=this, $container=$(this.element), $select_options=$(this.element).children(); var resize_finish; if(self.options.allItems!==true){ $(window).resize(function(){ clearTimeout(resize_finish); resize_finish=setTimeout( function (){ self.make_magic($container, $select_options); }, 11 ); } ); } self.make_magic($container, $select_options); if(self.options.allItems!==true){ setTimeout( function(){ $(window).resize(); }, 500 ); }}; ZerifSubmenuOrientation.prototype.make_magic=function (container, select_options){ var self=this, $container=$(container), $select_options=$(select_options); var itemWrap; if($container[0].tagName=='UL'){ itemWrap=$container[0]; }else{ itemWrap=$container.find('ul')[0]; } var windowsWidth=window.innerWidth; if(typeof itemWrap!=='undefined'){ var itemId='#' + itemWrap.id; $(itemId).children('li').each(function(){ if(this.id==''){ return; } var max_deep=self.max_deep('#' + this.id); var offsetLeft=$('#' + this.id).offset().left; var submenuWidthItem=$('#' + this.id).find('ul').width(); var submenuTotalWidth=max_deep * submenuWidthItem; if(submenuTotalWidth > 0&&windowsWidth < offsetLeft + submenuTotalWidth){ if(self.options.allItems===true){ $('#' + itemWrap.id).addClass('menu-item-open-left-all'); return false; } $('#' + this.id).addClass('menu-item-open-left'); }else if($('#' + this.id).hasClass('menu-item-open-left')){ $('#' + this.id).removeClass('menu-item-open-left'); }} ); }}; ZerifSubmenuOrientation.prototype.max_deep=function(item){ var maxDepth=-1, currentDepth=-1; $(item + ' li:not(:has(ul))').each(function(){ currentDepth=$(this).parents('ul').length; if(currentDepth > maxDepth){ maxDepth=currentDepth; }} ); return maxDepth - 1; } $.fn.zerifsubmenuorientation=function (options){ return this.each(function (){ var value=''; if(! $.data(this, value)){ $.data(this, value, new ZerifSubmenuOrientation(this, options)); }} ); }})(jQuery,window); jQuery(document).ready(function(){ jQuery('#site-navigation').zerifsubmenuorientation(); } ); (function($, pf){ $(document).ready(function (){ onDocumentReady(); }); $(window).load(function (){ onWindowLoad(); }); function onDocumentReady(){ 'use strict'; $('.pirate-forms-file-upload-button').on('click', function (){ var $button=$(this); $button.parent().find('input[type=file]').on('change', function (){ $button.parent().find('input[type=text]').val($(this).val()).change(); }); $button.parent().find('input[type=file]').focus().click(); }); $('.pirate-forms-file-upload-input').on('click', function (){ $(this).parent().find('.pirate-forms-file-upload-button').trigger('click'); }); $('.pirate-forms-file-upload-input').on('focus', function (){ $(this).blur(); }); var session_var=pf.errors; if((typeof session_var!=='undefined')&&(session_var!=='')&&(typeof $('#contact')!=='undefined')&&(typeof $('#contact').offset()!=='undefined')){ $('html, body').animate({ scrollTop: $('#contact').offset().top }, 'slow'); } $('.pirate-forms-submit-button-ajax').closest('form').submit(function(){ var form=$(this); var formData=new FormData(form[0]); ajaxStart(form); $('div.pirate-forms-ajax').remove(); $.ajax({ url: pf.rest.submit.url, data: formData, type: 'POST', dataType: 'json', contentType: false, processData: false, beforeSend: function(xhr){ xhr.setRequestHeader('X-WP-Nonce', pf.rest.nonce); }, success: function(data){ form.find('input').val(''); form.find('select').val(''); form.find('input[type="checkbox"]').removeAttr('checked'); form.find('input[type="radio"]').removeAttr('checked'); var $time=new Date().getTime(); if(data.message){ form.closest('.pirate_forms_wrap').before('
'); $('#' + $time).append(data.message); }else if(data.redirect){ location.href=data.redirect; }}, error: function(data){ if(data.responseJSON){ var $time=new Date().getTime(); form.closest('.pirate_forms_wrap').prepend('
'); $('#' + $time).append(data.responseJSON.error); }}, complete: function(){ ajaxStop(form); }}); return false; }); } function onWindowLoad(){ 'use strict'; if($('.pirate_forms_wrap').length){ $('.pirate_forms_wrap').each(function (){ var formWidth=$(this).innerWidth(); var footerWidth=$(this).find('.pirate-forms-footer').innerWidth(); if(footerWidth > formWidth){ $(this).find('.contact_submit_wrap, .form_captcha_wrap, .pirateform_wrap_classes_spam_wrap').css({'text-align':'left', 'display':'block' }); }}); }} function ajaxStart(element){ $(element).fadeTo('slow', 0.5); } function ajaxStop(element){ $(element).fadeTo('fast', 1); }})(jQuery, pirateFormsObject);