I've been in the same problematic situation as well. However, we managed 
to use jQuerys noConflict mode in the 3'rd part component so that was 
great - but two questions:

1)
Would it be possible to implement a noConflict mode in prototype? (why 
isn't there one already?)

2)
Why use the "$" per default? is it "by nature" of some javascript thing 
I havent realized - or is it just "by convention", aka could it have 
been "P" or "£" just as well?

/Jan




On 22-01-2009 01:10, Hector Virgen wrote:
> I'm not sure how Drupal has their Javascript set up, but generally you 
> should be able to wrap their JS in an anonymous function:
>
> (function($){
>     // Drupal JS code goes here
>     // Within this block, '$' represents jQuery
>     $('#foo').click(function() {
>         alert('jQuery event');
>     });
> })(jQuery);
>
> // Outside that block, $ is for prototype
> $('foo').observe('click', function()
> {
>     alert('Prototype event');
> });
>
> I hope this helps.
>
> -Hector
>
>
> On Wed, Jan 21, 2009 at 4:02 PM, Phil W <phi...@googlemail.com 
> <mailto:phi...@googlemail.com>> wrote:
>
>
>     jQuery is used by my CMS, and I don't really want to mess around below
>     the hood of Drupal. Using noConflict would mean I'd have to change
>     Drupal's js code that uses jQuery to use the new variable and I don't
>     want to do that as it could cause errors if I don't do it perfectly,
>     and when I upgrade the CMS the changes will just be overwritten.
>
>     I'm hoping to find a way to modify scriptaculous and prototype so that
>     they behave as if they have their own noConflict mode, and that it was
>     activated.
>
>     Hope that's cleared things up. I wish it was that simple!
>
>     On Jan 21, 11:37 pm, Tobie Langel <tobie.lan...@gmail.com
>     <mailto:tobie.lan...@gmail.com>> wrote:
>     > Why don't you just use jQuery's noConflict mode ?
>     >
>     > On Jan 21, 11:28 pm, Phil W <phi...@googlemail.com
>     <mailto:phi...@googlemail.com>> wrote:
>     >
>     >
>     >
>     > > Thanks a lot for the response, I've gone through prototype.js,
>     > > scriptaculous.js, builder.js, controls.js etc etc and replaced all
>     > > instances of $ with _$.
>     >
>     > > I've uploaded to my server, but now when I click on a link with a
>     > > onClick scroll event handler (using <a href="#"
>     > > onclick="Effect.ScrollTo('restofhomepage'); return
>     false;">read</a>) I
>     > > get this error:
>     >
>     > > JavaScript -http://liverpoolstudentmedia.com/
>     > > Event thread: click
>     > > Error:
>     > > name: ReferenceError
>     > > message: Statement on line 1: Undefined variable: Effect
>     > > Backtrace:
>     > >   Line 1 of function script
>     > >     Effect.ScrollTo('restofhomepage'); return false;
>     > >   ...
>     > > stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have
>     > > Stacktrace'
>     >
>     > > Any ideas what is going wrong?
>     >
>     > > Thanks,
>     >
>     > > Phil
>     >
>     > > On Jan 21, 5:16 pm, kangax <kan...@gmail.com
>     <mailto:kan...@gmail.com>> wrote:
>     >
>     > > > On Jan 21, 11:30 am, Phil W <phi...@googlemail.com
>     <mailto:phi...@googlemail.com>> wrote:> I suppose I could use
>     jQuery UI as it wouldn't clash, but I'd like to
>     > > > > stick with Scriptaculous as the code can be in onClick etc
>     events
>     > > > > rather than all specified in the <head> region.
>     >
>     > > > [...]
>     >
>     > > > I'm pretty sure simply replacing all occurrences of `$`
>     with, say `_
>     > > > $`, should work just fine. What exactly did you do last time
>     and how
>     > > > did it "break"?
>     >
>     > > > --
>     > > > kangax
>
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to