Readit News logoReadit News
MechanicalFish commented on One Million Checkboxes   onemillioncheckboxes.com/... · Posted by u/LorenDB
MechanicalFish · a year ago
// ==UserScript== // @name Check All Unchecked Checkboxes // @namespace http://tampermonkey.net/ // @version 1.0 // @description Check all unchecked checkboxes on the page // @author MechanicalFish // @match https://onemillioncheckboxes.com/* // @grant none // ==/UserScript==

(function() { 'use strict';

    function checkAllCheckboxes() {
        var checkboxes = document.querySelectorAll('input[type="checkbox"]');

        checkboxes.forEach(function(checkbox) {
            if (!checkbox.checked) {
                checkbox.checked = true;
            }
        });
    }

    const observer = new MutationObserver((mutations) => {
        checkAllCheckboxes();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    checkAllCheckboxes();
})();

u/MechanicalFish

KarmaCake day8July 17, 2022View Original