PageSourceSearch

https://www.elsembrador.com.mx/javascript/main.js

js elsembrador.com.mx collected 2026-10-08 11:53:43 UTC 22,886 bytes, 629 lines download raw bytes

1/**
2  * isMobile
3  * responsiveMenu
4  * headerFixed
5  * scrollBtn
6  * onepage_nav 
7  * ajaxAppointmentl
8  * ajaxContactForm
9  * alertBox
10  * detectViewport
11  * counter
12  * tabs
13  * flatPricingCarousel
14  * flatTestimonials
15  * simpleSlider
16  * datepicker
17  * sectionVideo
18  * googleMap  
19  * responsiveVideo
20  * flatAnimation
21  * goTop
22  * retinaLogos
23  * parallax
24  * removePreloader
25*/
26
27;(function($) {
28
29   'use strict'
30
31    var isMobile = {
32        Android: function() {
33            return navigator.userAgent.match(/Android/i);
34        },
35        BlackBerry: function() {
36            return navigator.userAgent.match(/BlackBerry/i);
37        },
38        iOS: function() {
39            return navigator.userAgent.match(/iPhone|iPad|iPod/i);
40        },
41        Opera: function() {
42            return navigator.userAgent.match(/Opera Mini/i);
43        },
44        Windows: function() {
45            return navigator.userAgent.match(/IEMobile/i);
46        },
47        any: function() {
48            return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
49        }
50    };
51
52    var headerFixed = function() {
53        if ( $('body').hasClass('header-sticky') ) {
54            var nav = $('.header');
55
56            if ( nav.size() != 0 ) {
57                var offsetTop = $('.header').offset().top,
58                    headerHeight = $('.header').height(),
59                    injectSpace = $('<div />', { height: headerHeight }).insertAfter(nav);   
60                    injectSpace.hide();                 
61
62                $(window).on('load scroll', function(){
63                    if ( $(window).scrollTop() > offsetTop + 120 ) {
64                        $('.header').addClass('downscrolled');
65                        injectSpace.show();
66                    } else {
67                        $('.header').removeClass('header-small downscrolled');
68                        injectSpace.hide();
69                    }
70
71                    if ( $(window).scrollTop() > 500 ) {
72                        $('.header').addClass('header-small upscrolled');
73                    } else {
74                        $('.header').removeClass('upscrolled');
75                    }
76                })
77            }
78        }     
79    };
80
81	var responsiveMenu = function() {
82        var menuType = 'desktop';
83
84        $(window).on('load resize', function() {
85            var currMenuType = 'desktop';
86
87            if ( matchMedia( 'only screen and (max-width: 991px)' ).matches ) {
88                currMenuType = 'mobile';
89            }
90
91            if ( currMenuType !== menuType ) {
92                menuType = currMenuType;
93
94                if ( currMenuType === 'mobile' ) {
95                    var $mobileMenu = $('#mainnav').attr('id', 'mainnav-mobi').hide();
96                    var hasChildMenu = $('#mainnav-mobi').find('li:has(ul)');
97
98                    $('#header').after($mobileMenu);
99                    hasChildMenu.children('ul').hide();
100                    hasChildMenu.children('a').after('<span class="btn-submenu"></span>');
101                    $('.btn-menu').removeClass('active');
102                } else {
103                    var $desktopMenu = $('#mainnav-mobi').attr('id', 'mainnav').removeAttr('style');
104
105                    $desktopMenu.find('.submenu').removeAttr('style');
106                    $('#header').find('.nav-wrap').append($desktopMenu);
107                    $('.btn-submenu').remove();
108                }
109            }
110        });
111
112        $('.btn-menu').on('click', function() {        	
113            $('#mainnav-mobi').slideToggle(300);
114            $(this).toggleClass('active');
115        });
116
117        $(document).on('click', '#mainnav-mobi li .btn-submenu', function(e) {
118            $(this).toggleClass('active').next('ul').slideToggle(300);
119            e.stopImmediatePropagation()
120        });
121    }
122
123    var counter = function() {
124        $('.flat-counter').on('on-appear', function() {
125            $(this).find('.numb-count').each(function() {
126                var to = parseInt($(this).attr('data-to'),10), speed = parseInt($(this).attr('data-speed'),10);
127                if ( $().countTo ) {
128                    $(this).countTo({
129                        to: to,
130                        speen: speed
131                    });
132                }
133            });
134        }); //counter
135    };
136
137    var testimonial = function () {
138      $('.testimonial-text').bxSlider({
139         mode: 'fade',
140         touchEnabled: true,
141         oneToOneTouch: true,
142         pagerCustom: '#bx-pager',
143         nextSelector: '#bx-next',
144         prevSelector: '#bx-prev',
145         nextText: '<i class="icons-angle-right"></i>',
146         prevText: '<i class="icons-angle-left"></i>',
147      });
148   };
149
150    var detectViewport = function() {
151        $('[data-waypoint-active="yes"]').waypoint(function() {
152            $(this).trigger('on-appear');
153        }, { offset: '90%', triggerOnce: true });
154    };
155
156    var portfolioIsotope = function() { 
157        if ( $().isotope ) {           
158            var $container = $('.portfolio-wrap');
159            $container.imagesLoaded(function(){
160                $container.isotope({
161                    itemSelector: '.item',
162                    transitionDuration: '1s'
163                });
164            });
165
166            $('.portfolio-filter li').on('click',function() {                           
167                var selector = $(this).find("a").attr('data-filter');
168                $('.portfolio-filter li').removeClass('active');
169                $(this).addClass('active');
170                $container.isotope({ filter: selector });
171                return false;
172            });            
173        };
174    };
175
176    var flatchooseus = function() {
177        $('.flat-silder').each(function() { 
178            if ( $().owlCarousel ) {
179                $(this).find('.post').owlCarousel({
180                    loop: true,
181                    nav: false,
182                    dots: true,
183                    margin: 0,                     
184                    autoplay: true,                    
185                    responsive:{
186                        0:{
187                            items: 1
188                        },
189                        767:{
190                            items: 1
191                        },
192                        991:{
193                            items: 1
194                        },
195                        1200: {
196                            items: 1
197                        }
198                    }
199                });
200            }
201        });
202    };
203
204    var flatreviews = function() {
205        $('.flat-silder').each(function() { 
206            if ( $().owlCarousel ) {
207                $(this).find('.featured-causes').owlCarousel({
208                    loop: true,
209                    nav: false,
210                    dots: true,
211                    margin: 0,                     
212                    autoplay: true,                    
213                    responsive:{
214                        0:{
215                            items: 1
216                        },
217                        767:{
218                            items: 1
219                        },
220                        991:{
221                            items: 1
222                        },
223                        1200: {
224                            items: 1
225                        }
226                    }
227                });
228            }
229        });
230    };
231    
232    var retinaLogos = function() {
233      var retina = window.devicePixelRatio > 1 ? true : false;
234
235        if(retina) {
236            $('.header .logo').find('img').attr( {src:'./images/[email protected]'} );   
237        }
238    }; 
239
240    var progressCircle = function() {
241        $('.flat-progress-circle').on('on-appear', function() {
242            $(this).each(function() {
243                if ( $().easyPieChart ) {
244                    $(this).easyPieChart({
245                        lineWidth: 8,
246                        barColor: '#ed9f24',
247                        trackColor: 'transparent',
248                        scaleColor: false,
249                        animate: 3000,
250                        lineCap: 'square',
251                        onStep: function(from, to, value) {
252                            $(this.el).find('.inner-circle span:eq(1)').text(~~value);
253                        }
254                    });
255                }
256            });
257        });
258    }; 
259
260    var ajaxContactForm = function() {  
261        $('#contactform').each(function() {
262            $(this).validate({
263                submitHandler: function( form ) {
264                    var $form = $(form),
265                        str = $form.serialize(),
266                        loading = $('<div />', { 'class': 'loading' });
267
268                    $.ajax({
269                        type: "POST",
270                        url:  $form.attr('action'),
271                        data: str,
272                        beforeSend: function () {
273                            $form.find('.submit-wrap').append(loading);
274                        },
275                        success: function( msg ) {
276                            var result, cls;                            
277                            if ( msg == 'Success' ) {                                
278                                result = 'Mensaje enviado con éxito';
279                                cls = 'msg-success';
280                            } else {
281                                result = 'Error sending email.';
282                                cls = 'msg-error';
283                            }
284
285                            $form.prepend(
286                                $('<div />', {
287                                    'class': 'flat-alert ' + cls,
288                                    'text' : result
289                                }).append(
290                                    $('<a class="close" href="#"><i class="fa fa-close"></i></a>')
291                                )
292                            );
293
294                            $form.find(':input').not('.submit').val('');
295                        },
296                        complete: function (xhr, status, error_thrown) {
297                            $form.find('.loading').remove();
298                        }
299                    });
300                }
301            });
302        }); // each contactform
303    };   
304
305    var alertBox = function() {
306        $(document).on('click', '.close', function(e) {
307            $(this).closest('.flat-alert').remove();
308            e.preventDefault();
309        })     
310    }    
311
312    var googleMap = function() {
313        if ( $().gmap3 ) {
314            $("#flat-map").gmap3({
315                map:{
316                    options:{
317                        zoom: 11,
318                        mapTypeId: 'iseo_style',
319                        mapTypeControlOptions: {
320                            mapTypeIds: ['iseo_style', google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.HYBRID]
321                        },
322                        scrollwheel: false
323                    }
324                },
325                getlatlng:{
326                    address:  "Thành phố New York, Tiểu bang New York",
327                    callback: function(results) {
328                        if ( !results ) return;
329                        $(this).gmap3('get').setCenter(new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()));
330                        $(this).gmap3({
331                            marker:{
332                                latLng:results[0].geometry.location,
333                                options:{
334                                    icon: 'http://themesflat.com/html/iseo/images/icon/marker.png'
335                                }
336                            }
337                        });
338                    }
339                },
340                styledmaptype:{
341                    id: "iseo_style",
342                    options:{
343                        name: "Iseo Map"
344                    }, 
345                    styles:[
346                        {
347                            "featureType": "administrative",
348                            "elementType": "labels.text.fill",
349                            "stylers": [
350                                {
351                                    "color": "#444444"
352                                }
353                            ]
354                        },
355                        {
356                            "featureType": "landscape",
357                            "elementType": "all",
358                            "stylers": [
359                                {
360                                    "color": "#f2f2f2"
361                                }
362                            ]
363                        },
364                        {
365                            "featureType": "poi",
366                            "elementType": "all",
367                            "stylers": [
368                                {
369                                    "visibility": "off"
370                                }
371                            ]
372                        },
373                        {
374                            "featureType": "road",
375                            "elementType": "all",
376                            "stylers": [
377                                {
378                                    "saturation": -100
379                                },
380                                {
381                                    "lightness": 45
382                                }
383                            ]
384                        },
385                        {
386                            "featureType": "road.highway",
387                            "elementType": "all",
388                            "stylers": [
389                                {
390                                    "visibility": "simplified"
391                                }
392                            ]
393                        },
394                        {
395                            "featureType": "road.arterial",
396                            "elementType": "labels.icon",
397                            "stylers": [
398                                {
399                                    "visibility": "off"
400                                }
401                            ]
402                        },
403                        {
404                            "featureType": "transit",
405                            "elementType": "all",
406                            "stylers": [
407                                {
408                                    "visibility": "off"
409                                }
410                            ]
411                        },
412                        {
413                            "featureType": "water",
414                            "elementType": "all",
415                            "stylers": [
416                                {
417                                    "color": "#46bcec"
418                                },
419                                {
420                                    "visibility": "on"
421                                }
422                            ]
423                        }
424                    ]
425                },
426            });
427        }
428    };    
429   
430    var blogMasory = function() {         
431        if ( $().isotope ) {           
432            var $container = $('.post-wrap');
433            $container.imagesLoaded(function(){
434                $container.masonry({
435                    itemSelector: '.entry',
436                    transitionDuration: '0.5s',                    
437                    layoutMode: 'masonry',                 
438                    masonry: { columnWidth: $container.width() / 12 }
439                }); // isotope
440             });
441
442            $(window).resize(function() {
443                $container.masonry({
444                   masonry: { columnWidth: $container.width() / 12 }
445                });
446            }); // relayout        
447            
448        };
449    };
450
451    var goTop = function() {
452        $(window).scroll(function() {
453            if ( $(this).scrollTop() > 500 ) {
454                $('.go-top').addClass('show');
455            } else {
456                $('.go-top').removeClass('show');
457            }
458        }); 
459
460        $('.go-top').on('click', function() {            
461            $("html, body").animate({ scrollTop: 0 }, 1000 , 'easeInOutExpo');
462            return false;
463        });
464    }; 
465    
466    var parallax = function() {
467        if ( $().parallax && isMobile.any() == null ) {
468            $('.parallax1').parallax("50%", 0.2);
469            $('.parallax2').parallax("50%", 0.4);  
470            $('.parallax3').parallax("50%", 0.5);            
471        }
472    };   
473
474    var videoPopup =  function() {
475        $(".fancybox").on("click", function(){
476            $.fancybox({
477              href: this.href,
478              type: $(this).data("type")
479            }); // fancybox
480            return false   
481        }); // on
482    }  
483
484     var ajaxSubscribe = {
485        obj: {
486            subscribeEmail    : $('#subscribe-email'),
487            subscribeButton   : $('#subscribe-button'),
488            subscribeMsg      : $('#subscribe-msg'),
489            subscribeContent  : $("#subscribe-content"),
490            dataMailchimp     : $('#subscribe-form').attr('data-mailchimp'),
491            success_message   : '<div class="notification_ok">Thank you for joining our mailing list! Please check your email for a confirmation link.</div>',
492            failure_message   : '<div class="notification_error">Error! <strong>There was a problem processing your submission.</strong></div>',
493            noticeError       : '<div class="notification_error">{msg}</div>',
494            noticeInfo        : '<div class="notification_error">{msg}</div>',
495            basicAction       : 'mail/subscribe.php',
496            mailChimpAction   : 'mail/subscribe-mailchimp.php'
497        },
498
499        eventLoad: function() {
500            var objUse = ajaxSubscribe.obj;
501
502            $(objUse.subscribeButton).on('click', function() {
503                if ( window.ajaxCalling ) return;
504                var isMailchimp = objUse.dataMailchimp === 'true';
505
506                if ( isMailchimp ) {
507                    ajaxSubscribe.ajaxCall(objUse.mailChimpAction);
508                } else {
509                    ajaxSubscribe.ajaxCall(objUse.basicAction);
510                }
511            });
512        },
513
514        ajaxCall: function (action) {
515            window.ajaxCalling = true;
516            var objUse = ajaxSubscribe.obj;
517            var messageDiv = objUse.subscribeMsg.html('').hide();
518            $.ajax({
519                url: action,
520                type: 'POST',
521                dataType: 'json',
522                data: {
523                   subscribeEmail: objUse.subscribeEmail.val()
524                },
525                success: function (responseData, textStatus, jqXHR) {
526                    if ( responseData.status ) {
527                        objUse.subscribeContent.fadeOut(500, function () {
528                            messageDiv.html(objUse.success_message).fadeIn(500);
529                        });
530                    } else {
531                        switch (responseData.msg) {
532                            case "email-required":
533                                messageDiv.html(objUse.noticeError.replace('{msg}
533','Error! <strong>Email is required.</strong>'));
534                                break;
535                            case "email-err":
536                                messageDiv.html(objUse.noticeError.replace('{msg}','Error! <strong>Email invalid.</strong>'));
537                                break;
538                            case "duplicate":
539                                messageDiv.html(objUse.noticeError.replace('{msg}','Error! <strong>Email is duplicate.</strong>'));
540                                break;
541                            case "filewrite":
542                                messageDiv.html(objUse.noticeInfo.replace('{msg}','Error! <strong>Mail list file is open.</strong>'));
543                                break;
544                            case "undefined":
545                                messageDiv.html(objUse.noticeInfo.replace('{msg}','Error! <strong>undefined error.</strong>'));
546                                break;
547                            case "api-error":
548                                objUse.subscribeContent.fadeOut(500, function () {
549                                    messageDiv.html(objUse.failure_message);
550                                });
551                        }
552                        messageDiv.fadeIn(500);
553                    }
554                },
555                error: function (jqXHR, textStatus, errorThrown) {
556                    alert('Connection error');
557                },
558                complete: function (data) {
559                    window.ajaxCalling = false;
560                }
561            });
562        }
563    };
564
565    var swClick = function () {
566        function activeLayout () {
567            $(".switcher-container" )
568            .on( "click", "a.sw-light", function() {
569                $(this).toggleClass( "active" );
570                $('body').addClass('home-boxed');                               
571                $('.sw-pattern.pattern').css ({ "top": "100%", "opacity": 1, "z-index": "10"});
572            })
573            .on( "click", "a.sw-dark", function() {
574                $('.sw-pattern.pattern').css ({ "top": "98%", "opacity": 0, "z-index": "-1"});
575                $(this).removeClass('active').addClass('active');
576                $('body').removeClass('home-boxed');   
577                $('body').css({'background': '#fff' });             
578                return false;
579            })       
580        }
581
582        function activePattern () {
583            $('.sw-pattern').on('click', function () {
584                $('.sw-pattern.pattern a').removeClass('current');
585                $(this).addClass('current');
586                $('body').css({'background': 'url("' + $(this).data('image') + '")', 'background-size' : '30px 30px', 'background-repeat': 'repeat' });
587                return false
588            })
589        }
590
591        activeLayout(); 
592        activePattern();
593    }
594
595    var removePreloader = function() {        
596        $('.loader').fadeOut('slow',function () {
597            $(this).remove();
598        });
599    };
600
601   	// Dom Ready
602	$(function() { 
603
604        if ( matchMedia( 'only screen and (min-width: 991px)' ).matches ) {
605            headerFixed(); 
606        }      
607          
608        flatchooseus();
609        flatreviews();
610        retinaLogos();   
611        progressCircle();  
612        responsiveMenu();   
613        counter();
614        detectViewport();   
615        blogMasory();
616        portfolioIsotope();
617        ajaxContactForm();
618        videoPopup(); 
619        alertBox();
620        parallax();
621        googleMap();
622        ajaxSubscribe.eventLoad();
623        swClick();
624        goTop();        
625        removePreloader();
626        testimonial(); 
627   	});
628
629})(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.