Did you try calling cms.links before including mootools? On Thu, Feb 18, 2010 at 10:49 AM, Matteo Pelucco (Tinext) < matteo.pelu...@tinext.com> wrote:
> Yes, it has, but not all the plugins use it. > > More info: > http://mootools.net/blog/2009/06/22/the-dollar-safe-mode/ > > PS: it doesn't explain why Magnolia steals the $ function on IE & Chrome > but not on Firefox... > > > -----Original Message----- > From: user-list-ow...@magnolia-cms.com [mailto: > user-list-ow...@magnolia-cms.com] On Behalf Of Hay (Husky) > Sent: mercoledì, 17. febbraio 2010 17:18 > To: Magnolia User-List > Subject: Re: [magnolia-user] Magnolia & Mootools > > > Doesn't Mootools have some kind of equivalent to jQuery's 'noConflict' > method? In that way you don't need to overwrite the Magnolia $ > function. > > -- Hay > Internet developer, VPRO Digitaal > > On Wed, Feb 17, 2010 at 3:09 PM, Matteo Pelucco > <matteo.pelu...@tinext.com> wrote: > > > > Hi all, > > I'm using Mootools as JS framework. Mootools is not scoped, so it defines > $ > > as a function. But it should not be a problem, because Magnolia defines > its > > own $ function with these lines: > > ***************************** > > if (typeof $ != 'function') { > > function $(element) > > { > > return document.getElementById(element); > > } > > } > > ***************************** > > > > I'am a bit confused: this piece of code > > > > ***************************** > > ...(head with mootools js declaration) > > <body ${bodyID} ${bodyClass}> > > > > <script type="text/javascript"> > > alert($); > > alert(typeof $); > > </script> > > > > [#-- add Magnolia css and js: --] > > [...@cms.links /] > > > > <script type="text/javascript"> > > alert($); > > alert(typeof $); > > </script> > > ... > > ***************************** > > > > produced the following alert in IE7 // Chrome // Safari > > > > 1) <mootols $ function> > > 2) function > > 3) <magnolia $ function> > > 4) function > > > > but in Firefox > > > > 1) <mootols $ function> > > 2) function > > 3) <mootools $ function> > > 4) function > > > > Why this? > > The only way to let Magnolia & Mootols (but I think it is also with other > > $-based-not-scoped js libs) is to replace > > > > ***************************** > > [#-- add Magnolia css and js: --] > > [...@cms.links /] > > ***************************** > > > > with > > > > ***************************** > > [#-- add Magnolia css and js: --] > > [...@cms.links /] > > > > [#-- Mootools 1.2.4 HACK, because Magnolia redefines $ function --] > > <script type="text/javascript"> > > $ = function (a, b) { > > return document.id(a, b, this.document); > > } > > </script> > > ***************************** > > > > > > PS: why not use something like "mgnl" as $ replacement? > > > > Matteo > > > > > > ---------------------------------------------------------------- > > For list details see > > http://www.magnolia-cms.com/home/community/mailing-lists.html > > To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> > > ---------------------------------------------------------------- > > > > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> > ---------------------------------------------------------------- > > > > ---------------------------------------------------------------- > For list details see > http://www.magnolia-cms.com/home/community/mailing-lists.html > To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> > ---------------------------------------------------------------- > > ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------