A `setInterval` Script Deleted 14 Pages of Social Posts While Its Author Played Mahjong Link
Every developer hits a repetitive browser task that a platform offers no bulk action for. Knowing how to inspect the DOM, identify the trigger elements, and script a timed loop in the console turns a multi-hour clickfest into a background job that finishes while you do something else.
Faced with 14 pages of old short posts on Juejin's content-management dashboard, a developer reverse-engineered the delete flow through the browser's DevTools. The UI required clicking a dropdown delete item, then confirming a modal — a two-step sequence that repeated identically for every post. Rather than click through it manually, they located the relevant CSS classes (`byte-dropdown-item` and `btn-confirm`) and triggered the actions from the console.
A `setInterval` loop calling a `deleteShortMsg` function every two seconds automated the entire cleanup. The script clicked the first available delete element, waited one second for the confirmation modal, then clicked confirm. While it ran, the author stepped away to play Mahjong Link.
The technique generalizes beyond deleting social posts: the same pattern of inspecting DOM events, abstracting a multi-step flow, and driving it with timed console scripts applies to any repetitive browser-based task or lightweight headless scraping job.
Platforms that lack bulk-delete features push users toward browser automation as the only practical escape hatch, which is a product gap, not a hack.
The two-second interval is conservative; tightening it risks race conditions where the modal hasn't appeared before the confirm click fires.
Hardcoding class names makes the script brittle — a CSS refactor on Juejin's side would break it instantly, but for a one-off cleanup that trade-off is irrelevant.