jQuery
According to the jQuery website:
"jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript."
As of b2evolution version 1.10.2, jQuery is included in the /rsc/js directory. All backoffice pages include jQuery and use it for various javascript effects.
Starting in b2evolution version 2.0, there is a function to allow skins and plugins to include jQuery when a blog is displayed.
‘’The rest of this manual page only applies to b2evolution version 2.0 and higher.'’
Using jQuery in a plugin
Do not add the script tag directly using the SkinBeginHtmlHead hook. If other plugins include jQuery, then it could get loaded multiple times, causing a waste of bandwidth and javascript errors. Instead, use this function:
<?php require_js( ‘#jquery#’ ); ?>
This will make sure that jQuery is added to the page, but if another plugin (or the skin) has already asked for jQuery, then it will only be added once.
Using jQuery in a skin
In your skin’s main.tpl.php file, find this line:
skin_include( ‘_html_header.inc.php’ );
and right above it, add this:
require_js( ‘#jquery#’ );
Incompatible with Prototype
If your plugin uses [http://www.prototypejs.org/ Prototype], and another plugin on the same blog uses jQuery, there could be a conflict. The best practice is to port your code to jQuery. You’ll have less chance of conflict and better use of bandwidth. Otherwise, consult this [http://docs.jquery.com/Using_jQuery_with_Other_Libraries document about how to make them work together].
jQuery plugins
jQuery itself can be extended with [http://jquery.com/plugins/ plugins].
TODO: Work up some code that checks in the $required_js variable to see if the jQuery plugin has already been added by another b2evolution plugin.