PageSourceSearch

https://essma.eu/wp-content/plugins/essma-elements/assets/js/research-rail.js?ver=1.0.200

js essma.eu collected 2026-10-02 17:38:04 UTC 1,534 bytes, 32 lines download raw bytes

1/**
2 * ESSMA Research Rail — horizontal scroll-snap controller. Dependency-free.
3 * Shows prev/next arrows only when the track overflows, disables them at the
4 * ends, and scrolls by ~one card per click. No-ops when no .essma-rail present.
5 */
6(function () {
7  function init(rail) {
8    if (rail._essmaRail) return; rail._essmaRail = 1;
9    var track = rail.querySelector('.essma-rail__track');
10    if (!track) return;
11    var prev = rail.querySelector('.essma-rail__arrow--prev');
12    var next = rail.querySelector('.essma-rail__arrow--next');
13
14    function step() {
15      var card = track.querySelector('.essma-rail__card');
16      return card ? Math.round(card.getBoundingClientRect().width + 18) : 320;
17    }
18    function update() {
19      var max = track.scrollWidth - track.clientWidth - 2;
20      rail.classList.toggle('has-overflow', max > 4);
21      if (prev) prev.disabled = track.scrollLeft <= 2;
22      if (next) next.disabled = track.scrollLeft >= max;
23    }
24    if (prev) prev.addEventListener('click', function () { track.scrollBy({ left: -step(), behavior: 'smooth' }); });
25    if (next) next.addEventListener('click', function () { track.scrollBy({ left: step(), behavior: 'smooth' }); });
26    track.addEventListener('scroll', update, { passive: true });
27    window.addEventListener('resize', update);
28    update();
29  }
30  function boot() { [].forEach.call(document.querySelectorAll('.essma-rail'), init); }
31  if (document.readyState !== 'loading') boot(); else document.addEventListener('DOMContentLoaded', boot);
32})();

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.