PageSourceSearch

https://ucgomezpalacio.com.mx/wp-content/themes/consulting/assets/js/custom.js?ver=4.0.2

js ucgomezpalacio.com.mx collected 2026-10-07 18:34:24 UTC 26,787 bytes, 653 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    jQuery(document).ready(function ($) {
5
6        var windowSize = $(window).width();
7        l18W();
8        stm_services_carousel();
9
10        $(window).on( "resize", function() {
11            l18W();
12            stm_stretch_column();
13            full_height_columns();
14        });
15
16        $.fn.is_on_screen = function () {
17            var win = $(window);
18            var viewport = {
19                top: win.scrollTop(),
20                left: win.scrollLeft()
21            };
22            viewport.right = viewport.left + win.width();
23            viewport.bottom = viewport.top + win.height();
24
25            var bounds = this.offset();
26            bounds.right = bounds.left + this.outerWidth();
27            bounds.bottom = bounds.top + this.outerHeight();
28
29            return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
30        };
31
32        $(".stm-register-form form").on( "submit", function(e) {
33            e.preventDefault();
34            $.ajax({
35                type: "POST",
36                url: ajaxurl,
37                dataType: 'json',
38                context: this,
39                data: $(this).serialize() + '&action=stm_custom_register&security=' + stm_custom_register,
40                beforeSend: function () {
41                    $(this).find('input').removeClass('form-error');
42                    $('.stm-validation-message').empty();
43                },
44                success: function (data) {
45
46                    for (var err in data.errors) {
47                        $(this).find('input[name=' + err + ']').addClass('form-error');
48                    }
49
50                    if (data.message) {
51                        var message = $('<div class="stm-message-ajax-validation heading-font">' + data.message + '</div>').hide();
52
53                        $(this).find('.stm-validation-message').append(message);
54                        message.slideDown('fast');
55                    }
56                }
57            });
58        });
59
60        $(document).on("click", ".load_more_btn", function (e) {
61            e.preventDefault();
62            var page = $(this).attr("data-page");
63            var load_by = $(this).attr("data-load");
64            var filter = $(this).attr("data-filter");
65            var category = $(this).attr('data-category');
66            $.ajax({
67                url: ajaxurl,
68                type: "POST",
69                dataType: "json",
70                data: "&page=" + page + "&load_by=" + load_by + "&category=" + category + "&filter=" + filter + "&action=stm_ajax_load_events&security=" + stm_ajax_load_events,
71                context: this,
72                beforeSend: function (data) {
73                    $(this).parent().addClass("event_posts_loading");
74                },
75                success: function (data) {
76                    $(this).parent().removeClass("event_posts_loading");
77                    $(".stm_events_modern_list ").append(data.html);
78                    $(this).attr("data-page", data.new_page);
79                    if (!data.load_more) {
80                        $(this).remove();
81                    }
82                }
83            });
84        });
85
86        $('.scroll_to_event_form').on('click', function (e) {
87            event.preventDefault();
88            $('html,body').animate({scrollTop: $(this.hash).offset().top}, 500);
89        });
90
91        $('.show_popup').on('click', function (e) {
92            $(this).parents().find('#video').addClass('video_popup_box')
93        });
94
95        stm_stretch_column();
96
97        function stm_stretch_column() {
98            $('.wpb_column[data-stretch]').each(function () {
99                var stretch = $(this).data('stretch');
100                var xPos = $(this).offset().left;
101                var wW = $(window).width();
102                var xW = $(this).width();
103
104                var value = wW - (xW + xPos);
105                if (stretch == 'left') {
106                    value = xPos;
107                }
108
109                $(this).find('.vc_column-inner').css('width', xW + value + 'px');
110                $(this).find('.vc_column-inner').css('margin-' + stretch, '-' + value + 'px');
111            });
112        };
113
114        //Full height
115        full_height_columns();
116
117        function full_height_columns() {
118
119            $(".full_height_columns").each(function () {
120                var full_height_columns = $(this).find(".wpb_column:first").height();
121                $(this).find("iframe").css("height", full_height_columns);
122            });
123        };
124
125        stm_ajax_add_event_member();
126
127        function stm_ajax_add_event_member() {
128            $("#event-members-form").on("submit", function (event) {
129                event.preventDefault();
130
131                var $this = $(this),
132                    eventID = parseInt($($this).find('input[name="event_member_id"]').val()),
133                    addedEvents = localStorage.getItem('addedEvents'),
134                    eventAdded = false;
135
136                if (addedEvents) {
137                    addedEvents = JSON.parse(addedEvents);
138                    eventAdded = $.inArray(eventID, addedEvents) > -1;
139                }
140                if (!eventAdded) {
141                    $.ajax({
142                        url: ajaxurl,
143                        type: "POST",
144                        dataType: "json",
145                        context: this,
146                        data: $(this).serialize() + "&action=stm_ajax_add_event_member&security=" + stm_ajax_add_event_member_sc,
147                        beforeSend: function () {
148                            $(".alert-modal").remove();
149                            $(this).closest("form").find("input").removeClass("form-error");
150                            $(this).closest("form").find(".stm-ajax-loader").addClass("loading");
151                        },
152                        success: function (data) {
153                            $(this).closest("form").find(".stm-ajax-loader").removeClass("loading");
154
155                            $(this).closest("form").find(".event-members-box").append('<div class="alert-modal alert alert-' + data.status + ' text-left">' + data.response + '</div>');
156                            for (var key in data.errors) {
157                                $('#event-members-form input[name="' + key + '"]').addClass("form-error");
158                            }
159                            if (!$('#event-members-form input[name="' + key + '"]').hasClass('form-error')) {
160                                $(".event-members-box-table .event-attended-count").text(parseInt($(".event-members-box-table .event-attended-count").text()) + 1);
161                                $(".event-attended-count.event-new-count").text(parseInt($(".event-attended-count.event-new-count").text()) + 1);
162                                if (addedEvents) {
163                                    addedEvents.push(eventID);
164                                } else {
165                                    addedEvents = [eventID];
166                                }
167                                localStorage.setItem('addedEvents', JSON.stringify(addedEvents));
168                                $($this).find(".form__notice_success").fadeIn(300);
169                            }
170                            $("#event-members-form button").addClass("disabled").prop('disabled', true);
171                        },
172                        complete: function (data) {
173                            $("#event-members-form")[0].reset();
174                        }
175                    });
176                    $(this).closest("form").find(".form-error").on("hover", function () {
177                        $(this).removeClass("form-error");
178                    });
179                } else {
180                    $($this).find(".form__notice_information").fadeIn(300);
181                }
182                return false;
183            });
184        }
185
186        $(".event_terms_conditions #event_terms_conditions").on("click", function (e) {
187            if ($(this).is(':checked')) {
188                $("#event-members-form button").removeClass("disabled").prop('disabled', false);
189            } else {
190                $("#event-members-form button").addClass("disabled").prop('disabled', true);
191            }
192        });
193
194        $(".event_joining .show_event_list_form").on("click", function (e) {
195            var eventItemValId = $(this).parents(".item").find(".event-item-id").val();
196            $(".stm_events_classic #event-members-form .event_member_id").val(eventItemValId);
197            $(".stm_events_list_form").show();
198            $(this).parents(".item").find(".event-attended-count").addClass("event-new-count");
199        });
200        $(".notice__hide").on("click", function (e) {
201            $(".stm_events_list_form").hide();
202            $("#event-members-form")[0].reset();
203            $("#event-members-form .alert-modal").hide();
204            $("#event-members-form .form__notice_information").hide();
205            $(".stm_events_classic .item").find(".event-attended-count").removeClass("event-new-count");
206        });
207
208        $(".events_lessons_box .event_lesson_tabs:first-child").addClass("active");
209        $('.events_lessons_box .event_lesson_tabs a').each(function (e) {
210            if ($(this).parent().hasClass("active")) {
211                $($(this).attr('href')).show();
212            }
213        });
214        $('.events_lessons_box .event_lesson_tabs a').on('click', function (e) {
215            $(this).parents(".events_lessons_box").find(".event_lesson_info").hide();
216            $(this).parents(".events_lessons_box").find(".event_lesson_tabs").removeClass("active");
217            $(this).parent().addClass("active");
218            $($(this).attr("href")).show();
219            return false;
220        });
221
222        $(document).on("click", ".js-open-search-box", function () {
223            $(this).closest(".header_search").toggleClass("active");
224            return false;
225        });
226
227        if ($(".wpb_revslider_element").length && $('body').hasClass("header_style_7")) {
228            $(".wpb_revslider_element").closest(".vc_row-no-padding").addClass("stm-revslider-wrapper");
229        }
230
231        $(document).on("click", "body", function (e) {
232            if (!$(e.target).closest(".header_search").length) {
233                $(".header_search").removeClass("active");
234
235            }
236        });
237
238        $("body .wpb_video_widget .wpb_wrapper .wpb_video_wrapper .play_video").on('click', function () {
239            $(this).parent().find('iframe').attr('allow', 'autoplay');
240            $(this).parent().addClass('active');
241            $(this).parent().find('iframe').attr('src', $(this).parent().find('iframe').attr('src') + '?autoplay=1').delay();
242            $(this).hide();
243            $(this).parent().find('img').hide();
244            $(this).parent().find('.video').show();
245            $(this).parent().addClass('show_video');
246            return false;
247        });
248
249        $(".staff_read_more").on('click', function () {
250            $(this).closest('.stm_staff_2').find('.full_description').slideToggle(150);
251            return false;
252        });
253
254        $("select:not(.stm_not_select2)").each(function () {
255            if (!$(this).closest(".gfield").hasClass("stm_not_select2")) {
256                $(this).select2({width: '100%', minimumResultsForSearch: '-1'});
257            }
258        });
259        if ($("#rating").length) {
260            $("#rating").select2('destroy');
261        }
262
263        if ($("#demos_switcher").length) {
264            $("#demos_switcher").select2("destroy");
265
266            $("#demos_switcher").select2({
267                templateResult: demosItemTemplate,
268                width: '100%',
269                minimumResultsForSearch: '-1'
270            });
271
272        }
273
274        if ($('body').hasClass('customizer_page')) {
275            $(".customizer_page .ui-tabs").remove();
276        }
277
278        $('.menu-toggle, .menu_toggle').on('click', function () {
279            $(this).toggleClass('open');
280            $(this).parents().find('.main_menu_nav').slideToggle(300);
281            $('.mobile_header .top_nav_mobile, .consulting_menu_nav .consulting_menu_nav').slideToggle(300);
282            return false;
283        });
284        $('#menu_toggle_button').on('click', function () {
285            $(this).toggleClass('open');
286            $('#header').each(function () {
287                if (!$(this).hasClass('show')) {
288                    $(this).addClass('show');
289                    if ($('body').hasClass('rtl')) {
290                        $(this).animate({right: "0"}, 300);
291                    } else {
292                        $(this).animate({left: "0"}, 300);
293                    }
294                } else {
295                    $(this).removeClass('show');
296                    if ($('body').hasClass('rtl')) {
297                        $(this).animate({right: "-100%"}, 600);
298                    } else {
299                        $(this).animate({left: "-100%"}, 600);
300                    }
301                }
302            });
303
304            return false;
305        });
306
307        $(".main_menu_nav > li.menu-item-has-children > a").after('<span class="arrow"><i></i></span>');
308        $(".main_menu_nav > li.menu-item-has-children > .sub-menu > .menu-item-has-children > a").after('<span class="arrow"><i class="fa fa-chevron-down"></i></span>');
309        $(".consulting_menu_nav > li.menu-item-has-children > a").after('<i class="fa fa-plus arrow" aria-hidden="true"></i>');
310        $(".consulting_menu_nav > li ul > li.menu-item-has-children > a").after('<i class="fa fa-plus arrow" aria-hidden="true"></i>');
311
312        $(".main_menu_nav > li.menu-item-has-children .arrow, .consulting_menu_nav .menu-item-has-children .arrow").on('click', function () {
313            let $this = $(this);
314            if ($this.hasClass('active')) {
315                $this.removeClass('active');
316                $this.parent().removeClass('active').find('> ul').slideUp(300);
317            } else {
318                $this.closest('ul').find('li').removeClass('active');
319                $this.closest('ul').find('li .arrow').removeClass('active');
320                $this.closest('ul').find('li ul').slideUp(300);
321                $this.parent().find('> ul').slideDown(300);
322                $this.addClass('active');
323                $this.parent().addClass('active');
324            }
325        });
326
327        $('.consulting_menu_nav > li').each(function () {
328            if ($(this).hasClass('stm_megamenu')) {
329                $(this).parents(".elementor-column").addClass("stm_megamenu_
329column")
330            }
331        });
332
333        $(".mobile_header .top_nav_mobile .main_menu_nav > li.menu-item-has-children > a").on('click', function () {
334            if ($(this).attr('href') == '#') {
335                $(this).closest('li').find('ul').slideToggle(300);
336                $(this).closest('li').find('.arrow').toggleClass('active');
337            }
338        });
339
340        // Quantity actions
341        $('body').on('click', '.quantity_actions span', function () {
342            var quantityContainer = $(this).closest('.quantity'),
343                quantityInput = quantityContainer.find('.qty'),
344                quantityVal = quantityInput.val();
345
346            $('.shop_table.cart .button').removeAttr("disabled");
347
348            if ($(this).hasClass('plus')) {
349                quantityInput.val(parseInt(quantityVal) + 1);
350            } else if ($(this).hasClass('minus')) {
351                if (quantityVal > 1) {
352                    quantityInput.val(parseInt(quantityVal) - 1);
353                }
354            }
355        });
356
357        // Stiky Header
358        var headerHeight = $("#header").height();
359        var headerTop = $(".header_top").height();
360        var topBar = $(".top_bar").height();
361
362        $(".header_style_1.sticky_menu #header .nav-box, .header_style_3.sticky_menu #header .nav-box, .header_style_4.sticky_menu #header .nav-box, .header_style_5.sticky_menu #header .nav-box, .header_style_6.sticky_menu #header .nav-box, .header_style_11.sticky_menu #header .nav-box, .header_style_12.sticky_menu #header .nav-box").affix({
363            offset: {
364                top: headerHeight
365            }
366        });
367
368        $(".header_style_2.sticky_menu #header .header-box, .header_style_10.sticky_menu #header .header-box").affix({
369            offset: {
370                top: headerHeight
371            }
372        });
373
374        $(".sticky_menu #menu_toggle_button, .menu_toggle_button").affix({
375            offset: {
376                top: topBar
377            }
378        });
379
380        $("#wrapper").on( "scroll", function() {
381            if ($(".sticky_menu .header_top, .sticky_menu .nav-box").hasClass('affix')) {
382                $("#header").css("paddingBottom", headerTop);
383            } else {
384                $("#header").css("paddingBottom", 0);
385            }
386        });
387
388        $(".top_bar_info_switcher .active").on('click', function () {
389
390            if ($(".top_bar_info_switcher ul").is(':visible')) {
391                $(this).parent().find("ul").slideUp(100);
392            } else {
393                $(this).parent().find("ul").slideDown(100);
394            }
395
396            return false;
397        });
398
399        $(".top_bar_info_switcher a").on('click', function () {
400            var id = $(this).attr('href');
401            var title = $(this).text();
402            $(this).parents(".top_bar_info_wr").find(".top_bar_info").hide();
403            $(this).parents(".top_bar_info_wr").find('#'+id).show();
404            $(this).parents(".top_bar_info_wr").find(".top_bar_info_switcher .active span").text(title);
405            $(this).parents(".top_bar_info_wr").find(".top_bar_info_switcher ul").slideUp(100);
406            return false;
407        });
408
409        if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
410            stm_animate_block();
411        } else {
412            $(".stm_animation").css('opacity', 1);
413        }
414
415        jQuery(window).on( "scroll", function() {
416            if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
417                stm_animate_block();
418            } else {
419                $(".stm_animation").css('opacity', 1);
420            }
421        });
422
423        $('.single-product .product-type-variable table.variations select').on("change", function () {
424            $(this).parent().find('.select2-selection__rendered').text($(this).find('option[value="' + $(this).val() + '"]').text());
425        });
426
427        /*Adds*/
428        if (typeof($.fancybox) !== 'undefined') {
429            $('.stm_fancy-iframe').fancybox({
430                type: 'iframe',
431                padding: 0,
432                maxWidth: '800px',
433                width: '100%',
434                fitToView: false,
435                afterLoad: function () {
436                    var url = $(this.element).data('url');
437                    this.href = url;
438                }
439            });
440
441            $('.stm_fancybox').fancybox({
442                fitToView: false,
443                padding: 30,
444                maxWidth: '500px',
445                autoSize: true,
446                closeClick: false,
447                openEffect: 'none',
448                closeEffect: 'none'
449            });
450        }
451
452        $('[data-scroll-to]').on('click', function (e) {
453            var url = $(this).attr('data-scroll-to');
454            if (typeof(url) !== 'undefined') {
455                var url_parsed = url.split('#');
456                if (typeof(url_parsed[1]) !== 'undefined' && $('#' + url_parsed[1]).length > 0) {
457                    $('html, body').stop().animate({
458                        scrollTop: $('#' + url_parsed[1]).offset().top
459                    }, 700);
460                } else {
461                    window.location.href = url;
462                }
463            }
464        });
465
466        if ($('body').hasClass('site_layout_19')) {
467            $('.top_nav li a').on('click', function (e) {
468                e.preventDefault();
469                var url = $(this).attr('href');
470                if (typeof(url) !== 'undefined') {
471                    var url_parsed = url.split('#');
472                    if (typeof(url_parsed[1]) !== 'undefined' && $('#' + url_parsed[1]).length > 0) {
473                        $('html, body').stop().animate({
474                            scrollTop: $('#' + url_parsed[1]).offset().top - 50
475                        }, 700);
476                    } else {
477                        window.location.href = url;
478                    }
479                }
480            });
481        }
482
483        $('.header_search_in_popup .search-icon').on('click', function () {
484            $(this).parent().addClass('search_active');
485            $('.header_search_in_popup .search-form').append('<div class="header_search_close"></div>');
486            $('.header_search_close').on('click', function () {
487                $(this).parents('.header_search_in_popup').removeClass('search_active');
488                $('.header_search_close').remove();
489            });
490        });
491
492        $('.consulting-search button, .stm_top_bar_l13-search button').on('click', function (e) {
493            var $wr = $(this).closest('.stm_top_bar_l13-search, .consulting-search');
494            if ($wr.hasClass('active')) {
495                if ($wr.find('input').val() == '') {
496                    e.preventDefault();
497                    $wr.removeClass('active active-focus');
498                }
499            } else {
500                e.preventDefault();
501                $wr.addClass('active active-focus');
502                setTimeout(function () {
503                    $wr.find('input').focus();
504                }, 300);
505            }
506        });
507
508        $('body').on('click', function (e) {
509            if ($(e.target).closest('.consulting-search, .stm_top_bar_l13-search').length === 0) {
510                var $wr = $('.consulting-search, .stm_top_bar_l13-search');
511                $wr.find('input').focusout();
512                $wr.removeClass('active active-focus');
513            }
514        });
515
516    });
517
518    jQuery(window).on( "load", function() {
519        l18W();
520        if ($('html').hasClass('stm-site-preloader')) {
521            $('html').addClass('stm-site-loaded');
522
523            setTimeout(function () {
524                $('html').removeClass('stm-site-preloader stm-site-loaded');
525            }, 250);
526
527            $(window).on('onbeforeunload', function (e) {
528                $('html').addClass('stm-site-preloader stm-after-hidden');
529            });
530
531            if ($('a[href^=mailto], a[href^=skype], a[href^=tel]').on('click', function (e) {
532                    setTimeout(function () {
533                        $('html').removeClass('stm-site-preloader stm-site-loaded');
534                    });
535                })) ;
536        }
537    });
538
539    function stm_animate_block() {
540        jQuery('.stm_animation').each(function () {
541            if (jQuery(this).attr('data-animate')) {
542                var animation_blocks = jQuery(this).children('*');
543                var animationName = jQuery(this).attr('data-animate'),
544                    animationDuration = jQuery(this).attr('data-animation-duration') + 's',
545                    animationDelay = jQuery(this).attr('data-animation-delay');
546                var style = 'opacity:1;-webkit-animation-delay:' + animationDelay + 's;-webkit-animation-duration:' + animationDuration + '; -moz-animation-delay:' + animationDelay + 's;-moz-animation-duration:' + animationDuration + '; animation-delay:' + animationDelay + 's;';
547                var container_style = 'opacity:1;-webkit-transition-delay: ' + (animationDelay) + 's; -moz-transition-delay: ' + (animationDelay) + 's; transition-delay: ' + (animationDelay) + 's;';
548                if (isAppear(jQuery(this))) {
549                    jQuery(this).attr('style', container_style);
550                    jQuery.each(animation_blocks, function (index, value) {
551                        jQuery(this).attr('style', style);
552                        jQuery(this).addClass('animated').addClass(animationName);
553                    });
554                }
555            }
556        });
557    }
558
559    function isAppear(id) {
560        var window_scroll = jQuery(window).scrollTop();
561        var window_height = jQuery(window).height();
562
563        if (jQuery(id).hasClass('stm_viewport')) {
564            var start_effect = jQuery(id).data('viewport_position');
565        }
566
567        if (typeof(start_effect) === 'undefined' || start_effect == '') {
568            var percentage = 2;
569        } else {
570            var percentage = 100 - start_effect;
571        }
572        var element_top = jQuery(id).offset().top;
573        var position = element_top - window_scroll;
574
575        var cut = window_height - (window_height * (percentage / 100));
576        if (position <= cut) {
577            return true;
578        } else {
579            return false;
580        }
581    }
582
583    function demosItemTemplate(state) {
584        if (!state.id) {
585            return state.text;
586        }
587        var $state = jQuery(
588            '<span class="' + state.element.value + '"> ' + state.text + '</span>'
589        );
590        return $state;
591    }
592
593    function l18W() {
594        var $ = jQuery;
595        if ($('body').hasClass('site_layout_18')) {
596            var contentW = $('#fullpage').outerWidth();
597            var contentArea = $('.content-area').outerWidth();
598            var fullWleft = contentW / 2;
599
600            var marginArea = (contentW - contentArea) / 2;
601            //$('.stm_bg_right').css('width', contentW + 'px');
602            $('.stm_fullwidth_left').css({
603                'width': fullWleft + 'px'
604            });
605
606            $('.stm_fullwidth_content').css({
607                'width': contentW + 'px',
608                'margin-right': '-' + marginArea + 'px'
609            })
610
611        }
612    }
613
614    function stm_services_carousel() {
615        $('.stm_services.style_3').each(function () {
616            var perRow = $(this).attr('data-per-row');
617            $(this).owlCarousel({
618                nav: false,
619                dots: true,
620                responsive: {
621                    0: {
622                        items: 1
623                    },
624                    480: {
625                        items: 2
626                    },
627                    768: {
628                        items: 3
629                    },
630                    1024: {
631                        items: perRow
632                    },
633                    1110: {
634                        items: perRow
635                    }
636                }
637            });
638        });
639
640        $('.stm_services.style_7').each(function () {
641            $(this).owlCarousel({
642                nav: false,
643                dots: true,
644                responsive: {
645                    0: {
646                        items: 1
647                    }
648                }
649            });
650        })
651    }
652})(jQuery);
653

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.