PageSourceSearch

https://www.whirlwind.co.in/wp-content/plugins/wprt-addons/tabs/js/eTabs.js?ver=7.0.5

js whirlwind.co.in collected 2026-09-24 09:41:45 UTC 16,973 bytes, 403 lines download raw bytes

1/**
2 * eTabs.js v3.3.2
3 */
4 ;( function( window ) {
5
6 	'use strict';
7
8 	function extend( a, b ) {
9 		for( var key in b ) {
10 			if( b.hasOwnProperty( key ) ) {
11 				a[key] = b[key];
12 			}
13 		}
14 		return a;
15 	}
16 	function IW_Tabs( el, options ) {
17 		this.el = el;
18 		this.options = extend( {}, this.options );
19   		extend( this.options, options );
20   		this._init();
21 	}
22 	IW_Tabs.prototype.options = {
23 		start : 0
24 	};
25 	IW_Tabs.prototype._init = function() {
26 		// tabs elems
27 		this.tabs = [].slice.call( this.el.querySelectorAll( 'nav > ul > li' ) );
28 		// content items
29 		this.items = [].slice.call( this.el.querySelectorAll( '.et-content-wrap > section' ) );
30 		// current index
31 		this.current = -1;
32 		// show current content item
33 		this._show();
34 		// init events
35 		this._initEvents();
36 	};
37 	IW_Tabs.prototype._initEvents = function() {
38 		var self = this;
39 		this.tabs.forEach( function( tab, idx ) {
40 			tab.addEventListener( 'click', function( ev ) {
41 				ev.preventDefault();
42 				jQuery(document).trigger("resize");
43 				self._show( idx );
44 			} );
45 		} );
46 	};
47 	IW_Tabs.prototype._show = function( idx ) {
48 		if( this.current >= 0 ) {
49 			this.tabs[ this.current ].className = this.items[ this.current ].className = '';
50 		}
51 		this.tabs.forEach( function( tab, idx ) {
52 			tab.className = "";
53 		});
54 		// change current
55 		this.current = idx != undefined ? idx : this.options.start >= 0 && this.options.start < this.items.length ? this.options.start : 0;
56		var hash = jQuery( jQuery( this.tabs[ this.current ] ).find( 'a' )[0] ).data('href');
57		    hash = hash.substr( hash.indexOf("#") );
58 		setTimeout( function(){
59 			jQuery(document).trigger("elegantTabSwitched",[hash]);
60 		}, 100 );
61 		var anim = jQuery(this.items[ this.current ]).data('animation');
62		this.items.forEach( function( tab, idx ) {
63			tab.className = '';
64		} );
65
66		// Make first tab inactive.
67		if ( -1 == this.options.start ) {
68			var loaded = jQuery( jQuery( this.tabs[ this.current ] ).parents( '.elegant-tabs-container' )[0] ).data( 'loaded' );
69
70			if ( 'undefined' !== typeof loaded || loaded ) {
71				this.tabs[ this.current ].className = 'tab-current';
72				this.items[ this.current ].className = 'content-current';
73				jQuery( this.items[ this.current ] ).find( '.infi-content-wrapper' )[0].className = 'infi-content-wrapper animated '+anim;
74			}
75			jQuery( jQuery( this.tabs[ this.current ] ).parents( '.elegant-tabs-container' )[0] ).attr('data-loaded', true );
76		} else {
77			this.tabs[ this.current ].className = 'tab-current';
78			this.items[ this.current ].className = 'content-current';
79			jQuery( this.items[ this.current ] ).find( '.infi-content-wrapper' )[0].className = 'infi-content-wrapper animated '+anim;
80		}
81
82 	};
83 	// add to global namespace
84 	window.IW_Tabs = IW_Tabs;
85 })( window );
86
87 function checkHash( hashLink ) {
88 	if ( hashLink !== '' ) {
89 		hash 	= hashLink.substr(hashLink.indexOf("#") );
90 		if ( jQuery( hash ).length ) {
91 			var animation = jQuery( hash ).data( 'animation' ),
92 			    tab_link = jQuery('a[data-href="'+hash+'"]').parents("ul").find('li'),
93 			    tabs = jQuery(hash).parents(".et-tabs").find("section");
94 			tab_link.removeClass('tab-current');
95 			tab_link.each(function(index, element) {
96 	      jQuery(this).removeClass('tab-current');
97 	    });
98 			tabs.each(function(index, element) {
99 	      jQuery(this).removeClass('content-current');
100 	    });
101 			jQuery('a[data-href="'+hash+'"]').parent('li').addClass('tab-current');
102 			jQuery( hash + ' > .infi-content-wrapper' )[0].className = 'infi-content-wrapper animated ' + animation;
103 			jQuery(hash).addClass('content-current');
104 			setTimeout( function(){
105 				jQuery(document).trigger("elegantTabSwitched",[hash]);
106 			}, 100 );
107 		}
108 	}
109 }
110
111function checkHashPosition( hash ) {
112	var hashPosition = 0;
113	hashPosition = jQuery( 'a[data-href="' + hash + '"]' ).parent( 'li' ).index();
114	return hashPosition;
115}
116
117function elegantAutoSwitchTabs( el, interval, startTab ) {
118	var timeInterval, tabCount = 0, currnetIndex = 1;
119
120	 tabCount = jQuery( el ).find( 'li' ).length;
121
122	 currnetIndex = startTab + 1;
123
124	 changeTabIndex();
125	 timeInterval = setInterval( function () { changeTabIndex(); }, interval * 1000);
126
127
128	 function changeTabIndex() {
129			 if ( currnetIndex > tabCount ) {
130					 currnetIndex = 1;
131			 }
132
133			 var currentAncorObj = jQuery( el ).find( 'li' ).eq( currnetIndex - 1 );
134
135			 jQuery( currentAncorObj ).trigger( 'click' );
136
137			 currnetIndex++;
138	 };
139
140	 jQuery( el ).find( 'li' ).mouseenter( function () {
141			 clearInterval( timeInterval );
142	 }).mouseleave( function () {
143			 timeInterval = setInterval( function () { changeTabIndex(); }, interval * 1000);
144	 });
145}
146
147function etGenerateCSS() {
148	var css = '<style type="text/css" id="tabs-dynamic-css">',
149    st = '',
150    bg = '',
151    color = '',
152    bg_hover = '',
153    color_hover = '';
154
155	[].slice.call( document.querySelectorAll( '.et-tabs' ) ).forEach( function( el ) {
156
157	var url 	= window.location;
158 	    hash 	= url.href,
159	    hashPosition = 0,
160			listContainer = '',
161			autoSwitch = false,
162			autoSwitchInterval = 5;
163
164 	if ( -1 !== hash.indexOf('#') ) {
165 		hash = hash.replace( "/#", '#' );
166		hash = hash.substr( hash.indexOf( "#" ) );
167
168		if ( jQuery( el ).find( 'a[data-href="' + hash + '"]' ).length ) {
169			hashPosition = checkHashPosition( hash );
170			setTimeout( function() {
171				jQuery( 'html, body' ).animate( { scrollTop:( ( jQuery( hash ) ).offset().top ) - 150 }, 300 );
172			}, 500 );
173		} else {
174			hashPosition = ( 'undefined' !== typeof jQuery( el ).data( 'active-tab' ) ) ? jQuery( el ).data( 'active-tab' ) : 0;
175		}
176 	} else {
177		hashPosition = ( 'undefined' !== typeof jQuery( el ).data( 'active-tab' ) ) ? jQuery( el ).data( 'active-tab' ) : 0;
178	}
179
180	new IW_Tabs( el, { start: hashPosition } );
181
182	listContainer      = jQuery( el ).find( '.elegant-tabs-list-container' );
183	autoSwitch         = jQuery( el ).data( 'auto-switch-tab' );
184	autoSwitchInterval = jQuery( el ).data( 'switch-interval' );
185
186	if ( 'no' !== autoSwitch ) {
187		elegantAutoSwitchTabs( listContainer[0], autoSwitchInterval, hashPosition );
188	}
189
190	var cn = el.className.split(" "),
191	    cl = '';
192
193	jQuery(cn).each(function(i,v){
194		cl += "."+v;
195	});
196
197	st = jQuery(cl).data("tab_style");
198	bg = jQuery(cl).data("active-bg");
199	color = jQuery(cl).data("active-text");
200	bg_hover = jQuery(cl).data("hover-bg");
201	color_hover = jQuery(cl).data("hover-text");
202
203		css += cl+' .infi-tab-accordion.infi-active-tab .infi_accordion_
203item{background:'+bg+' !important; color:'+color+' !important;}\n';
204		css += cl+' .infi-tab-accordion.infi-active-tab .infi_accordion_item .infi-accordion-item-heading{color:'+color+' !important;}\n';
205		css += cl+' .infi-tab-accordion.infi-active-tab .infi_accordion_item .infi-accordion-item-heading .iw-icons{color:'+color+' !important;}\n';
206		switch(st){
207			case 'bars':
208				css += cl+' li.tab-current a{background:'+bg+'; color:'+color+';}\n';
209				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
210			css += cl+' li:not(.tab-current) a:hover{background:'+bg_hover+'; color:'+color_hover+';}\n';
211				css += cl+' nav ul li:not(.tab-current) a:hover, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
212				break;
213			case 'iconbox':
214		case 'iconbox-iconlist':
215				css += cl+' li.tab-current a{background:'+bg+'; color:'+color+' !important;}\n';
216				css += cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
217				css += cl+' nav ul li.tab-current::after{color:'+bg+';}\n';
218			css += cl+' nav ul li.tab-current{color:'+bg+' !important;}\n';
219			css += cl+' li:not(.tab-current) a:hover{background:'+bg_hover+'; color:'+color_hover+';}\n';
220				css += cl+' nav ul li:not(.tab-current) a:hover, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
221				break;
222			case 'underline':
223				css += cl+' nav ul li a::after{background:'+bg+';}\n';
224				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
225			css += cl+' nav ul li:not(.tab-current) a:hover:after{background:'+bg_hover+'; transform: translate3d(0,0,0);}\n';
226				css += cl+' nav ul li:not(.tab-current) a:hover, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
227				break;
228			case 'topline':
229			if ( '' == color ) {
230				color = bg;
231			}
232				css += cl+' nav ul li.tab-current a{box-shadow:inset 0px 3px 0px '+bg+';}\n';
233				css += cl+' nav ul li.tab-current {border-top-color: '+color+';}\n';
234				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
235			css += cl+' nav ul li:not(.tab-current):hover a{box-shadow:inset 0px 3px 0px '+bg_hover+';}\n';
236				css += cl+' nav ul li:not(.tab-current):hover {border-top-color: '+color_hover+';}\n';
237				css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
238				break;
239			case 'iconfall':
240			case 'circle':
241			case 'square':
242				css += cl+' nav ul li::before{background:'+bg+'; border-color:'+bg+';}\n';
243				css += cl+' nav ul li.tab-current::after { border-color:'+bg+';}\n';
244				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
245			css += cl+' nav ul li:not(.tab-current):hover::before{background:'+bg_hover+'; border-color:'+bg_hover+'; transform: translate3d(0,0,0);}\n';
246				css += cl+' nav ul li:not(.tab-current):hover::after { border-color:'+bg_hover+';}\n';
247			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
248				break;
249			case 'line':
250				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
251			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
252				break;
253			case 'linebox':
254				css += cl+' nav ul li a::after{background:'+bg+';}\n';
255				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
256			css += cl+' nav ul li:not(.tab-current):hover a::after{background:'+bg_hover+'; transform: translate3d(0,0,0);}\n';
257			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
258				break;
259			case 'flip':
260				css += cl+' nav ul li a::after, '+cl+' nav ul li.tab-current a{background:'+bg+';}\n';
261				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
262			css += cl+' nav ul li:not(.tab-current):hover a::after, '+cl+' nav ul li:not(.tab-current):hover a{background:'+bg_hover+';
262 transform: translate3d(0,0,0);}\n';
263			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
264				break;
265			case 'tzoid':
266				var style = jQuery(cl + ' nav ul li').attr('style');
267				css += cl+' nav ul li a::after{'+style+';}\n';
268				css += cl+' li.tab-current a::after{background:'+bg+'; color:'+color+';}\n';
269				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
270			css += cl+' li:not(.tab-current):hover a::after{background:'+bg_hover+'; color:'+color_hover+'; transform: perspective(5px) rotateX(0.93deg) translateZ(-1px);;}\n';
271			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
272				break;
273			case 'fillup':
274				css += cl+' nav ul li.tab-current a::after{background:'+bg+';}\n';
275				css += cl+' nav ul li a::after{background:'+bg+'; border-color: '+bg+';}\n';
276				css += cl+' nav ul li.tab-current a, '+cl+' nav ul li.tab-current a > i{color:'+color+' !important;}\n';
277				css += cl+' nav ul li a {border-color:'+color+' !important;}\n';
278			css += cl+' nav ul li:not(.tab-current):hover a::after{background:'+bg_hover+'; translate3d(0,0,0)}\n';
279				css += cl+' nav ul li:not(.tab-current):hover a::after{background:'+bg_hover+'; border-color: '+bg_hover+'; transform: translate3d(0,0,0)}\n';
280				css += cl+' nav ul li:not(.tab-current):hover a {border-color:'+color_hover+' !important;}\n';
281			css += cl+' nav ul li:not(.tab-current):hover a, '+cl+' nav ul li:not(.tab-current):hover a > i{color:'+color_hover+' !important;}\n';
282				break;
283		}
284		// css += cl+' li.tab-current a{background:'+bg+'; color:'+color+';}\n';
285
286	});
287	css += '</style>';
288	jQuery("head").append(css);
289}
290/* Call tabs function */
291(function() {
292
293	etGenerateCSS();
294
295	[].slice.call( document.querySelectorAll( '.et-mobile-enabled' ) ).forEach( function( el ) {
296		// Create the dropdown base
297		var nav = jQuery(el).find("nav");
298		jQuery("<select />", { "class":"et-mobile-tabs"}).appendTo( nav );
299
300		// Populate dropdown with menu items
301		nav.find("a").each(function() {
302		 var el = jQuery(this);
303		 jQuery("<option />", {
304				 "value"   : el.attr("data-href"),
305				 "text"    : el.text()
306		 }).appendTo(nav.find("select") );
307		});
308		nav.find( "select" ).change( function() {
309			var hashLink = jQuery( this ).find( "option:selected" ).val();
310			checkHash( hashLink );
311		});
312	});
313
314	jQuery("a").not('.et-anchor-tag').click( function(e){
315		var url = jQuery(this).attr("href");
316		if( url !== "" && typeof url !== "undefined"){
317	        var isHash = url.indexOf('#section');
318	        var isTabPage = '';
319	        hash 	= url.substring(url.indexOf('#section'));
320	        if( isHash !== -1 ){
321	       		isTabPage = jQuery(hash).length;
322	       	}
323	        if( isHash !== -1 && isTabPage ) {
324	        	e.preventDefault();
325	            checkHash( url );
326						jQuery( 'html, body' ).animate( { scrollTop:( ( jQuery(hash) ).offset().top ) - 150 }, 300 );
327					}
328			}
329	});
330
331	jQuery(".et-anchor-tag").hover(
332		function(){
333			if ( ! jQuery(this).parent('li').hasClass('tab-current') ) {
334				var hover_src = jQuery(this).find('.elegant-tabs-image-icon').data( 'hover-src' );
335				if ( '' !== hover_src ) {
336					jQuery(this).find('.elegant-tabs-image-icon').attr( 'src', hover_src );
337				}
338			}
339		},
340		function(){
341			if ( ! jQuery(this).parent('li').hasClass('tab-current') ) {
342				var original_src = jQuery(this).find('.elegant-tabs-image-icon').data( 'original-src' );
343				jQuery(this).find('.elegant-tabs-image-icon').attr( 'src', original_src );
344			}
345		}
346	);
347
348	jQuery( document ).on( "elegantTabSwitched", function( e, hash ) {
349		jQuery(document).trigger("resize");
350		if (typeof wpb_prepare_tab_content == 'function') {
351			wpb_prepare_tab_content( e, { newPanel: jQuery('.et-content-wrap') } );
352		}
353		jQuery( hash ).parents( '.et-tabs' ).find( '.et-mobile-tabs' ).val( hash );
354		jQuery( hash ).parent( '.et-content-wrap' ).find( '.infi-tab-accordion' ).removeClass( 'infi-active-tab' );
355		jQuery('div[data-href="'+hash+'"]').parents( '.infi-tab-accordion' ).addClass( 'infi-active-tab' );
356		jQuery( hash ).siblings().find('iframe').each( function( i ) {
357			jQuery(this).attr('src', jQuery(this).attr('src'));
358		} );
359		var hover_src = jQuery('a[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').data( 'hover-src' );
360		jQuery('a[data-href*="'+hash+'"]').parents( '.elegant-tabs-list-container' ).find( '.elegant-tabs-image-icon' ).each( function(){
361			var original_src = jQuery(this).data( 'original-src' );
362			jQuery(this).attr( 'src', original_src );
363		});
364		if ( '' !== hover_src ) {
365			jQuery('a[data-href*="'+hash+'"]').find('.elegant-tabs-image-icon').attr( 'src', hover_src );
366		}
367	});
368
369	// Responsive Tabs.
370	jQuery(document).ready( function(){
371		var accHD = document.getElementsByClassName('infi-accordion-item-heading');
372		for (i = 0; i < accHD.length; i++) {
373				accHD[i].addEventListener('click', toggleItem.bind( self, i), false);
374		}
375		function toggleItem( index, event ) {
376			var $this = jQuery( event.target ),
377			    hash 	= $this.data('href'),
378					itemID,
379					animation,
380					hashLink;
381
382			if ( typeof hash == 'undefined' ) {
383				hash = $this.parent( '.infi-accordion-item-heading' ).data( 'href' );
384				$this = $this.parent( '.infi-accordion-item-heading' );
385			}
386
387			itemID = hash;
388			animation = jQuery( itemID ).data( 'animation' );
389
390			jQuery( itemID ).parents( '.et-tabs' ).find( 'nav > ul li').removeClass( 'tab-current' );
391			jQuery( itemID ).parent( '.et-content-wrap' ).find( 'section' ).removeClass( 'content-current' );
392			jQuery( itemID ).parent( '.et-content-wrap' ).find( '.infi-tab-accordion' ).removeClass( 'infi-active-tab' );
393			$this.parents( '.infi-tab-accordion' ).addClass( 'infi-active-tab' );
394
395			jQuery( itemID )[0].className = 'content-current';
396			jQuery( itemID + ' > .infi-content-wrapper' )[0].className = 'infi-content-wrapper animated ' + animation;
397			[].slice.call( document.querySelectorAll( '.et-tabs' ) ).forEach( function( el ) {
398				var Tabs = new IW_Tabs( el, { start: index } );
399			});
400			jQuery( 'html, body' ).animate( { scrollTop:( ( $this ).offset().top ) - 85 }, 300 );
401		}
402	});
403})();

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.