PageSourceSearch

http://zavisimost-v-seti.ru/modules/kwicks/js/kwicks.js

js zavisimost-v-seti.ru collected 2026-10-02 20:14:57 UTC 6,248 bytes, 186 lines download raw bytes

1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
3{
4  let window = _____WB$wombat$assign$function_____("window");
5  let self = _____WB$wombat$assign$function_____("self");
6  let document = _____WB$wombat$assign$function_____("document");
7  let location = _____WB$wombat$assign$function_____("location");
8  let top = _____WB$wombat$assign$function_____("top");
9  let parent = _____WB$wombat$assign$function_____("parent");
10  let frames = _____WB$wombat$assign$function_____("frames");
11  let opener = _____WB$wombat$assign$function_____("opener");
12
13/*
14	Kwicks for jQuery (version 1.5.1)
15	Copyright (c) 2008 Jeremy Martin
16	http://www.jeremymartin.name/projects.php?project=kwicks
17	
18	Licensed under the MIT license:
19		http://www.opensource.org/licenses/mit-license.php
20
21	Any and all use of this script must be accompanied by this copyright/license notice in its present form.
22*/
23
24(function($){
25	$.fn.kwicks = function(options) {
26		var defaults = {
27			isVertical: false,
28			sticky: false,
29			defaultKwick: 0,
30			event: 'mouseover',
31			spacing: 0,
32			duration: 500
33		};
34		var o = $.extend(defaults, options);
35		var WoH = (o.isVertical ? 'height' : 'width'); // WoH = Width or Height
36		var LoT = (o.isVertical ? 'top' : 'left'); // LoT = Left or Top
37		
38		return this.each(function() {
39			var container = $(this);
40			var kwicks = container.children('li');
41			var normWoH = kwicks.eq(0).css(WoH).replace(/px/,''); // normWoH = Normal Width or Height
42			if(!o.max) {
43				o.max = (normWoH * kwicks.size()) - (o.min * (kwicks.size() - 1));
44			} else {
45				o.min = ((normWoH * kwicks.size()) - o.max) / (kwicks.size() - 1);
46			}
47			// set width of container ul
48			if(o.isVertical) {
49				container.css({
50					width : kwicks.eq(0).css('width'),
51					height : (normWoH * kwicks.size()) + (o.spacing * (kwicks.size() - 1)) + 'px'
52				});				
53			} else {
54				container.css({
55					width : (normWoH * kwicks.size()) + (o.spacing * (kwicks.size() - 1)) + 'px',
56					height : kwicks.eq(0).css('height')
57				});				
58			}
59
60			// pre calculate left or top values for all kwicks but the first and last
61			// i = index of currently hovered kwick, j = index of kwick we're calculating
62			var preCalcLoTs = []; // preCalcLoTs = pre-calculated Left or Top's
63			for(i = 0; i < kwicks.size(); i++) {
64				preCalcLoTs[i] = [];
65				// don't need to calculate values for first or last kwick
66				for(j = 1; j < kwicks.size() - 1; j++) {
67					if(i == j) {
68						preCalcLoTs[i][j] = o.isVertical ? j * o.min + (j * o.spacing) : j * o.min + (j * o.spacing);
69					} else {
70						preCalcLoTs[i][j] = (j <= i ? (j * o.min) : (j-1) * o.min + o.max) + (j * o.spacing);
71					}
72				}
73			}
74			
75			// loop through all kwick elements
76			kwicks.each(function(i) {
77				var kwick = $(this);
78				// set initial width or height and left or top values
79				// set first kwick
80				if(i === 0) {
81					kwick.css(LoT, '0px');
82				} 
83				// set last kwick
84				else if(i == kwicks.size() - 1) {
85					kwick.css(o.isVertical ? 'bottom' : 'right', '0px');
86				}
87				// set all other kwicks
88				else {
89					if(o.sticky) {
90						kwick.css(LoT, preCalcLoTs[o.defaultKwick][i]);
91					} else {
92						kwick.css(LoT, (i * normWoH) + (i * o.spacing));
93					}
94				}
95				// correct size in sticky mode
96				if(o.sticky) {
97					if(o.defaultKwick == i) {
98						kwick.css(WoH, o.max + 'px');
99						kwick.addClass('active');
100					} else {
101						kwick.css(WoH, o.min + 'px');
102					}
103				}
104				kwick.css({
105					margin: 0,
106					position: 'absolute'
107				});
108				
109				kwick.bind(o.event, function() {
110					// calculate previous width or heights and left or top values
111					var prevWoHs = []; // prevWoHs = previous Widths or Heights
112					var prevLoTs = []; // prevLoTs = previous Left or Tops
113					kwicks.stop().removeClass('active');
114					for(j = 0; j < kwicks.size(); j++) {
115						prevWoHs[j] = kwicks.eq(j).css(WoH).replace(/px/, '');
116						prevLoTs[j] = kwicks.eq(j).css(LoT).replace(/px/, '');
117					}
118					var aniObj = {};
119					aniObj[WoH] = o.max;
120					var maxDif = o.max - prevWoHs[i];
121					var prevWoHsMaxDifRatio = prevWoHs[i]/maxDif;
122					kwick.addClass('active').animate(aniObj, {
123						step: function(now) {
124							// calculate animation completeness as percentage
125							var percentage = maxDif != 0 ? now/maxDif - prevWoHsMaxDifRatio : 1;
126							// adjsut other elements based on percentage
127							kwicks.each(function(j) {
128								if(j != i) {
129									kwicks.eq(j).css(WoH, prevWoHs[j] - ((prevWoHs[j] - o.min) * percentage) + 'px');
130								}
131								if(j > 0 && j < kwicks.size() - 1) { // if not the first or last kwick
132									kwicks.eq(j).css(LoT, prevLoTs[j] - ((prevLoTs[j] - pre
132CalcLoTs[i][j]) * percentage) + 'px');
133								}
134							});
135						},
136						duration: o.duration,
137						easing: o.easing
138					});
139				});
140			});
141			if(!o.sticky) {
142				container.bind("mouseleave", function() {
143					var prevWoHs = [];
144					var prevLoTs = [];
145					kwicks.removeClass('active').stop();
146					for(i = 0; i < kwicks.size(); i++) {
147						prevWoHs[i] = kwicks.eq(i).css(WoH).replace(/px/, '');
148						prevLoTs[i] = kwicks.eq(i).css(LoT).replace(/px/, '');
149					}
150					var aniObj = {};
151					aniObj[WoH] = normWoH;
152					var normDif = normWoH - prevWoHs[0];
153					kwicks.eq(0).animate(aniObj, {
154						step: function(now) {
155							var percentage = normDif != 0 ? (now - prevWoHs[0])/normDif : 1;
156							for(i = 1; i < kwicks.size(); i++) {
157								kwicks.eq(i).css(WoH, prevWoHs[i] - ((prevWoHs[i] - normWoH) * percentage) + 'px');
158								if(i < kwicks.size() - 1) {
159									kwicks.eq(i).css(LoT, prevLoTs[i] - ((prevLoTs[i] - ((i * normWoH) + (i * o.spacing))) * percentage) + 'px');
160								}
161							}
162						},
163						duration: o.duration,
164						easing: o.easing
165					});
166				});
167			}
168		});
169	};
170})(jQuery);
171
172}
173
174/*
175playback timings (ms):
176  exclusion.robots: 0.142
177  CDXLines.iter: 20.771 (3)
178  captures_list: 1188.81
179  load_resource: 62.615
180  cdx.remote: 0.072
181  exclusion.robots.policy: 0.13
182  PetaboxLoader3.datanode: 1111.774 (4)
183  LoadShardBlock: 1126.659 (3)
184  esindex: 0.01
185  PetaboxLoader3.resolve: 18.994
186*/

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.