<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[PhotoSweep]]></title><description><![CDATA[PhotoSweep]]></description><link>https://photosweep.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Dec 2026 00:50:31 GMT</lastBuildDate><atom:link href="https://photosweep.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Built a Zero-OAuth Google Photos Bulk Cleaner in Vanilla JS (Virtual Scroll & DOM Pitfalls)]]></title><description><![CDATA[A few weeks ago, my Google account hit the dreaded 15GB storage limit—to the point where Gmail started warning me that incoming emails would bounce. I…]]></description><link>https://photosweep.hashnode.dev/how-i-built-a-zero-oauth-google-photos-bulk-cleaner-in-vanilla-js-virtual-scroll-dom-pitfalls</link><guid isPermaLink="true">https://photosweep.hashnode.dev/how-i-built-a-zero-oauth-google-photos-bulk-cleaner-in-vanilla-js-virtual-scroll-dom-pitfalls</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[browser extensions]]></category><dc:creator><![CDATA[JOJO9090]]></dc:creator><pubDate>Mon, 23 Nov 2026 09:05:49 GMT</pubDate><content:encoded><![CDATA[<blockquote>
<h3>🎁 Free Lifetime Pro for the First 199 Readers!</h3>
<ul>
<li><strong>Get a Free Pro Code</strong>: Email <strong><a href="mailto:9090qzm@gmail.com">9090qzm@gmail.com</a></strong> (subject: <code>PhotoSweep Pro</code>) — the <strong>first 199 readers</strong> get a free Lifetime Pro activation code (no strings attached).</li>
<li><strong>Try It on Edge</strong>: <a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi">PhotoSweep on Microsoft Edge Add-ons</a> | <a href="https://qzm12348.github.io/photosweep/">Homepage</a></li>
<li><strong>Feedback Welcome</strong>: If you find it useful, an honest review on the Edge Store would help a solo dev a ton! If anything feels clunky or missing, <strong>drop a comment below with your feature request or bug report</strong> and I'll fix/build it ASAP.</li>
</ul>
</blockquote>
<p>A few weeks ago, my Google account hit the dreaded <strong>15GB storage limit</strong>—to the point where Gmail started warning me that incoming emails would bounce.</p>
<p>I opened Google Photos to clean up years of old screenshots, blurry bursts, and huge videos, and immediately remembered why everyone dreads this:</p>
<ol>
<li>Google Photos still has <strong>no native "Select All"</strong> button for an entire library.</li>
<li>Holding <code>Shift</code> to select thousands of items breaks as soon as the virtualized grid unmounts earlier DOM nodes—either the tab freezes or one accidental misclick wipes your entire selection.</li>
<li>Most existing bulk-delete extensions are years old, break on non-English Google Photos interfaces, or start deleting immediately without letting you preview what's selected.</li>
</ol>
<p>And you can't solve this cleanly with the official Google Photos Library API either—<strong>the API doesn't even allow deleting photos that weren't uploaded by your own app</strong>, plus requesting Google OAuth scopes raises obvious privacy concerns.</p>
<p>So I built <strong><a href="https://qzm12348.github.io/photosweep/">PhotoSweep</a></strong>, a lightweight, <strong>100% local Manifest V3 extension</strong> in plain Vanilla JS + CSS with zero backend and zero Google OAuth. It just went live on the <a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi">Microsoft Edge Add-ons Store</a>.</p>
<p>Here are the 4 trickiest DOM engineering pitfalls I ran into while automating <code>photos.google.com</code>—hopefully useful if you ever build a browser extension on top of Google's Closure/Wiz web apps.</p>
<hr />
<h2>1. Finding the Real Virtual Scroll Container (Not <code>window</code>)</h2>
<p>Google Photos doesn't scroll <code>window</code>. The photo grid lives inside a nested scrollable container under <code>c-wiz[role="main"]</code>.</p>
<p>If you blindly scroll the first <code>overflow-y: auto</code> element you find, you'll end up scrolling the left navigation sidebar instead of the photo feed. I ended up filtering candidate scroll containers by bounding-box dimensions (<code>width</code> &amp; <code>height</code> thresholds) and driving virtual list hydration with a combination of <code>scrollBy</code>, <code>scrollIntoView</code>, and <code>WheelEvent</code>.</p>
<p>Detecting <strong>true end-of-library</strong> (versus "still lazy-loading") also required checking three signals together:</p>
<ul>
<li>Scroll offset delta;</li>
<li>The timeline scrubber <code>[role="slider"]</code> (<code>aria-valuenow</code>);</li>
<li>Whether any new <code>a[href*="/photo/"]</code> nodes appeared in the DOM.</li>
</ul>
<h2>2. Invisible <code>opacity: 0</code> Checkboxes &amp; Date-Header Collisions</h2>
<p>Two subtle checkbox traps bit me early on:</p>
<ul>
<li><strong>Un-hovered checkboxes have <code>opacity: 0</code></strong>: Every photo's <code>[role="checkbox"]</code> is hidden until hover, so standard "is element visible?" checks skip them completely.</li>
<li><strong>Date-header "Select entire day" checkboxes</strong>: Each date group has its own checkbox next to the date heading (<code>h2</code>/<code>h3</code>). If your script clicks one of those by accident, it selects an entire day at once and throws off your batch counter. Filtering them out via <code>aria-label</code> patterns and parent heading checks fixed it cleanly.</li>
</ul>
<h2>3. Google's <code>jsaction</code> Event Pipeline Ignores Plain <code>.click()</code></h2>
<p>Google Photos relies heavily on Google's <code>jsaction</code> event delegation. Calling <code>el.click()</code> alone intermittently fails to trigger selection or toolbar actions.</p>
<p>Dispatching the full pointer + mouse sequence solved the flakiness:</p>
<pre><code class="language-js">pointerdown -&gt; mousedown -&gt; pointerup -&gt; mouseup -&gt; click
</code></pre>
<p>Pairing this with configurable click delays (<code>100ms–500ms</code>) and batch sizes (<code>25 / 50 / 100</code>) keeps the tab smooth even on libraries with tens of thousands of photos.</p>
<h2>4. Multi-Language Trash Detection (3-Layer Fallback)</h2>
<p>A huge complaint about older cleaners is: <em>"Doesn't work because my Google Photos is in Spanish / Japanese / Chinese."</em></p>
<p>Instead of relying on English text alone, PhotoSweep uses a 3-layer fallback to trigger "Move to Trash":</p>
<ol>
<li><strong>Layer 1</strong>: Built-in <code>aria-label</code> / <code>data-tooltip</code> dictionary covering <strong>11+ languages</strong> (EN, ZH, ES, FR, DE, JA, KO, PT, RU, IT, etc.).</li>
<li><strong>Layer 2</strong>: Matching the Material Trash icon's SVG <code>path</code> signature in the top action bar.</li>
<li><strong>Layer 3</strong>: Dispatching Google Photos' native keyboard shortcut (<code>#</code> / <code>Delete</code>).</li>
</ol>
<p>For the confirmation modal, the script polls for up to 3 seconds matching <code>data-mdc-dialog-action="ok"</code> or localized confirmation labels. If no dialog appears, <strong>it automatically pauses</strong> so nothing runs out of sync.</p>
<hr />
<h2>Safety First (Dry-Run by Default)</h2>
<p>Nobody trusts an automation tool near years of family photos—myself included. So PhotoSweep enforces a few guardrails:</p>
<ul>
<li><strong>Starts in Dry-Run (Select Only) mode by default</strong>: It highlights selected items with a blue border and <strong>never clicks delete</strong> until you explicitly switch to <em>"Auto Move to Trash"</em>.</li>
<li><strong>Trash only (30-day recovery)</strong>: Items are only moved to Google Photos Trash, never permanently wiped.</li>
<li><strong>Skip Starred / Cutoff Year</strong>: Automatically skips favorited photos by default, and lets you set a cutoff year (e.g., <em>2024 &amp; Older</em>) so recent photos stay untouched.</li>
<li><strong>100% Local</strong>: Only requests <code>storage</code>, <code>activeTab</code>, and <code>https://photos.google.com/*</code>. No photos, credentials, or metadata ever leave your browser.</li>
</ul>
<p><em>(Quick reminder if you try it: if mobile backup &amp; sync is turned on in your phone's Google Photos app, deleting cloud photos may also delete synced local copies on your phone—turn off backup first if you only want to free cloud storage.)</em></p>
<hr />
<h2>Try It Out &amp; Free Pro Giveaway (First 199 Readers!)</h2>
<ul>
<li><strong>Edge Add-ons Store</strong>: <a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi">PhotoSweep on Microsoft Edge Add-ons</a></li>
<li><strong>Landing Page &amp; Privacy Policy</strong>: <a href="https://qzm12348.github.io/photosweep/">https://qzm12348.github.io/photosweep/</a></li>
</ul>
<p>It includes <strong>500 free items per day</strong> (resets daily at midnight, with all filters, Dry-Run, and Skip Starred unlocked), plus an optional <strong>$4.99 one-time lifetime Pro</strong> unlock if you want to wipe tens of thousands of old photos in one sitting.</p>
<p>🎁 <strong>Early-Bird Giveaway</strong>: To celebrate the launch, I'm giving away <strong>free Lifetime Pro promo codes to the first 199 readers</strong>—no strings attached! Just email me at <strong><a href="mailto:9090qzm@gmail.com">9090qzm@gmail.com</a></strong> (subject: <code>PhotoSweep Pro</code>) and I'll reply with your free activation code.</p>
<p>If you give PhotoSweep a spin and find it genuinely helpful, leaving an honest review on the Microsoft Edge Add-ons Store would mean the world to a solo indie dev. And since Google occasionally tweaks Google Photos' DOM structure, feel free to drop any bugs or edge cases in the comments below—I'll fix them ASAP!</p>
]]></content:encoded></item></channel></rss>