JQuery Plugin for Joomla

Sunday, December 20, 2009 21:08
Posted in category JQuery, Joomla, MyUpdates, News, PHP, Projects

I recently released jQuery plugin for Joomla on joomlaguru.com.np. This is a simple plugin that allows user to use jQuery in Joomla and is based on my tutorial here. This plugin works in two modes and allows user a flexibility to replace or use jquery in conjunction with mootools.  This plugin is released under GNU/GPL and is free as in free beer!

Features

1. Two modes

User can select to replace mootools with jQuery completely or use jQuery in conjunction with mootools. Using jQuery with mootools introduces noConflict features of jQuery and replaces ‘$’ operator with jquery. This allows other libraries to use ‘$’ operator without conflict.

2. Where to use selection

Use can select where to use jQuery. User can choose to use jQuery in frontend and/ or in administrator.

3. Allows other application to check if jquery is loaded.

This plugin also introduces a variable in application session that allows others to check if jquery is loaded or not. The illustration of use is as below\

    $app =& JFactory::getApplication();

        //Check to see if jquery is already included
        if( $app->get('jquery') === true ) {

            //Code here

        }
    else
    {

    //Code here

    }

Here is the screenshot of plugin parameters

License

The module is released under GNU/GPL license and hence users are allowed distribute and modify the module without warranty what so ever. The developer does not bear any liability for the extension.

Download

Download the latest release from the download section of joomlaguru.com.np or you can click here to download the plugin.

Send in your comments and feedbacks on the plugin. Hope you will like the plugin. Happy reading.

VN:F [1.8.8_1072]
Rating: 7.9/10 (7 votes cast)
VN:F [1.8.8_1072]
Rating: 0 (from 2 votes)
JQuery Plugin for Joomla7.9107
http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/digg_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/reddit_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/stumbleupon_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/delicious_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/blogmarks_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/google_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/myspace_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/facebook_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/yahoobuzz_32.png http://www.sanjeevshrestha.com.np/wp-content/plugins/sociofluid/images/twitter_32.png
You can leave a response, or trackback from your own site.

6 Responses to “JQuery Plugin for Joomla”

  1. pres says:

    December 24th, 2009 at 9:15 am

    can u give a usage example ? Plugins are usually like “{plugin_name }”. Therefore, unclear how to use.

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)
  2. Sanjeev says:

    December 24th, 2009 at 10:47 pm

    @pres: The usage is simple. Install the plugin, enable it and you can use the jquery in your codes. You can write jQuery codes in your views, modules, or plugins after the installation. But be advised; you need to use jQuery instead of $ operator if you use jQuery in conjunction with mootools.

    You don’t need to insert any {plugin_name} type of code. This is a system plugin and enhances the core to support jQuery.

    UA:F [1.8.8_1072]
    Rating: 4.0/5 (2 votes cast)
    UA:F [1.8.8_1072]
    Rating: 0 (from 0 votes)
  3. nilambar sharma says:

    February 20th, 2010 at 9:48 am

    nice. very useful and more interesting is that its free as free beer. thanks a lot. :)

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)
  4. Richard Hellyer says:

    April 27th, 2010 at 2:42 pm

    This is an outstanding plugin and thanks for doing it!

    I am having a problem though with Jcaption.js that seems to be brought in automatically and appears to rely on mootools. Is there a way of removing jcaption as well?

    Thanks again, Richard

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)
  5. player says:

    May 23rd, 2010 at 9:06 am

    Try update OSJQuery to jQuery 1.4.2

    1.Download plgOSJQuery-1.1.zip and upzip

    2.edit File: osjquery.xml
    —————————

    System – OSJQuery
    Sanjeev Shrestha
    December 2009
    Copyright (C) 2009 http://www.joomlaguru.com.np. All rights reserved.
    http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
    info@joomlaguru.com.np
    http://www.joomlaguru.com.np
    1.4.2
    Use Jquery with Joomla! View details on http://www.sanjeevshrestha.com.np or http://www.joomlaguru.com.np

    osjquery.php
    osjquery

    No
    Yes

    No
    Yes

    with Mootools
    Only JQuery (No Mootools)

    No
    Yes

    3.edit File:osjquery.php
    —————————
    loadLanguage( );
    }

    /**
    * Display the tracking code
    *
    */
    function onAfterDispatch()
    {
    //Load Parameters
    $frontend = $this->params->get(‘jquery_frontend’, 0);
    $admin = $this->params->get(‘jquery_administrator’, 0);
    $usetype = $this->params->get(‘use_type’, ”);
    $usemin = $this->params->get(‘jquery_min’, 1);

    //Get Application
    $app =& JFactory::getApplication();

    //Check to see if jquery is already included
    if( $app->get(‘jquery’) === true )
    {
    return false;
    }

    if($app->isAdmin()&&$admin==0)
    {
    return false;
    }

    if($app->isSite()&&$frontend==0)
    {
    return false;
    }

    if($usemin==1)
    {
    $jqueryfile = ‘jquery-1.4.2.min.js’;
    }
    else
    {
    $jqueryfile = ‘jquery-1.4.2.js’;
    }

    //Get Document
    $document =& JFactory::getDocument();

    $filepath = JPATH_ROOT . DS . ‘plugins’ . DS . ’system’ . DS . ‘osjquery’ . DS;
    $urlpath = JURI::root( true ) . ‘/plugins/system/osjquery/’;

    //Remove Mootools first

    $path=’media/system/js/mootools.js’;
    $path = JURI::root(true).’/’.$path;

    unset($document->_scripts[$path]);
    $scripts=$document->_scripts;

    switch($usetype)
    {
    case ‘2′:
    //Remove Mootools

    if(file_exists($filepath.$jqueryfile))
    {
    $document->addScript($urlpath.$jqueryfile);
    }

    break;
    case ‘1′:
    //Add Mootools
    $document->addScript($path);
    //Add JQuery
    if(file_exists($filepath.$jqueryfile))
    {
    $document->addScript($urlpath.$jqueryfile);
    }
    //Add Conflict removal Code
    $document->addScriptDeclaration(“jQuery.noConflict();”);
    default:
    break;
    }

    if(count($scripts)>0)
    {
    foreach($scripts as $key=>$s)
    {
    unset($document->_scripts[$key]);
    $document->addScript($key);
    }
    }

    //Set jquery for other application to check if the jquery is included or not.
    $app->set(‘jquery’,true);
    }
    }

    4. Download jquery-1.4.2.js and jquery-1.4.2.min.js to Folder osjquery
    5.Compress to plgOSJQuery-1.4.2.zip
    —————————

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)
  6. player says:

    May 23rd, 2010 at 9:20 am

    Orz

    Setp 2. edit File: osjquery.xml
    It does not display properly.

    http://www.player.idv.tw/file/Joomla/plgOSJQuery-1.4.2.zip

    UN:F [1.8.8_1072]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.8_1072]
    Rating: 0 (from 0 votes)

Leave a Reply