PageSourceSearch

https://hacktronics.com/media/system/js/caption.js

js hacktronics.com collected 2026-10-02 12:15:00 UTC 1,721 bytes, 60 lines download raw bytes

1/**
2* @version		$Id: modal.js 5263 2006-10-02 01:25:24Z webImagery $
3* @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
4* @license		GNU/GPL, see LICENSE.php
5* Joomla! is free software. This version may have been modified pursuant
6* to the GNU General Public License, and as distributed it includes or
7* is derivative of works licensed under the GNU General Public License or
8* other free or open source software licenses.
9* See COPYRIGHT.php for copyright notices and details.
10*/
11
12/**
13 * JCaption javascript behavior
14 *
15 * Used for displaying image captions
16 *
17 * @package		Joomla
18 * @since		1.5
19 * @version     1.0
20 */
21var JCaption = new Class({
22	initialize: function(selector)
23	{
24		this.selector = selector;
25
26		var images = $$(selector);
27		images.each(function(image){ this.createCaption(image); }, this);
28	},
29
30	createCaption: function(element)
31	{
32		var caption   = document.createTextNode(element.title);
33		var container = document.createElement("div");
34		var text      = document.createElement("p");
35		var width     = element.getAttribute("width");
36		var align     = element.getAttribute("align");
37
38		if(!width) {
39			width = element.width;
40		}
41
42		text.appendChild(caption);
43		element.parentNode.insertBefore(container, element);
44		container.appendChild(element);
45		if ( element.title != "" ) {
46			container.appendChild(text);
47		}
48		container.className   = this.selector.replace('.', '_');
49		container.className   = container.className + " " + align;
50		container.setAttribute("style","float:"+align);
51		container.style.width = width + "px";
52
53	}
54});
55
56document.caption = null
57window.addEvent('load', function() {
58  var caption = new JCaption('img.caption')
59  document.caption = caption
60});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.