PageSourceSearch

https://www.sarahucoach.com/wp-content/themes/wpcoach/js/myscript.js?ver=1.0

js sarahucoach.com collected 2026-10-04 21:18:39 UTC 18,926 bytes, 590 lines download raw bytes

1var $ = jQuery.noConflict();
2(function( window, $, undefined ){
3
4  'use strict';
5
6  var $event = $.event,
7      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
8      resizeTimeout;
9
10  $event.special.smartresize = {
11    setup: function() {
12      $(this).bind( "resize", $event.special.smartresize.handler );
13    },
14    teardown: function() {
15      $(this).unbind( "resize", $event.special.smartresize.handler );
16    },
17    handler: function( event, execAsap ) {
18      // Save the context
19      var context = this,
20          args = arguments;
21
22      // set correct event type
23      event.type = "smartresize";
24
25
26      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
27      resizeTimeout = setTimeout(function() {
28        $event[ dispatchMethod ].apply( context, args );
29      }, execAsap === "execAsap"? 0 : 100 );
30    }
31  };
32
33  $.fn.smartresize = function( fn ) {
34    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
35  };
36
37})( window, jQuery );
38
39/* --- Parallax Background Function--- */
40
41jQuery(document).ready(function($){
42
43    "use strict";
44
45    var dtParallax=function() {
46
47        "use strict";
48        var $window = $(window);
49        var minwidthparallax = 768;
50
51        $('body[data-type="background"],section[data-type="background"],div[data-type="background"]').each(function(){
52
53            var $bgobj = $(this); // assigning the object
54            $window.scroll(function() {
55
56               if ($(this).width()>minwidthparallax) {
57                    var position=$bgobj.position();
58                    var yPos = (($(document).scrollTop() - position.top) / $bgobj.data('speed'));
59                    // Put together our final background position
60                    var coords = '50% '+ yPos + 'px';
61       
62                   // Move the background
63                    $bgobj.css({ backgroundPosition: coords });
64                }
65            }); 
66        });    
67
68
69    }
70
71    dtParallax();
72
73    //dtCounter();
74
75    var setFooterWidget=function(){
76
77
78        if ($('#footer-right .border-left').length) {
79
80            var $item=$('#footer-right .border-left:first');
81            var $col=$item.hasClass('col-2')?2:$item.hasClass('col-3')?3:$item.hasClass('col-4')?4:1;
82            var rowHeight=$item.outerHeight(true);
83
84            $('.border-left').matchHeight();
85        }
86
87    };
88
89    
90    if($('.searchform').length){
91      var windowWidth = $(window).width();
92
93      $( ".search_btn" ).click(function() {
94        if (windowWidth>991) {
95          $(this).parents('form').find(".popup_form").fadeToggle( "fast", "swing" );
96          return false;
97        }
98      });
99
100
101      $('body').click(function(e){
102        if (windowWidth>991) {
103          var $searchform=$('.popup_form');
104          if(! ($searchform.has(e.target).length || $(e.target).is('.popup_form input'))){
105            $searchform.fadeOut('fast','swing');
106          }
107        }
108      });
109    }
110
111    if ($('.social-share-link').length) {
112        $('.social-share-link').each(function () {
113            $(this).click(function (event) {
114                event.preventDefault();
115                var idtobedisplay = $(this).siblings('.list-social-icons').attr('id');
116
117                $('.list-social-icons').each(function () {
118                  if (idtobedisplay!=$(this).attr('id')) {
119                    $(this).fadeOut();
120                  }
121                });
122
123                $(this).siblings('.list-social-icons').toggle(200);
124            });
125        });
126    }
127
128    function dtCounto() {
129        if ($('.dt-counto').length) {
130            $('.dt-counto').each(function () {
131              $(this).appear(function () {
132                var $to = $(this).data('to'),$oldvalue=$(this).text(),$from = $(this).data('from');
133
134                if($oldvalue){
135                  $to =parseFloat($oldvalue);
136                }
137
138                $(this).countTo({
139                    from: $from,
140                    to: $to,
141                    speed: 1500,
142                    refreshInterval: 50,
143                    onUpdate:function(value){
144                      $(this).text(value.toFixed(0));
145                    }
146                });
147
148              }, {
149                  accX: 0,
150                  accY: -200
151              })
152
153            });
154
155        }
156    }
157
158    dtCounto();
159
160
161    // Equal Heights
162
163
164      try{
165
166       $('.dt-iconboxes.layout-6').matchHeight();
167       $('.dt-iconboxes-4.layout-4').matchHeight(); 
168       $('.equal-height').matchHeight();
169       $('.same-height').matchHeight();
170       $('.dt-partner .partner-item').matchHeight();
171       $('.products .status-publish').matchHeight();
172      }
173        catch(err){}
174
175  
176    // Sticky Menu
177
178
179     try{
180
181      if ($("#head-page.sticky").length) {
182        $("#head-page.adminbar-not-here").sticky({ topSpacing: 0 });
183        $("#head-page.adminbar-is-here").sticky({ topSpacing: 32 });
184      }
185
186    }
187    catch(err){}
188
189
190    $(window).smartresize(function(){
191
192        setFooterWidget();
193
194      // Full Screen Slider
195
196      $('.slide-bg').css({
197          marginLeft: - ($(window).width() - $('.slide-frame').outerWidth())/2,
198          height: ($(window).height()),
199          width : ($(window).width()) + 200
200      }); 
201   });
202
203    // Sub Banner Top Padding
204
205    $( window ).smartresize(function() {
206        var topHeadPageHeight = $('.top-bar').height();
207        var topBarHeight = $('#head-page').height();
208
209        if ($('#banner-section')) {
210          if (!$('#banner-section.vertical_menu_container')) {
211            $('#banner-section').css('padding-top', topHeadPageHeight + topBarHeight);
212          }
213        }
214
215    });
216
217    // Set Menu Height on mobile to show scrolling inside menu
218    $(window).smartresize(function() {
219        var menuBarHeight = $('#head-page').height();
220        // outerHeight is used for IOS
221        var outerHeight = $(window).outerHeight() + menuBarHeight;
222        var windowHeight = $(window).height();
223
224        windowHeight = (outerHeight>windowHeight) ? outerHeight : windowHeight;
225
226        var windowWidth = $(window).width();
227        if ($('#mobile-header').css('display')!='none') {
228          if (windowWidth<=991) {
229              $('#dt-menu').css('height',windowHeight);
230          } else {
231            $('#dt-menu').css('height','auto');
232          }
233        } else {
234            $('#dt-menu').css('height','auto');
235        }
236    });
237
238    // Set content position relative to menu
239    $(window).smartresize(function() {
240      var windowWidth = $(window).width();
241      var topheadHeight = 0;
242      var headpageHeight = 0;
243      
244      headpageHeight = $('#head-page').height();
245      topheadHeight = $('#top-bar').height() + headpageHeight;
246      topheadHeight = (topheadHeight<=0) ? $('#head-page header').height() : topheadHeight;
247
248      if (windowWidth<=767) {
249        //krn top-bar tdk ditampilkan di resolusi < 767px maka tinggi top-bar tidak perlu ditambahkan
250        topheadHeight = $('#head-page').height();
251      }
252
253      topheadHeight = (topheadHeight<=60) ? 60 : topheadHeight;
254
255      var is_Vertical_Menu    = ($('.vertical_menu').length==0) ? false : true;
256      var is_PageBar_Menu     = ($('.dt-menu-pagebar').length==0) ? false : true;
257      var has_Banner_Section  = ($('#banner-section').length==0) ? false : true;
258      var has_Top_Bar         = ($('#top-bar').length==0) ? false : true;
259      var is_single         = ($('body.single').length==0) ? false : true;
260
261      var height_Top_Bar = 0;
262      if (has_Top_Bar) { height_Top_Bar = $('#top-bar').height(); }
263
264      var height_Banner = 0;
265      if (has_Banner_Section) { height_Banner = $('#banner-section').height(); }
266
267      if (has_Top_Bar && has_Banner_Section) {
268            //$('#banner-section').css('margin-top',-height_Top_Bar);
269      }
270
271      if (is_Vertical_Menu) {
272          $('.top-head ~ .content').css('padding-top',40);
273      } else if (is_PageBar_Menu) { //if (is_Vertical_Menu) {
274            if (has_Banner_Section) {
275              $('#dt_pagebar').css('margin-top',-height_Banner+headpageHeight+height_Top_Bar);
276            } else {
277              $('#dt_pagebar').css('margin-top',headpageHeight);
278              var height_pagebar = $('#dt_pagebar').height();
279              $('#dt_pagebar ~ .content').css('padding-top',headpageHeight + height_pagebar + 40);
280            }
281
282            var dt_pagebar_menu_height = $('#dt_pagebar').height()/2;
283            $('.dt_pagebar_menu').css('height',dt_pagebar_menu_height);
284            $('.dt_pagebar_wrapper').css('margin-top',-dt_pagebar_menu_height + 2);
285            $('#dt_pagebar').css('z-index',1000);
286      } else { //if (is_Vertical_Menu) {
287
288        if (has_Banner_Section) {
289          if(!is_single){
290            $('.top-head ~ .content').css('padding-top',100);
291          }
292        } else { //if (has_Banner_Section)
293          if ($('.dt-boxed-container .top-head').length!=0) {
294            $('.top-head ~ .content').css('padding-top',headpageHeight + 20);  
295          } else {
296            $('.top-head ~ .content').css('padding-top',topheadHeight + 40);
297            //$('.top-head ~ .content').css('padding-top',100);
298          }
299        } //if (has_Banner_Section)
300
301      } //if (is_Vertical_Menu) {
302
303    });
304    
305  // Blog Social Share hover 
306  $(".billio-ss-facebook51").hover(function() {
307        $(this).addClass("billio-ss-facebook52");
308        $(this).removeClass("billio-ss-facebook51");
309    },function() {
310        $(this).addClass("billio-ss-facebook51");
311        $(this).removeClass("billio-ss-facebook52");
312    }
313  );
314
315  $(".billio-ss-twitter44").hover(function() {
316        $(this).addClass("billio-ss-twitter43");
317        $(this).removeClass("billio-ss-twitter44");
318    },function() {
319        $(this).addClass("billio-ss-twitter44");
320        $(this).removeClass("billio-ss-twitter43");
321    }
322  );
323
324  $(".billio-ss-google115").hover(function() {
325        $(this).addClass("billio-ss-google114");
326        $(this).removeClass("billio-ss-google115");
327    },function() {
328        $(this).addClass("billio-ss-google115");
329        $(this).removeClass("billio-ss-google114");
330    }
331  );
332
333  $(".social-share-button-group li a").click(function(event) {
334    if ($(this).attr('href')) {
335      event.preventDefault();
336      popup_social($(this).attr('href'), {url: $(this).data('url'), u: $(this).data('url')});
337    }
338  });
339
340  // Target Parent menu on child hover
341  $(".sub-nav").hover(function() {
342        $(this).closest(".menu-item").toggleClass("hovered")
343  });
344
345
346  // SCROLLING SIDEBAR
347
348  // Fix issue sticky scrolling bar on Safari Browser.
349  /*
350  $(document).scroll(function() {
351    if ($("#floatMenu").length) {
352      $("#floatMenu").css("left",$("#floatMenu-sticky-wrapper").offset().left);
353    }
354  });
355
356
357  $("#floatMenu").sticky({topSpacing:150});
358  */
359  // /SCROLLING SIDEBAR
360
361  // Cart Popup
362
363  if ((jQuery.browser.msie) && $('.logo-container').length>0) {
364    $('.logo-container').height($('.logo-container').parent().height());
365  }
366 
367  var cartbox = $('.cart-popup');
368  $(".cart-click").click(function() {
369      if($(window).width() >480 ){
370          $( ".popup_form" ).fadeOut("fast", "swing");
371          $('.md-modal').removeClass('md-show');
372
373          if ($(".dt-menu-left .cart-popup").length>0) {
374            if($(window).width() >767 ){
375              $(".dt-menu-left .cart-popup").css('right',$(".dt-menu-left").width()-$(".dt-menu-left .bag").position().left-60);
376            } else {
377              $(".dt-menu-left .cart-popup").css('right',0);
378            } 
379          }
380
381          if ($(".dt-menu-center .cart-popup").length>0) {
382            if($(window).width() >767 ){
383              $(".dt-menu-center .cart-popup").css('right',$(".dt-menu-center").width()-$(".dt-menu-center .bag").position().left-60);
384            } else {
385              $(".dt-menu-center .cart-popup").css('right',0);
386            } 
387          }
388
389          return false;
390      }
391  });
392
393
394  $('body').on('added_to_cart',function(){
395      //var cartTotal=$('body').find('.total .amount:first'),catItemCount=$('.total:first').data('items');
396      //$('.cart_amounts').html(cartTotal);
397        $('.item_count').html($('#cart_contents_count').html());
398      }).click(function(event){
399      
400        if (!$(event.target).is(".cart-popup,.cart-popup *,.popup_form, .popup_form *")) {
401          //$( ".cart-popup,.popup_form" ).fadeOut("fast", "swing");
402        }
403  });
404
405  // search "read more" on blog article, if find show button "read more"
406  $(".blog .postcontent:has(.more-link)").each(function( index ) {
407    $(this).next(".postmetabottom").children("div").children("div").children("a.btn-readmore").css("display","inline-block");
408  });
409
410    // scroll to anchor 
411
412     var url_test=location.hash;
413
414     if(url_test!=''){
415        lets_Scroll($(url_test));
416     }
417
418
419    $("a[href*='#']:not([href='#'])").unbind('click').on("click", function(e) {
420
421        if($(this).closest('.woocommerce-tabs').length || $(this).data('toggle')=='tab' || $(this).data('toggle')=='collapse' || $(this).data('slide')=='next' || $(this).data('slide')=='prev'
422          || $(this).is('.woocommerce-review-link') || $(this).is('.ui-tabs-anchor') || typeof $(this).data('vc-container')=='string' || $(this).closest('.vc_tta-tabs-list').length || $(this).closest('.wpb_accordion_section').length || $(this).closest('.nav-tabs').length
423          || $(this).closest('.tt_tabs_navigation').length || $(this).closest('.tabs_box_navigation').length){
424          return;
425        }
426        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
427
428            var target = $(this.hash);
429            if(target.length){
430              e.preventDefault();
431              lets_Scroll(target);
432            }
433        }
434
435    });
436
437
438    function lets_Scroll(target){
439
440           var scroll,navbar=$('#head-page'),offset=0;
441           var ua = window.navigator.userAgent;
442           var msie = ua.indexOf("MSIE ");
443
444            var target = target.length ? target : $("[id=" + this.hash.slice(1) + "]");
445            scroll = target.offset().top;
446
447            if(navbar.length){
448               offset=navbar.outerHeight(true)+parseInt($('html').css('margin-top'));
449            }
450
451            if (target.length) {
452
453                if (typeof document.body.style.transitionProperty === 'string' && !msie) {
454
455                    var avail = $(document).height() - $(window).height();
456
457                    if (scroll > avail) {
458                        scroll = avail;
459                    }
460
461
462                    $("body").css({
463                        "margin-top" : ( $(window).scrollTop() - scroll + offset) + "px",
464                        "transition" : "1s ease-in-out"
465                    }).data("transitioning", true);
466
467                } else {
468                    $("html, body").animate({
469                        scrollTop: scroll-offset
470                    }, 1000);
471                    return;
472                }
473            }
474
475        $("body").on("transitionend webkitTransitionEnd msTransitionEnd oTransitionEnd", function (e) {
476        if (e.target == e.currentTarget && $(this).data("transitioning") === true) {
477            $(this).removeAttr("style").data("transitioning", false);
478            $("html, body").scrollTop(scroll-offset);
479             return;
480          }
481        });
482    }
483
484    /* responsive iframe */
485
486  $(window).resize();
487  $(document).scroll();
488
489
490  /* navigation button */
491  if($('.navigation_button_item').length){
492
493      var navigation_column_width=100 / $('.navigation_button_item').length;
494
495      $('.navigation_button_item').each(function(){
496          $(this).click(function(e){
497              e.preventDefault();
498
499              if($(window).width() > 768) return;
500              var $row_parent=$(this).closest('.navigation_button');
501              $row_parent.find('.navigation_button_item').removeClass('navigation_active');
502              $(this).addClass('navigation_active');
503
504          });
505
506      });
507
508  }
509
510
511}); //jQuery(document).ready 
512
513function uncheckboxes(nav){
514  var navarray = document.getElementsByName(nav);
515  for(var i = 0; i < navarray.length; i++){
516    navarray[i].checked = false
517  }     
518}
519
520function popup_social(url, params) {
521    var k, popup, qs, v;
522
523    if (params == null) {
524      params = {};
525    }
526    popup = {
527      width: 500,
528      height: 350
529    };
530
531    popup.top = (screen.height / 2) - (popup.height / 2);
532    popup.left = (screen.width / 2) - (popup.width / 2);
533    qs = ((function() {
534      var _results;
535      _results = [];
536      for (k in params) {
537        v = params[k];
538        _results.push("" + k + "=" + v);
539      }
540      return _results;
541    }).call(this)).join('&');
542    if (qs) {
543      qs = "?" + qs;
544    }
545
546    return window.open(url + qs, 'targetWindow', "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=" + popup.left + ",top=" + popup.top + ",width=" 
546+ popup.width + ",height=" + popup.height);
547
548};
549
550//=================== STICKY Menu when scroll up =====================
551
552(function($) { "use strict";
553jQuery(document).ready(function($){
554  //"use strict";
555  //if you change this breakpoint in the style.css file, don't forget to update this value as well
556  //var MQL = 1170;
557  var MQL = 0;
558
559  //primary navigation slide-in effect
560  if($(window).width() > MQL) {
561    
562    $(window).on('scroll',
563    {
564          previousTop: 0
565      }, 
566      function () {
567        var headerHeight = $('.stickyonscrollup').height();
568        var currentTop = $(window).scrollTop();
569        //check if user is scrolling up
570        if (currentTop < this.previousTop ) {
571          //if scrolling up...
572          if (currentTop > 0 && $('.stickyonscrollup').hasClass('is-fixed')) {
573            $('.stickyonscrollup').addClass('is-visible');
574            $('.stickyonscrollup').parent().addClass('is-sticky');
575          } else {
576            $('.stickyonscrollup').removeClass('is-visible is-fixed');
577            $('.stickyonscrollup').parent().removeClass('is-sticky');
578          }
579        } else {
580          //if scrolling down...
581          $('.stickyonscrollup').removeClass('is-visible');
582          $('.stickyonscrollup').parent().removeClass('is-sticky');
583          if( currentTop > headerHeight && !$('.stickyonscrollup').hasClass('is-fixed')) $('.stickyonscrollup').addClass('is-fixed');
584        }
585        this.previousTop = currentTop;
586    });
587  }
588
589});
590 })(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.