Drupal, jQuery, Prototype, TinyMCE, oh my!

First, I posted the following feature request on drupal.org [[http://drupal.org/node/125030]]:

First, I posted the following feature request on drupal.org [[http://drupal.org/node/125030]]:

As things stand, if you want to use Drupal with the prototype library, you have a problem, in that both jQuery and Prototype use the $() function.

On the jQuery site, there is a workaround using (see http://docs.jquery.com/Using_jQuery_with_Other_Libraries ).

However: the recommended method doesn't work with jQuery 1.0.4:

var $j = jQuery.noConflict(); 
     // Use jQuery via $j(...)
$j(document).ready(function(){
$j("div").hide();
});

because the noConflict() function isn't supported in 1.0.4!

What I did

In each of the files listed below, I did two things:

1. Added the following at the top:

var $jq = jQuery;

2. Change ever instance of $(…) to $jq(…)

Then, my prototype and jQuery got on fine.

List of files changed (in Drupal ./misc directory):

autocomplete.js
collapse.js
drupal.js
progress.js
tableselect.js
textarea.js
upload.js
update.js

As of jQuery 1.1.x, the first line in the files will have to read:
var $jq = jQuery.noConflict();

My _feature request_ is… is there any way that in core, we could adopt a $jq or $drupal_jq override of the jQuery $() function? That way, Drupal will be compatible with Prototype and other libraries off the shelf!

Secondly, TinyMCE stopped working with scriptaculous.

So there, I followed the advice on the scriptaculous page (see [[http://wiki.script.aculo.us/scriptaculous/show/TinyMCE]] ):

<script type=”text/javascript” src=”prototype.js”></script>
<script type=”text/javascript” src=”tiny_mce.js”></script>
<script type=”text/javascript” src=”scriptaculous.js”></script>
<script type=”text/javascript”> tinyMCE.init({ config stuff here });
</script>