You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "David Vittor (JIRA)" <ji...@apache.org> on 2014/09/06 10:04:29 UTC

[jira] [Commented] (JSPWIKI-811) Migrate from Mootools to jQuery

    [ https://issues.apache.org/jira/browse/JSPWIKI-811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14124390#comment-14124390 ] 

David Vittor commented on JSPWIKI-811:
--------------------------------------

I've had a look at the work involved in doing this, and it really is a big job. More than one weekends work I think.

However there is an intermediate point available:
* http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/

We could allow jQuery to be present but leave mootools as the main "$" representation.

If we add the following to the commonheader.jsp - the 2nd line is new
{noformat}
<script type="text/javascript" src="<wiki:Link format='url' jsp='scripts/mootools.js'/>"></script>
<script type="text/javascript" src="<wiki:Link format='url' jsp='scripts/jquery-1.11.1.min.js'/>"></script>
<script type="text/javascript" src="<wiki:Link format='url' jsp='scripts/jspwiki-common.js'/>"></script>
{noformat}

And then wrap the *jspwiki-common.js* code in the below:
{noformat}
var $j = jQuery.noConflict();
$j(document).ready(function() {
	// $j( "div" ).show();
});

window.onload = function() {
{noformat}
... Main Body ...
{noformat}
//window.addEvent('load', function(){
	Wiki.onPageLoad();

	SearchBox.onPageLoad();
	HighlightWord.onPageLoad();
	Wiki.setFocus();
	//console.profile();
	//console.profileEnd();
//});

} // end window.onload
{noformat}

You can effectively have both jQuery and mootools available. 

However to use jQuery you need to use $j. This is fine if you want to write your own code, but if you want to borrow someone elses library, you need to convert all their "$" to "$j", which is not really feasible. Still if you really need jQuery in a plugin, etc. The above does help.

I would love to hear your thoughts, on just providing jQuery as per the above, until the migration is completed....


> Migrate from Mootools to jQuery
> -------------------------------
>
>                 Key: JSPWIKI-811
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-811
>             Project: JSPWiki
>          Issue Type: Improvement
>          Components: Default template
>            Reporter: Ichiro Furusato
>              Labels: javascript
>             Fix For: FutureVersion
>
>
> Following a discussion on the dev mailing list, this is a suggestion to migrate from Mootools to jQuery, given the latter's overwhelming popularity.
> Re: Mootools vs. jQuery, jspwiki-dev mailing list
> http://mail-archives.apache.org/mod_mbox/jspwiki-dev/201401.mbox/%3CCAEUnRMtqhu%3Drd5MfJ4mEJdDKn2bhMZkFKwMKogYyjfh%3D-j9ocA%40mail.gmail.com%3E



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)