PageSourceSearch

https://clovo.au/wp-content/themes/yootheme/assets/site/js/clovo-headroom.js?ver=2

js clovo.au collected 2026-10-02 15:26:47 UTC 3,479 bytes, 101 lines download raw bytes

1/* Clovo headroom — hide mobile header on scroll-down, reveal on scroll-up. */
2(function () {
3  'use strict';
4
5  var header = document.querySelector('.tm-header-mobile');
6  var mobileViewport = !window.matchMedia || window.matchMedia('(max-width: 959px)').matches;
7  if (!header || !mobileViewport) return;
8
9  var lastY = window.scrollY;
10  var hideThreshold = 80;  // px from top before hiding kicks in
11  var delta = 5;           // minimum scroll px to trigger a direction change
12
13  function update() {
14    var y = window.scrollY;
15    var diff = y - lastY;
16
17    if (y < hideThreshold) {
18      header.classList.remove('tm-headroom-hidden');
19    } else if (diff > delta) {
20      header.classList.add('tm-headroom-hidden');
21    } else if (diff < -delta) {
22      header.classList.remove('tm-headroom-hidden');
23    }
24
25    lastY = y;
26  }
27
28  window.addEventListener('scroll', update, { passive: true });
29}());
30
31/* Load the only optional UIkit component used by the site on demand. The
32   homepage and most landing pages contain no parallax attributes, so they
33   should not download or parse this extra module. UIkit registers components
34   added after boot and initializes matching elements automatically. */
35(function () {
36  'use strict';
37
38  if (!document.querySelector('[uk-parallax], [data-uk-parallax]')) return;
39
40  var script = document.createElement('script');
41  script.src = '/wp-content/themes/yootheme/vendor/assets/uikit/dist/js/components/parallax.min.js?ver=5.0.28';
42  script.defer = true;
43  document.head.appendChild(script);
44}());
45
46/* Mobile-nav tablet mode — at 640–959px the hamburger modal still renders
47   (desktop header only appears at @m/960+), but the collapsed accordion
48   looks sparse on a tablet. Force both <details> groups open at tablet
49   widths so Platform + Company show all their feature links immediately.
50   CSS hides chevrons and disables summary clicks at the same breakpoint. */
51(function () {
52  'use strict';
53
54  if (!window.matchMedia) return;
55  var mq = window.matchMedia('(min-width: 640px) and (max-width: 959px)');
56
57  function apply() {
58    var groups = document.querySelectorAll('.tm-mobile-nav-group');
59    for (var i = 0; i < groups.length; i++) {
60      if (mq.matches) groups[i].setAttribute('open', '');
61      else groups[i].removeAttribute('open');
62    }
63  }
64
65  if (mq.addEventListener) mq.addEventListener('change', apply);
66  else if (mq.addListener) mq.addListener(apply);
67
68  if (document.readyState === 'loading') {
69    document.addEventListener('DOMContentLoaded', apply);
70  } else {
71    apply();
72  }
73}());
74
75/* "No credit card required" pill — click the little card character to replay
76   the full entry/slash/sad animation from the beginning. Uses clone-and-replace
77   so CSS animations restart from t=0. The tear loop is infinite and keeps
78   running after the replay completes. */
79(function () {
80  'use strict';
81
82  function bind() {
83    var pill = document.querySelector('.tm-hero-nocc-pill');
84    if (!pill) return;
85
86    pill.addEventListener('click', function (e) {
87      var svg = pill.querySelector('.tm-hero-nocc-card');
88      if (!svg) return;
89      // Only replay if the click actually lands on the SVG, not the text.
90      if (e.target !== svg && !svg.contains(e.target)) return;
91      var clone = svg.cloneNode(true);
92      svg.parentNode.replaceChild(clone, svg);
93    });
94  }
95
96  if (document.readyState === 'loading') {
97    document.addEventListener('DOMContentLoaded', bind);
98  } else {
99    bind();
100  }
101}());

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.