PageSourceSearch

https://artershov.ru/js/slideitmoo.js?202403181500

js artershov.ru collected 2026-10-08 13:54:09 UTC 11,003 bytes, 389 lines download raw bytes

1/*
2	Cлайдер
3*/
4var SlideItMoo = new Class({
5	ci : 0,
6
7	Implements : [ Events, Options ],
8
9	options : {
10		overallContainer : null,
11		elementScrolled : null,
12		thumbsContainer : null,
13		navigationBack : null,
14		navigationForward : null,
15		itemsSelector : null,
16		itemsVisible : 5,
17		elemsSlide : null,
18		itemWidth : 300,
19		itemHeight : null,
20		navs : {
21			fwd : ".SlideItMoo_forward",
22			bk : ".SlideItMoo_back"
23		},
24		slideVertical : false,
25		showControls : 1,
26		transition : Fx.Transitions.linear,
27		duration : 800,
28		direction : 1,
29		autoSlide : false,
30		mouseWheelNav : true,
31		startIndex : null
32	},
33
34	initialize : function(A) {
35		this.setOptions(A);
36		$(this.options.navigationBack).setStyles({'border-bottom' : '0px dashed #F6E7C7'});
37		this.elements = $(this.options.thumbsContainer).getElements(this.options.itemsSelector);
38		this.totalElements = this.elements.length;
39		if (this.totalElements <= this.options.itemsVisible) {
40			return
41		}
42		var B = this.elements[0].getSize();
43		this.elementWidth = this.options.itemWidth || B.x;
44		this.elementHeight = this.options.itemHeight || B.y;
45		this.currentElement = 0;
46		this.direction = this.options.direction;
47		this.autoSlideTotal = this.options.autoSlide + this.options.duration;
48		if (this.options.elemsSlide == 1) {
49			this.options.elemsSlide = null
50		}
51		this.begin()
52	},
53
54	begin : function() {
55		this.addControls();
56		this.setContainersSize();
57		this.myFx = new Fx.Tween(this.options.thumbsContainer, {
58			property : (this.options.slideVertical ? "margin-top" : "margin-left"),
59			wait : true,
60			transition : this.options.transition,
61			duration : this.options.duration
62		});
63		if (this.options.mouseWheelNav && !this.options.autoSlide) {
64			$(this.options.thumbsContainer).addEvent("mousewheel", function(B) {
65				new Event(B).stop();
66				this.slide(-B.wheel)
67			}.bind(this))
68		}
69		if (this.options.startIndex && this.options.startIndex > 0 && this.options.startIndex < this.elements.length) {
70			for ( var A = 1; A < this.options.startIndex; A++) {
71				this.rearange()
72			}
73		}
74		if (this.options.autoSlide && this.elements.length > this.options.itemsVisible) {
75			this.startAutoSlide()
76		}
77	},
78
79	resetAll : function() {
80		$(this.options.overallContainer).removeProperty("style");
81		$(this.options.elementScrolled).removeProperty("style");
82		$(this.options.thumbsContainer).removeProperty("style");
83		this.stopAutoSlide();
84		if ($defined(this.fwd)) {
85			this.fwd.dispose();
86			this.bkwd.dispose()
87		}
88		this.initialize()
89	},
90
91	setContainersSize : function() {
92		var F = {};
93		var E = {};
94		var B = {};
95		if (this.options.slideVertical) {
96			E.height = this.options.itemsVisible * this.elementHeight;
97			B.height = this.totalElements * (this.elementHeight + 10)
98		} else {
99			var D = 0;
100			if (this.options.showControls) {
101				var C = this.fwd.getSize();
102				var A = this.bkwd.getSize();
103				var D = C.x + A.x
104			}
105			F.width = this.options.itemsVisible * this.elementWidth + D;
106			E.width = this.options.itemsVisible * this.elementWidth;
107			B.width = this.totalElements * (this.elementWidth + 10)
108		}
109		$(this.options.overallContainer).set({styles : F});
110		$(this.options.elementScrolled).set({styles : E});
111		$(this.options.thumbsContainer).set({styles : B})
112	},
113
114	addControls : function() {
115		if (!this.options.showControls || this.elements.length <= this.options.itemsVisible) {
116			return
117		}
118		this.fwd = $(this.options.overallContainer).getElement(this.options.navs.fwd);
119		this.bkwd = $(this.options.overallContainer).getElement(this.options.navs.bk);
120		if (this.fwd) {
121			this.fwd.addEvent("click", this.slide.pass(1, this))
122		}
123		if (this.bkwd) {
124			this.bkwd.addEvent("click", this.slide.pass(-1, this))
125		}
126	},
127
128	slide : function(D) {
129		if (this.started) {
130			return
131		}
132		this.direction = D ? D : this.direction;
133		var A = this.currentIndex();
134
135		// alert(this.totalElements);
136		if ((A == -1) && (this.direction == "-1")) {
137			return
138		}
139		if ((A == (this.totalElements)) && (this.direction == "1")) {
140			return
141		}
142//		if ((A == 0) && (this.direction == "1")) {
143//			return
144//		}
145//		if ((A == (this.totalElements - 1)) && (this.direction == "-1")) {
146//			return
147//		}
148		if (this.options.elemsSlide && this.options.elemsSlide > 1 && this.endingElem == null) {
149			this.endingElem = this.currentElement;
150			for ( var B = 0; B < this.options.elemsSlide; B++) {
151				this.endingElem += D;
152				if (this.endingElem >= this.totalElements) {
153					this.endingElem = 0
154				}
155				if (this.endingElem < 0) {
156					this.endingElem = this.totalElements - 1
157				}
158			}
159		}
160		var C = new Hash();
161		var E = 0;
162		if (this.options.slideVertical) {
163			C.include("margin-top", -this.elementHeight);
164			E = this.direction == 1 ? -this.elementHeight : 0
165		} else {
166			C.include("margin-left", -this.elementWidth);
167			E = this.direction == 1 ? -this.elementWidth : 0
168		}
169		if (this.direction == -1) {
170			this.rearange();
171			$(this.options.thumbsContainer).setStyles(C)
172		}
173		this.started = true;
174		this.myFx.start(E).chain(function() {
175			this.rearange(true);
176			if (this.options.elemsSlide) {
177				if (this.endingElem !== this.currentElement) {
178					if (this.options.autoSlide) {
179						this.stopAutoSlide()
180					}
181					this.slide(this.direction)
182				} else {
183					if (this.options.autoSlide) {
184						this.startAutoSlide()
185					}
186					this.endingElem = null
187				}
188			}
189		}.bind(this));
190		this.fireEvent("onChange", A)
191	},
192
193	rearange : function(A) {
194		if (A) {
195			this.started = false
196		}
197		if (A && this.direction == -1) {
198			return
199		}
200		this.currentElement = this.currentIndex(this.direction);
201		var B = new Hash();
202		if (this.options.slideVertical) {
203			B.include("margin-top", 0)
204		} else {
205			B.include("margin-left", 0)
206		}
207		$(this.options.thumbsContainer).setStyles(B);
208		if (this.currentElement == 1 && this.direction == 1) {
209			this.elements[0].injectAfter(this.elements[this.totalElements - 1]);
210			return
211		}
212		if ((this.currentElement == 0 && this.direction == 1) || (this.direction == -1 && this.currentElement == this.totalElements - 1)) {
213			this.rearrangeElement(this.elements.getLast(), this.direction == 1 ? this.elements[this.totalElements - 2] : this.elements[0]);
214			return
215		}
216		if (this.direction == 1) {
217			this.rearrangeElement(this.elements[this.currentElement - 1], this.elements[this.currentElement - 2])
218		} else {
219			this.rearrangeElement(this.elements[this.currentElement], this.elements[this.currentElement + 1])
220		}
221	},
222
223	rearrangeElement : function(B, A) {
224		if (A != undefined && B != undefined) {
225			this.direction == 1 ? B.injectAfter(A) : B.injectBefore(A)
226		}
227	},
228
229	currentIndex : function() {
230		var A = null;
231		switch (this.direction) {
232		case 1:
233			A = this.currentElement >= this.totalElements - 1 ? this.totalElements : this.currentElement + this.direction;
234			break;
235		case -1:
236			A = this.currentElement == 0 ? -1 : this.currentElement + this.direction;
237			break
238		}
239		return A
240	},
241
242	startAutoSlide : function() {
243		this.startIt = this.slide.bind(this).pass(this.direction | 1);
244		this.autoSlide = this.startIt.periodical(this.autoSlideTotal, this);
245		this.isRunning = true;
246		this.elements.addEvents({
247			mouseenter : function() {
248				$clear(this.autoSlide);
249				this.isRunning = false
250			}.bind(this),
251			mouseleave : function() {
252				this.autoSlide = this.startIt.periodical(this.autoSlideTotal, this);
253				this.isRunning = true
254			}.bind(this)
255		})
256	},
257
258	stopAutoSlide : function() {
259		$clear(this.autoSlide);
260		this.isRunning = false
261	}
262});
263
264function ShowText(index) {
265	if (isNaN(index)) {
266		index = this.ci;
267	}
268
269	this.ci = index;
270
271	var Yars = new Array();
272	Yars[0] = "1932";
273	Yars[1] = "1937";
274	Yars[2] = "1938";
275	Yars[3] = "1940";
276	Yars[4] = "1944";
277	Yars[5] = "1946";
278	Yars[6] = "1947";
279	Yars[7] = "1950";
280	Yars[8] = "1951";
281	Yars[9] = "1953";
282	Yars[10] = "1965";
283	Yars[11] = "1967";
284	Yars[12] = "1972";
285	Yars[13] = "1988";
286	Yars[14] = "1989";
287	Yars[15] = "1993";
288	Yars[16] = "2001";
289	Yars[17] = "2005";
290	Yars[18] = "2010";
291	Yars[19] = "2011";
292
293	// index = index + 1;
294
295	if (index == 0) {
296		$("SlideItMoo_back").setStyles({'border-bottom' : '0px dashed #F6E7C7'});
297	} else {
298		$("SlideItMoo_back").setStyles({'border-bottom' : '1px dashed #F6E7C7'});
299	}
300	if (index == 19) {
301		$("SlideItMoo_forward").setStyles({'border-bottom' : '0px dashed #F6E7C7'});
302	} else {
303		$("SlideItMoo_forward").setStyles({'border-bottom' : '1px dashed #F6E7C7'});
304	}
305
306	if (index == 0) {
307		$("SlideItMoo_back").innerHTML = '';
308		$("SlideItMoo_forward").innerHTML = Yars[(index + 1)];
309	} else if (index == 19) {
310		$("SlideItMoo_back").innerHTML = Yars[(index - 1)];
311		$("SlideItMoo_forward").innerHTML = '';
312	} else {
313		$("SlideItMoo_back").innerHTML = Yars[(index - 1)];
314		$("SlideItMoo_forward").innerHTML = Yars[(index + 1)];
315	}
316}
317
318function RebuildNavigationButtons(index) {
319	if (isNaN(index)) {
320		index = this.ci;
321	}
322
323	this.ci = index;
324
325	if (index == 0) {
326		$("span_Students_back").removeClass('span_Students_back_active');
327	} else {
328		$("span_Students_back").addClass('span_Students_back_active');
329	}
330	if (index == 3) {
331		$("span_Students_forward").removeClass('span_Students_forward_active');
332	} else {
333		$("span_Students_forward").addClass('span_Students_forward_active');
334	}
335}
336
337window.addEvents({
338	'domready' : function() {
339		if ($('SlideItMoo_outer') != null) {
340			$('SlideItMoo_outer').setStyle('height', '205px');
341			new SlideItMoo({
342				overallContainer : 'SlideItMoo_outer',
343				elementScrolled : 'SlideItMoo_inner',
344				thumbsContainer : 'SlideItMoo_items',
345				navigationBack : 'SlideItMoo_back',
346				navigationForward : 'SlideItMoo_forward',
347				navs : {
348					fwd : ".SlideItMoo_forward",
349					bk : ".SlideItMoo_back"
350				},
351				itemsVisible : 1,
352				elemsSlide : 1,
353				duration : 300,
354				itemsSelector : '.SlideItMoo_element',
355				itemWidth : 140,
356				showControls : 1,
357				startIndex : 1,
358				onChange : function(index) {
359					ShowText(index);
360				}
361			});
362		}
363
364		if ($('SlideItMoo_Students_outer') != null) {
365			$('SlideItMoo_Students_outer').setStyle('height', '330px');
366			new SlideItMoo({
367				overallContainer : 'SlideItMoo_Students_outer',
368				elementScrolled : 'SlideItMoo_Students_inner',
369				thumbsContainer : 'SlideItMoo_Students_items',
370				navigationBack : 'span_Students_back',
371				navigationForward : 'span_Students_forward',
372				navs : {
373					fwd : ".SlideItMoo_Students_forward",
374					bk : ".SlideItMoo_Students_back"
375				},
376				itemsVisible : 1,
377				elemsSlide : 1,
378				duration : 300,
379				itemsSelector : '.SlideItMoo_Students_element',
380				itemWidth : 730,
381				showControls : 1,
382				startIndex : 1,
383				onChange : function(index) {
384					RebuildNavigationButtons(index);
385				}
386			});
387		}
388	}
389});

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.