CoreFiles by mySites.guru
caption-uncompressed.js49 lines, 1,342 bytes, from Joomla_3.3.2-Stable-Full_Package.zip
Raw History Compare with 3.3.1
md5
d3e66348804ff5a39e976ee373b49997
sha1
e1fb54557fba2fea8bd46be54f85b465c914802b
sha256
2aae599f7c7a1d282a7d0c73aabfe0893d5a7795f4fececbd198e9c02e4f2357
/**
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * JCaption javascript behavior
 *
 * Used for displaying image captions
 *
 * @package     Joomla
 * @since       1.5
 * @version  1.0
 */
var JCaption = function(_selector) {
    var $, selector,
    
    initialize = function(_selector) {
        $ = jQuery.noConflict();
        selector = _selector;
        $(selector).each(function(index, el) {
            createCaption(el);
        })
    },
    
    createCaption = function(element) {
        var $el = $(element), 
        caption = $el.attr('title'),
        width = $el.attr("width") || element.width,
        align = $el.attr("align") || $el.css("float") || element.style.styleFloat || "none",
        $p = $('<p/>', {
            "text" : caption,
            "class" : selector.replace('.', '_')
        }),
        $container = $('<div/>', {
            "class" : selector.replace('.', '_') + " " + align,
            "css" : {
                "float" : align,
                "width" : width
            }
        });
        $el.before($container);
        $container.append($el);
        if (caption !== "") {
            $container.append($p);
        }
    }
    initialize(_selector);
}

The same content is in 6 releases, Joomla 3.3.2 to 3.4.0-alpha. See them all, or every version of this file.