This project has moved and is read-only. For the latest updates, please go here.

v1.3 - prototype.js being replaced JQuery - dealing with plugins built for earlier versions

Jul 12, 2010 at 2:01 PM

We are looking into upgrading from version 1.1 to 1.2 of the Graffiti CMS but it seems that 1.3 is the way ahead. A big issue we have is that we use plugins that were developed for 1.1/1.2. These use prototype.js and but v1.3 uses JQuery. I have thought about adding a script tag in the header that references prototype.js but am aware that this will cause a conflict.

There is the noconflict flag that can be used to make JQuery play nice with prototype but the problem with that is that this requires the $('#id') reference to be replaced with $J('#id') when using JQuery but the JQuery seems to be hardcoded into the CMS as $(... This work-around is for adding JQuery to systems that already use prototype. Not the other way around

Any advice on what we should do to overcome this problem?


Jul 12, 2010 at 5:49 PM

If you don't use the built in $macros.Head you don't have to pull in the jQuery file or the graffiti.js file which relies on jQuery. This would also mean that the built in comment and contact forms would not work.

The other option may be to use the noconflict flag, and then update the graffiti.js file to use this method. The file isn't that big or complicated and it should be a fairly simple find and replace. Just make sure to keep the jQuery file as-is so the admin can pull it in and use as needed.

Jul 12, 2010 at 7:00 PM

I had similar issues, unfortuantely using jquery, prototype, and mootools on the same site, and just has to load specific libraries on specific pages using #if where="home" for example. It took a little work but paid off to convert everything over to jquery. I found it was really quite easy to convert from prototype to jquery and actually used a lot less code to do the same tasks in the end.

Jul 12, 2010 at 7:21 PM

I'm sure that everyone here knows this, but it is worth pointing out. If you want to have the best possible website performance, you should limit the number of frameworks you use on the site as much as possible. Obviously, zero is best, but in this day and age, that isn't likely, so using a single framework is best. Telligent switched to jQuery with 1.3 because they (like most other businesses) determined that jQuery is by and far the most widely used as well as the most extensible framework out there. Not that the other frameworks are bad, but they just don't have as much available to them.

Anything that you use from one of the other frameworks can also most likely be replaced with a very similar (if not exact) replacement in jQuery without too much effort. Now, that doesn't help if you had all sorts of custom code using those frameworks, but if you were just using plugins, it should be easy to take care of.

Jul 21, 2010 at 10:26 AM
Thanks for the replies. I will try updating the graffiti.js file as a starter. I would much rather have a single library being used but unfortunately we have some legacy stuff over here that we need to support and some of the plugins are out of our control. Over time we will be converting exisiting sites to JQuery but as a stop gap we will need to use both.