NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Simple Auto-Scroll // @namespace http://tampermonkey.net/ // @version 1.0 // @description Auto-scroll a webpage up and down to prevent it from timing out. // @author Taylor Halliwill // @license MIT // @match https://privacy.apple.com/* // @grant none // ==/UserScript== /* MIT License * * Copyright (c) 2024 Taylor Halliwill * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ (function() { 'use strict'; let scrolling = false; let scrollDirection = 1; // 1 for down, -1 for up let scrollDistance = 100; // 10 cm in pixels (approximate) let scrollInterval = 2000; // Time between scrolls in milliseconds // Create the start/stop button let btn = document.createElement("button"); btn.style.position = "fixed"; btn.style.bottom = "20px"; btn.style.right = "20px"; btn.style.zIndex = "1000"; btn.innerHTML = "Start Auto-Scroll"; document.body.appendChild(btn); // Scroll function function autoScroll() { if (scrolling) { window.scrollBy(0, scrollDirection * scrollDistance); // Reverse scroll direction scrollDirection *= -1; setTimeout(autoScroll, scrollInterval); } } // Toggle scrolling on button click btn.addEventListener("click", function() { scrolling = !scrolling; if (scrolling) { btn.innerHTML = "Stop Auto-Scroll"; autoScroll(); } else { btn.innerHTML = "Start Auto-Scroll"; } }); })();