PageSourceSearch

https://i-sosna.ru/bitrix/templates/adaptive/js/jquery.tabs.js?17854450167065

js i-sosna.ru collected 2026-10-04 16:08:08 UTC 7,065 bytes, 236 lines download raw bytes

1// page init
2jQuery(function(){
3	initTabs();
4});
5
6// tabs init
7function initTabs() {
8	jQuery('ul.tab-list').contentTabs({
9		animSpeed:500,
10		effect: 'none'
11	});
12	jQuery('ul.information-list').contentTabs({
13		animSpeed:500,
14		effect: 'none'
15	});
16	jQuery('.photo-box ul').contentTabs({
17		animSpeed:500,
18		effect: 'none'
19	});
20	// jQuery('.sorting-type').contentTabs({
21		// animSpeed:500,
22		// effect: 'none'
23	// });
24	
25}
26
27/*
28 * jQuery Tabs plugin
29 */
30;(function($){
31	$.fn.contentTabs = function(o){
32		// default options
33		var options = $.extend({
34			activeClass:'active',
35			addToParent:false,
36			autoHeight:false,
37			autoRotate:false,
38			animSpeed:400,
39			switchTime:3000,
40			effect: 'none', // "fade", "slide"
41			tabLinks:'a',
42			event:'click'
43		},o);
44
45		return this.each(function(){
46			var tabset = $(this);
47			var tabLinks = tabset.find(options.tabLinks);
48			var tabLinksParents = tabLinks.parent();
49			var prevActiveLink = tabLinks.eq(0), currentTab, animating;
50			var tabHolder;
51			
52			// init tabLinks
53			tabLinks.each(function(){
54				var link = $(this);
55				var href = link.attr('href');
56				var parent = link.parent();
57				href = href.substr(href.lastIndexOf('#'));
58				
59				// get elements
60				var tab = $(href);
61				link.data('cparent', parent);
62				link.data('ctab', tab);
63				
64				// find tab holder
65				if(!tabHolder && tab.length) {
66					tabHolder = tab.parent();
67				}
68				
69				// show only active tab
70				if((options.addToParent ? parent : link).hasClass(options.activeClass)) {
71					prevActiveLink = link; currentTab = tab;
72					tab.removeClass(tabHiddenClass).width('');
73					contentTabsEffect[options.effect].show({tab:tab, fast:true});
74				} else {
75					contentTabsEffect[options.effect].hide({tab:tab, fast:true});
76					tab.width(tab.width()).addClass(tabHiddenClass);
77				}
78				
79				// event handler
80				link.bind(options.event, function(e){
81					if(link != prevActiveLink && !animating) {
82						switchTab(prevActiveLink, link);
83						prevActiveLink = link;
84					}
85					e.preventDefault();
86				});
87				if(options.event !== 'click') {
88					link.bind('click', function(e){
89						e.preventDefault();
90					});
91				}
92			});
93			
94			// tab switch function
95			function switchTab(oldLink, newLink) {
96				animating = true;
97				var oldTab = oldLink.data('ctab');
98				var newTab = newLink.data('ctab');
99				currentTab = newTab;
100				
101				// refresh pagination links
102				(options.addToParent ? tabLinksParents : tabLinks).removeClass(options.activeClass);
103				(options.addToParent ? newLink.data('cparent') : newLink).addClass(options.activeClass);
104				
105				// hide old tab
106				resizeHolder(oldTab, true);
107				contentTabsEffect[options.effect].hide({
108					speed: options.animSpeed,
109					tab:oldTab,
110					complete: function() {
111						// show current tab
112						resizeHolder(newTab.removeClass(tabHiddenClass).width(''));
113						contentTabsEffect[options.effect].show({
114							speed: options.animSpeed,
115							tab:newTab,
116							complete: function() {
117								oldTab.width(oldTab.width()).addClass(tabHiddenClass);
118								animating = false;
119								resizeHolder(newTab, false);
120								autoRotate();
121							}
122						});
123					}
124				});
125			}
126			
127			// holder auto height
128			function resizeHolder(block, state) {
129				var curBlock = block && block.length ? block : currentTab;
130				if(options.autoHeight && curBlock) {
131					tabHolder.stop();
132					if(state === false) {
133						tabHolder.css({height:''});
134					} else {
135						var origStyles = curBlock.attr('style');
136						curBlock.show().css({width:curBlock.width()});
137						var tabHeight = curBlock.outerHeight(true);
138						if(!origStyles) curBlock.removeAttr('style'); else curBlock.attr('style', origStyles);
139						if(state === true) {
140							tabHolder.css({height: tabHeight});
141						} else {
142							tabHolder.animate({height: tabHeight}, {duration: options.animSpeed});
143						}
144					}
145				}
146			}
147			if(options.autoHeight) {
148				$(window).bind('resize orientationchange', function(){
149					resizeHolder(currentTab, false);
150				});
151			}
152			
153			// autorotation handling
154			var rotationTimer;
155			function nextTab() {
156				var activeItem = (options.addToParent ? tabLinksParents : tabLinks).filter('.' + options.activeClass);
157				var activeIndex = (options.addToParent ? tabLinksParents : tabLinks).index(activeItem);
158				var newLink = tabLinks.eq(activeIndex < tabLinks.length - 1 ? activeIndex + 1 : 0);
159				prevActiveLink = tabLinks.eq(activeIndex);
160				switchTab(prevActiveLink, newLink);
161			}
162			function autoRotate() {
163				if(options.autoRotate && tabLinks.length > 1) {
164					clearTimeout(rotationTimer);
165					rotationTimer = setTimeout(nextTab, options.switchTime);
166				}
167			}
168			autoRotate();
169		});
170	}
171	
172	// add stylesheet for tabs on DOMReady
173	var tabHiddenClass = 'js-tab-hidden';
174	$(function() {
175		var tabStyleSheet = $('<style type="text/css">')[0];
176		var tabStyleRule = '.'+tabHiddenClass;
177		tabStyleRule += '{position:absolute !important;left:-9999px !important;top:-9999px !important;display:block !important}';
178		if (tabStyleSheet.styleSheet) {
179			tabStyleSheet.styleSheet.cssText = tabStyleRule;
180		} else {
181			tabStyleSheet.appendChild(document.createTextNode(tabStyleRule));
182		}
183		$('head').append(tabStyleSheet);
184	});
185	
186	// tab switch effects
187	var contentTabsEffect = {
188		none: {
189			show: function(o) {
190				o.tab.css({display:'block'});
191				if(o.complete) o.complete();
192			},
193			hide: function(o) {
194				o.tab.css({display:'none'});
195				if(o.complete) o.complete();
196			}
197		},
198		fade: {
199			show: function(o) {
200				if(o.fast) o.speed = 1;
201				o.tab.fadeIn(o.speed);
202				if(o.complete) setTimeout(o.complete, o.speed);
203			},
204			hide: function(o) {
205				if(o.fast) o.speed = 1;
206				o.tab.fadeOut(o.speed);
207				if(o.complete) setTimeout(o.complete, o.speed);
208			}
209		},
210		slide: {
211			show: function(o) {
212				var tabHeight = o.tab.show().css({width:o.tab.width()}).outerHeight(true);
213				var tmpWrap = $('<div class="effect-div">').insertBefore(o.tab).append(o.tab);
214				tmpWrap.css({width:'100%', overflow:'hidden', position:'relative'}); o.tab.css({marginTop:-tabHeight,display:'block'});
215				if(o.fast) o.speed = 1;
216				o.tab.animate({marginTop: 0}, {duration: o.speed, complete: function(){
217					o.tab.css({marginTop: '', width: ''}).insertBefore(tmpWrap);
218					tmpWrap.remove();
219					if(o.complete) o.complete();
220				}});
221			},
222			hide: function(o) {
223				var tabHeight = o.tab.show().css({width:o.tab.width()}).outerHeight(true);
224				var tmpWrap = $('<div class="effect-div">').insertBefore(o.tab).append(o.tab);
225				tmpWrap.css({width:'100%', overflow:'hidden', position:'relative'});
226				
227				if(o.fast) o.speed = 1;
228				o.tab.animate({marginTop: -tabHeight}, {duration: o.speed, complete: function(){
229					o.tab.css({display:'none', marginTop:'', width:''}).insertBefore(tmpWrap);
230					tmpWrap.remove();
231					if(o.complete) o.complete();
232				}});
233			}
234		}
235	}
236}(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.