AmuleWebUI-Reloaded icon indicating copy to clipboard operation
AmuleWebUI-Reloaded copied to clipboard

[feature request] make a button to select all downloads

Open evilsh3ll opened this issue 1 year ago • 0 comments

Hello, can you make a button to select all downloads? Manually selection a lot of file it's tedious.

Edit: this is my userscript to do that, if someone is interested

image

// ==UserScript==
// @name        amuleweb auto checkbox
// @namespace   Violentmonkey Scripts
// @match       http://localhost:4711/amuleweb-main-dload.php
// @grant       none
// @version     1.0
// @author      SH3LL
// @description 5/12/2023, 12:29:31
// ==/UserScript==

(function() {
    'use strict';

    // Function to check all checkboxes
    function checkAllCheckboxes() {
        // Select all checkboxes on the page
        var checkboxes = document.querySelectorAll('input[type="checkbox"]');

        // Iterate through all checkboxes and check them
        checkboxes.forEach(function(checkbox) {
            checkbox.checked = true;
        });
    }

    // Function to uncheck all checkboxes
    function uncheckAllCheckboxes() {
        // Select all checkboxes on the page
        var checkboxes = document.querySelectorAll('input[type="checkbox"]');

        // Iterate through all checkboxes and uncheck them
        checkboxes.forEach(function(checkbox) {
            checkbox.checked = false;
        });
    }

    // Find an element with the class "form-inline form-tasks"
    var formElement = document.querySelector('.form-inline.form-tasks');

    // Check if the element is found
    if (formElement) {
        // Create the button to check all checkboxes
        var checkButton = document.createElement('button');
        checkButton.textContent = 'Check ALL';

        // Add CSS style for spacing and positioning
        checkButton.style.marginRight = '10px';

        // Add an event handler to the check button
        checkButton.addEventListener('click', function(event) {
            // Prevent default behavior (in this case, page refresh)
            event.preventDefault();

            // Call the function to check all checkboxes
            checkAllCheckboxes();
        });

        // Create the button to uncheck all checkboxes
        var uncheckButton = document.createElement('button');
        uncheckButton.textContent = 'Uncheck ALL';

        // Add CSS style for spacing and positioning
        uncheckButton.style.marginRight = '10px';
        uncheckButton.style.marginTop = '10px';

        // Add an event handler to the uncheck button
        uncheckButton.addEventListener('click', function(event) {
            // Prevent default behavior (in this case, page refresh)
            event.preventDefault();

            // Call the function to uncheck all checkboxes
            uncheckAllCheckboxes();
        });

        // Add the buttons to the "form-inline form-tasks" element
        formElement.appendChild(checkButton);
        formElement.appendChild(uncheckButton);
    }
})();

evilsh3ll avatar Dec 05 '23 11:12 evilsh3ll