hideCart(0,0)}).on("click","a.remove",debounce(function(){var t=jq(this).data("skucode"),n=[{id:t,q:1}];return e.remove(n),_gaq.push(["_trackEvent",eshop.CC+"_ShoppingCart","ItemRemovedFromCart",t]),!1},500,!0))},fetchCartItems:function(){if(null===eshop.cart.cartGUID||typeof eshop.cart.cartGUID=="undefined")return;jq.getJSON(eshop.cart.cartItemsUrl).done(function(e){eshop.cart.cartItems=e}).fail(function(){eshop.cart.cartItems=[],console.log("Failed fetching Cart Items. Url: "+eshop.cart.cartItemsUrl)}).always(function(){eshop.cart.updateDisplay()})},add:function(e){var t=null,n=!1,r=e[0];for(var i=0,s=eshop.cart.cartItems.length;i<s;i++){t=eshop.cart.cartItems[i];if(t.id===r.id){t.q+=r.q,n=!0;break}}return n||this.cartItems.push(r),this.highlightCartButton(),eshop.BODY.trigger("cartUpdated"),!0},remove:function(e){var t=eshop.cart.cartItems,n=null,r=e[0].id;for(var i=0,s=this.cartItems.length;i<s;i++){n=this.cartItems[i];if(n.id===r){n.q-=e[0].q,n.q<=0&&this.cartItems.splice(i,1);break}}eshop.BODY.trigger("cartUpdated");var o=eshop.cart.cartRemoveItemUrl+r+"?callback=?&method=DELETE",u=!0;return jq.getJSON(o).done(function(e){}).fail(function(){u=!1}).always(function(){}),u},update:function(e,t){return e=typeof e!="undefined"?e:null,t=typeof t!="undefined"?t:!1,e===null?this.fetchCartItems():(eshop.cart.cartItems=e,eshop.cart.updateDisplay()),t&&this.highlightCartButton(),!0},highlightCartButton:function(){var e=this,t=jq("#cart_button_bnw .cart-shake-container");t.stop().css({right:0}),jq("html, body").animate({scrollTop:0},300),setTimeout(function(){e.showCart(),t.animate({right:5},100,function(){t.animate({right:-5},100,function(){t.animate({right:5},100,function(){t.animate({right:-5},100,function(){t.animate({right:5},100,function(){t.animate({right:0},100,function(){e.hideCart()})})})})})})},300)},isMouseOffCartIcon:function(e,t){var n,r,i,s;return n=jq(t).offset().left,r=jq(t).offset().top,i=e.clientX,s=e.clientY+jq(document).scrollTop(),i>n+79&&i<n+215&&s>r+6&&s<r+38?!0:!1},isMouseOnCartIcon:function(e,t){var n,r,i,s;return n=jq(t).offset().left,r=jq(t).offset().top,i=e.clientX,s=e.clientY+jq(document).scrollTop(),i>n+13&&i<n+79&&s>r+6&&s<r+38?!0:!1},showCart:function(){clearTimeout(this.cartHideTimout),this.cartTopWrapper.removeClass("cart-empty").addClass("cart-active"),this.cartContainer.slideDown(200)},hideCart:function(e,t){var n=e!==undefined?e:5e3,r=t!==undefined?t:200;clearTimeout(this.cartHideTimout),this.cartHideTimout=setTimeout(function(){eshop.cart.cartContainer.stop().slideUp(r,function(){eshop.cart.cartTopWrapper.removeClass("cart-active")})},n)},showCartEmpty:function(){eshop.cart.cartContainer.slideUp(0,function(){eshop.cart.cartTopWrapper.removeClass("cart-active").addClass("cart-empty")})},updateDisplay:function(){if(!jq.isEmpty(this.cartItems)){var e=0,t,n,r;window.clearTimeout(this.cartHideTimout),this.cartItemTable.empty();for(var i=0,s=this.cartItems.length;i<s;i++)n=this.cartItems[i],r=this.calculateTotalPrice(n.p,n.q),n.total=accounting.formatMoney(r),this.cartItemTable.append(this.cartItemTemplate.render(n)),e+=parseFloat(r);this.cartSubTotal.html(accounting.formatMoney(e)),t=this.getTotalItemsInCart(),this.cartCounter.html(t),this.cartTopWrapper.removeClass("cart-empty"),this.hideCart()}else this.showCartEmpty();this.cartTopWrapper.removeClass("cart-hidden")},calculateTotalPrice:function(e,t){var n=accounting.unformat(e,accounting.settings.number.decimal);return parseFloat(parseFloat(n)*Number(t))},getTotalItemsInCart:function(){var e=0;for(var t=0,n=this.cartItems.length;t<n;t++)e+=Number(this.cartItems[t].q);return e},parseCookie:function(){return jq.cookie(this.cartCookie)}},eshop.loadViewTemplates=function(){jq("textarea.view-template").each(function(){eshop.ViewTemplates[this.id]=jq(this).text(),jq(this).remove()})},eshop.setAccountingSettings=function(e,t,n,r){accounting.settings={currency:{symbol:e,format:t,decimal:r,thousand:n,precision:2},number:{precision:2,thousand:n,decimal:r}}},function(e){e&&(e.fn.extend({exists:function(){return this.length>0}}),e.extend({isEmpty:function(t){function n(t){return t===null||t==="undefined"?!1:typeof t=="string"?e.trim(t).length>0:e.isArray(t)?t.length>0:!0}return!n(t)},resizedImageUrl:function(e,t){var n=e.substring(e.lastIndexOf("."),e.length),r="_"+t+n;return eshop.IMAGEAPPPATH+e.replace(n,r)},getDomain:function(){var e=document.location.hostname,t=null;try{t=e.match(/[a-z]+\.+[a-z]+$/)[0].toString()}catch(n){}return t=t===null?e:t,t}}))}(jq),jq(document).ready(function(){eshop.BODY=jq("#cart_container_bnw"),eshop.CC=jq("#cart_container_bnw").data("site-id"),springmessage_item=jq("#cart_container_bnw").data("springmessage-item"),springmessage_remove=jq("#cart_container_bnw").data("springmessage-remove"),eshop.loadViewTemplates(),eshop.cart.init()})}),define("cart",["cookie","jquery","epshop"],function(e,t,n){"use strict";var r=t.cookie("customerSessionGuid");if(r===null||r==="[]"||r==="")t("#cart_button_bnw").addClass("cart-empty"),t("#cart_button_bnw").removeClass("cart-hidden");require(["accounting","json2"],function(e){window.accounting=e})}),"use strict",function(e,t){function i(){if(!n)return;e.console&&e.console.log&&e.console.log(arguments)}function s(e,n){e=a(e);if(!e)return;t.all?e.innerText=n:e.textContent=n}function o(e){e=a(e);if(!e)return;e.style.display="block"}function u(e){e=a(e);if(!e)return;e.style.display="none"}function a(e){return typeof e=="string"&&(e=t.getElementById(e)),e}function f(e,t){var n=e.length;for(var r=0;r<n;r++)t(e[r])}function l(e,t){e=a(e);if(!e)return;e.onclick=t}function c(e,t){e=a(e);if(!e)return;e.href=t}function h(e,t){e=a(e);if(!e)return;e.className=t}function p(t){t||(t=e.location);var n={};return t.search.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(e,t,r,i){n[t]=i}),n}function d(){var e=p();delete e.exchange_token,delete e.cause,delete e.code;var t=location.protocol+"//"+location.host+location.pathname,n=v(e);n&&(t+="?"+n);var r=location.href.split("#")[1];return r=r=="_=_"?"":r,t+=r?"#"+r:"",t}function v(e){var t="";for(var n in e)t+=n+"="+e[n]+"&";return t.length>0?t.substring(0,t.length-1):t}function m(e,n){var r=t.
Back to home |
File page
Subscribe |
Register |
Login
| N