PageSourceSearch

http://llmotorsport.se/resources/4.3/scripts/gallery/jquery.ds.transition-1.0.1.js

js llmotorsport.se collected 2026-09-30 21:12:30 UTC 10,112 bytes, 463 lines download raw bytes

1(function($) {
2
3	function doTransition (prev, next, prevTarget, nextTarget, prevEasing, nextEasing, prevSpeed, nextSpeed, synchronous)
4	{
5		var nextIn = function () {
6			next.show().animate(nextTarget, nextSpeed, nextEasing, function () {
7				// Remove opacity, workaround for an IE bug:
8				// http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/4df69380-c1ef-4fb6-8e7b-f133131b4abe
9				next.css({opacity: ""});
10			});
11		};
12		prev.animate(prevTarget, prevSpeed, prevEasing, function() {
13			if (!synchronous)
14			{
15				nextIn();
16			}
17			prev.remove();
18		});
19		if (synchronous)
20		{
21			nextIn();
22		}
23	}
24
25	var transitions = {
26		fade : function (prev, next, container, forward) {
27			var width = container.width();
28
29			next.css({
30				zIndex : 1,
31				opacity : 0
32			});
33			prev.css({
34				zIndex : 2,
35				opacity : 1
36			});
37			doTransition(prev, next,
38				{
39					opacity : 0
40				},
41				{
42					opacity : 1
43				},
44				"linear",
45				"linear",
46				"normal",
47				"normal",
48				true);
49		},
50		blindX : function (prev, next, container, forward) {
51			var width = container.width();
52
53			container.css({
54				overflow : "hidden"
55			});
56			next.css({
57				left : width
58			});
59			doTransition(prev, next,
60				{
61					left : width
62				},
63				{
64					left : 0
65				},
66				"swing",
67				"swing",
68				"normal",
69				"normal",
70				false);
71		},
72		blindY : function (prev, next, container, forward) {
73			var height = container.height();
74
75			container.css({
76				overflow : "hidden"
77			});
78			next.css({
79				top : height
80			});
81			doTransition(prev, next,
82				{
83					top : height
84				},
85				{
86					top : 0
87				},
88				"swing",
89				"swing",
90				"normal",
91				"normal",
92				false);
93		},
94		scrollX : function (prev, next, container, forward) {
95			var width = container.width();
96
97			container.css({
98				overflow : "hidden"
99			});
100			next.css({
101				left : forward ? width : -width
102			});
103			doTransition(prev, next,
104				{
105					left : forward ? -width : width
106				},
107				{
108					left : 0
109				},
110				"easeOutElastic",
111				"easeOutElastic",
112				1500,
113				1500,
114				true);
115		},
116		scrollY : function (prev, next, container, forward) {
117			var height = container.height();
118
119			container.css({
120				overflow : "hidden"
121			});
122			next.css({
123				top : forward ? height : -height
124			});
125			doTransition(prev, next,
126				{
127					top : forward ? -height : height
128				},
129				{
130					top : 0
131				},
132				"easeOutElastic",
133				"easeOutElastic",
134				1500,
135				1500,
136				true);
137		},
138		closeX : function (prev, next, container, forward) {
139			var width = container.width(),
140				height = container.height(),
141				visible = {clip : "rect(0px, Wpx, Hpx, 0px)".replace("W", width).replace("H", height)},
142				invisible = {clip : "rect(0px, Wpx, Hpx, Wpx)".replace("H", height).replace(/W/g, width / 2)};
143				
144			next.css(invisible);
145			prev.css(visible);
146			doTransition(prev, next,
147				invisible,
148				visible,
149				"swing",
150				"easeOutBounce",
151				"fast",
152				"slow",
153				false);
154		},
155		closeY : function (prev, next, container, forward) {
156			var width = container.width(),
157				height = container.height(),
158				visible = {clip : "rect(0px, Wpx, Hpx, 0px)".replace("W", width).replace("H", height)},
159				invisible = {clip : "rect(Hpx, Rpx, Hpx, 0px)".replace("R", width).replace(/H/g, height / 2)};
160
161			next.css(invisible);
162			prev.css(visible);
163			doTransition(prev, next,
164				invisible,
165				visible,
166				"swing",
167				"easeOutBounce",
168				"fast",
169				"slow",
170				false);
171		},
172/*
173		wipeX : function (prev, next, container, forward) {
174			var width = container.width(),
175				height = container.height(),
176				clipStart = "rect(0px Rpx Bpx 0px)".replace("R", width).replace("B", height),
177				clipEnd = "rect(0px Rpx Bpx Lpx)".replace("R", forward ? 0 : width).replace("B", height).replace("L", forward ? 0 : width);
178			prev.css({
179				zIndex : 2,
180				clip : clipStart
181			});
182			next.css({
183				zIndex : 1
184			});
185			doTransition(prev, next,
186				{
187					clip : clipEnd
188				},
189				{
190					// Strange, need this bogus animation in order not to mess up future animations
191					height : height
192				},
193				"swing",
194				"swing",
195				"normal",
196				"normal",
197				true);
198		},
199		wipeY : function (prev, next, container, forward) {
200			var width = container.width(),
201				height = container.height(),
202				clipStart = "rect(0px Rpx Bpx 0px)".replace("R", width).replace("B", height),
203				clipEnd = "rect(Tpx Rpx Bpx 0px)".replace("T", forward ? 0 : height).replace("B", forward ? 0 : height).replace("R", width);
204			prev.css({
205				zIndex : 2,
206				clip : clipStart
207			});
208			next.css({
209				zIndex : 1
210			});
211			doTransition(prev, next,
212				{
213					clip : clipEnd
214				},
215				{
216					height : height
217				},
218				"swing",
219				"swing",
220				"normal",
221				"normal",
222				true);
223		},
224*/
225		shuffle : function (prev, next, container, forward) {
226			var width = container.width(),
227				subject = forward ? prev : next;
228
229			container.css({
230				overflow : "visible"
231			});
232
233			next.css({
234				zIndex : 2
235			});
236			prev.css({
237				zIndex : 3
238			});
239			next.show();
240
241			// Move
242			subject.css("opacity", forward ? 1: 0);
243			subject.animate({
244				top : 20,
245				left : -width,
246				opacity : 0.8
247			}, "normal", "swing", function() {
248				// Move in
249				subject.css({
250					zIndex : forward ? 1 : 3
251				});
252				subject.animate({
253					top : 0,
254					left : 0,
255					opacity : forward ? 0.6 : 1
256				}, "normal", "swing", function () {
257					prev.remove();
258				});
259			});
260		},
261		uncoverX : function (prev, next, container, forward) {
262			var width = container.width();
263			container.css({
264				overflow : "hidden"
265			});
266			prev.css({
267				zIndex : forward ? 2 : 1
268			});
269			next.css({
270				left : forward ? 0 : -width,
271				zIndex : forward ? 1 : 2
272			});
273			doTransition(prev, next,
274				{
275					left : forward ? -width : 0
276				},
277				{
278					left : 0
279				},
280				"swing",
281				"swing",
282				"normal",
283				"normal",
284				true);
285		},
286		uncoverY : function (prev, next, container, forward) {
287			var height = container.height();
288			container.css({
289				overflow : "hidden"
290			});
291			prev.css({
292				zIndex : forward ? 2 : 1
293			});
294			next.css({
295				top : forward ? 0 : -height,
296				zIndex : forward ? 1 : 2
297			});
298			doTransition(prev, next,
299				{
300					top : forward ? -height : 0
301				},
302				{
303					top : 0
304				},
305				"swing",
306				"swing",
307				"normal",
308				"normal",
309				true);
310		},
311		toss : function (prev, next, container, forward) {
312			var width = container.width(),
313				height = container.height(),
314				tossed = {
315					top : -(height / 2),
316					left : width * 2,
317					opacity : 0
318				},
319				visible = {
320					left : 0,
321					top : 0,
322					opacity : 1
323				};
324
325			container.css({
326				overflow : "visible"
327			});
328			prev.css({
329				zIndex : forward ? 2 : 1
330			});
331			next.css({
332				zIndex : forward ? 1 : 2
333			});
334			if (!forward)
335			{
336				next.css(tossed);
337			}
338
339			doTransition(prev, next,
340				forward ? tossed : visible,
341				visible,
342				"swing",
343				"swing",
344				1100,
345				1100,
346				true);
347		},
348		clipFadeZoom : function (prev, next, container, forward) {
349			var width = container.width(),
350				height = container.height(),
351				small = "rect(Hpx Wpx Hpx Wpx)".replace(/W/g, Math.floor(width / 2)).replace(/H/g, Math.floor(height / 2)),
352				large = "rect(0px Wpx Hpx 0px)".replace("H", height).replace("W", width);
353			prev.css({
354				zIndex : forward ? 1 : 2,
355				clip : large,
356				opacity : 1
357			});
358			next.css({
359				zIndex : forward ? 2 : 1,
360				clip : forward ? small : large,
361				opacity : forward ? 1 : 0
362			});
363			doTransition(prev, next,
364				{
365					clip : forward ? large : small,
366					opacity : forward ? 0 : 1
367				},
368				{
369					clip : large,
370					opacity : 1
371				},
372				"swing",
373				"swing",
374				"normal",
375				"normal",
376				true);
377		}
378	};
379
380	function centerImage (element)
381	{
382		var img = new Image(),
383			containerWidth = element.parent().width(),
384			containerHeight = element.parent().height(),
385			width,
386			height,
387			ratio;
388		img.onload = function () {
389			width = img.width;
390			height = img.height;
391			ratio = Math.min(1, containerWidth / width);
392			ratio = Math.min(ratio, containerHeight / height);
393			width *= ratio;
394			height *= ratio;
395
396			var style = {
397				position : "absolute",
398				left : (containerWidth - width) / 2,
399				top : (containerHeight - height) / 2,
400				width : width,
401				height : height
402			};
403			element.css(style);
404		};
405		img.src = element.attr("src");
406	}
407
408	$.fn.transitionTo = function(src, transition, forward) {
409		var prev,
410			img = this.find("img"),
411			container = this.parent(),
412			fnTransition = transitions[transition],
413			relativeStyle = {
414					position : "relative",
415					top: 0,
416					left : 0,
417					width : container.width(),
418					height : container.height()
419				},
420			absoluteStyle = {
421					position : "absolute",
422					opacity : "",
423					clip : 	"rect(0px Rpx Bpx 0px)".replace("R", container.width()).replace("B", container.height()),
424					top: 0,
425					left : 0,
426					width : container.width(),
427					height : container.height()
428				};
429
430		// remove all siblings and stop any running animation
431		this.siblings().remove().andSelf().stop(true, true);
432
433		// Only do this if the elements are visible
434		if (container.filter(":visible").size())
435		{
436			// Previous animations may have messed up the CSS so we need to reset it
437			container.css(relativeStyle);
438			this.css(absoluteStyle);
439		}
440		
441		if (!fnTransition)
442		{
443			img.attr("src", src).parent().css(relativeStyle);
444			centerImage(img);
445			return;
446		}
447
448		// Insert a clone to serve as "previous" image in animation
449		prev = this.clone().insertAfter(this);
450
451		// Replace image and center it
452		img.attr("src", src).parent().css(relativeStyle);
453		centerImage(img);
454
455		if (typeof forward == "undefined")
456		{
457			forward = true;
458		}
459
460		fnTransition(prev, this, container, forward);
461	};
462
463})(jQuery);

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.