PageSourceSearch

https://ncil.org/wp-content/plugins/wp-amo/js/pagination-scroll.js?ver=1.0

js ncil.org collected 2026-10-02 03:18:54 UTC 1,374 bytes, 41 lines download raw bytes

1/**
2 * Handle pagination scroll behavior
3 * Scrolls to the content block after pagination navigation
4 */
5(function() {
6    'use strict';
7
8    // Store scroll target when pagination link is clicked
9    document.addEventListener('click', function(e) {
10        var target = e.target.closest('.pagination a[data-scroll-target]');
11        if (target) {
12            var scrollTarget = target.getAttribute('data-scroll-target');
13            if (scrollTarget) {
14                sessionStorage.setItem('amo_pagination_scroll_target', scrollTarget);
15            }
16        }
17    });
18
19    // Scroll to target after page load
20    function scrollToTarget() {
21        var scrollTarget = sessionStorage.getItem('amo_pagination_scroll_target');
22        if (scrollTarget) {
23            sessionStorage.removeItem('amo_pagination_scroll_target');
24
25            var targetElement = document.getElementById(scrollTarget);
26            if (targetElement) {
27                // Use setTimeout to ensure page is fully loaded
28                setTimeout(function() {
29                    targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
30                }, 100);
31            }
32        }
33    }
34
35    // Run on DOM ready
36    if (document.readyState === 'loading') {
37        document.addEventListener('DOMContentLoaded', scrollToTarget);
38    } else {
39        scrollToTarget();
40    }
41})();

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.