/*!
* MiniCart
*
* Improve your PayPal integration by creating an overlay which appears as a user adds products to their cart.
*
* @version 2.5.0 - 2012-12-02, 1:04:43 PM
* @author Jeff Harrell
* @url http://www.minicartjs.com/
* @license >
*/
if (typeof PAYPAL === 'undefined' || !PAYPAL) {
var PAYPAL = {};
}
PAYPAL.apps = PAYPAL.apps || {};
(function () {
'use strict';
/**
* Default configuration
*/
var config = {
/**
* The parent element the cart should "pin" to
*/
parent: document.body,
/**
* Edge of the window to pin the cart to
*/
displayEdge: 'right',
/**
* Distance from the edge of the window
*/
edgeDistance: '50px',
/**
* HTML target property for the checkout form
*/
formTarget: null,
/**
* The base path of your website to set the cookie to
*/
cookiePath: '/',
/**
* The number of days to keep the cart data
*/
cartDuration: 30,
/**
* Strings used for display text
*/
strings: {
button: 'Checkout',
subtotal: 'Subtotal: ',
discount: 'Discount: ',
shipping: 'Your Shopping Basket',
processing: 'Processing...'
},
/**
* Unique ID used on the wrapper element
*/
name: 'PPMiniCart',
/**
* Boolean to determine if the cart should "peek" when it's hidden with items
*/
peekEnabled: true,
/**
* The URL of the PayPal website
*/
paypalURL: 'https://www.paypal.com/cgi-bin/webscr',
/**
* The base URL to the visual assets
*/
assetURL: 'http://www.minicartjs.com/build/',
events: {
/**
* Custom event fired before the cart is rendered
*/
onRender: null,
/**
* Custom event fired after the cart is rendered
*/
afterRender: null,
/**
* Custom event fired before the cart is hidden
*
* @param e {event} The triggering event
*/
onHide: null,
/**
* Custom event fired after the cart is hidden
*
* @param e {event} The triggering event
*/
afterHide: null,
/**
* Custom event fired before the cart is shown
*
* @param e {event} The triggering event
*/
onShow: null,
/**
* Custom event fired after the cart is shown
*
* @param e {event} The triggering event
*/
afterShow: null,
/**
* Custom event fired before a product is added to the cart
*
* @param data {object} Product object
*/
onAddToCart: null,
/**
* Custom event fired after a product is added to the cart
*
* @param data {object} Product object
*/
afterAddToCart: null,
/**
* Custom event fired before a product is removed from the cart
*
* @param data {object} Product object
*/
onRemoveFromCart: null,
/**
* Custom event fired after a product is removed from the cart
*
* @param data {object} Product object
*/
afterRemoveFromCart: null,
/**
* Custom event fired before the checkout action takes place
*
* @param e {event} The triggering event
*/
onCheckout: null,
/**
* Custom event fired before the cart is reset
*/
onReset: null,
/**
* Custom event fired after the cart is reset
*/
afterReset: null
}
};
if (!PAYPAL.apps.MiniCart) {
/**
* Mini Cart application
*/
PAYPAL.apps.MiniCart = (function () {
var minicart = {},
isShowing = false,
isRendered = false;
/** PRIVATE **/
/**
* PayPal form cmd values which are supported
*/
var SUPPORTED_CMDS = { _cart: true, _xclick: true };
/**
* The form origin that is passed to PayPal
*/
var BN_VALUE = 'MiniCart_AddToCart_WPS_US';
/**
* Regex filter for cart settings, which appear only once in a cart
*/
var SETTING_FILTER = /^(?:business|currency_code|lc|paymentaction|no_shipping|cn|no_note|invoice|handling_cart|weight_cart|weight_unit|tax_cart|page_style|image_url|cpp_|cs|cbt|return|cancel_return|notify_url|rm|custom|charset)/;
/**
* Adds the cart's CSS to the page in a