Comments (42)
π
I was thinking I'd like to use this with React.js and would love to have a component I could use.
from card.
Yeah, I think it could definitely be done. Really, the primary obstacle is that I rely on stripe/jquery.payment for a bunch of the formatting and card data stuff. That relies on jQuery...etc.
π to React. I use React at work and love it. Thought about building Card with it, but figured that was too big a dependency.
from card.
+1 to no jq deps!
AngularJS would rock this well.
from card.
I'm definitely trying to implement that on my angularjs mobile app.
from card.
You are serious guys ? Remove jQuery to rely on AngularJS for such a "tiny" thing ?
from card.
with jquery, we're already loading up a minimum of 80kb to do such a 'tiny'
thing. angular costs 100kb. vanilla javascript would be best for those that
haven't learned why angular is probably the best thing out atm :P
On Fri, Jun 6, 2014 at 5:24 AM, Maxime Thirouin [email protected]
wrote:
You are serious guys ? Remove jQuery to rely on AngularJS for such a
"tiny" things ?β
Reply to this email directly or view it on GitHub
#23 (comment).
from card.
Angular is clearly not the answer to everything, like jQuery isn't. So don't try to remove a dep by adding a bigger dep, it's just stupid. Or open another issue.
The goal of this issue is to provide the feature of this package with the less dependencies possible.
from card.
I think it would be cool to have the core of this code as vanilla JS and CSS that can be plugged in to a jQuery plugin, React component, Angular directive, etc. With that said, since the plugin is only ~200 lines of code, it's hard to abstract away the core functionality.
from card.
actually, angular can recreate the universe if you leverage your services
and controllers right so it might just be the answer to everything, as long
as your directives are conscious.. heheh but ya, like i mentioned vanilla
javascript is good too.
On Fri, Jun 6, 2014 at 9:22 AM, Maxime Thirouin [email protected]
wrote:
Angular is clearly not the answer to everything, like jQuery isn't. So
don't try to remove a dep by adding a bigger dep, it's just stupid. Or open
another issue.
The goal of this issue is to provide the feature of this package with the
less dependencies possible.β
Reply to this email directly or view it on GitHub
#23 (comment).
from card.
We could also use php & imagemagik to achieve this, but I'm not sure it's relevant.
from card.
ng-Card plzzzzzzzzzzzzzzzz
Hell no, please do a standalone one, and wrap it if you want with angular, jquery or mootools if you want.
from card.
I'd like to do it standalone. The real dependence is on jquery.payment
unsure how much effort it would take to recreate that in vanilla.
On Jun 6, 2014 12:37 PM, "ErwΓ€nn Mest" [email protected] wrote:
ng-Card plzzzzzzzzzzzzzzzz
[image:
]
Hell no, please do a standalone one, and wrap it if you want with angular,
jquery or mootools if you want.β
Reply to this email directly or view it on GitHub
#23 (comment).
from card.
I understand this point.
from card.
I'm on my way to remove this dependency with https://github.com/lukelex/payment.js/blob/master/src/payment.js
I'm maintaining the same API to avoid compatibility problems while trying to pass all the original tests from jquery.payment.
from card.
Terrific!
On Jun 7, 2014 8:36 AM, "Lukas Alexandre" [email protected] wrote:
I'm on my way to remove this dependency with
https://github.com/lukelex/payment.js/blob/master/src/payment.jsβ
Reply to this email directly or view it on GitHub
#23 (comment).
from card.
any KeyboardEvent guru here? I'm having trouble while simulate events on jsdom during tests
from card.
Is there anyone working on this?
from card.
@lukelex was doing awesome stuff with payment.js
, not sure what his progress is there. would love to drop that in instead of jquery.payment
though.
from card.
@jessepollak hey man, i'm trying to do this task, but i cant understand what some functions do.
Can you explain to me bindVal
?
This is the start of what i'm doing.
I'll open a branch into my forked repo and we can do things there until its ready.
https://gist.github.com/luanmuniz/3eef90c8d057d5a07c84
And about jquery.payment
lets worry about that later, one thing at a time.
from card.
@luanmuniz Doesn't jquery.payment require jquery? If you are rewriting the whole library, please make the cards array public, so we can add the exclusion of some card types.
from card.
@JacquesLoubser yeah, i don't want to worry about the dependencies now, i want to rewrite the main code first and later see what i can do about the dependences. Maybe rewrite the whole library or maybe just a tiny part, i don't know yet. But i'll have this in mind! :D
Cc @jessepollak
from card.
π I would like to use this with Ember as well, although Ember currently depends on jQuery, I would prefer a more modular design.
from card.
Anyone making a serious attempt at this or should I fork and start my own attempt?
from card.
both @lukelex and @luanmuniz were making progress, but I'm not sure exactly how far they are.
The hardest part is that the library relies on stripe/jquery.payment
from card.
Kind of interesting re JQuery dependencies:
https://gist.github.com/lancecarlson/1c32c598a961f5d0b132
from card.
Why not fork jquery.payment and replace the jquery bits. Maybe I'll also take a look. And then fix the jquery dependencies as per @lancecarlson stated.
Only problem I see is the initialization.
from card.
So, bindVal encompasses a bunch of functionality that's necessary to take an input and render to the outputted field on the Card. I'll walk through this functionality step by step.
opts.fill
specifies whether the outputted version of the input should be "filled" if it is not full. With fill: true
, an input like 54
in the number
field would output on the card as 54β’β’ β’β’β’β’ β’β’β’β’ β’β’β’β’
. Looking at the code, it doesn't look like this is actually enabled anywhere.
opts.filters
is a list of filters that get applied to the val taken from the input. These filters can both change the value (like this filter on the expiry field) or have an external effect (like the validToggler).
opts.join
is a string
or a function
that returns a string
. It is the value that's used to join the output of multiple fields (like a first_name
and last_name
field).
outDefaults
is an array
of default values for the outputted fields (i.e. β’β’β’β’ β’β’β’β’ β’β’β’β’ β’β’β’β’
or β’β’/β’β’
), taken directly from them on that line.
On focus
of the input, we add the focused
class to the outputted field on the Card and on blur
we remove that class.
On keyup
, change
, or paste
in the input, we process the input and output it to the output field. More detail on that now.
First, we grab the value of the input (we use map because it can come from multiple inputs). Next, we get the value of the joiner, then join the values. If the result is just the join (i.e. the input fields have no value), we set the output to no value.
Next, we apply the filters.
Next, for every output field, we either set the field to val
or the appropriate outDefault
.
Finally, we return the $el
, so these functions can be chained.
from card.
@JacquesLoubser I think jquery.payment
would definitely need to be forked for this to work.
from card.
If you guys haven't seen it, this site has helped me out in the past when removing jquery dependencies
http://youmightnotneedjquery.com/
On Jun 30, 2014, at 3:25 PM, Jesse Pollak [email protected] wrote:
@JacquesLoubser I think jquery.payment would definitely need to be forked for this to work.
β
Reply to this email directly or view it on GitHub.
from card.
We only need to target modern browsers and IE10+ (unless anyone wants to go down the rabbit hole of CSS support for IE9).
from card.
@lancecarlson @jessepollak I got stuck while trying to emulate clicks on jsdom (they just haven't implemented it yet). Besides that, I've got all original tests of jquery.payment passing.
from card.
@lukelex can you explain better your problem? maybe i can help you.
from card.
I just opened up #94, which goes a long way towards removing the jQuery dependence from Card.
In that PR, I swap out jquery.payment
for payment
β a library that mimics the jquery.payment
without using any jQuery. It is 100% feature-complete and increases the test coverage for the project.
Please follow along there if y'all are interested βΒ I'm hoping to get the jQuery-free version of this library (along with a jQuery-version) out in the next week and would love to see support for the frameworks y'all have been discussing as well.
from card.
Awesome. Thanks for you work @jessepollak
from card.
π Great, thank you.
from card.
I know this has taken a long time, but this is finally getting close in #128, which will fully remove the jQuery dependence, ship as 1.0, and add some other niceties :)
from card.
+1
from card.
+1
from card.
Just shipped v1.0.0-beta
which removes the jQuery dependence. Check it out here.
Would love to see people using and giving feedback on it!
from card.
This is going to ship in v1.0.0 later today! WOOOOO!
from card.
Hey hi sir this your great work.
Thank's for it
i have one problem with it . i have to use only backside .
Can you help me?
from card.
Jquery still dependency according to bower.json. Please update bower.json file.
from card.
Related Issues (20)
- How to remove the input whitespaces when entering a card number? HOT 2
- Demo 404s HOT 3
- This project is being used in suspicious site HOT 2
- Mastercard Not recognized HOT 5
- Card Number Can't Be Blur In IOS When Input Card Numbers HOT 10
- Credit Card with RTL the float:right makes a problem HOT 1
- Cannot read properties of undefined (reading 'replace') HOT 6
- Card Info storage to database. HOT 1
- how to flip card from js code HOT 7
- Show card without inputs HOT 3
- Add CSS variable support for card colors HOT 3
- Card credit
- Demo link is broken in the readme file HOT 2
- npm install errors HOT 10
- Credit Card Expiration Date Format Not Accepted Error HOT 13
- How to get the card type (visa, mastercard, etc.) so I can pass that info to payment gateway HOT 3
- It does not work HOT 2
- not sure if this is still relevant but for people with the same question: you can use the bin of the card to decode if it's type, the bin is the bank identification number of each card and it identifies a card down to the bank which issued it, with a BIN API like the one from binlist.io you are easily able to check which card goes with which card type. HOT 1
- pleasss.. HOT 2
- Hi
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from card.