File: D:/HostingSpaces/SBogers10/kemi.komma.pro/wwwroot/js/shop/shop.js
var ShoppingCart={init:function(){$(".userMenu").bind("click",function(){console.log($(this).children(".dropdown").show())}),$("[contenteditable]").bind("blur",function(){var t=$(this).html(),n=$(this).data("id");t>0&&ShoppingCart.setItemAmountInShoppingcart(n,t)}),$("[contenteditable]").bind("keypress",function(t){10!==event.keyCode&&13!==event.keyCode||($(this).blur(),t.preventDefault())}),$(".order-box .amount").bind("change",function(){var t=parseInt($(this).val()),n=$(this).data("id");t>0&&ShoppingCart.setItemAmountInShoppingcart(n,t)})},addProductToShoppingcart:function(t){var n=parseInt($(".order-box .amount").val());n>0&&$.post("/addProductToShoppingcart",{itemID:t,amount:n}).done(function(t){ShoppingCart.updateCartButtonCounter(),"/offerte"!==window.location.href&&(window.location="/offerte")})},removeItemFromShoppingcart:function(t){$.post("/removeItemFromShoppingcart",{itemID:t}).done(function(t){$(".shoppingCartContent").html(t),ShoppingCart.updateCartButtonCounter()})},setItemAmountInShoppingcart:function(t,n){n>0?$.post("/setItemAmountInShoppingcart",{itemID:t,amount:n}).done(function(t){$(".shoppingCartContent").html(t),ShoppingCart.updateCartButtonCounter()}):0===n&&this.removeItemFromShoppingcart(t)},updateCartButtonCounter:function(){$.get("/getCartItemCount",function(t){$("span.shoppingCartButtonCounter").html(t>0?t:"")})}};ShoppingCart.init();