forked from lemonstand/lscloud-theme-boxie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.min.js
1 lines (1 loc) · 6.59 KB
/
main.min.js
1
!function($){$(document).ready(function(){function e(){$('[rel="tooltip"]').tooltip({placement:"bottom"})}function t(){$(".product-img-zoom").each(function(){var e=$(this).data("lg");$(this).zoom({url:e})}),$("#sharrre .twitter").sharrre({template:'<a href="#" rel="tooltip" title="Twitter: {total}"><i class="fa fa-twitter"></i></a>',share:{twitter:!0},enableHover:!1,enableTracking:!0,click:function(e,t){e.simulateClick(),e.openPopup("twitter")},render:function(){e()}}),$("#sharrre .facebook").sharrre({template:'<a href="#" rel="tooltip" title="Facebook: {total}"><i class="fa fa-facebook"></i></a>',share:{facebook:!0},enableHover:!1,enableTracking:!0,click:function(e,t){e.simulateClick(),e.openPopup("facebook")},render:function(){e()}}),$("#sharrre .pinterest").sharrre({template:'<a href="#" rel="tooltip" title="Pinterest: {total}"><i class="fa fa-pinterest"></i></a>',share:{pinterest:!0},enableHover:!1,enableTracking:!0,click:function(e,t){e.simulateClick(),e.openPopup("pinterest")},render:function(){e()}})}function a(e,t,a){$(e).each(function(e){$(this).on(a,function(){var a=$(this).val();"on"==$(".btn-form-mirror").data("toggle-mirror")&&$(t+":eq("+e+")").val(a)})})}function o(){$("#billing-info [data-mirror]").each(function(e){var t=$(this).val();$("#shipping-info [data-mirror]:eq("+e+")").val(t)}),$("#shipping_country[data-mirror]").trigger("change")}$("#product-carousel").owlCarousel({itemsScaleUp:!0,navigation:!0,navigationText:!1,afterInit:function(){$(".owl-prev").addClass("fa fa-angle-left"),$(".owl-next").addClass("fa fa-angle-right")}});var i=$(window).width();$(window).resize(function(){i=$(window).width()}),$("#search-form").on("click",".search-btn.toggle",function(e){$(this).addClass("close-search").find(".fa").toggleClass("fa-search fa-times").closest("#search-form").addClass("active"),$(".search-form").focus()}),$("#search-form").on("click",".search-btn.toggle.close-search",function(e){$(this).removeClass("close-search").find(".fa").removeClass("fa-times").addClass("fa-search").closest("#search-form").removeClass("active")}),$(document).on("click",".quantity-selector .minus",function(){var e=$(this).closest(".quantity-selector").find(".quantity"),t=parseInt(e.val())-1;t>1&&e.val(t)}),$(document).on("click",".quantity-selector .plus",function(){var e=$(this).closest(".quantity-selector").find(".quantity"),t=parseInt(e.val())+1;e.val(t)}),e(),t(),$(document).on("change","select.product-option",function(){$(this).sendRequest("shop:product",{update:{"#product-images":"shop-product-gallery"},onAfterUpdate:function(){t()}})}),$(".btn-quick-view").on("click",function(){var e=$(this),a=$(this).attr("href")+" #single-product";return e.find(".fa").removeClass("fa-eye").addClass("fa-refresh fa-spin"),$("#product-quick-view").find(".modal-body").load(a,function(){$(this).closest("#product-quick-view").modal({show:!0}),e.find(".fa").removeClass("fa-refresh fa-spin").addClass("fa-eye"),t()}),!1}),$(document).on("click",".page-items-controller a",function(){$(this).addClass("active").html('<i class="fa fa-refresh fa-spin"></i>').siblings().removeClass("active")});var n=new $.Deferred;$(document).on("click",".btn-add-cart",function(){n.resolve(),$(this).prepend('<i class="fa fa-refresh fa-spin"/>')}),$(".btn-update-cart").on("click",function(){n.resolve(),$(this).find(".fa").addClass("fa-spin")}),$("body").on("click",".remove-item",function(){n.resolve(),$(this).find(".fa").removeClass("fa-times").addClass("fa-refresh fa-spin")}),$(document).ajaxComplete(function(){$(".btn-add-cart").find(".fa-refresh").remove(),$(".btn-update-cart").find(".fa-refresh").removeClass("fa-spin"),$.when(n).then(function(){$("#navbar-totals").addClass("active"),setTimeout(function(){$("#navbar-totals").removeClass("active"),n=new $.Deferred},500)})}),$(".chzn-select").chosen({width:"100%"}),$(window).on("onAjaxAfterUpdate",function(){$(".chzn-select").trigger("chosen:updated"),$(".chzn-select").chosen({width:"100%"})}),$(document).on("click",".btn-checkout-step",function(){$(this).find(".fa").removeClass("fa-arrow-right fa-arrow-left fa-money").addClass("fa-refresh fa-spin")}),$(window).on("onAjaxFailure",function(){$(".btn-checkout-step .fa").removeClass("fa-refresh fa-spin").addClass("fa-arrow-right")}),$(document).on("click",".btn-form-mirror",function(){"on"==$(this).data("toggle-mirror")?($(this).data("toggle-mirror","off").find(".fa").css("visibility","hidden"),sessionStorage.toggleMirror="off"):($(this).data("toggle-mirror","on").find(".fa").css("visibility","visible"),sessionStorage.toggleMirror="on",o())}),$(window).on("onAjaxAfterUpdate",function(){$(".btn-form-mirror").length&&"off"==sessionStorage.toggleMirror&&($(".btn-form-mirror").data("toggle-mirror","off").find(".fa").css("visibility","hidden"),$("#shipping-info").addClass("in"))}),a("#billing-info [data-mirror]","#shipping-info [data-mirror]","keyup keypress blur change"),$(window).load(function(){"on"==$(".btn-form-mirror").data("toggle-mirror")&&o()});var r=!1;$("#billing_country[data-mirror]").on("change",function(){"on"==$(".btn-form-mirror").data("toggle-mirror")&&(r=!0)}),$(window).on("onAfterAjaxUpdate",function(){1==r&&($("#shipping_country[data-mirror]").change(),console.log("ajax done"),r=!1),$("#shipping_state[data-mirror]").val()!=$("#billing_state[data-mirror]").val()&&$("#shipping_state[data-mirror]").val($("#billing_state[data-mirror]").val())}),$("#checkout-page").on("change","#shipping-methods input",function(){$(this).sendRequest("shop:checkout",{update:{"#cart-totals":"shop-checkout-totals","#mini-cart":"shop-minicart"}}),$("#cart-totals .order-shipping .badge").html('<i class="fa fa-refresh fa-spin"/>')}),$(document).on("change","#payment_method input",function(){$("#payment_form").html('<i class="fa fa-refresh fa-spin"/>'),$(this).sendRequest("shop:onUpdatePaymentMethod",{update:{"#payment_form":"shop-paymentform"}})}),$(document).ajaxComplete(function(){"#checkout-page"&&($(".credit-card-input").length&&($(".credit-card-input").validateCreditCard(function(e){e.length_valid===!0?$(".credit-card-input").next("label").html(e.card_type.name).append(' <i class="fa fa-check-circle" />').parent().removeClass("invalid").addClass("valid"):$(".credit-card-input").next("label").html("Credit Card Number").parent().removeClass("valid").addClass("invalid")}),""==$(".credit-card-input").val()&&$(".credit-card-input").parent().removeClass("valid invalid")),$(".fa-question").on({mouseenter:function(){$(this).popover("show")},mouseleave:function(){$(this).popover("hide")}}))});var s=document.querySelector(".product-grid > .row"),c;$(".product-grid").length&&imagesLoaded(s,function(){c=new Masonry(s,{itemSelector:".product-holder"}),console.log("loaded")})})}(jQuery);