Greasy Fork is available in English.

Pelckmans Portaal Downloader

Klikt automatisch een vooraf ingesteld aantal keren rechts in Pelckmans portaal om zo het volledig boek in de cache te steken

// ==UserScript==
// @name         Pelckmans Portaal Downloader
// @namespace    http://tampermonkey.net/
// @version      1.0 BETA
// @description  Klikt automatisch een vooraf ingesteld aantal keren rechts in Pelckmans portaal om zo het volledig boek in de cache te steken
// @author       PcLover2
// @match        https://digiboek.pelckmansportaal.be/digibook/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Initial wait time in milliseconds before starting to listen for user input
    const initialWaitTime = 10000; // 5 seconds
    // Interval time in milliseconds between clicks
    const intervalTime = 1500; // 1.5 seconds

    let targetClicks = 0;
    let clickCount = 0;
    let clickInterval;

    // Function to click the right arrow button
    function clickRightArrowButton() {
        const button = document.querySelector('button:has(i.pbb-sidebar__icon.icon-bb-arrow-right)');
        if (button) {
            button.click();
            clickCount++;
            if (clickCount >= targetClicks) {
                clearInterval(clickInterval);
                console.log(`Clicked the button ${targetClicks} times and stopped.`);
            }
        } else {
            console.log('Right arrow button not found');
        }
    }

    // Wait for the initial wait time
    setTimeout(() => {
        // Prompt the user to input the target number of clicks
        targetClicks = prompt('Enter the number of clicks:');
        if (!isNaN(targetClicks) && targetClicks > 0) {
            // Start clicking the right arrow button at regular intervals
            clickInterval = setInterval(clickRightArrowButton, intervalTime);
        } else {
            console.log('Invalid input. Please enter a valid number.');
        }
    }, initialWaitTime);
})();