File "update-cart.min.js"
Path: /StudyIB/js/subscribe/update-cartminjs
File size: 1.56 KB
MIME-type: text/plain
Charset: utf-8
function updateCart(t,e,a,s,r){var o="/pages/subscribe/update-cart.php",c=$('input[name="currency"]').val(),n={action:t,ticket:$("#ticket").val(),subject:e,product:a,units:s,currency:c,editable:r?"1":"0"};$.post(o,n,(function(s){if(1==s.success){if($("#cart-items tbody").html(s.items),$("#cart-total").html(s.total),1==s.continue?($("#cart-items tfoot").show(),$(".btn.continue").removeClass("disabled")):($("#cart-items tfoot").hide(),$(".btn.continue").addClass("disabled")),1==s.paid?$(".arrow-breadcrumb .has-payment").fadeIn("fast"):$(".arrow-breadcrumb .has-payment").fadeOut("fast"),"remove-subject"==t){var r=e+"-"+a;$("#card-"+e).removeClass("in-basket")}else s.products.length&&$.each(s.subjects,(function(t,e){$("#card-"+e).addClass("in-basket")}));"undefined"!=typeof isMobileDevice&&isMobileDevice()&&(s.products.length?(hasProductsInCart=!0,$("span.cart-xs-count").show(),$("span.cart-xs-count").text(s.products.length),isScrolledIntoView($("#shopping-cart"))?$(".btn-circle-cart").fadeOut("fast"):$(".btn-circle-cart").fadeIn("fast")):(hasProductsInCart=!1,$("span.cart-xs-count").hide(),$(".btn-circle-cart").fadeOut("fast")))}else 0==s.success?alert(s.msg):alert("Something went wrong updating your basket. Please contact support.")}),"json")}function scrollToShoppingCart(){var t=$("#shopping-cart"),e=$("ol.arrow-breadcrumb").outerHeight(),a=$(".navbar-header").outerHeight();$("html, body").animate({scrollTop:t.offset().top-(e+a+15)},"slow")}function isScrolledIntoView(t){var e=$(window).scrollTop(),a=e+$(window).height(),s=t.offset().top,r;return s+t.height()<=a&&s>=e}