News for hackers. Stuff that matters.
Re:One Million Checkboxes by MechanicalFish on Wednesday June 26, 2024 @03:20PM (#40803526)
// ==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();
})();
Re:One Million Checkboxes by Mystery-Machine on Wednesday June 26, 2024 @04:41PM (#40804379)
This ain't gonna work for 1,000,000 checkboxes. You could try using requestAnimationFrame or querying only non-checked checkboxes querySelectorAll('input[type="checkbox"]:not(:checked)') or not calling checkAllCheckboxes for all mutations.

Edit: or just call querySelector('input[type="checkbox"]:not(:checked)') and do them one by one in some kinda while(true) loop

Re:One Million Checkboxes by sillysaurusx on Wednesday June 26, 2024 @05:16PM (#40804672)
Just write data to the underlying API. No need to interact with the browser UI at all.
Re:One Million Checkboxes by some_random on Wednesday June 26, 2024 @06:00PM (#40805079)
This really feels like it defeats the purpose of the site ngl
Re:One Million Checkboxes by Vampiero on Wednesday June 26, 2024 @08:11PM (#40805992)
Well maybe next time OP will actually do their analysis and figure out that the project is DOA before even writing one line of code.
Re:One Million Checkboxes by sillysaurusx on Wednesday June 26, 2024 @08:46PM (#40806192)
The project was wildly successful. I didn't know who eieio was, and now I do. I suspect that's true for lots of people now.
Re:One Million Checkboxes by furyofantares on Wednesday June 26, 2024 @10:45PM (#40806712)
Oh that's Celine Dion minus the consonants
Re:One Million Checkboxes by sillysaurusx on Thursday June 27, 2024 @12:55AM (#40807380)
How on earth did you come up with this? Or did you hear it somewhere?

If it’s the former, you need to do improv. You have the gift.

Re:One Million Checkboxes by baapercollege on Thursday June 27, 2024 @03:18AM (#40808163)
He is celine dion
Re:One Million Checkboxes by quesera on Thursday June 27, 2024 @09:42AM (#40810422)
Re:One Million Checkboxes by furyofantares on Thursday June 27, 2024 @10:11AM (#40810745)
Yep, that's the form I've seen it in before.
Re:One Million Checkboxes by em-bee on Wednesday June 26, 2024 @09:16PM (#40806354)
i thought it was old mac donald