Giter Site home page Giter Site logo

Comments (42)

smizell avatar smizell commented on July 22, 2024

πŸ‘

I was thinking I'd like to use this with React.js and would love to have a component I could use.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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.

34r7h avatar 34r7h commented on July 22, 2024

+1 to no jq deps!

AngularJS would rock this well.

from card.

gsabater avatar gsabater commented on July 22, 2024

I'm definitely trying to implement that on my angularjs mobile app.

from card.

MoOx avatar MoOx commented on July 22, 2024

You are serious guys ? Remove jQuery to rely on AngularJS for such a "tiny" thing ?

from card.

34r7h avatar 34r7h commented on July 22, 2024

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.

MoOx avatar MoOx commented on July 22, 2024

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.

smizell avatar smizell commented on July 22, 2024

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.

34r7h avatar 34r7h commented on July 22, 2024

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.

MoOx avatar MoOx commented on July 22, 2024

We could also use php & imagemagik to achieve this, but I'm not sure it's relevant.

from card.

kud avatar kud commented on July 22, 2024

ng-Card plzzzzzzzzzzzzzzzz









































:trollface:

Hell no, please do a standalone one, and wrap it if you want with angular, jquery or mootools if you want.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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: :trollface:]

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.

kud avatar kud commented on July 22, 2024

I understand this point.

from card.

lukelex avatar lukelex commented on July 22, 2024

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.

jessepollak avatar jessepollak commented on July 22, 2024

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.

lukelex avatar lukelex commented on July 22, 2024

any KeyboardEvent guru here? I'm having trouble while simulate events on jsdom during tests

from card.

luanmuniz avatar luanmuniz commented on July 22, 2024

Is there anyone working on this?

from card.

jessepollak avatar jessepollak commented on July 22, 2024

@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.

luanmuniz avatar luanmuniz commented on July 22, 2024

@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.

JacquesLoubser avatar JacquesLoubser commented on July 22, 2024

@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.

luanmuniz avatar luanmuniz commented on July 22, 2024

@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.

quaertym avatar quaertym commented on July 22, 2024

πŸ‘ 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.

lancecarlson avatar lancecarlson commented on July 22, 2024

Anyone making a serious attempt at this or should I fork and start my own attempt?

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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.

lancecarlson avatar lancecarlson commented on July 22, 2024

Kind of interesting re JQuery dependencies:

https://gist.github.com/lancecarlson/1c32c598a961f5d0b132

from card.

JacquesLoubser avatar JacquesLoubser commented on July 22, 2024

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.

jessepollak avatar jessepollak commented on July 22, 2024

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.

jessepollak avatar jessepollak commented on July 22, 2024

@JacquesLoubser I think jquery.payment would definitely need to be forked for this to work.

from card.

allenan avatar allenan commented on July 22, 2024

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.

jessepollak avatar jessepollak commented on July 22, 2024

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.

lukelex avatar lukelex commented on July 22, 2024

@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.

luanmuniz avatar luanmuniz commented on July 22, 2024

@lukelex can you explain better your problem? maybe i can help you.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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.

MoOx avatar MoOx commented on July 22, 2024

Awesome. Thanks for you work @jessepollak

from card.

quaertym avatar quaertym commented on July 22, 2024

πŸ‘ Great, thank you.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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.

34r7h avatar 34r7h commented on July 22, 2024

+1

from card.

lukelex avatar lukelex commented on July 22, 2024

+1

from card.

jessepollak avatar jessepollak commented on July 22, 2024

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.

jessepollak avatar jessepollak commented on July 22, 2024

This is going to ship in v1.0.0 later today! WOOOOO!

from card.

jaypalkadam avatar jaypalkadam commented on July 22, 2024

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.

uetkaje avatar uetkaje commented on July 22, 2024

Jquery still dependency according to bower.json. Please update bower.json file.

from card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.