PageSourceSearch

http://artelmedia.ru/lib/js/jquery.jqir.js

js artelmedia.ru collected 2026-10-05 00:24:26 UTC 1,876 bytes, 60 lines download raw bytes

1/*
2 *
3 * Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
4 * Licensed under the MIT License:
5 * http://www.opensource.org/licenses/mit-license.php
6 * 
7 */
8
9 
10/*
11 * jQuery Image Replacement. An alternative to using CSS hacks
12 * The id attribute (or class) is used for the filename
13 *
14 * @name     jQIR
15 * @param    String format    Image format/file extension (e.g. png, gif, jpg) - ignored if specifying the filename in the class
16 * @param    String path      (optional) Path to images folder 
17 * @param    Function onload  (optional) Function to run when image has loaded 
18 * @author   Sam Collett (http://www.texotela.co.uk)
19 * @example  $(".jqir").jQIR("png", "images/");
20 * @before   <h1 id="heading1" class="jqir">Heading 1</h1>
21 *           <h2 class="jqir {src:heading2.png}">Heading 2</h2>
22 * @result   <h1 id="heading1" class="jqir"><img alt="Heading 1" src="images/heading1.png"></h1>   
23 *           <h2 class="jqir {src:heading2.png}"><img alt="Heading 2" src="images/heading2.png"></h2>   
24 * @example  $(".jqir").jQIR("gif"); // use same folder as page
25 * @before   <h1 id="heading1" class="jqir">Heading 1</h1>
26 * @result   <h1 id="heading1" class="jqir"><img alt="Heading 1" src="heading1.gif"></h1>   
27 *
28 */
29jQuery.fn.jQIR = function(format, path, onload)
30{
31	if(!document.images) return this;
32	path = path || "";
33	this.each(
34		function()
35		{
36			var img = $("<img>"), el = jQuery(this);
37			var file;
38			var re = /(?:{src\:)(\S+)(?:})/i;
39			var m = this.className.match(re);
40			if(m)
41			{
42				file = path + m[1];
43			}
44			else
45			{
46				file = path + this.id + "." + format;
47			}
48			
49			jQuery(img).attr(
50			{
51				src: file,
52				alt: el.text()
53			}).load(typeof onload == "function" ? onload : function(){} );
54			var a = el.find("a");
55			var toAppend = a.length ? a.empty().append(img) : img;
56			el.empty().append(toAppend);
57		}
58	)
59	return this;
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.