CoreFiles by mySites.guru
caption-uncompressed.js62 lines, 1,504 bytes, from Joomla_2.5.8-Stable-Full_Package.zip
Raw History Compare with 2.5.7
md5
bd60d4b040bccc526539a668a746ec64
sha1
1d9519a1bd23d484e9761348ec82fa130d05cc2b
sha256
8a4e0704b45599e953ff6463abbdcf85b0bb5d52b1cfdb4dd781e74c5447ccde
/**
 * @copyright	Copyright (C) 2005 - 2012 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 = new Class({
	initialize: function(selector)
	{
		this.selector = selector;

		var images = $$(selector);
		images.each(function(image){ this.createCaption(image); }, this);
	},

	createCaption: function(element)
	{
		var caption   = document.createTextNode(element.title);
		var container = document.createElement("div");
		var text      = document.createElement("p");
		var width     = element.getAttribute("width");
		var align     = element.getAttribute("align");

		if(!width) {
			width = element.width;
		}

		//Windows fix
		if (!align)
			align = element.getStyle("float");  // Rest of the world fix
		if (!align) // IE DOM Fix
			align = element.style.styleFloat;

		if (align=="" || !align) {
			align="none";
		}

		text.appendChild(caption);
		text.className = this.selector.replace('.', '_');

		element.parentNode.insertBefore(container, element);
		container.appendChild(element);
		if (element.title != "") {
			container.appendChild(text);
		}
		container.className   = this.selector.replace('.', '_');
		container.className   = container.className + " " + align;
		container.setAttribute("style","float:"+align);

		container.style.width = width + "px";

	}
});

The same content is in 12 releases, Joomla 2.5.0 to 3.0.2. See them all, or every version of this file.