Tap to Scroll (Ignore Links)

Tap the top or bottom of the screen to scroll the page up or down, while ignoring taps on links and interactive elements.

Από την 04/02/2025. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Tap to Scroll (Ignore Links)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Tap the top or bottom of the screen to scroll the page up or down, while ignoring taps on links and interactive elements.
// @author       Your Name
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Define the threshold for tap zones (e.g., top 20% and bottom 20% of the screen)
    const tapZoneThreshold = 0.2; // 20% of the screen height

    document.addEventListener('click', function(event) {
        // Check if the tap is on an interactive element (e.g., link, button, input)
        const interactiveElements = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL'];
        if (interactiveElements.includes(event.target.tagName)) {
            return; // Ignore taps on interactive elements
        }

        const screenHeight = window.innerHeight;
        const tapY = event.clientY; // Y-coordinate of the tap

        // Determine if the tap is in the top or bottom zone
        if (tapY < screenHeight * tapZoneThreshold) {
            // Tap in the top zone: scroll up
            window.scrollBy({ top: -window.innerHeight * 0.8, behavior: 'smooth' });
        } else if (tapY > screenHeight * (1 - tapZoneThreshold)) {
            // Tap in the bottom zone: scroll down
            window.scrollBy({ top: window.innerHeight * 0.8, behavior: 'smooth' });
        }
    });
})();