brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 530 forks source link

More JQuery noConflict goodness! #23

Closed mmattax closed 11 years ago

mmattax commented 12 years ago

Hi Guys,

I missed a few spots that @dvdotsenko mentioned, I added $.noConflict support in:

jSignature.CompressorSVG.js jSignature.UndoButton.js plugins/signhere/jSignature.SignHere.js

I also ran the build script this time and have tested the new minified version in our codebase; all seems good!

Thanks,

Michael

dvdotsenko commented 12 years ago

@mmattax

For that exact reason (plugins) I normally prefer to relegate all the fancy wrapping (like turning libs into AMD-compatible module) to build time instead of baking the thing into lib itself.

What I would probably do instead is:

and

})(jQuery)

The problem with baking `jQuery' into core is that now all other wrappers need to declare jQuery and (future) jQuery replacements stop working.

Still, this is a better fix than none, as some of out clients needed .NoConflct because they are on Prototype. I had to roll custom builds for them (in the 'wrapper' fashion described above).

On unrelated note:

I see FormStack is offering "payment" gateways. I happen to work for an ACH / Check21 / Canadian EFT processor so that part interested me. We actually got involved with jSignature because we use it for transaction capture. I don't see any providers on the list who do ACH/Chekc21/Canadian EFT. Who would I talk to at FormStack about possibly having us as another payment option?

mmattax commented 12 years ago

@dvdotsenko I'm not quite sure I understand. The Javascript files I changed require jQuery, and "jQuery" is always defined by the jQuery library, the "$" variable is an alias to "jQuery" (hope that makes sense).

As far as the payment gateways, we love adding "foreign" payment processors, do you mind telling me which one you work for? I can put you in touch with our "partner person", I know we have Beanstream in testing right now.

dvdotsenko commented 12 years ago

@mmattax Seems i misspoke... ACH, Check21 are United States-based methods of payment. (When you give your biller routing number, account number and they draw funds directly out of your account. That's how PayPal, in part allows you to "load" PayPal accounts). We do that + it's Canadian equivalent.

Fees on ACH are lower than on credit card side (there is rarely a %-based component) and there is less regulation - payment page is easy to implement because there is no PCI compliance. Large institutional customers usually like this sorta thing.

I am not entirely sure how you "sell" the payments functionality. Depending on how it's done, there could be a cut going to FormStack. Could you or your "sales" or someone who manages "payments integration" kindly spend a few minutes on the phone with me? 562-370-5065 (Pacific office hours) If we are a good fit for your customers, I will help you decide if it is worth the trouble to integrate.

Regarding my (minor) issue with depending on baked-in jQuery variable: It's a minor thing. Mostly involves negotiating how other users (specifically those using AMD / RequireJS ) consume this lib. I am humble and happy for now.

dvdotsenko commented 12 years ago

@mmattax

This is an example of accommodating for "unusual" scenarios: https://github.com/willowsystems/jSignature/commit/d359a43866382f4845944f53b630774b8eefa7a7

There, instead of making the change to every plugin, you just put whole minified core+plugins into a (self-exec'ing) scope and tweak "global" vars that way.

jQuery is, sometimes not in global. I have seen some messed up overrides of "this" and global in AMD loaders. I have seen modified jQuery too that returns ONLY the AMD modules. I have seen people trying to use zQuery instead of jQuery. Dealing with niche cases within the lib itself is nuts. Usually it's easier to split "core code" from "var set up wrapping" and join at build time.

mmattax commented 12 years ago

@dvdotsenko Thanks for the clarification, I've never used and don't know much about AMD loaders, so I'll take your word.

I'm actually the senior developer over at Formstack and can speak about how our integrations work (from a technical standpoint, and as a feature/upsell standpoint). I'll be out of the office tomorrow, but let's arrange a time to chat. Email me at michael@formstack.com.