PageSourceSearch

https://purchaseagreementgroup.com/assets/js/site.js

js purchaseagreementgroup.com collected 2026-10-06 13:14:23 UTC 5,096 bytes, 160 lines download raw bytes

1(function () {
2  function all(s, r) {
3    return Array.prototype.slice.call((r || document).querySelectorAll(s))
4  }
5  function one(s, r) {
6    return (r || document).querySelector(s)
7  }
8  function norm(v) {
9    return (v || '').toString().toLowerCase().trim()
10  }
11
12  var reducedMotion =
13    window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches
14
15  var toggle = one('[data-nav-toggle]')
16  var menu = one('[data-mobile-menu]')
17  var overlay = one('[data-sidebar-overlay]')
18  if (toggle && menu) {
19    function isOpen() {
20      return menu.classList.contains('open')
21    }
22    function close() {
23      menu.classList.remove('open')
24      if (overlay) {
25        overlay.classList.remove('open')
26        overlay.setAttribute('aria-hidden', 'true')
27      }
28      toggle.setAttribute('aria-expanded', 'false')
29    }
30    function open() {
31      menu.classList.add('open')
32      if (overlay) {
33        overlay.classList.add('open')
34        overlay.setAttribute('aria-hidden', 'false')
35      }
36      toggle.setAttribute('aria-expanded', 'true')
37    }
38    toggle.setAttribute('aria-expanded', 'false')
39    toggle.addEventListener('click', function () {
40      isOpen() ? close() : open()
41    })
42    if (overlay) overlay.addEventListener('click', close)
43    document.addEventListener('keydown', function (e) {
44      if (e.key === 'Escape' && isOpen()) close()
45    })
46  }
47
48  all('img').forEach(function (img) {
49    img.addEventListener(
50      'error',
51      function () {
52        img.classList.add('image-off')
53      },
54      { once: true }
55    )
56  })
57
58  all('[data-carousel]').forEach(function (root) {
59    var slides = all('[data-slide]', root)
60    if (!slides.length) return
61    var dots = all('[data-carousel-dot]', root)
62    var index = 0
63    function show(i) {
64      index = (i + slides.length) % slides.length
65      slides.forEach(function (s, n) {
66        s.classList.toggle('active', n === index)
67      })
68      dots.forEach(function (d, n) {
69        d.classList.toggle('active', n === index)
70      })
71    }
72    var next = one('[data-carousel-next]', root)
73    var prev = one('[data-carousel-prev]', root)
74    if (next) next.addEventListener('click', function () { show(index + 1) })
75    if (prev) prev.addEventListener('click', function () { show(index - 1) })
76    dots.forEach(function (d, n) {
77      d.addEventListener('click', function () { show(n) })
78    })
79    if (!reducedMotion) {
80      setInterval(function () {
81        if (!document.hidden) show(index + 1)
82      }, 5200)
83    }
84  })
85
86  function apply(scope) {
87    var q = norm((one('[data-filter-input]', scope) || {}).value)
88    var region = (one('[data-filter-region]', scope) || {}).value || ''
89    var year = (one('[data-filter-year]', scope) || {}).value || ''
90    var cat = (one('[data-filter-category]', scope) || {}).value || ''
91    var visible = false
92    all('[data-card]', document).forEach(function (card) {
93      if (!scope.contains(card)) return
94      var ok = true
95      if (q && norm(card.getAttribute('data-search')).indexOf(q) === -1) ok = false
96      if (region && card.getAttribute('data-region') !== region) ok = false
97      if (year && card.getAttribute('data-year') !== year) ok = false
98      if (cat && card.getAttribute('data-category') !== cat) ok = false
99      card.hidden = !ok
100      if (ok) visible = true
101    })
102    var empty = one('[data-empty]', scope.parentNode || document)
103    if (empty) empty.hidden = visible
104  }
105
106  all('[data-filter-scope]').forEach(function (scope) {
107    all('input,select', scope).forEach(function (el) {
108      el.addEventListener('input', function () { apply(scope) })
109      el.addEventListener('change', function () { apply(scope) })
110    })
111    var params = new URLSearchParams(location.search)
112    var q = params.get('q')
113    var input = one('[data-filter-input]', scope)
114    if (q && input) {
115      input.value = q
116      apply(scope)
117    }
118  })
119
120  window.initPlayer = function (src) {
121    var video = document.getElementById('movie-player')
122    if (!video || !src) return
123    var err = document.querySelector('[data-video-error]')
124    function hideErr() {
125      if (!err) return
126      err.hidden = true
127      err.style.display = 'none'
128    }
129    function fail() {
130      if (!err) return
131      err.hidden = false
132      err.style.display = 'grid'
133    }
134    hideErr()
135    var isMp4 = /\.mp4(\?|$)/i.test(src)
136    function bindMp4() {
137      video.src = src
138      video.addEventListener('loadeddata', hideErr, { once: true })
139      video.addEventListener('playing', hideErr)
140      video.addEventListener('error', fail, { once: true })
141    }
142    if (isMp4) {
143      bindMp4()
144      return
145    }
146    if (video.canPlayType('application/vnd.apple.mpegurl')) {
147      video.src = src
148      video.addEventListener('error', fail, { once: true })
149    } else if (window.Hls && window.Hls.isSupported()) {
150      var hls = new Hls({ enableWorker: true, lowLatencyMode: true })
151      hls.loadSource(src)
152      hls.attachMedia(video)
153      hls.on(Hls.Events.ERROR, function (e, d) {
154        if (d && d.fatal) fail()
155      })
156    } else {
157      bindMp4()
158    }
159  }
160})()

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.