Live data from Hacker News

One Million Checkboxes

onemillioncheckboxes.com

71–80 of 320 posts

Re: One Million Checkboxes

#77
post #27

tried doing: ``` $$('input[type=checkbox]').forEach(elt => elt.click()); ``` and got an alert that said "CHILL LOL". fun site

Time to write a Playwright script.

const { chromium } = require('playwright');

(async () => { // Launch the browser const browser = await chromium.launch({ headless: false }); const context = await browser.newContext(); const page = await context.newPage();

    // Navigate to your page
    await page.goto('https://example.com'); // Replace with the actual URL

    // Click all checkboxes
    await page.$$eval('input[type=checkbox]', checkboxes => {
        checkboxes.forEach(checkbox => checkbox.click());
    });

    // Close the browser
    await browser.close();
})();

I'm proud of myself for getting the chill alert without even running a script, just frantically tapping with my fingers!

Re: One Million Checkboxes

#79
post #59

Earlier quoted context omitted.

Would be fun to read a writeup of how you implemented it.

it's a tiny flask server, a bitset stored in redis, updates broadcast (too frequently! but i don't want to change it now) via websockets, and react-window to only render the checkboxes that are in view. I'll do a writeup when i finish putting out fires!

Fun challenge: userscript to make an animated fire out of checkboxes

Re: One Million Checkboxes

#80

for (const input of document.querySelectorAll('input[type=checkbox]')) { if (!input.checked) { input.click(); await new Promise(res => setTimeout(res, 250)); } }

or the defensive maneuver

  window.addEventListener("change", function(e) {
      if (e.target instanceof HTMLInputElement && !e.target.checked) {
          e.target.click();
      }
  });
Post reply on HN