PageSourceSearch

https://waaree.kz/bitrix/components/beono/banner_rotation/templates/.default/script.js

js waaree.kz collected 2026-10-05 00:05:17 UTC 5,736 bytes, 177 lines download raw bytes

1function Beono_Banner_Rotation (settings) {
2
3	this.id = settings.id;
4	this.transition_speed = settings.transition_speed;
5	this.transition_interval = settings.transition_interval;
6	this.effect = settings.effect;
7	this.stop_on_focus = settings.stop_on_focus;
8	this._interval_pointer = null;
9
10	var __instance = this;
11	
12	var __context = $('#' + this.id);
13	this.context = __context;
14	
15	this.getActiveBanner = function () {
16		return $('div.beono-banner_slider-item', __context).index($('div.beono-banner_slider-item:visible', __context).get(0));
17	};
18	
19	this.getNextBanner = function () {
20		var active_banner_index = this.getActiveBanner();
21		var next_banner_index = active_banner_index + 1;
22		
23		if (!$('div.beono-banner_slider-item:eq('+next_banner_index+')', __context).length) {
24			next_banner_index = 0;
25		}
26		return next_banner_index;
27	};
28
29	this.hideBanner = function (banner_index) {
30
31		if (this.effect == 'slide_h') {
32			if (this.next_banner_index < banner_index) {
33				var next_banner_position = '100%';
34				var next_banner_position_new = '-=100%';
35			} else {
36				var next_banner_position = '-100%';
37				var next_banner_position_new = '+=100%';
38			}
39			$('div.beono-banner_slider-item:eq('+banner_index+')', __context)
40			.animate(
41				{left: next_banner_position}, 
42				this.transition_speed,
43				function () {
44					$('div.beono-banner_slider-item:eq('+banner_index+')', __context).hide();
45				}
46			);	
47		} else if (this.effect == 'slide_v') {
48			$('div.beono-banner_slider-item:eq('+banner_index+')', __context)
49				.animate(
50					{top: '+=100%'}, 
51					this.transition_speed,
52					function () {
53						$('div.beono-banner_slider-item:eq('+banner_index+')', __context).hide();
54					}
55				);			
56		} else {
57			$('div.beono-banner_slider-item:eq('+banner_index+')', __context).fadeOut(this.transition_speed);
58		}
59		return true;
60	};
61
62	this.showBanner = function (next_banner_index) {
63		
64		this.next_banner_index = next_banner_index;
65		
66		if (typeof(this.onBeforeShowBanner) == 'function') {
67			this.onBeforeShowBanner(next_banner_index);
68		}
69		
70		var active_banner_index = this.getActiveBanner();
71		
72		if (active_banner_index != next_banner_index) {
73			
74			if (this.effect == 'slide_h') {
75				if (next_banner_index > active_banner_index) {
76					var next_banner_position = '100%';
77					var next_banner_position_new = '-=100%';
78				} else {
79					var next_banner_position = '-100%';
80					var next_banner_position_new = '+=100%';
81				}
82				this.hideBanner(active_banner_index);
83				$('div.beono-banner_slider-item:eq('+next_banner_index+')', __context)
84					.css('left', next_banner_position)
85					.show()
86					.animate(
87						{left: next_banner_position_new}, 
88						this.transition_speed
89					);
90			} else if (this.effect == 'slide_v') {
91				this.hideBanner(active_banner_index);
92				$('div.beono-banner_slider-item:eq('+next_banner_index+')', __context)
93					.css('top', '-100%')
94					.show()
95					.animate(
96						{top: '+=100%'}, 
97						this.transition_speed
98					);		
99			} else {
100				this.hideBanner(active_banner_index);
101				$('div.beono-banner_slider-item:eq('+next_banner_index+')', __context).fadeIn(this.transition_speed);	
102			}
103		}
104		
105		if (this.hasPager) {
106			$('div.beono-banner_slider-pager a', __context).removeClass('active prev next');
107			$('div.beono-banner_slider-pager a:eq('+next_banner_index+')', __context).addClass('active');
108			
109			if ($('div.beono-banner_slider-pager a:eq('+(next_banner_index-1)+')', __context).length) {
110				$('div.beono-banner_slider-pager a:eq('+(next_banner_index-1)+')', __context).addClass('prev');
111			}
112			
113			if ($('div.beono-banner_slider-pager a:eq('+(next_banner_index+1)+')', __context).length) {
114				$('div.beono-banner_slider-pager a:eq('+(next_banner_index+1)+')', __context).addClass('next');
115			}
116		}
117		
118		if (typeof(this.onAfterShowBanner) == 'function') {
119			this.onAfterShowBanner(next_banner_index);
120		}
121		
122	};
123
124	this.startRotation = function  ()	{		
125		this._interval_pointer = setInterval (function () {
126			var next_banner_index = __instance.getNextBanner();
127			__instance.showBanner(next_banner_index);
128			
129		}, this.transition_interval);
130	};
131
132	this.stopRotation = function  ()	{ 
133		clearInterval(this._interval_pointer);
134	};
135
136	this.init = function () {
137		
138		this.hasPager = new Boolean($('div.beono-banner_slider-pager').length);
139		$('div.beono-banner_slider-wrapper div.beono-banner_slider-item', __context).hide();
140		$('div.beono-banner_slider-wrapper div.beono-banner_slider-item:first', __context).show();
141		 
142		this.showBanner(0);
143		this.startRotation();	
144		
145		if(this.stop_on_focus) {
146			$('div.beono-banner_slider-item', __context).mouseenter(function () {
147				__instance.stopRotation();
148			}).mouseleave(function () {
149				__instance.startRotation();
150			});
151		}
152		
153		if (this.hasPager) {
154			$('div.beono-banner_slider-pager a', __context).click(function () {
155				if($(this).hasClass('active') || $('div.beono-banner_slider-item:animated', __context).length) {
156					return false;
157				} else {
158					if ($(this).is('[href=#stop]')) {
159						$(this).attr('href' , '#start').text('Start');
160						__instance.stopRotation();
161					} else if ($(this).is('[href=#start]')) {
162						$(this).attr('href' , '#stop').text('Stop');
163						__instance.startRotation();
164					} else {
165						var next_banner_index = $('div.beono-banner_slider-pager a', __context).index(this);
166						__instance.stopRotation();
167						__instance.showBanner(next_banner_index);
168						setTimeout(function () {
169							__instance.startRotation();
170						}, __instance.transition_speed);
171						return false;
172					}
173				}
174			});
175		}
176	};
177}

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.