/*! * The PayPal Mini Cart * Visit http://www.minicartjs.com/ for details * Use subject to license agreement as set forth at the link below * * @author Jeff Harrell * @license https://github.com/jeffharrell/MiniCart/blob/master/LICENSE eBay Open Source License Agreement */ if (typeof PAYPAL == 'undefined' || !PAYPAL) { var PAYPAL = {}; } PAYPAL.apps = PAYPAL.apps || {}; (function () { /** * 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: '/', /** * Strings used for display text */ strings: { button: '', subtotal: '', discount: '', shipping: '', 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 } }; /** * 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