PageSourceSearch

https://www.paulanka.com/assets/a9c3057f/javascripts/theme.js

js paulanka.com collected 2026-10-02 03:25:23 UTC 3,947 bytes, 137 lines download raw bytes

1//#########################################################################
2// 
3// THEME.JS
4// 
5//#########################################################################
6
7$(function() {
8
9  var $window = $(window);
10  var $html = $('html');
11  var $body = $('body');
12
13
14//============================================================
15//  Has Scrolled
16//============================================================
17  
18var lastScrollTop = 0;
19$window.scroll(function(){
20  var st = $(this).scrollTop();
21
22  if ( st >= 1 ) {
23    $html.addClass("has-scrolled");
24    if ( st < lastScrollTop) {
25      $html.addClass("has-scrolled-up");
26      $html.removeClass("has-scrolled-down");
27    } else {
28      $html.addClass("has-scrolled-down");
29      $html.removeClass("has-scrolled-up");
30    }
31  } else {
32    $html.removeClass("has-scrolled");
33    $html.removeClass("has-scrolled-up");
34    $html.removeClass("has-scrolled-down");
35  }
36  lastScrollTop = st;
37});
38
39
40//============================================================
41//  Nav
42//============================================================
43  
44  /*
45  $(".nav").each(function() {
46    $(this).find('> li').addClass('nav-item');
47    $(this).find('> li > a').addClass('nav-link');
48  });
49  */
50
51  //active class
52  $(".nav a").each(function() {
53    if (this.href == window.location) {
54      $(this).attr('aria-current','page').addClass('active').parents('li').addClass('active');
55    };
56  });
57
58  //show drodown on mouse hover and make parent clickable
59  if (window.matchMedia("(min-width: 768px)").matches) {
60    $(".navbar-nav .dropdown").on('touchstart mouseenter mouseleave', function(e) {
61      e.preventDefault();
62      $this = $(this);
63      $dropdownFunction = 'toggle';
64      $dropdownToggle = $this.find('[data-toggle=dropdown]');
65      $dropdownMenu = $this.find('.dropdown-menu');
66      $dropdownMenuClasses = 'mt-0';
67      if(e.type == "touchstart") {
68        $this.find($dropdownToggle).dropdown($dropdownFunction);
69      } else if(e.type == "mouseenter") {
70        $this.find($dropdownToggle).dropdown($dropdownFunction);
71        $this.find($dropdownMenu).addClass($dropdownMenuClasses);
72        $this.find($dropdownToggle).on('click', function(){
73          window.location = $dropdownToggle.attr('href');
74        });
75      } else if(e.type == "mouseleave") {
76        $this.find($dropdownToggle).dropdown($dropdownFunction);
77        $this.find($dropdownMenu).removeClass($dropdownMenuClasses);
78      } 
79    });
80  }
81
82//============================================================
83//  Smooth Scroll
84//============================================================
85  
86
87$('.skip-link').click(function(){
88    $html.addClass('is-scrolling');
89  });
90  var scrollTimer;
91  $window.scroll(function(){
92    clearTimeout(scrollTimer);
93    scrollTimer = setTimeout(function () {
94      $html.removeClass('is-scrolling');
95    }, 0);
96  });
97  $window.on('hashchange', function(){
98    window.history.pushState("", document.title, window.location.pathname);  
99  });
100
101
102
103
104//============================================================
105//  Object Fit Fallback
106//  Must include .image- styles from _images.scss partial
107//============================================================
108
109  if('objectFit' in document.documentElement.style === false) {
110    var $objectFitContainer = $('[class*=bg-cover], [class*=bg-contain], [class*=image-]');
111    $objectFitContainer.each(function() {
112      var $this = $(this);
113      var $img = $this.find('img');
114      if ($img.attr('data-src')) {
115        var $imgSrc = $img.attr('data-src');
116      } else {
117        var $imgSrc = $img.attr('src');
118      }
119      $img.css('opacity','0');
120      $this.css({'background-image': 'url(' + $imgSrc + ')' });
121    });
122  }
123
124
125
126//============================================================
127//  Load
128//============================================================
129
130  $window.scroll();
131
132  setTimeout(function(){ 
133    $html.addClass('loaded');
134  }, 500);
135    
136
137});

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.