views:

87

answers:

1

Dokuwiki us prototype, my site use Jquery.

If there is another way to alter Dokuwiki javascript, instead using jQuery.noConflict(), or/and var $j = jQuery on my jQuery?

I open all .js files on Dokuwiki, search for "$(" and replace it with "$DW(", and it works like a charms, but I had to deal with every Dokuwiki plugins that has javascript in it.

So, how to alter "$" in prototype libaries/ Dokuwiki?

A: 

You are doing it the wrong way around. Just include jQuery after prototype then immediately make a call to jQuery.noConflict(). And in your code always write

jQuery(..) / jQuery.[functionname](...) instead of the usual $ notation.

This way you can leave the whole existing javascript source of dokuwiki and all existing plugins untouched. And you can use jQuery in your code.

Or if you still want a short handle instead of writing jQuery you could create an alias for jQuery

<script ... include prototype ..</script>
<script ... include jquery ..</script>
<script ...>
    var jQ = jQuery.noConflict();
    //do something with prototype
    $("findme");
    jQ("div hideme").hide();
</script>

For more info check jQuery.noConflict()

jitter
I had tons of functions on my JQuery and its a production site, I don't want to alter them. Are you suggesting editing all of them or I can do it like this?jQuery( $(function(){... my jquery...})$(document).ready(function(){... my doc.ready jquery...}));
Ta Coen