From 6eb1141c403055873a34774ffb7a111753b5d77e Mon Sep 17 00:00:00 2001 From: JackelineGCP Date: Fri, 23 Feb 2018 20:59:17 -0500 Subject: [PATCH 01/15] =?UTF-8?q?agregando=20estructura=20b=C3=A1sica=20de?= =?UTF-8?q?l=20proyecto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 31 ++++ .gitignore | 1 + README.md | 2 +- package-lock.json | 362 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 24 +++ public/css/main.css | 0 public/index.html | 0 public/js/app.js | 0 server.js | 8 + 9 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 .eslintrc create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/css/main.css create mode 100644 public/index.html create mode 100644 public/js/app.js create mode 100644 server.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..0d410cb9 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,31 @@ +{ + "parserOptions": { + "ecmaVersion": 6 + }, + "rules": { + "keyword-spacing": 1, + "space-before-function-paren": [1, "never"], + "eqeqeq": 1, + "space-infix-ops": 1, + "comma-spacing": 1, + "brace-style": 1, + "no-multiple-empty-lines": 1, + "camelcase": 1, + "func-call-spacing": 1, + "key-spacing": 1, + "semi": 1, + "no-floating-decimal": 1, + "no-multi-spaces": 1, + "object-property-newline": 1, + "padded-blocks": [1, "never"], + "space-before-blocks": 1, + "space-in-parens": 1, + "spaced-comment": 1, + "quotes": [1, "single"], + "id-length": [1, { + "exceptions": ["i", "j", "x"] + }], + "indent": [1, 2], + "no-array-constructor": 1 + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..07e6e472 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/node_modules diff --git a/README.md b/README.md index cc501c00..30a608eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# E-commerce +# E-commerce Produc Final * **Track:** _Especialización Front-end_ * **Curso:** _CONSTRUYE UNA SINGLE PAGE APP (SPA) MULTI-USUARIO CONSUMIENDO DATA REMOTA_ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..bb9f75d8 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,362 @@ +{ + "name": "ecommerse-product-final", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "accepts": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "requires": { + "mime-types": "2.1.18", + "negotiator": "0.6.1" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "1.0.4", + "debug": "2.6.9", + "depd": "1.1.2", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "1.6.16" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "express": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", + "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", + "requires": { + "accepts": "1.3.4", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "1.1.2", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "finalhandler": "1.1.0", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "1.1.2", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "2.0.3", + "qs": "6.5.1", + "range-parser": "1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.1", + "serve-static": "1.13.1", + "setprototypeof": "1.1.0", + "statuses": "1.3.1", + "type-is": "1.6.16", + "utils-merge": "1.0.1", + "vary": "1.1.2" + } + }, + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "requires": { + "debug": "2.6.9", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "on-finished": "2.3.0", + "parseurl": "1.3.2", + "statuses": "1.3.1", + "unpipe": "1.0.0" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": "1.3.1" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + } + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", + "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "proxy-addr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", + "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "requires": { + "forwarded": "0.1.2", + "ipaddr.js": "1.6.0" + } + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "send": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", + "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", + "requires": { + "debug": "2.6.9", + "depd": "1.1.2", + "destroy": "1.0.4", + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "etag": "1.8.1", + "fresh": "0.5.2", + "http-errors": "1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "2.3.0", + "range-parser": "1.2.0", + "statuses": "1.3.1" + } + }, + "serve-static": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", + "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", + "requires": { + "encodeurl": "1.0.2", + "escape-html": "1.0.3", + "parseurl": "1.3.2", + "send": "0.16.1" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "2.1.18" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..b8bc00d6 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "ecommerse-product-final", + "version": "1.0.0", + "description": "* **Track:** _Especialización Front-end_ * **Curso:** _CONSTRUYE UNA SINGLE PAGE APP (SPA) MULTI-USUARIO CONSUMIENDO DATA REMOTA_ * **Unidad:** _Producto final_", + "main": "server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/JackelineGCP/ecommerse-product-final.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/JackelineGCP/ecommerse-product-final/issues" + }, + "homepage": "https://github.com/JackelineGCP/ecommerse-product-final#readme", + "dependencies": { + "express": "^4.16.2" + } +} diff --git a/public/css/main.css b/public/css/main.css new file mode 100644 index 00000000..e69de29b diff --git a/public/index.html b/public/index.html new file mode 100644 index 00000000..e69de29b diff --git a/public/js/app.js b/public/js/app.js new file mode 100644 index 00000000..e69de29b diff --git a/server.js b/server.js new file mode 100644 index 00000000..494289d9 --- /dev/null +++ b/server.js @@ -0,0 +1,8 @@ +const express = require('express'); // descargando express +const app = express(); // guardame todas las funciones de expresss en una variable 'app' +const server = app.listen(3001, on); // cuando escuches el puerto 3000 recrea la funcion encender +function on() { + console.log('Servidor encendido'); +} + +app.use(express.static('public')); // cuando uses express static y la carpeta se llama 'public' \ No newline at end of file From c383e9d356da902fb992d84d295c6249b33cf5cb Mon Sep 17 00:00:00 2001 From: kamalyzl Date: Sat, 24 Feb 2018 18:44:43 -0500 Subject: [PATCH 02/15] =?UTF-8?q?Api=20mercado=20libre=20-=20dise=C3=B1o?= =?UTF-8?q?=20nav=20-=20libreria=20page.js=20-=20opcion=20categorias=20fun?= =?UTF-8?q?cional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 85 +++++++++++++++++++++++++++++++++++++++++++++++ public/js/page.js | 37 +++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 public/js/page.js diff --git a/public/index.html b/public/index.html index e69de29b..3f5440b2 100644 --- a/public/index.html +++ b/public/index.html @@ -0,0 +1,85 @@ + + + + + + + + + + + Index + + + + + + + + + + + + + + +
+

+
+ + + + + + + + + + \ No newline at end of file diff --git a/public/js/page.js b/public/js/page.js new file mode 100644 index 00000000..a4ae8365 --- /dev/null +++ b/public/js/page.js @@ -0,0 +1,37 @@ +page('/', index); +page('/categories', categories); +// page('/user/:userName', user); +page('*', notfound); +page(); + +// let container = document.querySelector('p'); + +function index() { + $.get('https://api.mercadolibre.com/sites/MLA/categories', function(data, status) { + data.forEach(element => { + // console.log(element); + let listCategories = $('#categories'); + listCategories.append(`${element.name}`); + + // Mostramos todas las categorias y guardamos el id en un atributo data para luego al hacerle click mostrar el contenido + }); + }); +} + +function categories() { + console.log('categories') + $.get(`https://api.mercadolibre.com/sites/MLA/search?condition=new&q=${input.val()}`, function(data, status) { + console.log(data); + }); +} + + +function user(ctx) { + $('p').text('Pagina user' + (ctx.params.userName)); +} + +function notfound() { + $('p').text('PÁGINA AUN SIN CONTENIDO - ESTAMOS TRABAJANDO PARA UD -- SALUDOS!'); +} + + From d03cbedc8428c39e2b99035d7ad4f26f57d91d95 Mon Sep 17 00:00:00 2001 From: JackelineGCP Date: Sat, 24 Feb 2018 23:10:25 -0500 Subject: [PATCH 03/15] Incluyendo .js de Culqi --- public/index.html | 42 +++++++++++++++++++++++++++++++++++++--- public/js/pagaronline.js | 30 ++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 public/js/pagaronline.js diff --git a/public/index.html b/public/index.html index 3f5440b2..3a76fbf0 100644 --- a/public/index.html +++ b/public/index.html @@ -44,8 +44,6 @@ - - + + -
-
- + +
+ + +
+
- + - - - + + + + - + - diff --git a/public/js/app.js b/public/js/app.js index ff612e3b..0e598137 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,5 +1,4 @@ - // Usamos libreria page.js para generar nuestras rutas dentro de la misma página page('/', index); page('/:categories', categories); diff --git a/public/js/pagaronline.js b/public/js/pagaronline.js deleted file mode 100644 index e9da9ebd..00000000 --- a/public/js/pagaronline.js +++ /dev/null @@ -1,65 +0,0 @@ -// Seteando valores de config - -Culqi.publicKey = 'pk_test_FP96YFVHPBdhfKqt'; // Colocar tu Código de Comercio (llave pública) -Culqi.init(); - -Culqi.settings({ - title: 'Culqi Store', - currency: 'PEN', // Código de la moneda, 'PEN' o 'USD' - description: 'Polo/remera Culqi lover', // Descripción acerca de la compra - amount: 3500 // Monto de la compra (sin punto decimal, en este caso 35.00 soles) -}); - -$('#buyButton').on('click', function (e) { - // Abre el formulario con las opciones de Culqi.settings - Culqi.open(); - e.preventDefault(); -}); - -// Recibimos el token desde los servidores de Culqi -function culqi() { - if (Culqi.token) { // Token creado exitosamente! - // Obtener el token ID - var token = Culqi.token.id; - alert('Se ha creado un token: ' + token); - } else { // Hubo algun problema! - // Mostramos JSON de objeto error en consola - console.log(Culqi.error); - alert(Culqi.error.mensaje); - } -}; - -/* - -// Configura el formulario -Culqi.publicKey = 'pk_test_FP96YFVHPBdhfKqt'; -Culqi.init(); -Culqi.createToken(); - -Culqi.settings({ - title: 'Culqi Store', - currency: 'PEN', - description: 'Polo Culqi lover', - amount: 3500 -}); - -// Muestra el Checkout de Culqi -$('#buyButton').on('click', function (e) { - // Abre el formulario con las opciones de Culqi.settings - Culqi.open(); - e.preventDefault(); -}); - -// Envia el token hacia tu servidor -function culqi() { - if (Culqi.token) { // ¡Token creado exitosamente! - // Get the token ID: - var token = Culqi.token.id; - alert('Se ha creado un token:'.token); - - } else { // ¡Hubo algún problema! - // Mostramos JSON de objeto error en consola - console.log(Culqi.error); - alert(Culqi.error.mensaje); - } -}; */ \ No newline at end of file diff --git a/public/vendors/lib/minicart.min.js b/public/vendors/lib/minicart.min.js new file mode 100644 index 00000000..0214c0aa --- /dev/null +++ b/public/vendors/lib/minicart.min.js @@ -0,0 +1,12 @@ +/*! + * minicart + * The Mini Cart is a great way to improve your PayPal shopping cart integration. + * + * @version 3.0.6 + * @author Jeff Harrell + * @url http://www.minicartjs.com/ + * @license MIT + */ + +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf;++f)a.hasOwnProperty(f)&&(e?d=b(d,a[f],f,a):(d=a[f],e=!0));return d},c.substr="b"!=="ab".substr(-1)?function(a,b,c){return 0>b&&(b=a.length+b),a.substr(b,c)}:function(a,b,c){return a.substr(b,c)},c.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},c.bind=function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(b.bind)return b.bind.apply(b,a);var c=a.shift();return function(){b.apply(c,a.concat([Array.prototype.slice.call(arguments)]))}},c.create="function"==typeof Object.create?Object.create:e;var l="function"==typeof Object.keys?Object.keys:g,m="function"==typeof Object.getOwnPropertyNames?Object.getOwnPropertyNames:h;if((new Error).hasOwnProperty("description")){var n=function(a,b){return"[object Error]"===j.call(a)&&(b=c.filter(b,function(a){return"description"!==a&&"number"!==a&&"message"!==a})),b};c.keys=function(a){return n(a,l(a))},c.getOwnPropertyNames=function(a){return n(a,m(a))}}else c.keys=l,c.getOwnPropertyNames=m;if("function"==typeof Object.getOwnPropertyDescriptor)try{Object.getOwnPropertyDescriptor({a:1},"a"),c.getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor}catch(o){c.getOwnPropertyDescriptor=function(a,b){try{return Object.getOwnPropertyDescriptor(a,b)}catch(c){return i(a,b)}}}else c.getOwnPropertyDescriptor=i},{}],2:[function(){},{}],3:[function(a,b,c){function d(a,b){for(var c=0,d=a.length-1;d>=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var e=a("__browserify_process"),f=a("util"),g=a("_shims"),h=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(a){return h.exec(a).slice(1)};c.resolve=function(){for(var a="",b=!1,c=arguments.length-1;c>=-1&&!b;c--){var h=c>=0?arguments[c]:e.cwd();if(!f.isString(h))throw new TypeError("Arguments to path.resolve must be strings");h&&(a=h+"/"+a,b="/"===h.charAt(0))}return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b=c.isAbsolute(a),e="/"===g.substr(a,-1);return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&e&&(a+="/"),(b?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(g.filter(a,function(a){if(!f.isString(a))throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),o(b)?d.showHidden=b:b&&c._extend(d,b),u(d.showHidden)&&(d.showHidden=!1),u(d.depth)&&(d.depth=2),u(d.colors)&&(d.colors=!1),u(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=e),h(d,a,d.depth)}function e(a,b){var c=d.styles[b];return c?"["+d.colors[c][0]+"m"+a+"["+d.colors[c][1]+"m":a}function f(a){return a}function g(a){var b={};return G.forEach(a,function(a){b[a]=!0}),b}function h(a,b,d){if(a.customInspect&&b&&z(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d);return s(e)||(e=h(a,e,d)),e}var f=i(a,b);if(f)return f;var o=G.keys(b),p=g(o);if(a.showHidden&&(o=G.getOwnPropertyNames(b)),0===o.length){if(z(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(v(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(x(b))return a.stylize(Date.prototype.toString.call(b),"date");if(y(b))return j(b)}var r="",t=!1,u=["{","}"];if(n(b)&&(t=!0,u=["[","]"]),z(b)){var w=b.name?": "+b.name:"";r=" [Function"+w+"]"}if(v(b)&&(r=" "+RegExp.prototype.toString.call(b)),x(b)&&(r=" "+Date.prototype.toUTCString.call(b)),y(b)&&(r=" "+j(b)),0===o.length&&(!t||0==b.length))return u[0]+r+u[1];if(0>d)return v(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var A;return A=t?k(a,b,d,p,o):o.map(function(c){return l(a,b,d,p,c,t)}),a.seen.pop(),m(A,r,u)}function i(a,b){if(u(b))return a.stylize("undefined","undefined");if(s(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return r(b)?a.stylize(""+b,"number"):o(b)?a.stylize(""+b,"boolean"):p(b)?a.stylize("null","null"):void 0}function j(a){return"["+Error.prototype.toString.call(a)+"]"}function k(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?l(a,b,c,d,String(g),!0):"");return G.forEach(e,function(e){e.match(/^\d+$/)||f.push(l(a,b,c,d,e,!0))}),f}function l(a,b,c,d,e,f){var g,i,j;if(j=G.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?i=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(i=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),i||(G.indexOf(a.seen,j.value)<0?(i=p(c)?h(a,j.value,null):h(a,j.value,c-1),i.indexOf("\n")>-1&&(i=f?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),u(g)){if(f&&e.match(/^\d+$/))return i;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+i}function m(a,b,c){var d=0,e=G.reduce(a,function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function n(a){return G.isArray(a)}function o(a){return"boolean"==typeof a}function p(a){return null===a}function q(a){return null==a}function r(a){return"number"==typeof a}function s(a){return"string"==typeof a}function t(a){return"symbol"==typeof a}function u(a){return void 0===a}function v(a){return w(a)&&"[object RegExp]"===C(a)}function w(a){return"object"==typeof a&&a}function x(a){return w(a)&&"[object Date]"===C(a)}function y(a){return w(a)&&"[object Error]"===C(a)}function z(a){return"function"==typeof a}function A(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function B(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.binarySlice}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),I[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=a("_shims"),H=/%[sdj%]/g;c.format=function(a){if(!s(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(e[c++]);case"%d":return Number(e[c++]);case"%j":try{return JSON.stringify(e[c++])}catch(b){return"[Circular]"}default:return a}}),h=e[c];f>c;h=e[++c])g+=p(h)||!w(h)?" "+h:" "+d(h);return g},c.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=n,c.isBoolean=o,c.isNull=p,c.isNullOrUndefined=q,c.isNumber=r,c.isString=s,c.isSymbol=t,c.isUndefined=u,c.isRegExp=v,c.isObject=w,c.isDate=x,c.isError=y,c.isFunction=z,c.isPrimitive=A,c.isBuffer=B;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=function(a,b){a.super_=b,a.prototype=G.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},c._extend=function(a,b){if(!b||!w(b))return a;for(var c=G.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}},{_shims:1}],5:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],6:[function(a,b,c){function d(a){return a.substr(1).split("|").reduce(function(a,b){var c=b.split(":"),d=c.shift(),e=c.join(":")||"";return e&&(e=", "+e),"filters."+d+"("+a+e+")"})}function e(a,b,c,d){var e=b.split("\n"),f=Math.max(d-3,0),g=Math.min(e.length,d+3),h=e.slice(f,g).map(function(a,b){var c=b+f+1;return(c==d?" >> ":" ")+c+"| "+a}).join("\n");throw a.path=c,a.message=(c||"ejs")+":"+d+"\n"+h+"\n\n"+a.message,a}function f(a,b){var c=k(i(b),a),d=j(a);return d||(c+=".ejs"),c}var g=a("./utils"),h=a("path"),i=h.dirname,j=h.extname,k=h.join,l=a("fs"),m=l.readFileSync,n=c.filters=a("./filters"),o={};c.clearCache=function(){o={}};var p=(c.parse=function(a,b){var b=b||{},e=b.open||c.open||"<%",g=b.close||c.close||"%>",h=b.filename,i=b.compileDebug!==!1,j="";j+="var buf = [];",!1!==b._with&&(j+="\nwith (locals || {}) { (function(){ "),j+="\n buf.push('";for(var k=1,l=!1,n=0,o=a.length;o>n;++n){var p=a[n];if(a.slice(n,e.length+n)==e){n+=e.length;var q,r,s=(i?"__stack.lineno=":"")+k;switch(a[n]){case"=":q="', escape(("+s+", ",r=")), '",++n;break;case"-":q="', ("+s+", ",r="), '",++n;break;default:q="');"+s+";",r="; buf.push('"}var t=a.indexOf(g,n),u=a.substring(n,t),v=n,w=null,x=0;if("-"==u[u.length-1]&&(u=u.substring(0,u.length-2),l=!0),0==u.trim().indexOf("include")){var y=u.trim().slice(7).trim();if(!h)throw new Error("filename option is required for includes");var z=f(y,h);w=m(z,"utf8"),w=c.parse(w,{filename:z,_with:!1,open:e,close:g,compileDebug:i}),j+="' + (function(){"+w+"})() + '",u=""}for(;~(x=u.indexOf("\n",x));)x++,k++;":"==u.substr(0,1)&&(u=d(u)),u&&(u.lastIndexOf("//")>u.lastIndexOf("\n")&&(u+="\n"),j+=q,j+=u,j+=r),n+=t-v+g.length-1}else"\\"==p?j+="\\\\":"'"==p?j+="\\'":"\r"==p||("\n"==p?l?l=!1:(j+="\\n",k++):j+=p)}return j+=!1!==b._with?"'); })();\n} \nreturn buf.join('');":"');\nreturn buf.join('');"},c.compile=function(a,b){b=b||{};var d=b.escape||g.escape,f=JSON.stringify(a),h=b.compileDebug!==!1,i=b.client,j=b.filename?JSON.stringify(b.filename):"undefined";a=h?["var __stack = { lineno: 1, input: "+f+", filename: "+j+" };",e.toString(),"try {",c.parse(a,b),"} catch (err) {"," rethrow(err, __stack.input, __stack.filename, __stack.lineno);","}"].join("\n"):c.parse(a,b),b.debug&&console.log(a),i&&(a="escape = escape || "+d.toString()+";\n"+a);try{var k=new Function("locals, filters, escape, rethrow",a)}catch(l){throw"SyntaxError"==l.name&&(l.message+=b.filename?" in "+j:" while compiling ejs"),l}return i?k:function(a){return k.call(this,a,n,d,e)}});c.render=function(a,b){var c,b=b||{};if(b.cache){if(!b.filename)throw new Error('"cache" option requires "filename".');c=o[b.filename]||(o[b.filename]=p(a,b))}else c=p(a,b);return b.__proto__=b.locals,c.call(b.scope,b)},c.renderFile=function(a,b,d){var e=a+":string";"function"==typeof b&&(d=b,b={}),b.filename=a;var f;try{f=b.cache?o[e]||(o[e]=m(a,"utf8")):m(a,"utf8")}catch(g){return void d(g)}d(null,c.render(f,b))},c.__express=c.renderFile,a.extensions?a.extensions[".ejs"]=function(a,b){b=b||a.filename;var c={filename:b,client:!0},d=l.readFileSync(b).toString(),e=p(d,c);a._compile("module.exports = "+e.toString()+";",b)}:a.registerExtension&&a.registerExtension(".ejs",function(a){return p(a,{})})},{"./filters":7,"./utils":8,fs:2,path:3}],7:[function(a,b,c){c.first=function(a){return a[0]},c.last=function(a){return a[a.length-1]},c.capitalize=function(a){return a=String(a),a[0].toUpperCase()+a.substr(1,a.length)},c.downcase=function(a){return String(a).toLowerCase()},c.upcase=function(a){return String(a).toUpperCase()},c.sort=function(a){return Object.create(a).sort()},c.sort_by=function(a,b){return Object.create(a).sort(function(a,c){return a=a[b],c=c[b],a>c?1:c>a?-1:0})},c.size=c.length=function(a){return a.length},c.plus=function(a,b){return Number(a)+Number(b)},c.minus=function(a,b){return Number(a)-Number(b)},c.times=function(a,b){return Number(a)*Number(b)},c.divided_by=function(a,b){return Number(a)/Number(b)},c.join=function(a,b){return a.join(b||", ")},c.truncate=function(a,b,c){return a=String(a),a.length>b&&(a=a.slice(0,b),c&&(a+=c)),a},c.truncate_words=function(a,b){var a=String(a),c=a.split(/ +/);return c.slice(0,b).join(" ")},c.replace=function(a,b,c){return String(a).replace(b,c||"")},c.prepend=function(a,b){return Array.isArray(a)?[b].concat(a):b+a},c.append=function(a,b){return Array.isArray(a)?a.concat(b):a+b},c.map=function(a,b){return a.map(function(a){return a[b]})},c.reverse=function(a){return Array.isArray(a)?a.reverse():String(a).split("").reverse().join("")},c.get=function(a,b){return a[b]},c.json=function(a){return JSON.stringify(a)}},{}],8:[function(a,b,c){c.escape=function(a){return String(a).replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}},{}],9:[function(a,b){"use strict";function c(a,b){var c,d,h,i,j;if(this._items=[],this._settings={bn:g.BN},e.call(this),f.call(this,a,b),(c=this.load())&&(d=c.items,h=c.settings,h&&(this._settings=h),d))for(j=0,i=d.length;i>j;j++)this.add(d[j])}var d=a("./product"),e=a("./util/pubsub"),f=a("./util/storage"),g=a("./constants"),h=a("./util/currency"),i=a("./util/mixin");i(c.prototype,e.prototype),i(c.prototype,f.prototype),c.prototype.add=function(a){var b,c,e,f,h=this,i=this.items(),j=!1,k=!1;for(c in a)g.SETTINGS.test(c)&&(this._settings[c]=a[c],delete a[c]);for(f=0,e=i.length;e>f;f++)if(i[f].isEqual(a)){b=i[f],b.set("quantity",b.get("quantity")+(parseInt(a.quantity,10)||1)),j=f,k=!0;break}return b||(b=new d(a),b.isValid()&&(j=this._items.push(b)-1,b.on("change",function(a,b){h.save(),h.fire("change",j,a,b)}),this.save())),b&&this.fire("add",j,b,k),j},c.prototype.items=function(a){return"number"==typeof a?this._items[a]:this._items},c.prototype.settings=function(a){return a?this._settings[a]:this._settings},c.prototype.discount=function(a){var b=parseFloat(this.settings("discount_amount_cart"))||0;return b||(b=(parseFloat(this.settings("discount_rate_cart"))||0)*this.subtotal()/100),a=a||{},a.currency=this.settings("currency_code"),h(b,a)},c.prototype.subtotal=function(a){var b,c,d=this.items(),e=0;for(b=0,c=d.length;c>b;b++)e+=d[b].total();return a=a||{},a.currency=this.settings("currency_code"),h(e,a)},c.prototype.total=function(a){var b=0;return b+=this.subtotal(),b-=this.discount(),a=a||{},a.currency=this.settings("currency_code"),h(b,a)},c.prototype.remove=function(a){var b=this._items.splice(a,1);return 0===this._items.length&&this.destroy(),b&&(this.save(),this.fire("remove",a,b[0])),!!b.length},c.prototype.save=function(){var a,b,c=this.items(),d=this.settings(),e=[];for(a=0,b=c.length;b>a;a++)e.push(c[a].get());f.prototype.save.call(this,{items:e,settings:d})},c.prototype.checkout=function(a){this.fire("checkout",a)},c.prototype.destroy=function(){f.prototype.destroy.call(this),this._items=[],this._settings={bn:g.BN},this.fire("destroy")},b.exports=c},{"./constants":11,"./product":13,"./util/currency":15,"./util/mixin":18,"./util/pubsub":19,"./util/storage":20}],10:[function(a,b){"use strict";var c=a("./util/mixin"),d=b.exports={name:"PPMiniCart",parent:"undefined"!=typeof document?document.body:null,action:"https://www.paypal.com/cgi-bin/webscr",target:"",duration:30,template:'<%var items = cart.items();var settings = cart.settings();var hasItems = !!items.length;var priceFormat = { format: true, currency: cart.settings("currency_code") };var totalFormat = { format: true, showCode: true };%>
    <% for (var i= 0, idx = i + 1, len = items.length; i < len; i++, idx++) { %>
  • "><%= items[i].get("item_name") %>
      <% if (items[i].get("item_number")) { %>
    • <%= items[i].get("item_number") %> " />
    • <% } %> <% if (items[i].discount()) { %>
    • <%= config.strings.discount %> <%= items[i].discount(priceFormat) %>
    • <% } %> <% for (var options = items[i].options(), j = 0, len2 = options.length; j < len2; j++) { %>
    • <%= options[j].key %>: <%= options[j].value %>
    • <% } %>
    " autocomplete="off" />
    <%= items[i].total(priceFormat) %>
    " /> " /> " />
  • <% } %>
<% for (var key in settings) { %> <% } %>
',styles:'@keyframes pop-in { 0% { opacity: 0; transform: scale(0.1); } 60% { opacity: 1; transform: scale(1.2); } 100% { transform: scale(1); }}@-webkit-keyframes pop-in { 0% { opacity: 0; -webkit-transform: scale(0.1); } 60% { opacity: 1; -webkit-transform: scale(1.2); } 100% { -webkit-transform: scale(1); }}@-moz-keyframes pop-in { 0% { opacity: 0; -moz-transform: scale(0.1); } 60% { opacity: 1; -moz-transform: scale(1.2); } 100% { -moz-transform: scale(1); }}.minicart-showing #PPMiniCart { display: block; transform: translateZ(0); -webkit-transform: translateZ(0); -moz-transform: translateZ(0); animation: pop-in 0.25s; -webkit-animation: pop-in 0.25s; -moz-animation: pop-in 0.25s;}#PPMiniCart { display: none; position: fixed; left: 50%; top: 75px;}#PPMiniCart form { position: relative; width: 400px; max-height: 400px; margin-left: -200px; padding: 10px 10px 40px; background: #fbfbfb; border: 1px solid #d7d7d7; border-radius: 4px; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5); font: 15px/normal arial, helvetica; color: #333;}#PPMiniCart form.minicart-empty { padding-bottom: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart ul { clear: both; float: left; width: 380px; margin: 5px 0 20px; padding: 10px; list-style-type: none; background: #fff; border: 1px solid #ccc; border-radius: 4px; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);}#PPMiniCart .minicart-empty ul { display: none;}#PPMiniCart .minicart-closer { float: right; margin: -12px -10px 0; padding: 10px; background: 0; border: 0; font-size: 18px; cursor: pointer; font-weight: bold;}#PPMiniCart .minicart-item { clear: left; padding: 6px 0; min-height: 25px;}#PPMiniCart .minicart-item + .minicart-item { border-top: 1px solid #f2f2f2;}#PPMiniCart .minicart-item a { color: #333; text-decoration: none;}#PPMiniCart .minicart-details-name { float: left; width: 62%;}#PPMiniCart .minicart-details-quantity { float: left; width: 15%;}#PPMiniCart .minicart-details-remove { float: left; width: 7%;}#PPMiniCart .minicart-details-price { float: left; width: 16%; text-align: right;}#PPMiniCart .minicart-attributes { margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: #999; font-size: 12px; line-height: 22px;}#PPMiniCart .minicart-attributes li { display: inline;}#PPMiniCart .minicart-attributes li:after { content: ",";}#PPMiniCart .minicart-attributes li:last-child:after { content: "";}#PPMiniCart .minicart-quantity { width: 30px; height: 18px; padding: 2px 4px; border: 1px solid #ccc; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); font-size: 13px; text-align: right; transition: border linear 0.2s, box-shadow linear 0.2s; -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s;}#PPMiniCart .minicart-quantity:hover { border-color: #0078C1;}#PPMiniCart .minicart-quantity:focus { border-color: #0078C1; outline: 0; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 3px rgba(0, 120, 193, 0.4);}#PPMiniCart .minicart-remove { width: 18px; height: 19px; margin: 2px 0 0; padding: 0; background: #b7b7b7; border: 1px solid #a3a3a3; border-radius: 3px; color: #fff; font-size: 13px; opacity: 0.70; cursor: pointer;}#PPMiniCart .minicart-remove:hover { opacity: 1;}#PPMiniCart .minicart-footer { clear: left;}#PPMiniCart .minicart-subtotal { position: absolute; bottom: 17px; padding-left: 6px; left: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart .minicart-submit { position: absolute; bottom: 10px; right: 10px; min-width: 153px; height: 33px; margin-right: 6px; padding: 0 9px; border: 1px solid #ffc727; border-radius: 5px; color: #000; text-shadow: 1px 1px 1px #fff6e9; cursor: pointer; background: #ffaa00; background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZjZlOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmFhMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: -moz-linear-gradient(top, #fff6e9 0%, #ffaa00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff6e9), color-stop(100%,#ffaa00)); background: -webkit-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -o-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -ms-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: linear-gradient(to bottom, #fff6e9 0%,#ffaa00 100%);}#PPMiniCart .minicart-submit img { vertical-align: middle; padding: 4px 0 0 2px;}',strings:{button:'Check Out with PayPal',subtotal:"Subtotal:",discount:"Discount:",empty:"Your shopping cart is empty"}};b.exports.load=function(a){return c(d,a)}},{"./util/mixin":18}],11:[function(a,b){"use strict";b.exports={COMMANDS:{_cart:!0,_xclick:!0,_donations:!0},SETTINGS:/^(?:business|currency_code|lc|paymentaction|no_shipping|cn|no_note|invoice|handling_cart|weight_cart|weight_unit|tax_cart|discount_amount_cart|discount_rate_cart|page_style|image_url|cpp_|cs|cbt|return|cancel_return|notify_url|rm|custom|charset)/,BN:"MiniCart_AddToCart_WPS_US",KEYUP_TIMEOUT:500,SHOWING_CLASS:"minicart-showing",REMOVE_CLASS:"minicart-remove",CLOSER_CLASS:"minicart-closer",QUANTITY_CLASS:"minicart-quantity",ITEM_CLASS:"minicart-item",ITEM_CHANGED_CLASS:"minicart-item-changed",SUBMIT_CLASS:"minicart-submit",DATA_IDX:"data-minicart-idx"}},{}],12:[function(a,b){"use strict";var c,d,e,f=a("./cart"),g=a("./view"),h=a("./config"),i={};i.render=function(a){d=i.config=h.load(a),c=i.cart=new f(d.name,d.duration),e=i.view=new g({config:d,cart:c}),c.on("add",e.addItem,e),c.on("change",e.changeItem,e),c.on("remove",e.removeItem,e),c.on("destroy",e.hide,e)},i.reset=function(){c.destroy(),e.hide(),e.redraw()},"undefined"==typeof window?b.exports=i:(window.paypal||(window.paypal={}),window.paypal.minicart=i)},{"./cart":9,"./config":10,"./view":22}],13:[function(a,b){"use strict";function c(a){a.quantity=g.quantity(a.quantity),a.amount=g.amount(a.amount),a.href=g.href(a.href),this._data=a,this._options=null,this._discount=null,this._amount=null,this._total=null,e.call(this)}var d=a("./util/currency"),e=a("./util/pubsub"),f=a("./util/mixin"),g={quantity:function(a){return a=parseInt(a,10),(isNaN(a)||!a)&&(a=1),a},amount:function(a){return parseFloat(a)||0},href:function(a){return a?a:"undefined"!=typeof window?window.location.href:null}};f(c.prototype,e.prototype),c.prototype.get=function(a){return a?this._data[a]:this._data},c.prototype.set=function(a,b){var c=g[a];this._data[a]=c?c(b):b,this._options=null,this._discount=null,this._amount=null,this._total=null,this.fire("change",a)},c.prototype.options=function(){var a,b,c,d,e,f;if(!this._options){for(a=[],e=0;b=this.get("on"+e);){for(c=this.get("os"+e),d=0,f=0;"undefined"!=typeof this.get("option_select"+f);){if(this.get("option_select"+f)===c){d=g.amount(this.get("option_amount"+f));break}f++}a.push({key:b,value:c,amount:d}),e++}this._options=a}return this._options},c.prototype.discount=function(a){var b,c,e,f,h,i;return this._discount||(h=0,e=parseInt(this.get("discount_num"),10)||0,f=Math.max(e,this.get("quantity")-1),void 0!==this.get("discount_amount")?(b=g.amount(this.get("discount_amount")),h+=b,h+=g.amount(this.get("discount_amount2")||b)*f):void 0!==this.get("discount_rate")&&(c=g.amount(this.get("discount_rate")),i=this.amount(),h+=c*i/100,h+=g.amount(this.get("discount_rate2")||c)*i*f/100),this._discount=h),d(this._discount,a)},c.prototype.amount=function(a){var b,c,e,f;if(!this._amount){for(b=this.get("amount"),c=this.options(),f=0,e=c.length;e>f;f++)b+=c[f].amount;this._amount=b}return d(this._amount,a)},c.prototype.total=function(a){var b;return this._total||(b=this.get("quantity")*this.amount(),b-=this.discount(),this._total=g.amount(b)),d(this._total,a)},c.prototype.isEqual=function(a){var b=!1;if(a instanceof c&&(a=a._data),this.get("item_name")===a.item_name&&this.get("item_number")===a.item_number&&this.get("amount")===g.amount(a.amount)){var d=0;for(b=!0;"undefined"!=typeof a["os"+d];){if(this.get("os"+d)!==a["os"+d]){b=!1;break}d++}}return b},c.prototype.isValid=function(){return this.get("item_name")&&this.amount()>0},c.prototype.destroy=function(){this._data=[],this.fire("destroy",this)},b.exports=c},{"./util/currency":15,"./util/mixin":18,"./util/pubsub":19}],14:[function(a,b){"use strict";b.exports.add=function(a,b){var c;return a?void(a&&a.classList&&a.classList.add?a.classList.add(b):(c=new RegExp("\\b"+b+"\\b"),c.test(a.className)||(a.className+=" "+b))):!1},b.exports.remove=function(a,b){var c;return a?void(a.classList&&a.classList.add?a.classList.remove(b):(c=new RegExp("\\b"+b+"\\b"),c.test(a.className)&&(a.className=a.className.replace(c,"")))):!1},b.exports.inject=function(a,b){var c; +return a?void(b&&(c=document.createElement("style"),c.type="text/css",c.styleSheet?c.styleSheet.cssText=b:c.appendChild(document.createTextNode(b)),a.appendChild(c))):!1}},{}],15:[function(a,b){"use strict";var c={AED:{before:"ج"},ANG:{before:"ƒ"},ARS:{before:"$",code:!0},AUD:{before:"$",code:!0},AWG:{before:"ƒ"},BBD:{before:"$",code:!0},BGN:{before:"лв"},BMD:{before:"$",code:!0},BND:{before:"$",code:!0},BRL:{before:"R$"},BSD:{before:"$",code:!0},CAD:{before:"$",code:!0},CHF:{before:"",code:!0},CLP:{before:"$",code:!0},CNY:{before:"¥"},COP:{before:"$",code:!0},CRC:{before:"₡"},CZK:{before:"Kc"},DKK:{before:"kr"},DOP:{before:"$",code:!0},EEK:{before:"kr"},EUR:{before:"€"},GBP:{before:"£"},GTQ:{before:"Q"},HKD:{before:"$",code:!0},HRK:{before:"kn"},HUF:{before:"Ft"},IDR:{before:"Rp"},ILS:{before:"₪"},INR:{before:"Rs."},ISK:{before:"kr"},JMD:{before:"J$"},JPY:{before:"¥"},KRW:{before:"₩"},KYD:{before:"$",code:!0},LTL:{before:"Lt"},LVL:{before:"Ls"},MXN:{before:"$",code:!0},MYR:{before:"RM"},NOK:{before:"kr"},NZD:{before:"$",code:!0},PEN:{before:"S/"},PHP:{before:"Php"},PLN:{before:"z"},QAR:{before:"﷼"},RON:{before:"lei"},RUB:{before:"руб"},SAR:{before:"﷼"},SEK:{before:"kr"},SGD:{before:"$",code:!0},THB:{before:"฿"},TRY:{before:"TL"},TTD:{before:"TT$"},TWD:{before:"NT$"},UAH:{before:"₴"},USD:{before:"$",code:!0},UYU:{before:"$U"},VEF:{before:"Bs"},VND:{before:"₫"},XCD:{before:"$",code:!0},ZAR:{before:"R"}};b.exports=function(a,b){var d=b&&b.currency||"USD",e=c[d],f=e.before||"",g=e.after||"",h=e.length||2,i=e.code&&b&&b.showCode,j=a;return b&&b.format&&(j=f+j.toFixed(h)+g),i&&(j+=" "+d),j}},{}],16:[function(a,b){"use strict";b.exports=function(a,b){var c=[];return b?b.addEventListener?{add:function(a,b,d,e){e=e||a;var f=function(a){d.call(e,a)};a.addEventListener(b,f,!1),c.push([a,b,d,f])},remove:function(a,b,d){var e,f,g,h=c.length;for(g=0;h>g;g++)if(f=c[g],f[0]===a&&f[1]===b&&f[2]===d&&(e=f[3]))return a.removeEventListener(b,e,!1),c=c.slice(g),!0}}:b.attachEvent?{add:function(b,d,e,f){f=f||b;var g=function(){var b=a.event;b.target=b.target||b.srcElement,b.preventDefault=function(){b.returnValue=!1},e.call(f,b)};b.attachEvent("on"+d,g),c.push([b,d,e,g])},remove:function(a,b,d){var e,f,g,h=c.length;for(g=0;h>g;g++)if(f=c[g],f[0]===a&&f[1]===b&&f[2]===d&&(e=f[3]))return a.detachEvent("on"+b,e),c=c.slice(g),!0}}:void 0:{add:function(){},remove:function(){}}}("undefined"==typeof window?null:window,"undefined"==typeof document?null:document)},{}],17:[function(a,b){"use strict";var c=b.exports={parse:function(a){var b,d,e,f,g=a.elements,h={};for(e=0,f=g.length;f>e;e++)b=g[e],(d=c.getInputValue(b))&&(h[b.name]=d);return h},getInputValue:function(a){var b=a.tagName.toLowerCase();return"select"===b?a.options[a.selectedIndex].value:"textarea"===b?a.innerText:"radio"===a.type?a.checked?a.value:null:"checkbox"===a.type?a.checked?a.value:null:a.value}}},{}],18:[function(a,b){"use strict";b.exports=function c(a,b){var d;for(var e in b)d=b[e],d&&d.constructor===Object&&a[e]?c(a[e]||{},d):a[e]=d;return a}},{}],19:[function(a,b){"use strict";function c(){this._eventCache={}}c.prototype.on=function(a,b,c){var d=this._eventCache[a];d||(d=this._eventCache[a]=[]),d.push([b,c])},c.prototype.off=function(a,b){var c,d,e=this._eventCache[a];if(e)for(c=0,d=e.length;d>c;c++)e[c]===b&&(e=e.splice(c,1))},c.prototype.fire=function(a){var b,c,d,e,f=this._eventCache[a];if(f)for(b=0,c=f.length;c>b;b++)d=f[b][0],e=f[b][1]||this,"function"==typeof d&&d.apply(e,Array.prototype.slice.call(arguments,1))},b.exports=c},{}],20:[function(a,b){"use strict";var c=b.exports=function(a,b){this._name=a,this._duration=b||30},d=c.prototype;d.load=function(){if("object"==typeof window&&window.localStorage){var a,b,c=window.localStorage.getItem(this._name);return c&&(c=JSON.parse(decodeURIComponent(c))),c&&c.expires&&(a=new Date,b=new Date(c.expires),a>b)?void this.destroy():c&&c.value}},d.save=function(a){if("object"==typeof window&&window.localStorage){var b,c=new Date;c.setTime(c.getTime()+24*this._duration*60*60*1e3),b={value:a,expires:c.toGMTString()},window.localStorage.setItem(this._name,encodeURIComponent(JSON.stringify(b)))}},d.destroy=function(){"object"==typeof window&&window.localStorage&&window.localStorage.removeItem(this._name)}},{}],21:[function(a,b){"use strict";var c=a("ejs");b.exports=function(a,b){return c.render(a,b)},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})},{ejs:6}],22:[function(a,b){"use strict";function c(a){var b;this.el=b=document.createElement("div"),this.model=a,this.isShowing=!1,b.id=d.name,d.parent.appendChild(b),h.inject(document.getElementsByTagName("head")[0],d.styles),e.add(document,"ontouchstart"in window?"touchstart":"click",i.click,this),e.add(document,"keyup",i.keyup,this),e.add(document,"readystatechange",i.readystatechange,this),e.add(window,"pageshow",i.pageshow,this)}var d=a("./config"),e=a("./util/events"),f=a("./util/template"),g=a("./util/forms"),h=a("./util/css"),i=a("./viewevents"),j=a("./constants");c.prototype.redraw=function(){e.remove(this.el.querySelector("form"),"submit",this.model.cart.checkout,this.model.cart),this.el.innerHTML=f(d.template,this.model),e.add(this.el.querySelector("form"),"submit",this.model.cart.checkout,this.model.cart)},c.prototype.show=function(){this.isShowing||(h.add(document.body,j.SHOWING_CLASS),this.isShowing=!0)},c.prototype.hide=function(){this.isShowing&&(h.remove(document.body,j.SHOWING_CLASS),this.isShowing=!1)},c.prototype.toggle=function(){this[this.isShowing?"hide":"show"]()},c.prototype.bind=function(a){var b=this;return j.COMMANDS[a.cmd.value]?a.hasMinicart?!1:(a.hasMinicart=!0,a.display?e.add(a,"submit",function(a){a.preventDefault(),b.show()}):e.add(a,"submit",function(c){c.preventDefault(c),b.model.cart.add(g.parse(a))}),!0):!1},c.prototype.addItem=function(a){this.redraw(),this.show();var b=this.el.querySelectorAll("."+j.ITEM_CLASS);h.add(b[a],j.ITEM_CHANGED_CLASS)},c.prototype.changeItem=function(a){this.redraw(),this.show();var b=this.el.querySelectorAll("."+j.ITEM_CLASS);h.add(b[a],j.ITEM_CHANGED_CLASS)},c.prototype.removeItem=function(){this.redraw()},b.exports=c},{"./config":10,"./constants":11,"./util/css":14,"./util/events":16,"./util/forms":17,"./util/template":21,"./viewevents":23}],23:[function(a,b){"use strict";var c,d=a("./constants"),e=a("./util/events");b.exports=c={click:function(a){var b=a.target,c=b.className;if(this.isShowing)if(c===d.CLOSER_CLASS)this.hide();else if(c===d.REMOVE_CLASS)this.model.cart.remove(b.getAttribute(d.DATA_IDX));else if(c===d.QUANTITY_CLASS)b[b.setSelectionRange?"setSelectionRange":"select"](0,999);else if(!/input|button|select|option/i.test(b.tagName)){for(;1===b.nodeType;){if(b===this.el)return;b=b.parentNode}this.hide()}},keyup:function(a){var b,c=this,e=a.target;e.className===d.QUANTITY_CLASS&&(b=setTimeout(function(){var a=parseInt(e.getAttribute(d.DATA_IDX),10),b=c.model.cart,f=b.items(a),g=parseInt(e.value,10);f&&(g>0?f.set("quantity",g):0===g&&b.remove(a))},d.KEYUP_TIMEOUT))},readystatechange:function(){if(/interactive|complete/.test(document.readyState)){var a,b,f,g;for(a=document.getElementsByTagName("form"),f=0,g=a.length;g>f;f++)b=a[f],b.cmd&&d.COMMANDS[b.cmd.value]&&this.bind(b);this.redraw(),e.remove(document,"readystatechange",c.readystatechange)}},pageshow:function(a){a.persisted&&(this.redraw(),this.hide())}}},{"./constants":11,"./util/events":16}]},{},[9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]); \ No newline at end of file From 39a00dc12d5f509589904efaf8614f80773a5aa8 Mon Sep 17 00:00:00 2001 From: kamalyzl Date: Mon, 26 Feb 2018 02:10:08 -0500 Subject: [PATCH 14/15] =?UTF-8?q?Corrigiendo=20identaci=C3=B3n=20y=20a?= =?UTF-8?q?=C3=B1adiendo=20comentarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 8 +++++ public/js/app.js | 85 +++++++++++++++++++++++------------------------ 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/public/index.html b/public/index.html index 88bec44a..d66e7e9f 100644 --- a/public/index.html +++ b/public/index.html @@ -65,11 +65,18 @@
+ + + + + +
@@ -83,6 +90,7 @@ + diff --git a/public/js/app.js b/public/js/app.js index 0e598137..08e108c2 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -14,11 +14,12 @@ let input = $('#search'); // En la función index, mostramos lo que hará apenas cargue la página function index() { - let containerSearch = $('#contente-search'); + $('#contente-list').html(''); + $('#container-search').html(''); + $('#contente-search').html(''); - containerSearch.html('

Bienvenido a Tienda Online

'); + $('#container-search').html('

Bienvenido a Tienda Online

'); $.get('https://api.mercadolibre.com/sites/MPE/categories', function(data, status) { - // console.log(data); data.forEach(element => { let listCategories = $('#categories'); listCategories.append(` @@ -32,22 +33,17 @@ function index() { function categories(ctx) { let containerSearch = $('#contente-search'); let containerList = $('#contente-list'); - let name = $('.dropdown-item').data('name'); - let id = $('#categories').data('id'); - console.log(ctx.params.categories); - // console.log(id); containerList.html(''); containerSearch.html(''); + $('#container-search').html(''); $.get(`https://api.mercadolibre.com/categories/${ctx.params.categories}`, function(data, status) { - console.log(data); containerSearch.append(`
`); - data.children_categories.forEach(element => { - localStorage.setItem('producto', element.name); + data.children_categories.forEach(element => { containerSearch.append(`
`); }); input.val(''); + // configuración inicial del carrito + paypal.minicart.render({ + strings: { + button: 'Pagar' + , buttonAlt: 'Total' + , subtotal: 'Total:' + , empty: 'No hay productos en el carrito' + } + }); + + // Eventos para agregar productos al carrito + $('.car').on('click', function(event) { + console.log($(this)); + console.log(event.target); + + event.stopPropagation(); + paypal.minicart.cart.add({ + // Cuenta paypal para recibir el dinero + business: 'kamaly.kazal@gmail.com', + item_name: $(this).attr('title'), + amount: $(this).attr('price'), + currency_code: 'PEN', + }); + }); }); }); - + // Funcion que lista los productos de cada categoria al momento de seleccionar function list(ctx) { @@ -100,4 +124,6 @@ function list(ctx) { }); }); */ -} \ No newline at end of file +} + + diff --git a/public/js/paypal.js b/public/js/paypal.js deleted file mode 100644 index 89b742fb..00000000 --- a/public/js/paypal.js +++ /dev/null @@ -1,27 +0,0 @@ -paypal.minicart.render({ - - // configuración inicial - strings: { - button: 'Pagar', - buttonAlt: 'Total:', - subtotal: 'Total:', - empty: 'No hay productos en el carrito' - - } -}); - - -// $('product').click(function(e) { -// e.stopPropagation(); -// paypal.minicart.view.show(); -// }); -$('#product').click(function(event) { - console.log($(this)); - event.stopPropagation(); - paypal.minicart.cart.add({ - business: 'kamaly.kazal@gmail.com', // Correo donde se depositará el dinero - item_name: $(this).attr('title'), - amount: $(this).attr('price'), - currency_code: 'USD', - }); -}); \ No newline at end of file diff --git a/public/vendors/lib/minicart.js b/public/vendors/lib/minicart.js new file mode 100644 index 00000000..0ad4c3b3 --- /dev/null +++ b/public/vendors/lib/minicart.js @@ -0,0 +1,3020 @@ +/*! + * minicart + * The Mini Cart is a great way to improve your PayPal shopping cart integration. + * + * @version 3.0.6 + * @author Jeff Harrell + * @url http://www.minicartjs.com/ + * @license MIT + */ + +;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o i; ++i) { + if (array.hasOwnProperty(i)) { + if (isValueSet) { + value = callback(value, array[i], i, array); + } + else { + value = array[i]; + isValueSet = true; + } + } + } + + return value; +}; + +// String.prototype.substr - negative index don't work in IE8 +if ('ab'.substr(-1) !== 'b') { + exports.substr = function (str, start, length) { + // did we get a negative start, calculate how much it is from the beginning of the string + if (start < 0) start = str.length + start; + + // call the original function + return str.substr(start, length); + }; +} else { + exports.substr = function (str, start, length) { + return str.substr(start, length); + }; +} + +// String.prototype.trim is supported in IE9 +exports.trim = function (str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +}; + +// Function.prototype.bind is supported in IE9 +exports.bind = function () { + var args = Array.prototype.slice.call(arguments); + var fn = args.shift(); + if (fn.bind) return fn.bind.apply(fn, args); + var self = args.shift(); + return function () { + fn.apply(self, args.concat([Array.prototype.slice.call(arguments)])); + }; +}; + +// Object.create is supported in IE9 +function create(prototype, properties) { + var object; + if (prototype === null) { + object = { '__proto__' : null }; + } + else { + if (typeof prototype !== 'object') { + throw new TypeError( + 'typeof prototype[' + (typeof prototype) + '] != \'object\'' + ); + } + var Type = function () {}; + Type.prototype = prototype; + object = new Type(); + object.__proto__ = prototype; + } + if (typeof properties !== 'undefined' && Object.defineProperties) { + Object.defineProperties(object, properties); + } + return object; +} +exports.create = typeof Object.create === 'function' ? Object.create : create; + +// Object.keys and Object.getOwnPropertyNames is supported in IE9 however +// they do show a description and number property on Error objects +function notObject(object) { + return ((typeof object != "object" && typeof object != "function") || object === null); +} + +function keysShim(object) { + if (notObject(object)) { + throw new TypeError("Object.keys called on a non-object"); + } + + var result = []; + for (var name in object) { + if (hasOwnProperty.call(object, name)) { + result.push(name); + } + } + return result; +} + +// getOwnPropertyNames is almost the same as Object.keys one key feature +// is that it returns hidden properties, since that can't be implemented, +// this feature gets reduced so it just shows the length property on arrays +function propertyShim(object) { + if (notObject(object)) { + throw new TypeError("Object.getOwnPropertyNames called on a non-object"); + } + + var result = keysShim(object); + if (exports.isArray(object) && exports.indexOf(object, 'length') === -1) { + result.push('length'); + } + return result; +} + +var keys = typeof Object.keys === 'function' ? Object.keys : keysShim; +var getOwnPropertyNames = typeof Object.getOwnPropertyNames === 'function' ? + Object.getOwnPropertyNames : propertyShim; + +if (new Error().hasOwnProperty('description')) { + var ERROR_PROPERTY_FILTER = function (obj, array) { + if (toString.call(obj) === '[object Error]') { + array = exports.filter(array, function (name) { + return name !== 'description' && name !== 'number' && name !== 'message'; + }); + } + return array; + }; + + exports.keys = function (object) { + return ERROR_PROPERTY_FILTER(object, keys(object)); + }; + exports.getOwnPropertyNames = function (object) { + return ERROR_PROPERTY_FILTER(object, getOwnPropertyNames(object)); + }; +} else { + exports.keys = keys; + exports.getOwnPropertyNames = getOwnPropertyNames; +} + +// Object.getOwnPropertyDescriptor - supported in IE8 but only on dom elements +function valueObject(value, key) { + return { value: value[key] }; +} + +if (typeof Object.getOwnPropertyDescriptor === 'function') { + try { + Object.getOwnPropertyDescriptor({'a': 1}, 'a'); + exports.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + } catch (e) { + // IE8 dom element issue - use a try catch and default to valueObject + exports.getOwnPropertyDescriptor = function (value, key) { + try { + return Object.getOwnPropertyDescriptor(value, key); + } catch (e) { + return valueObject(value, key); + } + }; + } +} else { + exports.getOwnPropertyDescriptor = valueObject; +} + +},{}],2:[function(require,module,exports){ + +// not implemented +// The reason for having an empty file and not throwing is to allow +// untraditional implementation of this module. + +},{}],3:[function(require,module,exports){ +var process=require("__browserify_process");// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var util = require('util'); +var shims = require('_shims'); + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (!util.isString(path)) { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(shims.filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = shims.substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(shims.filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(shims.filter(paths, function(p, index) { + if (!util.isString(p)) { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +},{"__browserify_process":5,"_shims":1,"util":4}],4:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var shims = require('_shims'); + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + shims.forEach(array, function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = shims.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = shims.getOwnPropertyNames(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + + shims.forEach(keys, function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = shims.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (shims.indexOf(ctx.seen, desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = shims.reduce(output, function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return shims.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && objectToString(e) === '[object Error]'; +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.binarySlice === 'function' + ; +} +exports.isBuffer = isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = function(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = shims.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); +}; + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = shims.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +},{"_shims":1}],5:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +process.nextTick = (function () { + var canSetImmediate = typeof window !== 'undefined' + && window.setImmediate; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canSetImmediate) { + return function (f) { return window.setImmediate(f) }; + } + + if (canPost) { + var queue = []; + window.addEventListener('message', function (ev) { + var source = ev.source; + if ((source === window || source === null) && ev.data === 'process-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +} + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],6:[function(require,module,exports){ + +/*! + * EJS + * Copyright(c) 2012 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./utils') + , path = require('path') + , dirname = path.dirname + , extname = path.extname + , join = path.join + , fs = require('fs') + , read = fs.readFileSync; + +/** + * Filters. + * + * @type Object + */ + +var filters = exports.filters = require('./filters'); + +/** + * Intermediate js cache. + * + * @type Object + */ + +var cache = {}; + +/** + * Clear intermediate js cache. + * + * @api public + */ + +exports.clearCache = function(){ + cache = {}; +}; + +/** + * Translate filtered code into function calls. + * + * @param {String} js + * @return {String} + * @api private + */ + +function filtered(js) { + return js.substr(1).split('|').reduce(function(js, filter){ + var parts = filter.split(':') + , name = parts.shift() + , args = parts.join(':') || ''; + if (args) args = ', ' + args; + return 'filters.' + name + '(' + js + args + ')'; + }); +}; + +/** + * Re-throw the given `err` in context to the + * `str` of ejs, `filename`, and `lineno`. + * + * @param {Error} err + * @param {String} str + * @param {String} filename + * @param {String} lineno + * @api private + */ + +function rethrow(err, str, filename, lineno){ + var lines = str.split('\n') + , start = Math.max(lineno - 3, 0) + , end = Math.min(lines.length, lineno + 3); + + // Error context + var context = lines.slice(start, end).map(function(line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +/** + * Parse the given `str` of ejs, returning the function body. + * + * @param {String} str + * @return {String} + * @api public + */ + +var parse = exports.parse = function(str, options){ + var options = options || {} + , open = options.open || exports.open || '<%' + , close = options.close || exports.close || '%>' + , filename = options.filename + , compileDebug = options.compileDebug !== false + , buf = ""; + + buf += 'var buf = [];'; + if (false !== options._with) buf += '\nwith (locals || {}) { (function(){ '; + buf += '\n buf.push(\''; + + var lineno = 1; + + var consumeEOL = false; + for (var i = 0, len = str.length; i < len; ++i) { + var stri = str[i]; + if (str.slice(i, open.length + i) == open) { + i += open.length + + var prefix, postfix, line = (compileDebug ? '__stack.lineno=' : '') + lineno; + switch (str[i]) { + case '=': + prefix = "', escape((" + line + ', '; + postfix = ")), '"; + ++i; + break; + case '-': + prefix = "', (" + line + ', '; + postfix = "), '"; + ++i; + break; + default: + prefix = "');" + line + ';'; + postfix = "; buf.push('"; + } + + var end = str.indexOf(close, i) + , js = str.substring(i, end) + , start = i + , include = null + , n = 0; + + if ('-' == js[js.length-1]){ + js = js.substring(0, js.length - 2); + consumeEOL = true; + } + + if (0 == js.trim().indexOf('include')) { + var name = js.trim().slice(7).trim(); + if (!filename) throw new Error('filename option is required for includes'); + var path = resolveInclude(name, filename); + include = read(path, 'utf8'); + include = exports.parse(include, { filename: path, _with: false, open: open, close: close, compileDebug: compileDebug }); + buf += "' + (function(){" + include + "})() + '"; + js = ''; + } + + while (~(n = js.indexOf("\n", n))) n++, lineno++; + if (js.substr(0, 1) == ':') js = filtered(js); + if (js) { + if (js.lastIndexOf('//') > js.lastIndexOf('\n')) js += '\n'; + buf += prefix; + buf += js; + buf += postfix; + } + i += end - start + close.length - 1; + + } else if (stri == "\\") { + buf += "\\\\"; + } else if (stri == "'") { + buf += "\\'"; + } else if (stri == "\r") { + // ignore + } else if (stri == "\n") { + if (consumeEOL) { + consumeEOL = false; + } else { + buf += "\\n"; + lineno++; + } + } else { + buf += stri; + } + } + + if (false !== options._with) buf += "'); })();\n} \nreturn buf.join('');"; + else buf += "');\nreturn buf.join('');"; + return buf; +}; + +/** + * Compile the given `str` of ejs into a `Function`. + * + * @param {String} str + * @param {Object} options + * @return {Function} + * @api public + */ + +var compile = exports.compile = function(str, options){ + options = options || {}; + var escape = options.escape || utils.escape; + + var input = JSON.stringify(str) + , compileDebug = options.compileDebug !== false + , client = options.client + , filename = options.filename + ? JSON.stringify(options.filename) + : 'undefined'; + + if (compileDebug) { + // Adds the fancy stack trace meta info + str = [ + 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };', + rethrow.toString(), + 'try {', + exports.parse(str, options), + '} catch (err) {', + ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);', + '}' + ].join("\n"); + } else { + str = exports.parse(str, options); + } + + if (options.debug) console.log(str); + if (client) str = 'escape = escape || ' + escape.toString() + ';\n' + str; + + try { + var fn = new Function('locals, filters, escape, rethrow', str); + } catch (err) { + if ('SyntaxError' == err.name) { + err.message += options.filename + ? ' in ' + filename + : ' while compiling ejs'; + } + throw err; + } + + if (client) return fn; + + return function(locals){ + return fn.call(this, locals, filters, escape, rethrow); + } +}; + +/** + * Render the given `str` of ejs. + * + * Options: + * + * - `locals` Local variables object + * - `cache` Compiled functions are cached, requires `filename` + * - `filename` Used by `cache` to key caches + * - `scope` Function execution context + * - `debug` Output generated function body + * - `open` Open tag, defaulting to "<%" + * - `close` Closing tag, defaulting to "%>" + * + * @param {String} str + * @param {Object} options + * @return {String} + * @api public + */ + +exports.render = function(str, options){ + var fn + , options = options || {}; + + if (options.cache) { + if (options.filename) { + fn = cache[options.filename] || (cache[options.filename] = compile(str, options)); + } else { + throw new Error('"cache" option requires "filename".'); + } + } else { + fn = compile(str, options); + } + + options.__proto__ = options.locals; + return fn.call(options.scope, options); +}; + +/** + * Render an EJS file at the given `path` and callback `fn(err, str)`. + * + * @param {String} path + * @param {Object|Function} options or callback + * @param {Function} fn + * @api public + */ + +exports.renderFile = function(path, options, fn){ + var key = path + ':string'; + + if ('function' == typeof options) { + fn = options, options = {}; + } + + options.filename = path; + + var str; + try { + str = options.cache + ? cache[key] || (cache[key] = read(path, 'utf8')) + : read(path, 'utf8'); + } catch (err) { + fn(err); + return; + } + fn(null, exports.render(str, options)); +}; + +/** + * Resolve include `name` relative to `filename`. + * + * @param {String} name + * @param {String} filename + * @return {String} + * @api private + */ + +function resolveInclude(name, filename) { + var path = join(dirname(filename), name); + var ext = extname(name); + if (!ext) path += '.ejs'; + return path; +} + +// express support + +exports.__express = exports.renderFile; + +/** + * Expose to require(). + */ + +if (require.extensions) { + require.extensions['.ejs'] = function (module, filename) { + filename = filename || module.filename; + var options = { filename: filename, client: true } + , template = fs.readFileSync(filename).toString() + , fn = compile(template, options); + module._compile('module.exports = ' + fn.toString() + ';', filename); + }; +} else if (require.registerExtension) { + require.registerExtension('.ejs', function(src) { + return compile(src, {}); + }); +} + +},{"./filters":7,"./utils":8,"fs":2,"path":3}],7:[function(require,module,exports){ +/*! + * EJS - Filters + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * First element of the target `obj`. + */ + +exports.first = function(obj) { + return obj[0]; +}; + +/** + * Last element of the target `obj`. + */ + +exports.last = function(obj) { + return obj[obj.length - 1]; +}; + +/** + * Capitalize the first letter of the target `str`. + */ + +exports.capitalize = function(str){ + str = String(str); + return str[0].toUpperCase() + str.substr(1, str.length); +}; + +/** + * Downcase the target `str`. + */ + +exports.downcase = function(str){ + return String(str).toLowerCase(); +}; + +/** + * Uppercase the target `str`. + */ + +exports.upcase = function(str){ + return String(str).toUpperCase(); +}; + +/** + * Sort the target `obj`. + */ + +exports.sort = function(obj){ + return Object.create(obj).sort(); +}; + +/** + * Sort the target `obj` by the given `prop` ascending. + */ + +exports.sort_by = function(obj, prop){ + return Object.create(obj).sort(function(a, b){ + a = a[prop], b = b[prop]; + if (a > b) return 1; + if (a < b) return -1; + return 0; + }); +}; + +/** + * Size or length of the target `obj`. + */ + +exports.size = exports.length = function(obj) { + return obj.length; +}; + +/** + * Add `a` and `b`. + */ + +exports.plus = function(a, b){ + return Number(a) + Number(b); +}; + +/** + * Subtract `b` from `a`. + */ + +exports.minus = function(a, b){ + return Number(a) - Number(b); +}; + +/** + * Multiply `a` by `b`. + */ + +exports.times = function(a, b){ + return Number(a) * Number(b); +}; + +/** + * Divide `a` by `b`. + */ + +exports.divided_by = function(a, b){ + return Number(a) / Number(b); +}; + +/** + * Join `obj` with the given `str`. + */ + +exports.join = function(obj, str){ + return obj.join(str || ', '); +}; + +/** + * Truncate `str` to `len`. + */ + +exports.truncate = function(str, len, append){ + str = String(str); + if (str.length > len) { + str = str.slice(0, len); + if (append) str += append; + } + return str; +}; + +/** + * Truncate `str` to `n` words. + */ + +exports.truncate_words = function(str, n){ + var str = String(str) + , words = str.split(/ +/); + return words.slice(0, n).join(' '); +}; + +/** + * Replace `pattern` with `substitution` in `str`. + */ + +exports.replace = function(str, pattern, substitution){ + return String(str).replace(pattern, substitution || ''); +}; + +/** + * Prepend `val` to `obj`. + */ + +exports.prepend = function(obj, val){ + return Array.isArray(obj) + ? [val].concat(obj) + : val + obj; +}; + +/** + * Append `val` to `obj`. + */ + +exports.append = function(obj, val){ + return Array.isArray(obj) + ? obj.concat(val) + : obj + val; +}; + +/** + * Map the given `prop`. + */ + +exports.map = function(arr, prop){ + return arr.map(function(obj){ + return obj[prop]; + }); +}; + +/** + * Reverse the given `obj`. + */ + +exports.reverse = function(obj){ + return Array.isArray(obj) + ? obj.reverse() + : String(obj).split('').reverse().join(''); +}; + +/** + * Get `prop` of the given `obj`. + */ + +exports.get = function(obj, prop){ + return obj[prop]; +}; + +/** + * Packs the given `obj` into json string + */ +exports.json = function(obj){ + return JSON.stringify(obj); +}; + +},{}],8:[function(require,module,exports){ + +/*! + * EJS + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function(html){ + return String(html) + .replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&') + .replace(//g, '>') + .replace(/'/g, ''') + .replace(/"/g, '"'); +}; + + +},{}],9:[function(require,module,exports){ +'use strict'; + + +var Product = require('./product'), + Pubsub = require('./util/pubsub'), + Storage = require('./util/storage'), + constants = require('./constants'), + currency = require('./util/currency'), + mixin = require('./util/mixin'); + + + +/** + * Renders the Mini Cart to the page's DOM. + * + * @constructor + * @param {string} name Name of the cart (used as a key for storage) + * @param {duration} number Time in milliseconds that the cart data should persist + */ +function Cart(name, duration) { + var data, items, settings, len, i; + + this._items = []; + this._settings = { bn: constants.BN }; + + Pubsub.call(this); + Storage.call(this, name, duration); + + if ((data = this.load())) { + items = data.items; + settings = data.settings; + + if (settings) { + this._settings = settings; + } + + if (items) { + for (i = 0, len = items.length; i < len; i++) { + this.add(items[i]); + } + } + } +} + + +mixin(Cart.prototype, Pubsub.prototype); +mixin(Cart.prototype, Storage.prototype); + + +/** + * Adds an item to the cart. This fires an "add" event. + * + * @param {object} data Item data + * @return {number} Item location in the cart + */ +Cart.prototype.add = function add(data) { + var that = this, + items = this.items(), + idx = false, + isExisting = false, + product, key, len, i; + + // Prune cart settings data from the product + for (key in data) { + if (constants.SETTINGS.test(key)) { + this._settings[key] = data[key]; + delete data[key]; + } + } + + // Look to see if the same product has already been added + for (i = 0, len = items.length; i < len; i++) { + if (items[i].isEqual(data)) { + product = items[i]; + product.set('quantity', product.get('quantity') + (parseInt(data.quantity, 10) || 1)); + idx = i; + isExisting = true; + break; + } + } + + // If not, then try to add it + if (!product) { + product = new Product(data); + + if (product.isValid()) { + idx = (this._items.push(product) - 1); + + product.on('change', function (key, value) { + that.save(); + that.fire('change', idx, key, value); + }); + + this.save(); + } + } + + if (product) { + this.fire('add', idx, product, isExisting); + } + + return idx; +}; + + +/** + * Returns the carts current items. + * + * @param {number} idx (Optional) Returns only that item. + * @return {array|object} + */ +Cart.prototype.items = function get(idx) { + return (typeof idx === 'number') ? this._items[idx] : this._items; +}; + + +/** + * Returns the carts current settings. + * + * @param {string} name (Optional) Returns only that setting. + * @return {array|string} + */ +Cart.prototype.settings = function settings(name) { + return (name) ? this._settings[name] : this._settings; +}; + + +/** + * Returns the cart discount. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Cart.prototype.discount = function discount(config) { + var result = parseFloat(this.settings('discount_amount_cart')) || 0; + + if (!result) { + result = (parseFloat(this.settings('discount_rate_cart')) || 0) * this.subtotal() / 100; + } + + config = config || {}; + config.currency = this.settings('currency_code'); + + return currency(result, config); +}; + + +/** + * Returns the cart total without discounts. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Cart.prototype.subtotal = function subtotal(config) { + var products = this.items(), + result = 0, + i, len; + + for (i = 0, len = products.length; i < len; i++) { + result += products[i].total(); + } + + config = config || {}; + config.currency = this.settings('currency_code'); + + return currency(result, config); +}; + + +/** + * Returns the cart total. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Cart.prototype.total = function total(config) { + var result = 0; + + result += this.subtotal(); + result -= this.discount(); + + config = config || {}; + config.currency = this.settings('currency_code'); + + return currency(result, config); +}; + + +/** + * Remove an item from the cart. This fires a "remove" event. + * + * @param {number} idx Item index to remove. + * @return {boolean} + */ +Cart.prototype.remove = function remove(idx) { + var item = this._items.splice(idx, 1); + + if (this._items.length === 0) { + this.destroy(); + } + + if (item) { + this.save(); + this.fire('remove', idx, item[0]); + } + + return !!item.length; +}; + + +/** + * Saves the cart data. + */ +Cart.prototype.save = function save() { + var items = this.items(), + settings = this.settings(), + data = [], + i, len; + + for (i = 0, len = items.length; i < len; i++) { + data.push(items[i].get()); + } + + Storage.prototype.save.call(this, { + items: data, + settings: settings + }); +}; + + +/** + * Proxies the checkout event + * The assumption is the view triggers this and consumers subscribe to it + * + * @param {object} The initiating event + */ +Cart.prototype.checkout = function checkout(evt) { + this.fire('checkout', evt); +}; + + +/** + * Destroy the cart data. This fires a "destroy" event. + */ +Cart.prototype.destroy = function destroy() { + Storage.prototype.destroy.call(this); + + this._items = []; + this._settings = { bn: constants.BN }; + + this.fire('destroy'); +}; + + + + +module.exports = Cart; + +},{"./constants":11,"./product":13,"./util/currency":15,"./util/mixin":18,"./util/pubsub":19,"./util/storage":20}],10:[function(require,module,exports){ +'use strict'; + + +var mixin = require('./util/mixin'); + + +var defaults = module.exports = { + + name: 'PPMiniCart', + + parent: (typeof document !== 'undefined') ? document.body : null, + + action: 'https://www.paypal.com/cgi-bin/webscr', + + target: '', + + duration: 30, + + template: '<%var items = cart.items();var settings = cart.settings();var hasItems = !!items.length;var priceFormat = { format: true, currency: cart.settings("currency_code") };var totalFormat = { format: true, showCode: true };%>
    <% for (var i= 0, idx = i + 1, len = items.length; i < len; i++, idx++) { %>
  • "><%= items[i].get("item_name") %>
      <% if (items[i].get("item_number")) { %>
    • <%= items[i].get("item_number") %> " />
    • <% } %> <% if (items[i].discount()) { %>
    • <%= config.strings.discount %> <%= items[i].discount(priceFormat) %>
    • <% } %> <% for (var options = items[i].options(), j = 0, len2 = options.length; j < len2; j++) { %>
    • <%= options[j].key %>: <%= options[j].value %>
    • <% } %>
    " autocomplete="off" />
    <%= items[i].total(priceFormat) %>
    " /> " /> " />
  • <% } %>
<% for (var key in settings) { %> <% } %>
', + + styles: '@keyframes pop-in { 0% { opacity: 0; transform: scale(0.1); } 60% { opacity: 1; transform: scale(1.2); } 100% { transform: scale(1); }}@-webkit-keyframes pop-in { 0% { opacity: 0; -webkit-transform: scale(0.1); } 60% { opacity: 1; -webkit-transform: scale(1.2); } 100% { -webkit-transform: scale(1); }}@-moz-keyframes pop-in { 0% { opacity: 0; -moz-transform: scale(0.1); } 60% { opacity: 1; -moz-transform: scale(1.2); } 100% { -moz-transform: scale(1); }}.minicart-showing #PPMiniCart { display: block; transform: translateZ(0); -webkit-transform: translateZ(0); -moz-transform: translateZ(0); animation: pop-in 0.25s; -webkit-animation: pop-in 0.25s; -moz-animation: pop-in 0.25s;}#PPMiniCart { display: none; position: fixed; left: 50%; top: 75px;}#PPMiniCart form { position: relative; width: 400px; max-height: 400px; margin-left: -200px; padding: 10px 10px 40px; background: #fbfbfb; border: 1px solid #d7d7d7; border-radius: 4px; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5); font: 15px/normal arial, helvetica; color: #333;}#PPMiniCart form.minicart-empty { padding-bottom: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart ul { clear: both; float: left; width: 380px; margin: 5px 0 20px; padding: 10px; list-style-type: none; background: #fff; border: 1px solid #ccc; border-radius: 4px; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);}#PPMiniCart .minicart-empty ul { display: none;}#PPMiniCart .minicart-closer { float: right; margin: -12px -10px 0; padding: 10px; background: 0; border: 0; font-size: 18px; cursor: pointer; font-weight: bold;}#PPMiniCart .minicart-item { clear: left; padding: 6px 0; min-height: 25px;}#PPMiniCart .minicart-item + .minicart-item { border-top: 1px solid #f2f2f2;}#PPMiniCart .minicart-item a { color: #333; text-decoration: none;}#PPMiniCart .minicart-details-name { float: left; width: 62%;}#PPMiniCart .minicart-details-quantity { float: left; width: 15%;}#PPMiniCart .minicart-details-remove { float: left; width: 7%;}#PPMiniCart .minicart-details-price { float: left; width: 16%; text-align: right;}#PPMiniCart .minicart-attributes { margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: #999; font-size: 12px; line-height: 22px;}#PPMiniCart .minicart-attributes li { display: inline;}#PPMiniCart .minicart-attributes li:after { content: ",";}#PPMiniCart .minicart-attributes li:last-child:after { content: "";}#PPMiniCart .minicart-quantity { width: 30px; height: 18px; padding: 2px 4px; border: 1px solid #ccc; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); font-size: 13px; text-align: right; transition: border linear 0.2s, box-shadow linear 0.2s; -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s;}#PPMiniCart .minicart-quantity:hover { border-color: #0078C1;}#PPMiniCart .minicart-quantity:focus { border-color: #0078C1; outline: 0; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 3px rgba(0, 120, 193, 0.4);}#PPMiniCart .minicart-remove { width: 18px; height: 19px; margin: 2px 0 0; padding: 0; background: #b7b7b7; border: 1px solid #a3a3a3; border-radius: 3px; color: #fff; font-size: 13px; opacity: 0.70; cursor: pointer;}#PPMiniCart .minicart-remove:hover { opacity: 1;}#PPMiniCart .minicart-footer { clear: left;}#PPMiniCart .minicart-subtotal { position: absolute; bottom: 17px; padding-left: 6px; left: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart .minicart-submit { position: absolute; bottom: 10px; right: 10px; min-width: 153px; height: 33px; margin-right: 6px; padding: 0 9px; border: 1px solid #ffc727; border-radius: 5px; color: #000; text-shadow: 1px 1px 1px #fff6e9; cursor: pointer; background: #ffaa00; background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZjZlOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmFhMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: -moz-linear-gradient(top, #fff6e9 0%, #ffaa00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff6e9), color-stop(100%,#ffaa00)); background: -webkit-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -o-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -ms-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: linear-gradient(to bottom, #fff6e9 0%,#ffaa00 100%);}#PPMiniCart .minicart-submit img { vertical-align: middle; padding: 4px 0 0 2px;}', + + strings: { + button: 'Check Out with PayPal', + subtotal: 'Subtotal:', + discount: 'Discount:', + empty: 'Your shopping cart is empty' + } + +}; + + +/** + * Mixes in the user config with the default config. + * + * @param {object} userConfig Configuration overrides + * @return {object} + */ +module.exports.load = function load(userConfig) { + return mixin(defaults, userConfig); +}; + +},{"./util/mixin":18}],11:[function(require,module,exports){ +'use strict'; + + +module.exports = { + + COMMANDS: { _cart: true, _xclick: true, _donations: true }, + + SETTINGS: /^(?:business|currency_code|lc|paymentaction|no_shipping|cn|no_note|invoice|handling_cart|weight_cart|weight_unit|tax_cart|discount_amount_cart|discount_rate_cart|page_style|image_url|cpp_|cs|cbt|return|cancel_return|notify_url|rm|custom|charset)/, + + BN: 'MiniCart_AddToCart_WPS_US', + + KEYUP_TIMEOUT: 500, + + SHOWING_CLASS: 'minicart-showing', + + REMOVE_CLASS: 'minicart-remove', + + CLOSER_CLASS: 'minicart-closer', + + QUANTITY_CLASS: 'minicart-quantity', + + ITEM_CLASS: 'minicart-item', + + ITEM_CHANGED_CLASS: 'minicart-item-changed', + + SUBMIT_CLASS: 'minicart-submit', + + DATA_IDX: 'data-minicart-idx' + +}; + +},{}],12:[function(require,module,exports){ +'use strict'; + + +var Cart = require('./cart'), + View = require('./view'), + config = require('./config'), + minicart = {}, + cartModel, + confModel, + viewModel; + + +/** + * Renders the Mini Cart to the page's DOM. + * + * @param {object} userConfig Configuration overrides + */ +minicart.render = function (userConfig) { + confModel = minicart.config = config.load(userConfig); + cartModel = minicart.cart = new Cart(confModel.name, confModel.duration); + viewModel = minicart.view = new View({ + config: confModel, + cart: cartModel + }); + + cartModel.on('add', viewModel.addItem, viewModel); + cartModel.on('change', viewModel.changeItem, viewModel); + cartModel.on('remove', viewModel.removeItem, viewModel); + cartModel.on('destroy', viewModel.hide, viewModel); +}; + + +/** + * Resets the Mini Cart and its view model + */ +minicart.reset = function () { + cartModel.destroy(); + + viewModel.hide(); + viewModel.redraw(); +}; + + + + +// Export to either node or the brower window +if (typeof window === 'undefined') { + module.exports = minicart; +} else { + if (!window.paypal) { + window.paypal = {}; + } + + window.paypal.minicart = minicart; +} + +},{"./cart":9,"./config":10,"./view":22}],13:[function(require,module,exports){ +'use strict'; + + +var currency = require('./util/currency'), + Pubsub = require('./util/pubsub'), + mixin = require('./util/mixin'); + + +var parser = { + quantity: function (value) { + value = parseInt(value, 10); + + if (isNaN(value) || !value) { + value = 1; + } + + return value; + }, + amount: function (value) { + return parseFloat(value) || 0; + }, + href: function (value) { + if (value) { + return value; + } else { + return (typeof window !== 'undefined') ? window.location.href : null; + } + } +}; + + +/** + * Creates a new product. + * + * @constructor + * @param {object} data Item data + */ +function Product(data) { + data.quantity = parser.quantity(data.quantity); + data.amount = parser.amount(data.amount); + data.href = parser.href(data.href); + + this._data = data; + this._options = null; + this._discount = null; + this._amount = null; + this._total = null; + + Pubsub.call(this); +} + + +mixin(Product.prototype, Pubsub.prototype); + + +/** + * Gets the product data. + * + * @param {string} key (Optional) A key to restrict the returned data to. + * @return {array|string} + */ +Product.prototype.get = function get(key) { + return (key) ? this._data[key] : this._data; +}; + + +/** + * Sets a value on the product. This is used rather than manually setting the + * value so that we can fire a "change" event. + * + * @param {string} key + * @param {string} value + */ +Product.prototype.set = function set(key, value) { + var setter = parser[key]; + + this._data[key] = setter ? setter(value) : value; + this._options = null; + this._discount = null; + this._amount = null; + this._total = null; + + this.fire('change', key); +}; + + +/** + * Parse and return the options for this product. + * + * @return {object} + */ +Product.prototype.options = function options() { + var result, key, value, amount, i, j; + + if (!this._options) { + result = []; + i = 0; + + while ((key = this.get('on' + i))) { + value = this.get('os' + i); + amount = 0; + j = 0; + + while (typeof this.get('option_select' + j) !== 'undefined') { + if (this.get('option_select' + j) === value) { + amount = parser.amount(this.get('option_amount' + j)); + break; + } + + j++; + } + + result.push({ + key: key, + value: value, + amount: amount + }); + + i++; + } + + this._options = result; + } + + return this._options; +}; + + +/** + * Parse and return the discount for this product. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Product.prototype.discount = function discount(config) { + var flat, rate, num, limit, result, amount; + + if (!this._discount) { + result = 0; + num = parseInt(this.get('discount_num'), 10) || 0; + limit = Math.max(num, this.get('quantity') - 1); + + if (this.get('discount_amount') !== undefined) { + flat = parser.amount(this.get('discount_amount')); + result += flat; + result += parser.amount(this.get('discount_amount2') || flat) * limit; + } else if (this.get('discount_rate') !== undefined) { + rate = parser.amount(this.get('discount_rate')); + amount = this.amount(); + + result += rate * amount / 100; + result += parser.amount(this.get('discount_rate2') || rate) * amount * limit / 100; + } + + this._discount = result; + } + + return currency(this._discount, config); +}; + + +/** + * Parse and return the total without discounts for this product. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Product.prototype.amount = function amount(config) { + var result, options, len, i; + + if (!this._amount) { + result = this.get('amount'); + options = this.options(); + + for (i = 0, len = options.length; i < len; i++) { + result += options[i].amount; + } + + this._amount = result; + } + + return currency(this._amount, config); +}; + + +/** + * Parse and return the total for this product. + * + * @param {object} config (Optional) Currency formatting options. + * @return {number|string} + */ +Product.prototype.total = function total(config) { + var result; + + if (!this._total) { + result = this.get('quantity') * this.amount(); + result -= this.discount(); + + this._total = parser.amount(result); + } + + return currency(this._total, config); +}; + + +/** + * Determine if this product has the same data as another. + * + * @param {object|Product} data Other product. + * @return {boolean} + */ +Product.prototype.isEqual = function isEqual(data) { + var match = false; + + if (data instanceof Product) { + data = data._data; + } + + if (this.get('item_name') === data.item_name) { + if (this.get('item_number') === data.item_number) { + if (this.get('amount') === parser.amount(data.amount)) { + var i = 0; + + match = true; + + while (typeof data['os' + i] !== 'undefined') { + if (this.get('os' + i) !== data['os' + i]) { + match = false; + break; + } + + i++; + } + } + } + } + + return match; +}; + + +/** + * Determine if this product is valid. + * + * @return {boolean} + */ +Product.prototype.isValid = function isValid() { + return (this.get('item_name') && this.amount() > 0); +}; + + +/** + * Destroys this product. Fires a "destroy" event. + */ +Product.prototype.destroy = function destroy() { + this._data = []; + this.fire('destroy', this); +}; + + + + +module.exports = Product; + +},{"./util/currency":15,"./util/mixin":18,"./util/pubsub":19}],14:[function(require,module,exports){ +/* jshint quotmark:double */ + + +"use strict"; + + + +module.exports.add = function add(el, str) { + var re; + + if (!el) { return false; } + + if (el && el.classList && el.classList.add) { + el.classList.add(str); + } else { + re = new RegExp("\\b" + str + "\\b"); + + if (!re.test(el.className)) { + el.className += " " + str; + } + } +}; + + +module.exports.remove = function remove(el, str) { + var re; + + if (!el) { return false; } + + if (el.classList && el.classList.add) { + el.classList.remove(str); + } else { + re = new RegExp("\\b" + str + "\\b"); + + if (re.test(el.className)) { + el.className = el.className.replace(re, ""); + } + } +}; + + +module.exports.inject = function inject(el, str) { + var style; + + if (!el) { return false; } + + if (str) { + style = document.createElement("style"); + style.type = "text/css"; + + if (style.styleSheet) { + style.styleSheet.cssText = str; + } else { + style.appendChild(document.createTextNode(str)); + } + + el.appendChild(style); + } +}; + +},{}],15:[function(require,module,exports){ +'use strict'; + + +var currencies = { + AED: { before: '\u062c' }, + ANG: { before: '\u0192' }, + ARS: { before: '$', code: true }, + AUD: { before: '$', code: true }, + AWG: { before: '\u0192' }, + BBD: { before: '$', code: true }, + BGN: { before: '\u043b\u0432' }, + BMD: { before: '$', code: true }, + BND: { before: '$', code: true }, + BRL: { before: 'R$' }, + BSD: { before: '$', code: true }, + CAD: { before: '$', code: true }, + CHF: { before: '', code: true }, + CLP: { before: '$', code: true }, + CNY: { before: '\u00A5' }, + COP: { before: '$', code: true }, + CRC: { before: '\u20A1' }, + CZK: { before: 'Kc' }, + DKK: { before: 'kr' }, + DOP: { before: '$', code: true }, + EEK: { before: 'kr' }, + EUR: { before: '\u20AC' }, + GBP: { before: '\u00A3' }, + GTQ: { before: 'Q' }, + HKD: { before: '$', code: true }, + HRK: { before: 'kn' }, + HUF: { before: 'Ft' }, + IDR: { before: 'Rp' }, + ILS: { before: '\u20AA' }, + INR: { before: 'Rs.' }, + ISK: { before: 'kr' }, + JMD: { before: 'J$' }, + JPY: { before: '\u00A5' }, + KRW: { before: '\u20A9' }, + KYD: { before: '$', code: true }, + LTL: { before: 'Lt' }, + LVL: { before: 'Ls' }, + MXN: { before: '$', code: true }, + MYR: { before: 'RM' }, + NOK: { before: 'kr' }, + NZD: { before: '$', code: true }, + PEN: { before: 'S/' }, + PHP: { before: 'Php' }, + PLN: { before: 'z' }, + QAR: { before: '\ufdfc' }, + RON: { before: 'lei' }, + RUB: { before: '\u0440\u0443\u0431' }, + SAR: { before: '\ufdfc' }, + SEK: { before: 'kr' }, + SGD: { before: '$', code: true }, + THB: { before: '\u0E3F' }, + TRY: { before: 'TL' }, + TTD: { before: 'TT$' }, + TWD: { before: 'NT$' }, + UAH: { before: '\u20b4' }, + USD: { before: '$', code: true }, + UYU: { before: '$U' }, + VEF: { before: 'Bs' }, + VND: { before: '\u20ab' }, + XCD: { before: '$', code: true }, + ZAR: { before: 'R' } +}; + + +module.exports = function currency(amount, config) { + var code = config && config.currency || 'USD', + value = currencies[code], + before = value.before || '', + after = value.after || '', + length = value.length || 2, + showCode = value.code && config && config.showCode, + result = amount; + + if (config && config.format) { + result = before + result.toFixed(length) + after; + } + + if (showCode) { + result += ' ' + code; + } + + return result; +}; + +},{}],16:[function(require,module,exports){ +'use strict'; + + +module.exports = (function (window, document) { + + /** + * Events are added here for easy reference + */ + var cache = []; + + // NOOP for Node + if (!document) { + return { + add: function () {}, + remove: function () {} + }; + // Non-IE events + } else if (document.addEventListener) { + return { + /** + * Add an event to an object and optionally adjust it's scope + * + * @param obj {HTMLElement} The object to attach the event to + * @param type {string} The type of event excluding "on" + * @param fn {function} The function + * @param scope {object} Object to adjust the scope to (optional) + */ + add: function (obj, type, fn, scope) { + scope = scope || obj; + + var wrappedFn = function (e) { fn.call(scope, e); }; + + obj.addEventListener(type, wrappedFn, false); + cache.push([obj, type, fn, wrappedFn]); + }, + + + /** + * Remove an event from an object + * + * @param obj {HTMLElement} The object to remove the event from + * @param type {string} The type of event excluding "on" + * @param fn {function} The function + */ + remove: function (obj, type, fn) { + var wrappedFn, item, len = cache.length, i; + + for (i = 0; i < len; i++) { + item = cache[i]; + + if (item[0] === obj && item[1] === type && item[2] === fn) { + wrappedFn = item[3]; + + if (wrappedFn) { + obj.removeEventListener(type, wrappedFn, false); + cache = cache.slice(i); + return true; + } + } + } + } + }; + + // IE events + } else if (document.attachEvent) { + return { + /** + * Add an event to an object and optionally adjust it's scope (IE) + * + * @param obj {HTMLElement} The object to attach the event to + * @param type {string} The type of event excluding "on" + * @param fn {function} The function + * @param scope {object} Object to adjust the scope to (optional) + */ + add: function (obj, type, fn, scope) { + scope = scope || obj; + + var wrappedFn = function () { + var e = window.event; + e.target = e.target || e.srcElement; + + e.preventDefault = function () { + e.returnValue = false; + }; + + fn.call(scope, e); + }; + + obj.attachEvent('on' + type, wrappedFn); + cache.push([obj, type, fn, wrappedFn]); + }, + + + /** + * Remove an event from an object (IE) + * + * @param obj {HTMLElement} The object to remove the event from + * @param type {string} The type of event excluding "on" + * @param fn {function} The function + */ + remove: function (obj, type, fn) { + var wrappedFn, item, len = cache.length, i; + + for (i = 0; i < len; i++) { + item = cache[i]; + + if (item[0] === obj && item[1] === type && item[2] === fn) { + wrappedFn = item[3]; + + if (wrappedFn) { + obj.detachEvent('on' + type, wrappedFn); + cache = cache.slice(i); + return true; + } + } + } + } + }; + } + +})(typeof window === 'undefined' ? null : window, typeof document === 'undefined' ? null : document); + +},{}],17:[function(require,module,exports){ +'use strict'; + + +var forms = module.exports = { + + parse: function parse(form) { + var raw = form.elements, + data = {}, + pair, value, i, len; + + for (i = 0, len = raw.length; i < len; i++) { + pair = raw[i]; + + if ((value = forms.getInputValue(pair))) { + data[pair.name] = value; + } + } + + return data; + }, + + + getInputValue: function getInputValue(input) { + var tag = input.tagName.toLowerCase(); + + if (tag === 'select') { + return input.options[input.selectedIndex].value; + } else if (tag === 'textarea') { + return input.innerText; + } else { + if (input.type === 'radio') { + return (input.checked) ? input.value : null; + } else if (input.type === 'checkbox') { + return (input.checked) ? input.value : null; + } else { + return input.value; + } + } + } + +}; +},{}],18:[function(require,module,exports){ +'use strict'; + + +var mixin = module.exports = function mixin(dest, source) { + var value; + + for (var key in source) { + value = source[key]; + + if (value && value.constructor === Object) { + if (!dest[key]) { + dest[key] = value; + } else { + mixin(dest[key] || {}, value); + } + } else { + dest[key] = value; + } + } + + return dest; +}; + +},{}],19:[function(require,module,exports){ +'use strict'; + + +function Pubsub() { + this._eventCache = {}; +} + + +Pubsub.prototype.on = function on(name, fn, scope) { + var cache = this._eventCache[name]; + + if (!cache) { + cache = this._eventCache[name] = []; + } + + cache.push([fn, scope]); +}; + + +Pubsub.prototype.off = function off(name, fn) { + var cache = this._eventCache[name], + i, len; + + if (cache) { + for (i = 0, len = cache.length; i < len; i++) { + if (cache[i] === fn) { + cache = cache.splice(i, 1); + } + } + } +}; + + +Pubsub.prototype.fire = function on(name) { + var cache = this._eventCache[name], i, len, fn, scope; + + if (cache) { + for (i = 0, len = cache.length; i < len; i++) { + fn = cache[i][0]; + scope = cache[i][1] || this; + + if (typeof fn === 'function') { + fn.apply(scope, Array.prototype.slice.call(arguments, 1)); + } + } + } +}; + + +module.exports = Pubsub; + +},{}],20:[function(require,module,exports){ +'use strict'; + + +var Storage = module.exports = function Storage(name, duration) { + this._name = name; + this._duration = duration || 30; +}; + + +var proto = Storage.prototype; + + +proto.load = function () { + if (typeof window === 'object' && window.localStorage) { + var data = window.localStorage.getItem(this._name), today, expires; + + if (data) { + data = JSON.parse(decodeURIComponent(data)); + } + + if (data && data.expires) { + today = new Date(); + expires = new Date(data.expires); + + if (today > expires) { + this.destroy(); + return; + } + } + + return data && data.value; + } +}; + + +proto.save = function (data) { + if (typeof window === 'object' && window.localStorage) { + var expires = new Date(), wrapped; + + expires.setTime(expires.getTime() + this._duration * 24 * 60 * 60 * 1000); + + wrapped = { + value: data, + expires: expires.toGMTString() + }; + + window.localStorage.setItem(this._name, encodeURIComponent(JSON.stringify(wrapped))); + } +}; + + +proto.destroy = function () { + if (typeof window === 'object' && window.localStorage) { + window.localStorage.removeItem(this._name); + } +}; + +},{}],21:[function(require,module,exports){ +'use strict'; + + +var ejs = require('ejs'); + + +module.exports = function template(str, data) { + return ejs.render(str, data); +}; + + +// Workaround for IE 8's lack of support +if (!String.prototype.trim) { + String.prototype.trim = function () { + return this.replace(/^\s+|\s+$/g, ''); + }; +} + +},{"ejs":6}],22:[function(require,module,exports){ +'use strict'; + + +var config = require('./config'), + events = require('./util/events'), + template = require('./util/template'), + forms = require('./util/forms'), + css = require('./util/css'), + viewevents = require('./viewevents'), + constants = require('./constants'); + + + +/** + * Creates a view model. + * + * @constructor + * @param {object} model + */ +function View(model) { + var wrapper; + + this.el = wrapper = document.createElement('div'); + this.model = model; + this.isShowing = false; + + // HTML + wrapper.id = config.name; + config.parent.appendChild(wrapper); + + // CSS + css.inject(document.getElementsByTagName('head')[0], config.styles); + + // JavaScript + events.add(document, ('ontouchstart' in window) ? 'touchstart' : 'click', viewevents.click, this); + events.add(document, 'keyup', viewevents.keyup, this); + events.add(document, 'readystatechange', viewevents.readystatechange, this); + events.add(window, 'pageshow', viewevents.pageshow, this); +} + + +/** + * Tells the view to redraw + */ +View.prototype.redraw = function redraw() { + events.remove(this.el.querySelector('form'), 'submit', this.model.cart.checkout, this.model.cart); + this.el.innerHTML = template(config.template, this.model); + events.add(this.el.querySelector('form'), 'submit', this.model.cart.checkout, this.model.cart); +}; + + +/** + * Tells the view to show + */ +View.prototype.show = function show() { + if (!this.isShowing) { + css.add(document.body, constants.SHOWING_CLASS); + this.isShowing = true; + } +}; + + +/** + * Tells the view to hide + */ +View.prototype.hide = function hide() { + if (this.isShowing) { + css.remove(document.body, constants.SHOWING_CLASS); + this.isShowing = false; + } +}; + + +/** + * Toggles the visibility of the view + */ +View.prototype.toggle = function toggle() { + this[this.isShowing ? 'hide' : 'show'](); +}; + + +/** + * Binds cart submit events to a form. + * + * @param {HTMLElement} form + * @return {boolean} + */ +View.prototype.bind = function bind(form) { + var that = this; + + // Don't bind forms without a cmd value + if (!constants.COMMANDS[form.cmd.value]) { + return false; + } + + // Prevent re-binding forms + if (form.hasMinicart) { + return false; + } else { + form.hasMinicart = true; + } + + if (form.display) { + events.add(form, 'submit', function (e) { + e.preventDefault(); + that.show(); + }); + } else { + events.add(form, 'submit', function (e) { + e.preventDefault(e); + that.model.cart.add(forms.parse(form)); + }); + } + + return true; +}; + + +/** + * Adds an item to the view. + * + * @param {number} idx + * @param {object} data + */ +View.prototype.addItem = function addItem(idx, data) { + this.redraw(); + this.show(); + + var els = this.el.querySelectorAll('.' + constants.ITEM_CLASS); + css.add(els[idx], constants.ITEM_CHANGED_CLASS); +}; + + +/** + * Changes an item in the view. + * + * @param {number} idx + * @param {object} data + */ +View.prototype.changeItem = function changeItem(idx, data) { + this.redraw(); + this.show(); + + var els = this.el.querySelectorAll('.' + constants.ITEM_CLASS); + css.add(els[idx], constants.ITEM_CHANGED_CLASS); +}; + + +/** + * Removes an item from the view. + * + * @param {number} idx + */ +View.prototype.removeItem = function removeItem(idx) { + this.redraw(); +}; + + + + +module.exports = View; + +},{"./config":10,"./constants":11,"./util/css":14,"./util/events":16,"./util/forms":17,"./util/template":21,"./viewevents":23}],23:[function(require,module,exports){ +'use strict'; + + +var constants = require('./constants'), + events = require('./util/events'), + viewevents; + + +module.exports = viewevents = { + + click: function (evt) { + var target = evt.target, + className = target.className; + + if (this.isShowing) { + // Cart close button + if (className === constants.CLOSER_CLASS) { + this.hide(); + // Product remove button + } else if (className === constants.REMOVE_CLASS) { + this.model.cart.remove(target.getAttribute(constants.DATA_IDX)); + // Product quantity input + } else if (className === constants.QUANTITY_CLASS) { + target[target.setSelectionRange ? 'setSelectionRange' : 'select'](0, 999); + // Outside the cart + } else if (!(/input|button|select|option/i.test(target.tagName))) { + while (target.nodeType === 1) { + if (target === this.el) { + return; + } + + target = target.parentNode; + } + + this.hide(); + } + } + }, + + + keyup: function (evt) { + var that = this, + target = evt.target, + timer; + + if (target.className === constants.QUANTITY_CLASS) { + timer = setTimeout(function () { + var idx = parseInt(target.getAttribute(constants.DATA_IDX), 10), + cart = that.model.cart, + product = cart.items(idx), + quantity = parseInt(target.value, 10); + + if (product) { + if (quantity > 0) { + product.set('quantity', quantity); + } else if (quantity === 0) { + cart.remove(idx); + } + } + }, constants.KEYUP_TIMEOUT); + } + }, + + + readystatechange: function () { + if (/interactive|complete/.test(document.readyState)) { + var forms, form, i, len; + + // Bind to page's forms + forms = document.getElementsByTagName('form'); + + for (i = 0, len = forms.length; i < len; i++) { + form = forms[i]; + + if (form.cmd && constants.COMMANDS[form.cmd.value]) { + this.bind(form); + } + } + + // Do the initial render when the buttons are ready + this.redraw(); + + // Only run this once + events.remove(document, 'readystatechange', viewevents.readystatechange); + } + }, + + + pageshow: function (evt) { + if (evt.persisted) { + this.redraw(); + this.hide(); + } + } + +}; + +},{"./constants":11,"./util/events":16}]},{},[9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]) +; \ No newline at end of file diff --git a/public/vendors/lib/minicart.min.js b/public/vendors/lib/minicart.min.js deleted file mode 100644 index 0214c0aa..00000000 --- a/public/vendors/lib/minicart.min.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * minicart - * The Mini Cart is a great way to improve your PayPal shopping cart integration. - * - * @version 3.0.6 - * @author Jeff Harrell - * @url http://www.minicartjs.com/ - * @license MIT - */ - -!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf;++f)a.hasOwnProperty(f)&&(e?d=b(d,a[f],f,a):(d=a[f],e=!0));return d},c.substr="b"!=="ab".substr(-1)?function(a,b,c){return 0>b&&(b=a.length+b),a.substr(b,c)}:function(a,b,c){return a.substr(b,c)},c.trim=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},c.bind=function(){var a=Array.prototype.slice.call(arguments),b=a.shift();if(b.bind)return b.bind.apply(b,a);var c=a.shift();return function(){b.apply(c,a.concat([Array.prototype.slice.call(arguments)]))}},c.create="function"==typeof Object.create?Object.create:e;var l="function"==typeof Object.keys?Object.keys:g,m="function"==typeof Object.getOwnPropertyNames?Object.getOwnPropertyNames:h;if((new Error).hasOwnProperty("description")){var n=function(a,b){return"[object Error]"===j.call(a)&&(b=c.filter(b,function(a){return"description"!==a&&"number"!==a&&"message"!==a})),b};c.keys=function(a){return n(a,l(a))},c.getOwnPropertyNames=function(a){return n(a,m(a))}}else c.keys=l,c.getOwnPropertyNames=m;if("function"==typeof Object.getOwnPropertyDescriptor)try{Object.getOwnPropertyDescriptor({a:1},"a"),c.getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor}catch(o){c.getOwnPropertyDescriptor=function(a,b){try{return Object.getOwnPropertyDescriptor(a,b)}catch(c){return i(a,b)}}}else c.getOwnPropertyDescriptor=i},{}],2:[function(){},{}],3:[function(a,b,c){function d(a,b){for(var c=0,d=a.length-1;d>=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var e=a("__browserify_process"),f=a("util"),g=a("_shims"),h=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(a){return h.exec(a).slice(1)};c.resolve=function(){for(var a="",b=!1,c=arguments.length-1;c>=-1&&!b;c--){var h=c>=0?arguments[c]:e.cwd();if(!f.isString(h))throw new TypeError("Arguments to path.resolve must be strings");h&&(a=h+"/"+a,b="/"===h.charAt(0))}return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b=c.isAbsolute(a),e="/"===g.substr(a,-1);return a=d(g.filter(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&e&&(a+="/"),(b?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(g.filter(a,function(a){if(!f.isString(a))throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),o(b)?d.showHidden=b:b&&c._extend(d,b),u(d.showHidden)&&(d.showHidden=!1),u(d.depth)&&(d.depth=2),u(d.colors)&&(d.colors=!1),u(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=e),h(d,a,d.depth)}function e(a,b){var c=d.styles[b];return c?"["+d.colors[c][0]+"m"+a+"["+d.colors[c][1]+"m":a}function f(a){return a}function g(a){var b={};return G.forEach(a,function(a){b[a]=!0}),b}function h(a,b,d){if(a.customInspect&&b&&z(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d);return s(e)||(e=h(a,e,d)),e}var f=i(a,b);if(f)return f;var o=G.keys(b),p=g(o);if(a.showHidden&&(o=G.getOwnPropertyNames(b)),0===o.length){if(z(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(v(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(x(b))return a.stylize(Date.prototype.toString.call(b),"date");if(y(b))return j(b)}var r="",t=!1,u=["{","}"];if(n(b)&&(t=!0,u=["[","]"]),z(b)){var w=b.name?": "+b.name:"";r=" [Function"+w+"]"}if(v(b)&&(r=" "+RegExp.prototype.toString.call(b)),x(b)&&(r=" "+Date.prototype.toUTCString.call(b)),y(b)&&(r=" "+j(b)),0===o.length&&(!t||0==b.length))return u[0]+r+u[1];if(0>d)return v(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var A;return A=t?k(a,b,d,p,o):o.map(function(c){return l(a,b,d,p,c,t)}),a.seen.pop(),m(A,r,u)}function i(a,b){if(u(b))return a.stylize("undefined","undefined");if(s(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return r(b)?a.stylize(""+b,"number"):o(b)?a.stylize(""+b,"boolean"):p(b)?a.stylize("null","null"):void 0}function j(a){return"["+Error.prototype.toString.call(a)+"]"}function k(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)f.push(F(b,String(g))?l(a,b,c,d,String(g),!0):"");return G.forEach(e,function(e){e.match(/^\d+$/)||f.push(l(a,b,c,d,e,!0))}),f}function l(a,b,c,d,e,f){var g,i,j;if(j=G.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?i=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(i=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),i||(G.indexOf(a.seen,j.value)<0?(i=p(c)?h(a,j.value,null):h(a,j.value,c-1),i.indexOf("\n")>-1&&(i=f?i.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+i.split("\n").map(function(a){return" "+a}).join("\n"))):i=a.stylize("[Circular]","special")),u(g)){if(f&&e.match(/^\d+$/))return i;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+i}function m(a,b,c){var d=0,e=G.reduce(a,function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function n(a){return G.isArray(a)}function o(a){return"boolean"==typeof a}function p(a){return null===a}function q(a){return null==a}function r(a){return"number"==typeof a}function s(a){return"string"==typeof a}function t(a){return"symbol"==typeof a}function u(a){return void 0===a}function v(a){return w(a)&&"[object RegExp]"===C(a)}function w(a){return"object"==typeof a&&a}function x(a){return w(a)&&"[object Date]"===C(a)}function y(a){return w(a)&&"[object Error]"===C(a)}function z(a){return"function"==typeof a}function A(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function B(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.binarySlice}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),I[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=a("_shims"),H=/%[sdj%]/g;c.format=function(a){if(!s(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(e[c++]);case"%d":return Number(e[c++]);case"%j":try{return JSON.stringify(e[c++])}catch(b){return"[Circular]"}default:return a}}),h=e[c];f>c;h=e[++c])g+=p(h)||!w(h)?" "+h:" "+d(h);return g},c.inspect=d,d.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=n,c.isBoolean=o,c.isNull=p,c.isNullOrUndefined=q,c.isNumber=r,c.isString=s,c.isSymbol=t,c.isUndefined=u,c.isRegExp=v,c.isObject=w,c.isDate=x,c.isError=y,c.isFunction=z,c.isPrimitive=A,c.isBuffer=B;var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=function(a,b){a.super_=b,a.prototype=G.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},c._extend=function(a,b){if(!b||!w(b))return a;for(var c=G.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}},{_shims:1}],5:[function(a,b){var c=b.exports={};c.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),c.title="browser",c.browser=!0,c.env={},c.argv=[],c.binding=function(){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(){throw new Error("process.chdir is not supported")}},{}],6:[function(a,b,c){function d(a){return a.substr(1).split("|").reduce(function(a,b){var c=b.split(":"),d=c.shift(),e=c.join(":")||"";return e&&(e=", "+e),"filters."+d+"("+a+e+")"})}function e(a,b,c,d){var e=b.split("\n"),f=Math.max(d-3,0),g=Math.min(e.length,d+3),h=e.slice(f,g).map(function(a,b){var c=b+f+1;return(c==d?" >> ":" ")+c+"| "+a}).join("\n");throw a.path=c,a.message=(c||"ejs")+":"+d+"\n"+h+"\n\n"+a.message,a}function f(a,b){var c=k(i(b),a),d=j(a);return d||(c+=".ejs"),c}var g=a("./utils"),h=a("path"),i=h.dirname,j=h.extname,k=h.join,l=a("fs"),m=l.readFileSync,n=c.filters=a("./filters"),o={};c.clearCache=function(){o={}};var p=(c.parse=function(a,b){var b=b||{},e=b.open||c.open||"<%",g=b.close||c.close||"%>",h=b.filename,i=b.compileDebug!==!1,j="";j+="var buf = [];",!1!==b._with&&(j+="\nwith (locals || {}) { (function(){ "),j+="\n buf.push('";for(var k=1,l=!1,n=0,o=a.length;o>n;++n){var p=a[n];if(a.slice(n,e.length+n)==e){n+=e.length;var q,r,s=(i?"__stack.lineno=":"")+k;switch(a[n]){case"=":q="', escape(("+s+", ",r=")), '",++n;break;case"-":q="', ("+s+", ",r="), '",++n;break;default:q="');"+s+";",r="; buf.push('"}var t=a.indexOf(g,n),u=a.substring(n,t),v=n,w=null,x=0;if("-"==u[u.length-1]&&(u=u.substring(0,u.length-2),l=!0),0==u.trim().indexOf("include")){var y=u.trim().slice(7).trim();if(!h)throw new Error("filename option is required for includes");var z=f(y,h);w=m(z,"utf8"),w=c.parse(w,{filename:z,_with:!1,open:e,close:g,compileDebug:i}),j+="' + (function(){"+w+"})() + '",u=""}for(;~(x=u.indexOf("\n",x));)x++,k++;":"==u.substr(0,1)&&(u=d(u)),u&&(u.lastIndexOf("//")>u.lastIndexOf("\n")&&(u+="\n"),j+=q,j+=u,j+=r),n+=t-v+g.length-1}else"\\"==p?j+="\\\\":"'"==p?j+="\\'":"\r"==p||("\n"==p?l?l=!1:(j+="\\n",k++):j+=p)}return j+=!1!==b._with?"'); })();\n} \nreturn buf.join('');":"');\nreturn buf.join('');"},c.compile=function(a,b){b=b||{};var d=b.escape||g.escape,f=JSON.stringify(a),h=b.compileDebug!==!1,i=b.client,j=b.filename?JSON.stringify(b.filename):"undefined";a=h?["var __stack = { lineno: 1, input: "+f+", filename: "+j+" };",e.toString(),"try {",c.parse(a,b),"} catch (err) {"," rethrow(err, __stack.input, __stack.filename, __stack.lineno);","}"].join("\n"):c.parse(a,b),b.debug&&console.log(a),i&&(a="escape = escape || "+d.toString()+";\n"+a);try{var k=new Function("locals, filters, escape, rethrow",a)}catch(l){throw"SyntaxError"==l.name&&(l.message+=b.filename?" in "+j:" while compiling ejs"),l}return i?k:function(a){return k.call(this,a,n,d,e)}});c.render=function(a,b){var c,b=b||{};if(b.cache){if(!b.filename)throw new Error('"cache" option requires "filename".');c=o[b.filename]||(o[b.filename]=p(a,b))}else c=p(a,b);return b.__proto__=b.locals,c.call(b.scope,b)},c.renderFile=function(a,b,d){var e=a+":string";"function"==typeof b&&(d=b,b={}),b.filename=a;var f;try{f=b.cache?o[e]||(o[e]=m(a,"utf8")):m(a,"utf8")}catch(g){return void d(g)}d(null,c.render(f,b))},c.__express=c.renderFile,a.extensions?a.extensions[".ejs"]=function(a,b){b=b||a.filename;var c={filename:b,client:!0},d=l.readFileSync(b).toString(),e=p(d,c);a._compile("module.exports = "+e.toString()+";",b)}:a.registerExtension&&a.registerExtension(".ejs",function(a){return p(a,{})})},{"./filters":7,"./utils":8,fs:2,path:3}],7:[function(a,b,c){c.first=function(a){return a[0]},c.last=function(a){return a[a.length-1]},c.capitalize=function(a){return a=String(a),a[0].toUpperCase()+a.substr(1,a.length)},c.downcase=function(a){return String(a).toLowerCase()},c.upcase=function(a){return String(a).toUpperCase()},c.sort=function(a){return Object.create(a).sort()},c.sort_by=function(a,b){return Object.create(a).sort(function(a,c){return a=a[b],c=c[b],a>c?1:c>a?-1:0})},c.size=c.length=function(a){return a.length},c.plus=function(a,b){return Number(a)+Number(b)},c.minus=function(a,b){return Number(a)-Number(b)},c.times=function(a,b){return Number(a)*Number(b)},c.divided_by=function(a,b){return Number(a)/Number(b)},c.join=function(a,b){return a.join(b||", ")},c.truncate=function(a,b,c){return a=String(a),a.length>b&&(a=a.slice(0,b),c&&(a+=c)),a},c.truncate_words=function(a,b){var a=String(a),c=a.split(/ +/);return c.slice(0,b).join(" ")},c.replace=function(a,b,c){return String(a).replace(b,c||"")},c.prepend=function(a,b){return Array.isArray(a)?[b].concat(a):b+a},c.append=function(a,b){return Array.isArray(a)?a.concat(b):a+b},c.map=function(a,b){return a.map(function(a){return a[b]})},c.reverse=function(a){return Array.isArray(a)?a.reverse():String(a).split("").reverse().join("")},c.get=function(a,b){return a[b]},c.json=function(a){return JSON.stringify(a)}},{}],8:[function(a,b,c){c.escape=function(a){return String(a).replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")}},{}],9:[function(a,b){"use strict";function c(a,b){var c,d,h,i,j;if(this._items=[],this._settings={bn:g.BN},e.call(this),f.call(this,a,b),(c=this.load())&&(d=c.items,h=c.settings,h&&(this._settings=h),d))for(j=0,i=d.length;i>j;j++)this.add(d[j])}var d=a("./product"),e=a("./util/pubsub"),f=a("./util/storage"),g=a("./constants"),h=a("./util/currency"),i=a("./util/mixin");i(c.prototype,e.prototype),i(c.prototype,f.prototype),c.prototype.add=function(a){var b,c,e,f,h=this,i=this.items(),j=!1,k=!1;for(c in a)g.SETTINGS.test(c)&&(this._settings[c]=a[c],delete a[c]);for(f=0,e=i.length;e>f;f++)if(i[f].isEqual(a)){b=i[f],b.set("quantity",b.get("quantity")+(parseInt(a.quantity,10)||1)),j=f,k=!0;break}return b||(b=new d(a),b.isValid()&&(j=this._items.push(b)-1,b.on("change",function(a,b){h.save(),h.fire("change",j,a,b)}),this.save())),b&&this.fire("add",j,b,k),j},c.prototype.items=function(a){return"number"==typeof a?this._items[a]:this._items},c.prototype.settings=function(a){return a?this._settings[a]:this._settings},c.prototype.discount=function(a){var b=parseFloat(this.settings("discount_amount_cart"))||0;return b||(b=(parseFloat(this.settings("discount_rate_cart"))||0)*this.subtotal()/100),a=a||{},a.currency=this.settings("currency_code"),h(b,a)},c.prototype.subtotal=function(a){var b,c,d=this.items(),e=0;for(b=0,c=d.length;c>b;b++)e+=d[b].total();return a=a||{},a.currency=this.settings("currency_code"),h(e,a)},c.prototype.total=function(a){var b=0;return b+=this.subtotal(),b-=this.discount(),a=a||{},a.currency=this.settings("currency_code"),h(b,a)},c.prototype.remove=function(a){var b=this._items.splice(a,1);return 0===this._items.length&&this.destroy(),b&&(this.save(),this.fire("remove",a,b[0])),!!b.length},c.prototype.save=function(){var a,b,c=this.items(),d=this.settings(),e=[];for(a=0,b=c.length;b>a;a++)e.push(c[a].get());f.prototype.save.call(this,{items:e,settings:d})},c.prototype.checkout=function(a){this.fire("checkout",a)},c.prototype.destroy=function(){f.prototype.destroy.call(this),this._items=[],this._settings={bn:g.BN},this.fire("destroy")},b.exports=c},{"./constants":11,"./product":13,"./util/currency":15,"./util/mixin":18,"./util/pubsub":19,"./util/storage":20}],10:[function(a,b){"use strict";var c=a("./util/mixin"),d=b.exports={name:"PPMiniCart",parent:"undefined"!=typeof document?document.body:null,action:"https://www.paypal.com/cgi-bin/webscr",target:"",duration:30,template:'<%var items = cart.items();var settings = cart.settings();var hasItems = !!items.length;var priceFormat = { format: true, currency: cart.settings("currency_code") };var totalFormat = { format: true, showCode: true };%>
    <% for (var i= 0, idx = i + 1, len = items.length; i < len; i++, idx++) { %>
  • "><%= items[i].get("item_name") %>
      <% if (items[i].get("item_number")) { %>
    • <%= items[i].get("item_number") %> " />
    • <% } %> <% if (items[i].discount()) { %>
    • <%= config.strings.discount %> <%= items[i].discount(priceFormat) %>
    • <% } %> <% for (var options = items[i].options(), j = 0, len2 = options.length; j < len2; j++) { %>
    • <%= options[j].key %>: <%= options[j].value %>
    • <% } %>
    " autocomplete="off" />
    <%= items[i].total(priceFormat) %>
    " /> " /> " />
  • <% } %>
<% for (var key in settings) { %> <% } %>
',styles:'@keyframes pop-in { 0% { opacity: 0; transform: scale(0.1); } 60% { opacity: 1; transform: scale(1.2); } 100% { transform: scale(1); }}@-webkit-keyframes pop-in { 0% { opacity: 0; -webkit-transform: scale(0.1); } 60% { opacity: 1; -webkit-transform: scale(1.2); } 100% { -webkit-transform: scale(1); }}@-moz-keyframes pop-in { 0% { opacity: 0; -moz-transform: scale(0.1); } 60% { opacity: 1; -moz-transform: scale(1.2); } 100% { -moz-transform: scale(1); }}.minicart-showing #PPMiniCart { display: block; transform: translateZ(0); -webkit-transform: translateZ(0); -moz-transform: translateZ(0); animation: pop-in 0.25s; -webkit-animation: pop-in 0.25s; -moz-animation: pop-in 0.25s;}#PPMiniCart { display: none; position: fixed; left: 50%; top: 75px;}#PPMiniCart form { position: relative; width: 400px; max-height: 400px; margin-left: -200px; padding: 10px 10px 40px; background: #fbfbfb; border: 1px solid #d7d7d7; border-radius: 4px; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5); font: 15px/normal arial, helvetica; color: #333;}#PPMiniCart form.minicart-empty { padding-bottom: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart ul { clear: both; float: left; width: 380px; margin: 5px 0 20px; padding: 10px; list-style-type: none; background: #fff; border: 1px solid #ccc; border-radius: 4px; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);}#PPMiniCart .minicart-empty ul { display: none;}#PPMiniCart .minicart-closer { float: right; margin: -12px -10px 0; padding: 10px; background: 0; border: 0; font-size: 18px; cursor: pointer; font-weight: bold;}#PPMiniCart .minicart-item { clear: left; padding: 6px 0; min-height: 25px;}#PPMiniCart .minicart-item + .minicart-item { border-top: 1px solid #f2f2f2;}#PPMiniCart .minicart-item a { color: #333; text-decoration: none;}#PPMiniCart .minicart-details-name { float: left; width: 62%;}#PPMiniCart .minicart-details-quantity { float: left; width: 15%;}#PPMiniCart .minicart-details-remove { float: left; width: 7%;}#PPMiniCart .minicart-details-price { float: left; width: 16%; text-align: right;}#PPMiniCart .minicart-attributes { margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: #999; font-size: 12px; line-height: 22px;}#PPMiniCart .minicart-attributes li { display: inline;}#PPMiniCart .minicart-attributes li:after { content: ",";}#PPMiniCart .minicart-attributes li:last-child:after { content: "";}#PPMiniCart .minicart-quantity { width: 30px; height: 18px; padding: 2px 4px; border: 1px solid #ccc; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); font-size: 13px; text-align: right; transition: border linear 0.2s, box-shadow linear 0.2s; -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s;}#PPMiniCart .minicart-quantity:hover { border-color: #0078C1;}#PPMiniCart .minicart-quantity:focus { border-color: #0078C1; outline: 0; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 3px rgba(0, 120, 193, 0.4);}#PPMiniCart .minicart-remove { width: 18px; height: 19px; margin: 2px 0 0; padding: 0; background: #b7b7b7; border: 1px solid #a3a3a3; border-radius: 3px; color: #fff; font-size: 13px; opacity: 0.70; cursor: pointer;}#PPMiniCart .minicart-remove:hover { opacity: 1;}#PPMiniCart .minicart-footer { clear: left;}#PPMiniCart .minicart-subtotal { position: absolute; bottom: 17px; padding-left: 6px; left: 10px; font-size: 16px; font-weight: bold;}#PPMiniCart .minicart-submit { position: absolute; bottom: 10px; right: 10px; min-width: 153px; height: 33px; margin-right: 6px; padding: 0 9px; border: 1px solid #ffc727; border-radius: 5px; color: #000; text-shadow: 1px 1px 1px #fff6e9; cursor: pointer; background: #ffaa00; background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZjZlOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmFhMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: -moz-linear-gradient(top, #fff6e9 0%, #ffaa00 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fff6e9), color-stop(100%,#ffaa00)); background: -webkit-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -o-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: -ms-linear-gradient(top, #fff6e9 0%,#ffaa00 100%); background: linear-gradient(to bottom, #fff6e9 0%,#ffaa00 100%);}#PPMiniCart .minicart-submit img { vertical-align: middle; padding: 4px 0 0 2px;}',strings:{button:'Check Out with PayPal',subtotal:"Subtotal:",discount:"Discount:",empty:"Your shopping cart is empty"}};b.exports.load=function(a){return c(d,a)}},{"./util/mixin":18}],11:[function(a,b){"use strict";b.exports={COMMANDS:{_cart:!0,_xclick:!0,_donations:!0},SETTINGS:/^(?:business|currency_code|lc|paymentaction|no_shipping|cn|no_note|invoice|handling_cart|weight_cart|weight_unit|tax_cart|discount_amount_cart|discount_rate_cart|page_style|image_url|cpp_|cs|cbt|return|cancel_return|notify_url|rm|custom|charset)/,BN:"MiniCart_AddToCart_WPS_US",KEYUP_TIMEOUT:500,SHOWING_CLASS:"minicart-showing",REMOVE_CLASS:"minicart-remove",CLOSER_CLASS:"minicart-closer",QUANTITY_CLASS:"minicart-quantity",ITEM_CLASS:"minicart-item",ITEM_CHANGED_CLASS:"minicart-item-changed",SUBMIT_CLASS:"minicart-submit",DATA_IDX:"data-minicart-idx"}},{}],12:[function(a,b){"use strict";var c,d,e,f=a("./cart"),g=a("./view"),h=a("./config"),i={};i.render=function(a){d=i.config=h.load(a),c=i.cart=new f(d.name,d.duration),e=i.view=new g({config:d,cart:c}),c.on("add",e.addItem,e),c.on("change",e.changeItem,e),c.on("remove",e.removeItem,e),c.on("destroy",e.hide,e)},i.reset=function(){c.destroy(),e.hide(),e.redraw()},"undefined"==typeof window?b.exports=i:(window.paypal||(window.paypal={}),window.paypal.minicart=i)},{"./cart":9,"./config":10,"./view":22}],13:[function(a,b){"use strict";function c(a){a.quantity=g.quantity(a.quantity),a.amount=g.amount(a.amount),a.href=g.href(a.href),this._data=a,this._options=null,this._discount=null,this._amount=null,this._total=null,e.call(this)}var d=a("./util/currency"),e=a("./util/pubsub"),f=a("./util/mixin"),g={quantity:function(a){return a=parseInt(a,10),(isNaN(a)||!a)&&(a=1),a},amount:function(a){return parseFloat(a)||0},href:function(a){return a?a:"undefined"!=typeof window?window.location.href:null}};f(c.prototype,e.prototype),c.prototype.get=function(a){return a?this._data[a]:this._data},c.prototype.set=function(a,b){var c=g[a];this._data[a]=c?c(b):b,this._options=null,this._discount=null,this._amount=null,this._total=null,this.fire("change",a)},c.prototype.options=function(){var a,b,c,d,e,f;if(!this._options){for(a=[],e=0;b=this.get("on"+e);){for(c=this.get("os"+e),d=0,f=0;"undefined"!=typeof this.get("option_select"+f);){if(this.get("option_select"+f)===c){d=g.amount(this.get("option_amount"+f));break}f++}a.push({key:b,value:c,amount:d}),e++}this._options=a}return this._options},c.prototype.discount=function(a){var b,c,e,f,h,i;return this._discount||(h=0,e=parseInt(this.get("discount_num"),10)||0,f=Math.max(e,this.get("quantity")-1),void 0!==this.get("discount_amount")?(b=g.amount(this.get("discount_amount")),h+=b,h+=g.amount(this.get("discount_amount2")||b)*f):void 0!==this.get("discount_rate")&&(c=g.amount(this.get("discount_rate")),i=this.amount(),h+=c*i/100,h+=g.amount(this.get("discount_rate2")||c)*i*f/100),this._discount=h),d(this._discount,a)},c.prototype.amount=function(a){var b,c,e,f;if(!this._amount){for(b=this.get("amount"),c=this.options(),f=0,e=c.length;e>f;f++)b+=c[f].amount;this._amount=b}return d(this._amount,a)},c.prototype.total=function(a){var b;return this._total||(b=this.get("quantity")*this.amount(),b-=this.discount(),this._total=g.amount(b)),d(this._total,a)},c.prototype.isEqual=function(a){var b=!1;if(a instanceof c&&(a=a._data),this.get("item_name")===a.item_name&&this.get("item_number")===a.item_number&&this.get("amount")===g.amount(a.amount)){var d=0;for(b=!0;"undefined"!=typeof a["os"+d];){if(this.get("os"+d)!==a["os"+d]){b=!1;break}d++}}return b},c.prototype.isValid=function(){return this.get("item_name")&&this.amount()>0},c.prototype.destroy=function(){this._data=[],this.fire("destroy",this)},b.exports=c},{"./util/currency":15,"./util/mixin":18,"./util/pubsub":19}],14:[function(a,b){"use strict";b.exports.add=function(a,b){var c;return a?void(a&&a.classList&&a.classList.add?a.classList.add(b):(c=new RegExp("\\b"+b+"\\b"),c.test(a.className)||(a.className+=" "+b))):!1},b.exports.remove=function(a,b){var c;return a?void(a.classList&&a.classList.add?a.classList.remove(b):(c=new RegExp("\\b"+b+"\\b"),c.test(a.className)&&(a.className=a.className.replace(c,"")))):!1},b.exports.inject=function(a,b){var c; -return a?void(b&&(c=document.createElement("style"),c.type="text/css",c.styleSheet?c.styleSheet.cssText=b:c.appendChild(document.createTextNode(b)),a.appendChild(c))):!1}},{}],15:[function(a,b){"use strict";var c={AED:{before:"ج"},ANG:{before:"ƒ"},ARS:{before:"$",code:!0},AUD:{before:"$",code:!0},AWG:{before:"ƒ"},BBD:{before:"$",code:!0},BGN:{before:"лв"},BMD:{before:"$",code:!0},BND:{before:"$",code:!0},BRL:{before:"R$"},BSD:{before:"$",code:!0},CAD:{before:"$",code:!0},CHF:{before:"",code:!0},CLP:{before:"$",code:!0},CNY:{before:"¥"},COP:{before:"$",code:!0},CRC:{before:"₡"},CZK:{before:"Kc"},DKK:{before:"kr"},DOP:{before:"$",code:!0},EEK:{before:"kr"},EUR:{before:"€"},GBP:{before:"£"},GTQ:{before:"Q"},HKD:{before:"$",code:!0},HRK:{before:"kn"},HUF:{before:"Ft"},IDR:{before:"Rp"},ILS:{before:"₪"},INR:{before:"Rs."},ISK:{before:"kr"},JMD:{before:"J$"},JPY:{before:"¥"},KRW:{before:"₩"},KYD:{before:"$",code:!0},LTL:{before:"Lt"},LVL:{before:"Ls"},MXN:{before:"$",code:!0},MYR:{before:"RM"},NOK:{before:"kr"},NZD:{before:"$",code:!0},PEN:{before:"S/"},PHP:{before:"Php"},PLN:{before:"z"},QAR:{before:"﷼"},RON:{before:"lei"},RUB:{before:"руб"},SAR:{before:"﷼"},SEK:{before:"kr"},SGD:{before:"$",code:!0},THB:{before:"฿"},TRY:{before:"TL"},TTD:{before:"TT$"},TWD:{before:"NT$"},UAH:{before:"₴"},USD:{before:"$",code:!0},UYU:{before:"$U"},VEF:{before:"Bs"},VND:{before:"₫"},XCD:{before:"$",code:!0},ZAR:{before:"R"}};b.exports=function(a,b){var d=b&&b.currency||"USD",e=c[d],f=e.before||"",g=e.after||"",h=e.length||2,i=e.code&&b&&b.showCode,j=a;return b&&b.format&&(j=f+j.toFixed(h)+g),i&&(j+=" "+d),j}},{}],16:[function(a,b){"use strict";b.exports=function(a,b){var c=[];return b?b.addEventListener?{add:function(a,b,d,e){e=e||a;var f=function(a){d.call(e,a)};a.addEventListener(b,f,!1),c.push([a,b,d,f])},remove:function(a,b,d){var e,f,g,h=c.length;for(g=0;h>g;g++)if(f=c[g],f[0]===a&&f[1]===b&&f[2]===d&&(e=f[3]))return a.removeEventListener(b,e,!1),c=c.slice(g),!0}}:b.attachEvent?{add:function(b,d,e,f){f=f||b;var g=function(){var b=a.event;b.target=b.target||b.srcElement,b.preventDefault=function(){b.returnValue=!1},e.call(f,b)};b.attachEvent("on"+d,g),c.push([b,d,e,g])},remove:function(a,b,d){var e,f,g,h=c.length;for(g=0;h>g;g++)if(f=c[g],f[0]===a&&f[1]===b&&f[2]===d&&(e=f[3]))return a.detachEvent("on"+b,e),c=c.slice(g),!0}}:void 0:{add:function(){},remove:function(){}}}("undefined"==typeof window?null:window,"undefined"==typeof document?null:document)},{}],17:[function(a,b){"use strict";var c=b.exports={parse:function(a){var b,d,e,f,g=a.elements,h={};for(e=0,f=g.length;f>e;e++)b=g[e],(d=c.getInputValue(b))&&(h[b.name]=d);return h},getInputValue:function(a){var b=a.tagName.toLowerCase();return"select"===b?a.options[a.selectedIndex].value:"textarea"===b?a.innerText:"radio"===a.type?a.checked?a.value:null:"checkbox"===a.type?a.checked?a.value:null:a.value}}},{}],18:[function(a,b){"use strict";b.exports=function c(a,b){var d;for(var e in b)d=b[e],d&&d.constructor===Object&&a[e]?c(a[e]||{},d):a[e]=d;return a}},{}],19:[function(a,b){"use strict";function c(){this._eventCache={}}c.prototype.on=function(a,b,c){var d=this._eventCache[a];d||(d=this._eventCache[a]=[]),d.push([b,c])},c.prototype.off=function(a,b){var c,d,e=this._eventCache[a];if(e)for(c=0,d=e.length;d>c;c++)e[c]===b&&(e=e.splice(c,1))},c.prototype.fire=function(a){var b,c,d,e,f=this._eventCache[a];if(f)for(b=0,c=f.length;c>b;b++)d=f[b][0],e=f[b][1]||this,"function"==typeof d&&d.apply(e,Array.prototype.slice.call(arguments,1))},b.exports=c},{}],20:[function(a,b){"use strict";var c=b.exports=function(a,b){this._name=a,this._duration=b||30},d=c.prototype;d.load=function(){if("object"==typeof window&&window.localStorage){var a,b,c=window.localStorage.getItem(this._name);return c&&(c=JSON.parse(decodeURIComponent(c))),c&&c.expires&&(a=new Date,b=new Date(c.expires),a>b)?void this.destroy():c&&c.value}},d.save=function(a){if("object"==typeof window&&window.localStorage){var b,c=new Date;c.setTime(c.getTime()+24*this._duration*60*60*1e3),b={value:a,expires:c.toGMTString()},window.localStorage.setItem(this._name,encodeURIComponent(JSON.stringify(b)))}},d.destroy=function(){"object"==typeof window&&window.localStorage&&window.localStorage.removeItem(this._name)}},{}],21:[function(a,b){"use strict";var c=a("ejs");b.exports=function(a,b){return c.render(a,b)},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")})},{ejs:6}],22:[function(a,b){"use strict";function c(a){var b;this.el=b=document.createElement("div"),this.model=a,this.isShowing=!1,b.id=d.name,d.parent.appendChild(b),h.inject(document.getElementsByTagName("head")[0],d.styles),e.add(document,"ontouchstart"in window?"touchstart":"click",i.click,this),e.add(document,"keyup",i.keyup,this),e.add(document,"readystatechange",i.readystatechange,this),e.add(window,"pageshow",i.pageshow,this)}var d=a("./config"),e=a("./util/events"),f=a("./util/template"),g=a("./util/forms"),h=a("./util/css"),i=a("./viewevents"),j=a("./constants");c.prototype.redraw=function(){e.remove(this.el.querySelector("form"),"submit",this.model.cart.checkout,this.model.cart),this.el.innerHTML=f(d.template,this.model),e.add(this.el.querySelector("form"),"submit",this.model.cart.checkout,this.model.cart)},c.prototype.show=function(){this.isShowing||(h.add(document.body,j.SHOWING_CLASS),this.isShowing=!0)},c.prototype.hide=function(){this.isShowing&&(h.remove(document.body,j.SHOWING_CLASS),this.isShowing=!1)},c.prototype.toggle=function(){this[this.isShowing?"hide":"show"]()},c.prototype.bind=function(a){var b=this;return j.COMMANDS[a.cmd.value]?a.hasMinicart?!1:(a.hasMinicart=!0,a.display?e.add(a,"submit",function(a){a.preventDefault(),b.show()}):e.add(a,"submit",function(c){c.preventDefault(c),b.model.cart.add(g.parse(a))}),!0):!1},c.prototype.addItem=function(a){this.redraw(),this.show();var b=this.el.querySelectorAll("."+j.ITEM_CLASS);h.add(b[a],j.ITEM_CHANGED_CLASS)},c.prototype.changeItem=function(a){this.redraw(),this.show();var b=this.el.querySelectorAll("."+j.ITEM_CLASS);h.add(b[a],j.ITEM_CHANGED_CLASS)},c.prototype.removeItem=function(){this.redraw()},b.exports=c},{"./config":10,"./constants":11,"./util/css":14,"./util/events":16,"./util/forms":17,"./util/template":21,"./viewevents":23}],23:[function(a,b){"use strict";var c,d=a("./constants"),e=a("./util/events");b.exports=c={click:function(a){var b=a.target,c=b.className;if(this.isShowing)if(c===d.CLOSER_CLASS)this.hide();else if(c===d.REMOVE_CLASS)this.model.cart.remove(b.getAttribute(d.DATA_IDX));else if(c===d.QUANTITY_CLASS)b[b.setSelectionRange?"setSelectionRange":"select"](0,999);else if(!/input|button|select|option/i.test(b.tagName)){for(;1===b.nodeType;){if(b===this.el)return;b=b.parentNode}this.hide()}},keyup:function(a){var b,c=this,e=a.target;e.className===d.QUANTITY_CLASS&&(b=setTimeout(function(){var a=parseInt(e.getAttribute(d.DATA_IDX),10),b=c.model.cart,f=b.items(a),g=parseInt(e.value,10);f&&(g>0?f.set("quantity",g):0===g&&b.remove(a))},d.KEYUP_TIMEOUT))},readystatechange:function(){if(/interactive|complete/.test(document.readyState)){var a,b,f,g;for(a=document.getElementsByTagName("form"),f=0,g=a.length;g>f;f++)b=a[f],b.cmd&&d.COMMANDS[b.cmd.value]&&this.bind(b);this.redraw(),e.remove(document,"readystatechange",c.readystatechange)}},pageshow:function(a){a.persisted&&(this.redraw(),this.hide())}}},{"./constants":11,"./util/events":16}]},{},[9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]); \ No newline at end of file