PageSourceSearch

https://cursodelper.es/wp-content/themes/masterstudy/assets/js/custom.js?ver=4.5.0

js cursodelper.es collected 2026-10-09 00:38:12 UTC 14,071 bytes, 437 lines download raw bytes

1"use strict";
2
3// Sticky Header vars
4var stickyHeader;
5var stickyHeaderOriginPos;
6var stickyHeaderHeight = 0;
7var sliderHeight = 0;
8
9(function ($) {
10  "use strict";
11
12  $(document).ready(function ($) {
13    changeCF7CustomPreloader();
14    $('#searchModal').on('shown.bs.modal', function (e) {
15      $('#searchform .search-input').focus();
16    });
17    $('.stm_fancybox').fancybox({
18      fitToView: false,
19      padding: 0,
20      autoSize: true,
21      closeClick: false,
22      maxWidth: '100%',
23      maxHeight: '90%',
24      beforeShow: function beforeShow() {
25        $('body').addClass('stm_locked');
26        this.title = $(this.element).attr("data-caption");
27      },
28      beforeClose: function beforeClose() {
29        $('body').removeClass('stm_locked');
30      },
31      helpers: {
32        title: {
33          type: 'inside'
34        },
35        overlay: {
36          locked: false
37        }
38      }
39    });
40    $('.video_course_preview').on('click', function (e) {
41      var url = $(this).attr('data-fancybox');
42      e.preventDefault();
43      e.stopPropagation();
44
45      if (typeof url != 'undefined') {
46        $.fancybox.open({
47          type: 'iframe',
48          src: url
49        });
50      }
51    });
52    footerToBottom(); // Is on screen
53
54    $.fn.is_on_screen = function () {
55      var win = $(window);
56      var viewport = {
57        top: win.scrollTop(),
58        left: win.scrollLeft()
59      };
60      viewport.right = viewport.left + win.width();
61      viewport.bottom = viewport.top + win.height();
62      var bounds = this.offset();
63      bounds.right = bounds.left + this.outerWidth();
64      bounds.bottom = bounds.top + this.outerHeight();
65      return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom);
66    };
67
68    $('select:not(".disable-select, .no-search")').select2({
69      width: '100%'
70    });
71    $('select.no-search:not(".disable-select")').select2({
72      width: '100%',
73      minimumResultsForSearch: -1,
74      dropdownParent: $('#wrapper')
75    });
76
77    if ($('.course_table').length > 1) {
78      productTableCountLessons();
79    }
80
81    $('.panel-title>a.tapable').on('click', function () {
82      var collapsed = $(this).hasClass('collapsed');
83
84      if (collapsed) {
85        $(this).closest('.panel').addClass('panel-collapsed');
86      } else {
87        $(this).closest('.panel').removeClass('panel-collapsed');
88      }
89    });
90    review_rating_stars(); // Event form validation
91
92    $('.event_popup_form').on('submit', function () {
93      var $this = $(this);
94      $($this).removeClass('error');
95      $($this).find('.loading').css({
96        'visibility': 'visible'
97      });
98      $(this).ajaxSubmit({
99        url: ajaxurl,
100        dataType: 'json',
101        success: function success(data) {
102          $($this).find('.loading').css({
103            'visibility': 'hidden'
104          });
105
106          if (data['redirect_url']) {
107            top.location.href = data['redirect_url'];
108          } else if (data['success']) {
109            $($this).replaceWith('<p class="alert alert-success heading_font">' + data['success'] + '</p>');
110          } else {
111            for (var k in data['errors']) {
112              $($this).find('input[name="event[' + k + ']"]').addClass('error');
113              $($this).find('textarea[name="event[' + k + ']"]').addClass('error');
114            }
115          }
116        }
117      });
118      $($this).find('.error').on('hover', function () {
119        $(this).removeClass('error');
120      });
121      return false;
122    });
123    menu_animated_line();
124    mobileMenu();
125    categoryFilter();
126    stm_stretch_column();
127    $('.left_bar .toggler').on('click', function () {
128      $(this).closest('.left_bar').toggleClass('open');
129    });
130  }); // Events onload
131
132  $(window).on('load', function () {
133    remove_preloader();
134    footerToBottom(); // Sticky header window load
135
136    if ($('#header').hasClass('sticky_header')) {
137      stickyHeader = $('#header.sticky_header .header_default');
138      stickyHeaderOriginPos = stickyHeader.offset().top;
139      stickyHeaderHeight = stickyHeader.height() + 20;
140      sticky_header();
141    } // Scroll event
142
143
144    $(window).on('scroll', function () {
145      sticky_header();
146    });
147    composerRTL();
148    stm_stretch_column();
149  }); // Resize events
150
151  $(window).on('resize', function () {
152    footerToBottom();
153    composerRTL();
154    menu_animated_line();
155    stm_stretch_column();
156  });
157  /* Custom functions */
158  // Sticky header
159
160  function sticky_header() {
161    if ($('#header').hasClass('sticky_header')) {
162      var currentPos = $(window).scrollTop(); // Transparent header is best viewed on revolution slider
163
164      if ($('.wpb_revslider_element').length < 1) {
165        var isAdmin = $('body').hasClass('admin-bar') ? 32 : 1;
166
167        if (currentPos > stickyHeaderOriginPos - isAdmin) {
168          stickyHeader.addClass('fixed');
169          $('#header').css({
170            'padding-bottom': stickyHeaderHeight + 'px'
171          });
172
173          if ($('#header').hasClass('transparent_header')) {
174            $('#header').addClass('scrolling');
175            $('.logo_transparent_static').addClass('hidden').removeClass('visible');
176            $('.logo_colored_fixed').addClass('visible').removeClass('hidden');
177          }
178        } else {
179          stickyHeader.removeClass('fixed');
180          $('#header').css({
181            'padding-bottom': 0
182          });
183
184          if ($('#header').hasClass('transparent_header')) {
185            $('#header').removeClass('scrolling');
186            $('.logo_transparent_static').addClass('visible').removeClass('hidden');
187            $('.logo_colored_fixed').addClass('hidden').removeClass('visible');
188          }
189        }
190      } else {
191        /* When revolution slider == true and header == transparent */
192        if ($('#header').hasClass('transparent_header')) {
193          sliderHeight = $('.wpb_revslider_element').height();
194          console.log(sliderHeight);
195
196          if (currentPos > stickyHeaderOriginPos + sliderHeight - 200) {
197            stickyHeader.addClass('fixed_invisible_top');
198          } else {
199            stickyHeader.removeClass('fixed_invisible_top');
200          }
201
202          if (currentPos > stickyHeaderOriginPos + sliderHeight - 45) {
203            stickyHeader.addClass('fixed');
204            $('#header').css({
205              'padding-bottom': stickyHeaderHeight + 'px'
206            });
207
208            if ($('#header').hasClass('transparent_header')) {
209              $('#header').addClass('scrolling');
210              $('.logo_transparent_static').addClass('hidden').removeClass('visible');
211              $('.logo_colored_fixed').addClass('visible').removeClass('hidden');
212            }
213          } else {
214            stickyHeader.removeClass('fixed');
215            $('#header').css({
216              'padding-bottom': 0
217            });
218
219            if ($('#header').hasClass('transparent_header')) {
220              $('#header').removeClass('scrolling');
221              $('.logo_transparent_static').addClass('visible').removeClass('hidden');
222              $('.logo_colored_fixed').addClass('hidden').removeClass('visible');
223            }
224          }
225        } else {
226          /* Rev slider == true header != transparent */
227          if (currentPos > stickyHeaderOriginPos - 1) {
228            stickyHeader.addClass('fixed');
229            $('#header').css({
230              'padding-bottom': stickyHeaderHeight + 'px'
231            });
232
233            if ($('#header').hasClass('transparent_header')) {
234              $('#header').addClass('scrolling');
235              $('.logo_transparent_static').addClass('hidden').removeClass('visible');
236              $('.logo_colored_fixed').addClass('visible').removeClass('hidden');
237            }
238          } else {
239            stickyHeader.removeClass('fixed');
240            $('#header').css({
241              'padding-bottom': 0
242            });
243
244            if ($('#header').hasClass('transparent_header')) {
245              $('#header').removeClass('scrolling');
246              $('.logo_transparent_static').addClass('visible').removeClass('hidden');
247              $('.logo_colored_fixed').addClass('hidden').removeClass('visible');
248            }
249          }
250        }
251      }
252    }
253  }
254
255  function footerToBottom() {
256    $("body").css("padding-bottom", $("#footer").outerHeight());
257    var windowHeight = $(window).height();
258    var footerHeight = $('#footer').outerHeight();
259
260    if (footerHeight + 50 > windowHeight) {
261      $('#footer').css({
262        'position': 'absolute'
263      });
264    } else {
265      $('#footer').removeAttr('style');
266    }
267  }
268
269  function productTableCountLessons() {
270    var i = 0;
271    var speed = 200;
272    $('.course_lessons_section .course_table tr').each(function () {
273      var el = this;
274      speed += 400;
275      setTimeout(function () {
276        var number_td = $(el).find('.number');
277        i++;
278        number_td.addClass('number-visible').text(i);
279
280        if (i > 9 && i < 99) {
281          number_td.addClass('overten');
282        } else if (i > 99) {
283          number_td.addClass('overthousand');
284        } else {
285          number_td.addClass('belowten');
286        }
287      }, speed);
288    });
289  }
290
291  function review_rating_stars() {
292    $(".woo_stm_rating_fields a").on('hover', function () {
293      $(this).addClass('filled');
294      $(this).prevAll().addClass('filled');
295    }, function () {
296      $(this).removeClass('filled');
297      $(this).prevAll().removeClass('filled');
298    });
299    $(".woo_stm_rating_fields a").on('click', function () {
300      $(".woo_stm_rating_fields a").removeClass('filled-active');
301      $(this).addClass('filled-active');
302      $(this).prevAll().addClass('filled-active');
303    });
304  }
305
306  function menu_animated_line() {
307    menu_animated_line_first_pos();
308    $('.header-menu>li').on('hover', function () {
309      $('.magic_line').removeClass('line_visible');
310      $(this).find('.magic_line').addClass('line_visible');
311    }, function () {
312      $('.magic_line').removeClass('line_visible');
313      menu_animated_line_first_pos();
314    });
315  }
316
317  var appendOnce = 0;
318
319  function menu_animated_line_first_pos() {
320    appendOnce++;
321    var hasCurrentMenuItem = false;
322    var li_anchestor = 'undefined';
323    $('.header-menu>li').each(function () {
324      if (appendOnce == 1) {
325        var maxLineWidth = 0;
326        maxLineWidth = $(this).width();
327        $(this).append('<div class="magic_line"></div>');
328        $(this).find('.magic_line').css({
329          'max-width': maxLineWidth + 'px'
330        });
331      }
332
333      if ($(this).hasClass('current-menu-item') || $(this).hasClass('current-menu-parent') || $(this).hasClass('current-menu-ancestor')) {
334        hasCurrentMenuItem = true;
335        li_anchestor = $(this);
336      }
337    });
338
339    if (hasCurrentMenuItem && li_anchestor != 'undefined') {
340      var lineFirstW = li_anchestor.innerWidth() - 28;
341      var lineFirstPos = li_anchestor.position().left + 14;
342      $(li_anchestor).find('.magic_line').addClass('line_visible');
343    }
344  }
345
346  function changeCF7CustomPreloader() {
347    if (typeof cf7_custom_image != 'undefined') {
348      $('.ajax-loader').attr('src', cf7_custom_image + 'ajax-loader.gif');
349    }
350  }
351
352  function mobileMenu() {
353    $(".header-menu-mobile .header-menu > li.menu-item-has-children > a").after('<span class="arrow"><i class="fa fa-angle-right"></i></span>');
354    $('.header-menu-mobile .header-menu .arrow').on('click', function () {
355      $(this).toggleClass('active');
356      $(this).closest('li').toggleClass('opened');
357      $(this).closest('li').find('> ul.sub-menu').slideToggle(300);
358    });
359    $(".header-menu-mobile .header-menu > li.menu-item-has-children > a").on('click', function (e) {
360      if ($(this).attr('href') == '#') {
361        e.preventDefault();
362        $(this).closest('li').find(' > ul.sub-menu').slideToggle(300);
363        $(this).closest('li').toggleClass('opened');
364        $(this).closest('li').find('.arrow').toggleClass('active');
365      }
366    });
367  }
368
369  function categoryFilter() {
370    $('select#product_categories_filter').on("select2:select", function (e) {
371      var link = $(this).val();
372      window.location.href = link;
373    });
374  }
375
376  function composerRTL() {
377    if ($('body').hasClass('rtl')) {
378      $('div[data-vc-full-width="true"]').each(function () {
379        var left = parseFloat($(this).css('left'));
380        left = -left;
381        $(this).css({
382          left: left + 'px'
383        });
384      });
385    }
386  }
387
388  function remove_preloader() {
389    $('body').removeClass('stm_preloader_1');
390  }
391
392  function stm_stretch_column() {
393    $('.wpb_column[data-stretch]').each(function () {
394      var el = $(this);
395      var stretch = el.data('stretch');
396      var wrapper = el.find('.wpb_wrapper').first();
397      var col = el.find('.vc_column-inner').first();
398      var colLeftOffset = el.offset().left;
399      stretch = $('body').hasClass('rtl') && stretch === 'left' ? 'right' : 'left';
400
401      if (stretch === 'left') {
402        wrapper.css({
403          'margin-left': 'auto'
404        });
405        col.css({
406          'width': el.width() + colLeftOffset + 'px',
407          'margin-left': '-' + colLeftOffset + 'px'
408        });
409      } else {
410        var margin = window.innerWidth - colLeftOffset - el.width();
411        col.css({
412          'width': window.innerWidth - colLeftOffset + 'px',
413          'margin-right': '-' + margin + 'px'
414        });
415      }
416
417      if (window.innerWidth <= 1024) {
418        col.css({
419          'width': window.innerWidth + 'px',
420          'margin-left': '-' + (window.innerWidth - col.outerWidth()) + 'px'
421        });
422      }
423    });
424  }
425
426  if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
427    $('footer').css('position', 'absolute');
428  }
429
430  if (typeof $.fn.swipe != 'undefined') {
431    $.fn.swipe.defaults.excludedElements = "button, input, select, textarea, .noSwipe";
432  }
433
434  $('.stm_product_meta_single_page table.variations select').on("change", function () {
435    $(this).parent().find('.select2-selection__rendered').text($(this).find('option[value="' + $(this).val() + '"]').text());
436  });
437})(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.