PageSourceSearch

https://vaynermedia.com/wp-content/plugins/salient-core/js/init.js?ver=2.0.9

js vaynermedia.com collected 2026-10-01 09:24:39 UTC 13,906 bytes, 454 lines download raw bytes

1/**
2 * Simplified JS for basic element functionality.
3 *
4 * @package Salient WPBakery Addons
5 * @author ThemeNectar
6 */
7 
8 /* global jQuery */
9 /* global Waypoint */
10 /* global imagesLoaded */
11
12jQuery(document).ready(function($){
13  
14  "use strict";
15  
16  var $body = $('body'),
17  $window   = $(window);
18  
19  /**
20  * Tabbed Section.
21  *
22  * @since 1.0
23  */
24  $('body').on('click','.tabbed > ul li:not(.cta-button) a',function(e){
25    
26    e.preventDefault();
27    
28    var $id = $(this).parents('li').index()+1;
29    
30    var $frontEndEditorTabDiv =  ($('body.vc_editor').length > 0) ? '> .wpb_tab ': '';
31    
32    if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
33      $(this).parents('ul').find('a').removeClass('active-tab');
34      $(this).addClass('active-tab');
35      
36      $(this).parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px', 'display': 'none'}).removeClass('visible-tab');
37      
38      if($('body.vc_editor').length > 0) {
39        //front end editor locate tab by modal id
40        var $data_m_id = ($(this).parent().is('[data-m-id]')) ? $(this).parent().attr('data-m-id') : '';
41        $(this).parents('.tabbed').find('> div[data-model-id="'+$data_m_id+'"]' + $frontEndEditorTabDiv).css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().animate({'opacity':1},400).addClass('visible-tab');
42        //update padding
43        
44      } else {
45        $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().animate({'opacity':1},400).addClass('visible-tab');
46      }
47      
48      if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+') .iframe-embed').length > 0 || $(this).parents('.tabbed').find('> div:nth-of-type('+$id+') .portfolio-items').length > 0) setTimeout(function(){ $(window).resize(); },10); 
49    }
50    
51
52    return false;
53    
54  });
55  
56  
57  
58  function tabbedInit(){ 
59    
60    $('.tabbed').each(function(){
61
62      //make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
63      if($(this).find('.swiper-container').length === 0 && $(this).find('.testimonial_slider').length === 0 && $(this).find('.portfolio-items:not(".carousel")').length === 0 && $(this).find('.wpb_gallery .portfolio-items').length == 0 && $(this).find('iframe').length == 0){
64        $(this).find('> ul li:first-child a').trigger('click');
65      }	
66      if($(this).find('.testimonial_slider').length > 0 || $(this).find('.portfolio-items:not(".carousel")').length > 0 || $(this).find('.wpb_gallery .portfolio-items').length > 0 || $(this).find('iframe').length > 0 ){
67        var $that = $(this);
68        
69        $(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
70        $(this).find('> ul li a').addClass('loading');
71        
72        setTimeout(function(){ 
73          $that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
74          $that.find('> ul li a').removeClass('loading');
75          $that.find('> ul li:first-child a').trigger('click'); 
76        },900);
77      }
78      
79    });
80  }
81  setTimeout(tabbedInit,60);
82  
83  
84  
85  /**
86  * Toggles.
87  *
88  * @since 1.0
89  */
90  $('body').on('click','.toggle h3 a', function(){
91    
92    if(!$(this).parents('.toggles').hasClass('accordion')) { 
93      $(this).parents('.toggle').find('> div').slideToggle(300);
94      $(this).parents('.toggle').toggleClass('open');
95      
96      //switch icon
97      if( $(this).parents('.toggle').hasClass('open') ){
98        $(this).find('i').attr('class','icon-minus-sign');
99      } else {
100        $(this).find('i').attr('class','icon-plus-sign');
101      }
102      
103      return false;
104    }
105  });
106  
107  // Accordion.
108  $('body').on('click','.accordion .toggle h3 a', function(){
109    
110    if($(this).parents('.toggle').hasClass('open')) return false;
111    
112    $(this).parents('.toggles').find('.toggle > div').slideUp(300);
113    $(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
114    $(this).parents('.toggles').find('.toggle').removeClass('open');
115    
116    $(this).parents('.toggle').find('> div').slideDown(300);
117    $(this).parents('.toggle').addClass('open');
118    
119    //switch icon
120    if( $(this).parents('.toggle').hasClass('open') ){
121      $(this).find('i').attr('class','icon-minus-sign');
122    } else {
123      $(this).find('i').attr('class','icon-plus-sign');
124    }
125    
126    if($('#nectar_fullscreen_rows').length > 0) {
127      clearTimeout($t);
128      var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
129    }
130    
131    return false;
132  });
133  
134  // accordion start open
135  function accordionInit(){ 
136    $('.accordion').each(function(){
137      $(this).find('> .toggle').first().addClass('open').find('> div').show();
138      $(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
139    });
140    
141    
142    $('.toggles').each(function() {
143      
144      var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
145      
146      $(this).find('.toggle').each(function(){
147        if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
148          var $that = $(this);
149          $(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
150          
151          setTimeout(function(){
152            $that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
153            if($isAccordion === true && $that.index() === 0) $that.find('> div').slideDown(300);
154          },900);
155        } 
156      });
157    });
158  }
159  accordionInit();
160  
161  
162  
163  /**
164  * Testimonial Slider.
165  *
166  * @since 1.0
167  */
168  function nectarTestimonialSliders() {
169    
170    var $testimonialSliders = [];
171    
172    if( typeof NectarTestimonialSlider == 'undefined' ) { 
173      return; 
174    }
175    
176    $('.testimonial_slider').each(function(i){
177      
178      var $that_el = $(this);
179      var $type = ( $(this).is('[data-style]') ) ? $(this).attr('data-style') : 'none';
180      
181      $testimonialSliders[i] = new NectarTestimonialSlider($that_el, $type);
182      
183      
184      if( $(this).is('.disable-height-animation:not([data-style*="multiple_visible"])') ) {
185        $testimonialSliders[i].testimonialSliderHeight(); 
186        setTimeout($testimonialSliders[i].testimonialSliderHeight.bind($testimonialSliders[i]),500);
187      }
188      
189      if( $(this).is('.testimonial_slider[data-style="multiple_visible_minimal"]') ) {
190        $testimonialSliders[i].testimonialSliderHeightMinimalMult();
191        setTimeout($testimonialSliders[i].testimonialSliderHeightMinimalMult.bind($testimonialSliders[i]),500);
192      }
193      
194    });
195  }
196  nectarTestimonialSliders();
197  
198  
199  /**
200  * Progress Bars
201  *
202  * @since 1.0
203  */
204  function progressBars() {
205    
206    $('.nectar-progress-bar').parent().each(function () {
207      
208      var $that = $(this);
209      
210
211        $that.find('.nectar-progress-bar .bar-wrap').css('opacity', '1');
212      
213        $that.find('.nectar-progress-bar').each(function (i) {
214          
215          var percent = $(this).find('span').attr('data-width'),
216          $endNum 		= parseInt($(this).find('span strong i').text()),
217          $that 			= $(this);
218          
219          $that.find('span').css({
220            'width': percent + '%'
221          });
222          
223          setTimeout(function () {
224            
225            $that.find('span strong').css({
226              'opacity': 1
227            });
228            
229          }, (i * 90));
230          
231          ////100% progress bar 
232          if (percent === '100') {
233            $that.find('span strong').addClass('full');
234          }
235        });
236        
237        $that.addClass('completed');
238        
239      
240    });
241  }
242  progressBars();
243  
244  
245  /**
246  * Image Comparison.
247  *
248  * @since 1.0
249  */
250  function twentytwentyInit() {
251    $('.twentytwenty-container').each(function () {
252      var $that = $(this);
253      
254      if ($that.find('.twentytwenty-handle').length === 0) {
255        $(this).imagesLoaded(function () {
256          $that.twentytwenty();
257        });
258      }
259      
260    });
261  }
262  twentytwentyInit();
263  
264  
265  
266  // Team Member Fullscreen.
267  function teamMemberFullscreen() {
268    
269    if ( $('.team-member').length === 0 ) {
270      return;
271    }
272    
273    // Open click event
274    $body.on('click', '.team-member[data-style="bio_fullscreen"]', function () {
275      
276      if ($('.nectar_team_member_overlay').length > 0) {
277        return;
278      }
279      
280      var $usingBoxedClass  = ($('body > #boxed').length > 0) ? 'in-boxed' : null,
281      $teamMemberMeta       = $(this).find('.nectar_team_bio').html(),
282      $teamMemberImg        = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '';
283      
284      $body.append('<div class="nectar_team_member_overlay ' + $usingBoxedClass + '"><div class="inner-wrap"><div class="team_member_details"><div class="bio-inner"><span class="mobile-close"></span><h2>' + $(this).find('.team-meta h3').html() + '</h2><div class="title">' + $(this).find('.team-meta p').html() + '</div><div class="team-desc">' + $teamMemberMeta + '</div></div></div><div class="team_member_picture"><div class="team_member_image_bg_cover"></div><div class="team_member_picture_wrap"><div class="team_member_image"></div></div></div></div></div><div class="nectar_team_member_close ' + $usingBoxedClass + '"><div class="inner"></div></div>');
285      
286      if ($teamMemberImg.length > 0) {
287        
288        // Fade in img on load
289        var teamTmpImg = new Image();
290        teamTmpImg.src = $teamMemberImg;
291        teamTmpImg.onload = function () {
292          $('.nectar_team_member_overlay .team_member_image').css('opacity', '1');
293        };
294        $('.nectar_team_member_overlay .team_member_image').css({
295          'background-image': 'url("' + $teamMemberImg + '")'
296        });
297      }
298      
299      var $headerNavSpace = 0;
300      $('.nectar_team_member_overlay .inner-wrap').css({
301        'padding-top': $headerNavSpace
302      });
303      
304      // No-scroll class - ios ready
305      if ($('.using-mobile-browser').length > 0) {
306        $('body,html').addClass('nectar-no-scrolling');
307      }
308      
309      teamFullscreenResize();
310      
311      // Transition in
312      $('.nectar_team_member_overlay')
313        .addClass('open')
314        .addClass('animating');
315      
316      setTimeout(function () {
317        $('.nectar_team_member_close').addClass('visible');
318        $('.nectar_team_member_overlay').removeClass('animating');
319      }, 500);
320      
321      // Bind close mousemove
322      $(document).on('mousemove', teamMousemoveOn);
323      
324      
325      if ($('.team-member[data-style="bio_fullscreen"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) {
326        $('.nectar_team_member_overlay').addClass('on-mobile');
327      }
328      
329    });
330    
331    // Close click event
332    $body.on('click', '.nectar_team_member_overlay', function () {
333      
334      if (!$(this).hasClass('animating')) {
335        
336        $('.nectar_team_member_overlay').removeClass('open');
337        $('.nectar_team_member_close').removeClass('visible');
338        
339        if ($('.using-mobile-browser').length > 0) {
340          $('body,html').removeClass('nectar-no-scrolling');
341        }
342        
343        setTimeout(function () {
344          
345          // Unbind close mousemove
346          $(document).off('mousemove', teamMousemoveOn);
347          
348          $('.nectar_team_member_overlay, .nectar_team_member_close').remove();
349          
350        }, 820);
351      }
352    });
353    
354    if ($('.team-member[data-style="bio_fullscreen"]').length > 0) {
355      $window.on('resize', teamFullscreenResize);
356    }
357
358  }
359  
360  
361  /**
362  * Team member element fullscreen resize event.
363  *
364  * @since 1.0
365  */
366  function teamFullscreenResize() {
367    var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $window.width() > 1000) ? 275 : 0;
368    $('.nectar_team_member_overlay').css({
369      'width': $window.width() - $leftHeaderSize,
370      'left': $leftHeaderSize
371    });
372  }
373  
374  
375  /**
376  * Team member element fullscreen close button follow on mousemove.
377  *
378  * @since 1.0
379  */
380  function teamMousemoveOn(e) {
381    
382    if ($('a:hover').length > 0) {
383      $('.nectar_team_member_close .inner').removeClass('visible');
384    } else {
385      $('.nectar_team_member_close .inner').addClass('visible');
386    }
387    $('.nectar_team_member_close').css({
388      left: e.pageX - 26,
389      top: e.pageY - $window.scrollTop() - 29
390    });
391  }
392  
393  teamMemberFullscreen();
394  
395  
396  /**
397  * Page builder full height row option.
398  *
399  * @since 8.0
400  */
401  
402  function vcFullHeightRow() {
403    
404    var $element = $(".vc_row-o-full-height:first");
405    if ($element.length) {
406      
407      var windowHeight, offsetTop, fullHeight;
408      windowHeight = $window.height();
409      
410      $(".vc_row-o-full-height").each(function () {
411        
412        offsetTop = $(this).offset().top;
413        
414        if (offsetTop < windowHeight && 
415          $(this).hasClass('top-level')) {
416            
417          fullHeight = 100 - offsetTop / (windowHeight / 100);
418          $(this).css("min-height", fullHeight + "vh");
419          $(this).find('> .col.span_12').css("min-height", fullHeight + "vh");
420          
421        } else {
422          
423          $(this).css("min-height", windowHeight);
424          $(this).find('> .col.span_12').css("min-height", windowHeight);
425          
426        }
427        
428      });
429      
430    }
431    
432  }
433  
434  
435  /**
436  * Page builder full height row init.
437  *
438  * @since 10.1
439  */
440  
441  function vcFullHeightRowInit() {
442    
443    if( $('.vc_row-o-full-height').length > 0 ) {
444      vcFullHeightRow();
445      $window.on('smartresize', vcFullHeightRow);
446    }
447    
448  }
449  
450  vcFullHeightRowInit();
451  
452  
453  
454});

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.