| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + /*! | ||
| 2 | + * <%= pkg.name %> | ||
| 3 | + * <%= pkg.description %> | ||
| 4 | + * | ||
| 5 | + * @version <%= pkg.version %> | ||
| 6 | + * @url <%= pkg.homepage %> | ||
| 7 | + * @license <%= pkg.licenses[0].type %> <<%= pkg.licenses[0].url %>> | ||
| 8 | + */ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | root = true | |
| 3 | 3 | ||
| 4 | 4 | [*] | |
| 5 | - indent_style = tab | ||
| 5 | + indent_style = spaces | ||
| 6 | 6 | indent_size = 4 | |
| 7 | 7 | end_of_line = lf | |
| 8 | 8 | charset = utf-8 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,14 +14,26 @@ | |||
| 14 | 14 | "mootools": false, | |
| 15 | 15 | "dojo": false, | |
| 16 | 16 | ||
| 17 | - "predef": [], | ||
| 17 | + "predef": [ | ||
| 18 | + "describe", | ||
| 19 | + "it", | ||
| 20 | + "before", | ||
| 21 | + "beforeEach", | ||
| 22 | + "after", | ||
| 23 | + "afterEach" | ||
| 24 | + ], | ||
| 18 | 25 | ||
| 19 | 26 | "debug": false, | |
| 20 | 27 | "devel": false, | |
| 21 | 28 | ||
| 22 | 29 | "strict": true, | |
| 23 | 30 | "globalstrict": false, | |
| 24 | 31 | ||
| 32 | + "globals": { | ||
| 33 | + "$TEMPLATES$": true, | ||
| 34 | + "$STRINGS$": true | ||
| 35 | + }, | ||
| 36 | + | ||
| 25 | 37 | "asi": false, | |
| 26 | 38 | "laxbreak": false, | |
| 27 | 39 | "bitwise": false, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,61 +1,25 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + | ||
| 1 | 4 | module.exports = function (grunt) { | |
| 2 | 5 | ||
| 3 | - 'use strict'; | ||
| 4 | - | ||
| 5 | - // Project configuration. | ||
| 6 | - grunt.initConfig({ | ||
| 7 | - | ||
| 8 | - pkg: grunt.file.readJSON('package.json'), | ||
| 9 | - | ||
| 10 | - meta: { | ||
| 11 | - banner: '/*!\n * <%= pkg.name %>\n * <%= pkg.description %>\n * @version <%= pkg.version %> - <%= grunt.template.today(\'yyyy-mm-dd\') %>\n * @author <%= pkg.author.name %> <<%= pkg.author.url %>>\n */\n' | ||
| 12 | - }, | ||
| 13 | - | ||
| 14 | - jshint: { | ||
| 15 | - all: { | ||
| 16 | - src: ['src/*.js', 'test/spec/*.js'], | ||
| 17 | - options: { | ||
| 18 | - jshintrc: '.jshintrc' | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - }, | ||
| 22 | - | ||
| 23 | - uglify: { | ||
| 24 | - dist: { | ||
| 25 | - src: ['<%= meta.banner %>', 'src/paypal-button.js'], | ||
| 26 | - dest: 'dist/paypal-button.min.js', | ||
| 27 | - options: { | ||
| 28 | - banner: '<%= meta.banner %>' | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | - }, | ||
| 32 | - | ||
| 33 | - mochaTest: { | ||
| 34 | - all: { | ||
| 35 | - options: { | ||
| 36 | - reporter: 'spec' | ||
| 37 | - }, | ||
| 38 | - src: ['test/spec/*.js'] | ||
| 39 | - } | ||
| 40 | - }, | ||
| 41 | - watch: { | ||
| 42 | - scripts: { | ||
| 43 | - files: ['src/**/*.js'], | ||
| 44 | - tasks: ['build'], | ||
| 45 | - options: { | ||
| 46 | - spawn: false | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - }); | ||
| 51 | - | ||
| 52 | - // Load grunt tasks from npm packages | ||
| 53 | - grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
| 54 | - grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
| 55 | - grunt.loadNpmTasks('grunt-contrib-watch'); | ||
| 56 | - grunt.loadNpmTasks('grunt-mocha-test'); | ||
| 57 | - | ||
| 58 | - grunt.registerTask('build', ['jshint', 'uglify']); | ||
| 59 | - grunt.registerTask('test', ['jshint', 'mochaTest']); | ||
| 6 | + | ||
| 7 | + // load all grunt tasks matching the `grunt-*` pattern | ||
| 8 | + require('load-grunt-config')(grunt, { | ||
| 9 | + configPath: require('path').resolve('tasks') | ||
| 10 | + }); | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + // Aliases for ease of use. | ||
| 14 | + grunt.registerTask('lint', ['jshint', 'eslint']); | ||
| 15 | + grunt.registerTask('coverage', ['mocha_istanbul']); | ||
| 16 | + grunt.registerTask('mocha', ['mochaTest']); | ||
| 17 | + grunt.registerTask('themify', ['templates', 'css', 'images', 'content']); | ||
| 18 | + grunt.registerTask('test', ['lint', 'build', 'coverage']); | ||
| 19 | + grunt.registerTask('develop', ['browserify', 'themify']); | ||
| 20 | + grunt.registerTask('build', ['browserify', 'themify', 'uglify', 'usebanner']); | ||
| 21 | + | ||
| 60 | 22 | ||
| 61 | 23 | }; | |
| 24 | + | ||
| 25 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,34 +106,23 @@ All of PayPal's [HTML button variables](https://developer.paypal.com/webapps/dev | |||
| 106 | 106 | * `data-style` The style of the button. Can be set to `primary` (default) and `secondary`. | |
| 107 | 107 | * `data-locale` The desired locale of the PayPal site. | |
| 108 | 108 | * `data-callback` The IPN notify URL to be called on completion of the transaction. | |
| 109 | - * `data-env` The PayPal environment to checkout in, e.g. `sandbox` (defaults to 'www'). | ||
| 109 | + * `data-host` The PayPal host to checkout in, e.g. `www.sandbox.paypal.com` (defaults to 'www.paypal.com'). | ||
| 110 | 110 | * `data-type` The type of button to render. `button` for a plain button (default), `form` to create a button with a PayPal Payments Standard HTML form, or `qr` to create a PayPal Payments Standard compatible QR code. | |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | - ### Editable fields | ||
| 114 | - Creating editable fields is easy! Just add `-editable` to the name of your variable, e.g. `data-quantity-editable`, and an input field will magically appear for your users. | ||
| 113 | + ### Editable inputs | ||
| 114 | + Creating editable inputs is easy. Just add `-editable` to the name of your variable, e.g. `data-quantity-editable`, and an input field will magically appear for your users. | ||
| 115 | 115 | ||
| 116 | 116 | ||
| 117 | - ### Custom fields | ||
| 118 | - You can also add custom text fields and dropdowns to your form. | ||
| 117 | + ### Options fields | ||
| 118 | + Allow the user to choose from multiple options with the following sytax: | ||
| 119 | 119 | ||
| 120 | - | ||
| 121 | - For a text field: | ||
| 122 | - ```javascript | ||
| 123 | - data-option0name="Coupon Number" | ||
| 124 | 120 | ``` | |
| 125 | - | ||
| 126 | - For a dropdown: | ||
| 127 | - ```javascript | ||
| 128 | - data-option0name="Size" | ||
| 129 | - data-option0select0="Small" | ||
| 130 | - data-option0select1="Medium" | ||
| 131 | - data-option0select2="Large" | ||
| 132 | - data-option0price0="8.00" | ||
| 133 | - data-option0price1="10.00" | ||
| 134 | - data-option0price2="12.00" | ||
| 121 | + data-option0="Color=Blue:8.00,Green:12.00,Red:10.00" | ||
| 122 | + data-option1="Size=Small,Medium,Large" | ||
| 135 | 123 | ``` | |
| 136 | 124 | ||
| 125 | + | ||
| 137 | 126 | ### Callback notification | |
| 138 | 127 | On completion of a transaction you can get a payment notification ([IPN](https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/)) on a callback URL you specify using the `data-callback` attribute. An [IPN simulator](https://developer.paypal.com/webapps/developer/applications/ipn_simulator) is available on the sandbox. | |
| 139 | 128 | ||
@@ -142,22 +131,22 @@ On completion of a transaction you can get a payment notification ([IPN](https:/ | |||
| 142 | 131 | ||
| 143 | 132 | ### Localization | |
| 144 | 133 | * Changing the default language of a button can be done by setting the variable `data-lc` with the correct locale code, e.g. es_ES. | |
| 145 | - * Changing the default input labels of editable buttons can be done by overriding the default configuration, e.g. PAYPAL.apps.ButtonFactory.config.labels. | ||
| 134 | + * Changing the default input labels of editable buttons can be done by overriding the default configuration, e.g. `paypal.button.config.labels`. | ||
| 146 | 135 | ||
| 147 | 136 | ||
| 148 | 137 | ### JavaScript API | |
| 149 | 138 | There's even a fancy JavaScript API if you'd like to pragmatically create your buttons. | |
| 150 | 139 | ||
| 151 | - **PAYPAL.apps.ButtonFactory.config** | ||
| 152 | - This can be overridden to change the default behavior of the buttons. | ||
| 153 | - | ||
| 154 | - **PAYPAL.apps.ButtonFactory.create(business, data, type, parentNode)** | ||
| 140 | + **paypal.button.create(business, data, config, parentNode)** | ||
| 155 | 141 | Creates and returns an HTML element that contains the button code. | |
| 156 | 142 | > **business** - A string containing either the business ID or the business email | |
| 157 | 143 | > **data** - A JavaScript object containing the button variables | |
| 158 | - > **type** - The button type, e.g. "buynow", "cart", "qr" | ||
| 144 | + > **config** - A configuration object for the button. Possible settings are `button`, `type`, `style`, `size`, and `host` | ||
| 159 | 145 | > **parentNode** - An HTML element to add the newly created button to (Optional) | |
| 160 | 146 | ||
| 147 | + **paypal.button.process(node)** | ||
| 148 | + Parses `node` and automatically runs `paypal.button.create` on any `<script>` element it finds matching the right criteria. This is called automatically on `document.body`. | ||
| 149 | + | ||
| 161 | 150 | ||
| 162 | 151 | ## Browser support | |
| 163 | 152 | The JavaScript buttons have been tested and work in all modern browsers including: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,136 @@ | |||
| 1 | + { | ||
| 2 | + "env": { | ||
| 3 | + "browser": true, | ||
| 4 | + "node": true, | ||
| 5 | + "amd": true, | ||
| 6 | + "mocha": true | ||
| 7 | + }, | ||
| 8 | + | ||
| 9 | + "rules": { | ||
| 10 | + "no-cond-assign": 2, | ||
| 11 | + "no-console": 0, | ||
| 12 | + "no-constant-condition": 2, | ||
| 13 | + "no-comma-dangle": 2, | ||
| 14 | + "no-control-regex": 2, | ||
| 15 | + "no-debugger": 2, | ||
| 16 | + "no-dupe-keys": 2, | ||
| 17 | + "no-empty": 2, | ||
| 18 | + "no-empty-class": 2, | ||
| 19 | + "no-ex-assign": 2, | ||
| 20 | + "no-extra-boolean-cast": 2, | ||
| 21 | + "no-extra-parens": 0, | ||
| 22 | + "no-extra-semi": 2, | ||
| 23 | + "no-func-assign": 2, | ||
| 24 | + "no-inner-declarations": [2, "functions"], | ||
| 25 | + "no-invalid-regexp": 2, | ||
| 26 | + "no-negated-in-lhs": 2, | ||
| 27 | + "no-obj-calls": 2, | ||
| 28 | + "no-regex-spaces": 2, | ||
| 29 | + "no-sparse-arrays": 2, | ||
| 30 | + "no-unreachable": 2, | ||
| 31 | + "use-isnan": 2, | ||
| 32 | + "valid-jsdoc": 0, | ||
| 33 | + "valid-typeof": 2, | ||
| 34 | + | ||
| 35 | + "block-scoped-var": 0, | ||
| 36 | + "complexity": [0, 11], | ||
| 37 | + "consistent-return": 2, | ||
| 38 | + "curly": [2, "all"], | ||
| 39 | + "default-case": 2, | ||
| 40 | + "dot-notation": 2, | ||
| 41 | + "eqeqeq": 2, | ||
| 42 | + "guard-for-in": 2, | ||
| 43 | + "no-alert": 2, | ||
| 44 | + "no-caller": 2, | ||
| 45 | + "no-div-regex": 2, | ||
| 46 | + "no-else-return": 2, | ||
| 47 | + "no-empty-label": 2, | ||
| 48 | + "no-eq-null": 2, | ||
| 49 | + "no-eval": 2, | ||
| 50 | + "no-extend-native": 0, | ||
| 51 | + "no-fallthrough": 2, | ||
| 52 | + "no-floating-decimal": 2, | ||
| 53 | + "no-implied-eval": 2, | ||
| 54 | + "no-labels": 2, | ||
| 55 | + "no-iterator": 2, | ||
| 56 | + "no-lone-blocks": 2, | ||
| 57 | + "no-loop-func": 2, | ||
| 58 | + "no-multi-str": 2, | ||
| 59 | + "no-native-reassign": 2, | ||
| 60 | + "no-new": 2, | ||
| 61 | + "no-new-func": 2, | ||
| 62 | + "no-new-wrappers": 2, | ||
| 63 | + "no-octal": 2, | ||
| 64 | + "no-octal-escape": 2, | ||
| 65 | + "no-proto": 2, | ||
| 66 | + "no-redeclare": 2, | ||
| 67 | + "no-return-assign": 2, | ||
| 68 | + "no-script-url": 2, | ||
| 69 | + "no-self-compare": 2, | ||
| 70 | + "no-sequences": 2, | ||
| 71 | + "no-unused-expressions": 2, | ||
| 72 | + "no-warning-comments": 0, | ||
| 73 | + "no-with": 2, | ||
| 74 | + "no-yoda": 2, | ||
| 75 | + "radix": 2, | ||
| 76 | + "wrap-iife": [2, "inside"], | ||
| 77 | + | ||
| 78 | + "no-global-strict": 0, | ||
| 79 | + "no-extra-strict": 2, | ||
| 80 | + "strict": 2, | ||
| 81 | + | ||
| 82 | + "no-catch-shadow": 2, | ||
| 83 | + "no-delete-var": 2, | ||
| 84 | + "no-label-var": 2, | ||
| 85 | + "no-shadow": 2, | ||
| 86 | + "no-shadow-restricted-names": 2, | ||
| 87 | + "no-undef": 2, | ||
| 88 | + "no-undef-init": 2, | ||
| 89 | + "no-unused-vars": [2, {"vars": "all", "args": "after-used"}], | ||
| 90 | + "no-use-before-define": 2, | ||
| 91 | + | ||
| 92 | + "handle-callback-err": 0, | ||
| 93 | + "no-mixed-requires": 0, | ||
| 94 | + "no-new-require": 2, | ||
| 95 | + "no-path-concat": 2, | ||
| 96 | + "no-process-exit": 2, | ||
| 97 | + "no-restricted-modules": 2, | ||
| 98 | + "no-sync": 2, | ||
| 99 | + | ||
| 100 | + "brace-style": [2, "1tbs"], | ||
| 101 | + "camelcase": 0, | ||
| 102 | + "consistent-this": [2, "self"], | ||
| 103 | + "func-names": 0, | ||
| 104 | + "func-style": [0, "declaration"], | ||
| 105 | + "new-cap": 2, | ||
| 106 | + "new-parens": 2, | ||
| 107 | + "no-nested-ternary": 2, | ||
| 108 | + "no-array-constructor": 2, | ||
| 109 | + "no-lonely-if": 2, | ||
| 110 | + "no-new-object": 2, | ||
| 111 | + "no-spaced-func": 2, | ||
| 112 | + "no-space-before-semi": 2, | ||
| 113 | + "no-ternary": 0, | ||
| 114 | + "no-underscore-dangle": 0, | ||
| 115 | + "no-wrap-func": 2, | ||
| 116 | + "quotes": [2, "single"], | ||
| 117 | + "quote-props": 0, | ||
| 118 | + "semi": 2, | ||
| 119 | + "sort-vars": 0, | ||
| 120 | + "space-after-keywords": 2, | ||
| 121 | + "space-in-brackets": [0, "never"], | ||
| 122 | + "space-infix-ops": 2, | ||
| 123 | + "space-return-throw-case": 2, | ||
| 124 | + "space-unary-word-ops": 2, | ||
| 125 | + "max-nested-callbacks": [0, 2], | ||
| 126 | + "one-var": 0, | ||
| 127 | + "wrap-regex": 2, | ||
| 128 | + | ||
| 129 | + "max-depth": [0, 4], | ||
| 130 | + "max-len": [0, 80, 4], | ||
| 131 | + "max-params": [0, 3], | ||
| 132 | + "max-statements": [0, 10], | ||
| 133 | + "no-bitwise": 2, | ||
| 134 | + "no-plusplus": 0 | ||
| 135 | + } | ||
| 136 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + buynow=Buy with {wordmark} | ||
| 2 | + cart=Add to Cart | ||
| 3 | + donate=Donate | ||
| 4 | + subscribe=Subscribe | ||
| 5 | + paynow=Pay Now | ||
| 6 | + item_name=Item | ||
| 7 | + number=Number | ||
| 8 | + amount=Amount | ||
| 9 | + quantity=Quantity | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + buynow=Acheter | ||
| 2 | + cart=Ajouter au panier | ||
| 3 | + donate=Faire un don | ||
| 4 | + subscribe=Souscrire | ||
| 5 | + paynow=Payer maintenant | ||
| 6 | + item_name=Objet | ||
| 7 | + number=Numéro | ||
| 8 | + amount=Montant | ||
| 9 | + quantity=Quantité | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments