Some people are already argueing about the jQuery-Library as standard JS-Framework in Drupal 5. Because jQuery uses the $()-Function too, it is incompatible with Prototype. I’m a fan of Prototype too, but I want to use Prototype as well, so I refactored Prototype, so that the $()-Function in Prototype is called $ID(), but $$()-function still remains as $$(). The following two files are my version of Prototype, one uncompressed, on compressed with JSJuicer, some my say I should have used Packer from Dean Edwards, but it’s buggy and Prototype does not work after packing it.
technorati tags:prototype, jsjuicer, drupal, jquery, javascript, compressed
Blogged with Flock
I'm a computer science student at the Karlsruhe
Institute of Technology. In my spare time I create some nice pieces of
software (mostly for the web), enjoy tuning some of my websites or volunteer
in a fantastic youth organisation.
Read more about me or
my projects.
xhochy
March 18th, 2007 at 7:04 pm
I’ve found this workaround http://awebfactory.com.ar/node/189 but this will not really work, because it breaks Drupal which relies on the $()-function of jQuery
zalun
March 20th, 2007 at 4:42 pm
Thank you for that file.
Finally I’ve the solution – after many tries to make Prototype and jQuery to work together under Drupal …
I created a module which loads your modification.
I don’t know Drupal very well and I couldn’t add Javascript in other way.
http://piotr.zalewa.info/prototype_module
cheers
StarBoy
October 26th, 2007 at 3:52 pm
I’ve solved the same problem, not exactly in Druppal but in another application which uses Prototype and jQuerry at same time (this if the case for the UI TABS Library used in conjunction with SCRIPT.ACULO.US portal Boxes). The Solutions very simple
In the JQUERRY SIDE
1) First you need call the jQuery.noConflict() method
and replace all the $ by jQuery, example
If we have something like this:
$( function(){
$(‘#container-0 ul’).tabs({ disabled: [] });
});
Replace it by this:
jQuery.noConflict();
jQuery( function(){
jQuery(‘#container-0 ul’).tabs({ disabled: [] });
});
Do this for ALL function files which use JQUERY
IN THE PROTOTYPE SIDE:
2) Replace the “function $(” definition in the prototype.js file
and in all parts in that file which uses $(, by said, $X
then the line 1249 of the prototype.js file which looked:
function $(element) {
will look now:
function $X(element) {
do the same in all function-calls “$(” in prototype.js
3) Do the same in all function-calls “$(” in all JavaScript files which uses Prototype.