PageSourceSearch

https://www.uninter.com/biblioteca/wp-content/themes/vantageChild/js/jquery.theme-main.min.js?ver=1.6.7

js uninter.com collected 2026-10-01 10:20:24 UTC 16,535 bytes, 435 lines download raw bytes

1/**
2 * Main theme Javascript - (c) Greg Priday, freely distributable under the terms of the GPL 2.0 license.
3 */
4
5/* global jQuery */
6
7jQuery(function($){
8    $('body.no-js').removeClass('no-js');
9
10    // Initialize FlexSlider.
11    $('.entry-content .flexslider:not(.metaslider .flexslider), #metaslider-demo.flexslider, .gallery-format-slider').flexslider( { } );
12
13    // Setup fitvids for entry content, video post format, panels, woocommerce pages, masthead widget area and the header sidebar.
14    if(typeof $.fn.fitVids !== 'undefined') {
15        $('.entry-content, .entry-content .panel, .entry-video, .woocommerce #main, #masthead-widgets, #header-sidebar' ).fitVids({ ignore: '.tableauViz' });
16    }
17
18	var isMobileDevice = $('body').hasClass('so-vantage-mobile-device'),
19		isCustomizer = $('body').hasClass('so-vantage-customizer-preview'),
20		isMobileNav = $('nav.site-navigation.primary').hasClass('mobile-navigation');
21    if( ( !isMobileDevice && $('#scroll-to-top').hasClass('scroll-to-top') ) || ( ( isCustomizer || isMobileDevice ) ) ) {
22
23        // Everything we need for scrolling up and down.
24        $(window).scroll( function(){
25            if($(window).scrollTop() > 150) {
26                $('#scroll-to-top').addClass('displayed');
27            }
28            else {
29                $('#scroll-to-top').removeClass('displayed');
30            }
31        } );
32
33        $('#scroll-to-top').click( function(){
34            $("html, body").animate( { scrollTop: "0px" } );
35            return false;
36        } );
37    }
38
39    // The carousel widget
40    $('.vantage-carousel').each(function(){
41        var $$ = $(this);
42        var wrap = $$.closest('.widget');
43        var title = wrap.find('.widget-title');
44        var $items = $$.find('.carousel-entry');
45        var $firstItem = $items.eq(0);
46
47        var position = 0, page = 1, fetching = false, complete = false, numItems = $items.length, itemWidth = ( $firstItem.width() + parseInt($firstItem.css('margin-right')) );
48
49        var updatePosition = function() {
50            if ( position < 0 ) {
51                position = 0;
52            }
53            if ( position >= $$.find('.carousel-entry').length - 1 ) {
54                position = $$.find('.carousel-entry').length - 1;
55
56                // Fetch the next batch
57                if( !fetching && !complete) {
58                    fetching = true;
59                    page++;
60                    $$.append('<li class="loading"></li>');
61
62                    $.get(
63                        $$.data('ajax-url'),
64                        {
65                            query : $$.data('query'),
66                            action : 'vantage_carousel_load',
67                            paged : page
68                        },
69                        function (data, status){
70                            var $items = $(data.html);
71                            var count = $items.find('.carousel-entry').appendTo($$).hide().fadeIn().length;
72                            numItems += count;
73                            if(count === 0) {
74                                complete = true;
75                                $$.find('.loading').fadeOut(function(){
76                                    $(this).remove();
77                                });
78                            }
79                            else {
80                                $$.find('.loading').remove();
81                            }
82                            fetching = false;
83                        }
84                    );
85                }
86            }
87            $$.css('transition-duration', "0.45s");
88            $$.css('margin-left', -( itemWidth * position) + 'px' );
89        };
90
91        title.find('a.previous').click( function(){
92            position -= 1;
93            updatePosition();
94            return false;
95        } );
96
97        title.find('a.next').click( function(){
98            position += 1;
99            updatePosition();
100            return false;
101        } );
102
103        // Setup swiping for mobile devices
104        var validSwipe = false;
105        var prevDistance = 0;
106        var startPosition = 0;
107        var velocity = 0;
108        var prevTime = 0;
109        var posInterval;
110        $$.swipe( {
111            excludedElements: "",
112            triggerOnTouchEnd: true,
113            threshold: 75,
114            swipeStatus: function (event, phase, direction, distance, duration, fingerCount, fingerData) {
115                if ( phase === "start" ) {
116                    startPosition = -( itemWidth * position);
117                    prevTime = new Date().getTime();
118                    clearInterval(posInterval);
119                }
120                else if ( phase === "move" ) {
121                    if( direction === "left" ) {
122                        distance *= -1;
123                    }
124                    setNewPosition(startPosition + distance);
125                    var newTime = new Date().getTime();
126                    var timeDelta = (newTime - prevTime) / 1000;
127                    velocity = (distance - prevDistance) / timeDelta;
128                    prevTime = newTime;
129                    prevDistance = distance;
130                }
131                else if ( phase === "end" ) {
132                    validSwipe = true;
133                    if( direction === "left" ) {
134                        distance *= -1;
135                    }
136                    if(Math.abs(velocity) > 400) {
137                        velocity *= 0.1;
138                        var startTime = new Date().getTime();
139                        var cumulativeDistance = 0;
140                        posInterval = setInterval(function () {
141                            var time = (new Date().getTime() - startTime) / 1000;
142                            cumulativeDistance += velocity * time;
143                            var newPos = startPosition + distance + cumulativeDistance;
144                            var decel = 30;
145                            var end = (Math.abs(velocity) - decel) < 0;
146                            if( direction === "left" ) {
147                                velocity += decel;
148                            }
149                            else {
150                                velocity -= decel;
151                            }
152                            if(end || !setNewPosition(newPos)) {
153                                clearInterval(posInterval);
154                                setFinalPosition();
155                            }
156                        }, 20);
157                    } else {
158                        setFinalPosition();
159                    }
160                }
161                else if( phase === "cancel") {
162                    updatePosition();
163                }
164            }
165        } );
166
167        var setNewPosition = function(newPosition) {
168            if(newPosition < 50 && newPosition >  -( itemWidth * numItems )) {
169                $$.css('transition-duration', "0s");
170                $$.css('margin-left', newPosition + 'px' );
171                return true;
172            }
173            return false;
174        };
175        var setFinalPosition = function() {
176            var finalPosition = parseInt( $$.css('margin-left') );
177            position = Math.abs( Math.round( finalPosition / itemWidth ) );
178            updatePosition();
179        };
180
181        // Prevent clicks when we're swiping
182        $$.on('click', 'li.carousel-entry .thumbnail a', function (event) {
183            if(validSwipe) {
184                event.preventDefault();
185                validSwipe = false;
186            }
187        } );
188    } );
189
190    // The menu hover effects
191    $('#masthead')
192        .on('mouseenter', '.main-navigation ul li', function(){
193            var $$ = $(this);
194            var $ul = $$.find('> ul');
195            $ul.css({
196                'display' : 'block',
197                'opacity' : 0
198            }).clearQueue().animate({opacity: 1}, 250);
199            $ul.data('final-opacity', 1);
200        } )
201        .on('mouseleave', '.main-navigation ul li', function(){
202            var $$ = $(this);
203            var $ul = $$.find('> ul');
204            $ul.clearQueue().animate( {opacity: 0}, 250, function(){
205                if($ul.data('final-opacity') === 0) {
206                    $ul.css('display', 'none');
207                }
208            });
209            $ul.data('final-opacity', 0);
210        } );
211
212    // Hover for the menu widget in the header
213    $( '#header-sidebar .widget_nav_menu', '#masthead-widgets .widget_nav_menu' )
214        .on('mouseenter', 'ul.menu li', function(){
215            var $$ = $(this);
216            var $ul = $$.find('> ul');
217            $ul.finish().css('opacity', 0)
218                .hide().slideDown(200)
219                .animate( { opacity: 1 }, { queue: false, duration: 200 } );
220        } )
221        .on('mouseleave', 'ul.menu li', function(){
222            var $$ = $(this);
223            var $ul = $$.find('> ul');
224            $ul.finish().fadeOut(150);
225        } );
226
227    // The search bar
228    var isSearchHover = false;
229    $(document).click(function(){
230        if(!isSearchHover) {
231            $('#search-icon form').fadeOut(250);
232        }
233    });
234
235    $(document)
236        .on('click','#search-icon-icon', function(){
237            var $$ = $(this).parent();
238            $$.find('form').fadeToggle(250);
239            setTimeout(function(){
240                $$.find('input[name=s]').focus();
241            }, 300);
242        } );
243
244    $( document )
245        .keyup( function(e) {
246            if ( e.keyCode == 27 ) { // escape key maps to keycode `27`
247                $('#search-icon form').fadeOut(250);
248            }
249        } );
250
251    $(document)
252        .on('mouseenter', '#search-icon', function(){
253            isSearchHover = true;
254        } )
255        .on('mouseleave', '#search-icon', function(){
256            isSearchHover = false;
257        } );
258
259    $(window).resize(function() {
260        $('#search-icon .searchform').each(function(){
261            $(this).width($(this).closest('.full-container').width());
262        });
263    }).resize();
264
265    // The sticky menu
266    if( ( $('nav.site-navigation.primary').hasClass('use-sticky-menu') && !isMobileDevice ) ||
267        ( ( isMobileDevice || isCustomizer ) && isMobileNav ) ) {
268
269        var $$ = $('nav.site-navigation.primary');
270        var $stickyContainer = $('<span id="menu-princ"></span>');
271
272        //$stickyContainer.css('margin-left', $$.css('margin-left'));
273        //$stickyContainer.css('margin-right', $$.css('margin-right'));
274        //$stickyContainer.css('position', $$.css('position'));
275        var $initTop;
276        var resetStickyMenu = function(){
277            if($initTop == null || typeof $initTop == "undefined") {
278                $initTop = $$.offset().top;
279            }
280            var threshold = 0;
281            if ( $('body').hasClass('admin-bar') ) {
282                var adminBar = $('#wpadminbar');
283                var adminBarHeight = adminBar.outerHeight();
284                threshold = adminBar.css('position') == "absolute" ? 0 : adminBarHeight;
285            }
286            var scrollTop = $(window).scrollTop();
287            var navTop = parseInt($initTop - scrollTop);//Force truncation of float value.
288            if( navTop < threshold ) {
289                if( ! $$.hasClass( 'sticky') ) {
290                    $$.wrapAll( $stickyContainer );
291                    // Work out the current position
292                    $$.css({
293                        'position' : 'absolute',
294
295                        'width' : '100%',
296						'padding':'0px',
297                        'top' : '50px',
298                        'left' : 'auto',
299
300                        'z-index' : 999
301                    }).addClass('sticky');
302
303                }
304				// else {
305
306                    // $$.css({
307                        // 'width': $$.parent().width(),
308                        // 'top': threshold,
309                        // 'left': $$.parent().position().left
310
311
312                    // });
313                // }
314                $$.parent().css('height', $$.outerHeight());
315            }
316            else {
317                if($$.hasClass('sticky')) {
318                    $$.css({
319                        'position': 'absolute',
320
321                        'width': '100%',
322						'padding':'0px',						
323                        'top': '50px',
324                        'left': 'auto',
325                        'z-index': '999'
326                    }).removeClass('sticky');
327                    $$.unwrap();
328                    $initTop = null;
329                }
330            }
331        };
332        $(window).scroll( resetStickyMenu ).resize( resetStickyMenu );
333        resetStickyMenu();
334    }
335
336    // Lets make the slider stretch.
337    $('body.layout-full #main-slider[data-stretch="true"]').each(function(){
338        var $$ = $(this);
339        $$.find('>div').css('max-width', '100%');
340        $$.find('.slides li').each(function(){
341            var $s = $(this);
342
343            // Move the image into the background
344            var $img = $s.find('img.ms-default-image').eq(0);
345            if(!$img.length) {
346                $img = $s.find('img').eq(0);
347            }
348
349            $s.css('background-image', 'url(' + $img.attr('src') + ')');
350            $img.css('visibility', 'hidden');
351            // Add a wrapper
352            $s.wrapInner('<div class="full-container"></div>');
353            // This is because IE doesn't detect links correctly when we stretch slider images.
354            var link = $s.find('a');
355            if(link.length) {
356                $s.mouseover(function () {
357                    $s.css('cursor', 'hand');
358                });
359                $s.mouseout(function () {
360                    $s.css('cursor', 'pointer');
361                });
362                $s.click(function ( event ) {
363                    event.preventDefault();
364                    var clickTarget = $(event.target);
365                    var navTarget = clickTarget.is('a') ? clickTarget : link;
366                    window.open( navTarget.attr( 'href' ), navTarget.attr( 'target' ) );
367                });
368            }
369        });
370    });
371
372    // Resize the header widget area
373    $('#header-sidebar').each(function(){
374        var $$ = $(this);
375        var padding = 0;
376        $$.find('> aside').each(function(){
377            var thisPadding = ( $$.outerHeight() - $$.find('> aside').outerHeight() ) / 2;
378            if(thisPadding > padding) {
379                padding = thisPadding;
380            }
381        });
382
383        if(padding > 15) {
384            $$.css({
385                'padding-top' : padding,
386                'padding-bottom' : padding
387            });
388        }
389        else{
390            padding = -padding + 15;
391            $('#masthead .logo > *').css({
392                'padding-top' : padding,
393                'padding-bottom' : padding
394            });
395        }
396
397        if( $$.hasClass('no-logo-overlay') ) {
398            // This will prevent the widgets from overlaying the logo
399            var autoResponsive = function(){
400                $$.closest('#masthead').removeClass('force-responsive');
401                var $l = $('#masthead .logo').find('h1,img');
402                if( $$.offset().left < $l.offset().left + $l.outerWidth() ) {
403                    $$.closest('#masthead').addClass('force-responsive');
404                }
405            };
406            $(window).resize(autoResponsive);
407            autoResponsive();
408        }
409
410    });
411
412	$('#colophon #footer-widgets .widget_nav_menu a').each(function(){
413		var $$ = $(this),
414			itemDepth = $(this).parents('.sub-menu').length,
415			itemPadding = ( 10 * itemDepth ) + 'px';
416
417		$(this).css('padding-left',itemPadding);
418	});
419
420});
421
422( function($) {
423	$(window).load( function() {
424		// Aligning menu elements
425		var mhHeight = $( '.masthead-logo-in-menu' ).height(),
426			menuItemHeight = $( '.masthead-logo-in-menu .menu > .menu-item' ).outerHeight(),
427			logoHeight = $( '.masthead-logo-in-menu .logo' ).outerHeight();
428		if( mhHeight > menuItemHeight ) {
429			$( '.masthead-logo-in-menu .menu > .menu-item' ).css( 'margin-top', ( mhHeight - menuItemHeight ) / 1);
430		}
431		if( mhHeight > logoHeight ) {
432			$( '.masthead-logo-in-menu .logo' ).css( 'margin-top', ( mhHeight - logoHeight ) / 1);
433		}
434	} );
435} )(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.