PageSourceSearch

https://bible.by/i/js/swipe.js

js bible.by collected 2026-10-02 10:01:22 UTC 1,922 bytes, 62 lines download raw bytes

1const addSwippingToPage = () => {
2    let startX;
3    let startY;
4    let threshold = 100; // Minimum distance required to trigger a swipe event
5    let allowedTime = 300; // Maximum time allowed between swipes
6    let elapsedTime;
7    let startTime;
8
9    let container = document.querySelector('div[itemprop="articleBody"]');
10
11    if (!container) return;
12
13    // Add touch event listeners to the container
14    container.addEventListener("touchstart", function(event) {
15        // Record the starting position and time
16        startX = event.touches[0].pageX;
17        startY = event.touches[0].pageY;
18        startTime = new Date().getTime();
19    });
20
21    container.addEventListener("touchend", function(event) {
22        // Calculate the distance and time elapsed
23        let endX = event.changedTouches[0].pageX;
24        let endY = event.changedTouches[0].pageY;
25        let distX = endX - startX;
26        let distY = endY - startY;
27        elapsedTime = new Date().getTime() - startTime;
28
29        // Determine if it was a swipe or not
30        if (elapsedTime <= allowedTime) {
31            if (Math.abs(distX) >= threshold && Math.abs(distY) <= threshold) {
32                // Swipe was in the horizontal direction
33                if (distX < 0) {
34                    // Swiped left, go to the next page
35                    nextPage();
36                } else {
37                    // Swiped right, go to the previous page
38                    prevPage();
39                }
40            }
41        }
42    });
43
44    function nextPage() {
45        const next = document.getElementById('next_page');
46
47        if (next) {
48            document.location = next.href;
49        }
50    }
51
52    function prevPage() {
53        const prev = document.getElementById('prev_page');
54
55        if (prev) {
56            document.location = prev.href;
57        }
58    }
59
60}
61
62addSwippingToPage();

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.