PageSourceSearch

https://afer.org/wp-content/themes/_afer/js/PromoSlider.js?v=2

js afer.org collected 2026-10-02 07:50:54 UTC 1,965 bytes, 104 lines download raw bytes

1PromoSlider = function()
2{
3	var i, c, ns;
4	if (arguments.length)
5	{
6		this.items = arguments[0].css("display", "none");
7		this.navs = (ns = arguments[1]);
8		this.navOnClass = arguments[2] ? arguments[2] : "nav_item_selected";
9		this.onclick = arguments[3] ? arguments[3] : function() { return true; };
10		for (i = 0, c = ns.length; i < c; i++)
11		{
12			jQuery("a", ns.eq(i)).click(this.anonNavClick(this, i));
13		}
14		this.count = this.items.length;
15		this.select(0);
16	}
17}
18new PromoSlider();
19
20PromoSlider.hasFocus = true;
21
22PromoSlider.prototype =
23{
24	"count": null,
25	"ind": null,
26	"timeoutMs": 10000,
27	"timeoutId": null,
28	"lastIter": 0,
29	"items": null,
30	"navs": null,
31	"anonNavClick": function(obj, i)
32	{
33		var f = function()
34		{
35			return obj.select(i);
36		};
37		return f;
38	},
39	"select": function(ind)
40	{
41		var nextInd, obj = this, items = this.items, navs = this.navs;
42
43		if (!this.onclick(ind))
44		{
45			return false;
46		}
47
48		if (this.timeoutId)
49		{
50			clearTimeout(this.timeoutId);
51		}
52try
53{
54	if (window.location.search.match(/cat=fud/))
55	{
56		jQuery("body").prepend("Too fast:"+Math.floor(((new Date()).getTime() - this.lastIter) / 1000)+"s ("+PromoSlider.hasFocus+")<br/>");
57	}
58}
59catch (e)
60{
61	// no hagas nada
62}
63		if (!PromoSlider.hasFocus)
64		{
65			this.timeoutId = setTimeout(function() { obj.select(ind); }, this.timeoutMs);
66			return false;
67		}
68
69		if (this.ind !== null)
70		{
71			items.eq(this.ind).fadeOut("slow");
72			navs.eq(this.ind).removeClass(this.navOnClass);
73		}
74		items.eq(ind).fadeIn("slow");
75		navs.eq(ind).addClass(this.navOnClass);
76
77		this.ind = ind;
78
79		nextInd = ind + 1;
80		if (nextInd == this.count)
81		{
82			nextInd = 0;
83		}
84
85		this.lastIter = (new Date()).getTime();
86		this.timeoutId = setTimeout(function() { obj.select(nextInd); }, this.timeoutMs);
87		return false;
88	}
89};
90
91jQuery
92(
93	function()
94	{
95		jQuery(window).focus(function() {
96				PromoSlider.hasFocus = true;
97		});
98
99		jQuery(window).blur(function() {
100				PromoSlider.hasFocus = false;
101		});
102	}
103);
104

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.