<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JOJO9090</title>
    <description>The latest articles on DEV Community by JOJO9090 (@qzm).</description>
    <link>https://dev.to/qzm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259973%2F7f6dc8f2-f576-4f8f-acab-f1c29721351c.jpg</url>
      <title>DEV Community: JOJO9090</title>
      <link>https://dev.to/qzm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qzm"/>
    <language>en</language>
    <item>
      <title>How I Built a Zero-OAuth Google Photos Bulk Cleaner in Vanilla JS (Virtual Scroll &amp; DOM Pitfalls)</title>
      <dc:creator>JOJO9090</dc:creator>
      <pubDate>Mon, 23 Nov 2026 07:49:50 +0000</pubDate>
      <link>https://dev.to/qzm/how-i-built-a-zero-oauth-google-photos-bulk-cleaner-in-vanilla-js-virtual-scroll-dom-pitfalls-11l8</link>
      <guid>https://dev.to/qzm/how-i-built-a-zero-oauth-google-photos-bulk-cleaner-in-vanilla-js-virtual-scroll-dom-pitfalls-11l8</guid>
      <description>&lt;blockquote&gt;
&lt;h3&gt;
  
  
  🎁 Free Lifetime Pro for the First 199 DEV Readers — Now Open Source &amp;amp; Supports Chrome / Brave / Edge!
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Get a Free Pro Code&lt;/strong&gt;: Email &lt;strong&gt;&lt;a href="mailto:9090qzm@gmail.com"&gt;9090qzm@gmail.com&lt;/a&gt;&lt;/strong&gt; (subject: &lt;code&gt;PhotoSweep Pro&lt;/code&gt;) — the &lt;strong&gt;first 199 readers&lt;/strong&gt; get a free Lifetime Pro activation code (no strings attached).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install on Edge (1-Click)&lt;/strong&gt;: &lt;a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi" rel="noopener noreferrer"&gt;PhotoSweep on Microsoft Edge Add-ons&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install on Chrome / Brave / Arc (Open Source, 10s ZIP Install)&lt;/strong&gt;: &lt;a href="https://github.com/qzm12348/photosweep" rel="noopener noreferrer"&gt;GitHub Repo &amp;amp; Chrome Guide&lt;/a&gt; | &lt;a href="https://qzm12348.github.io/photosweep/" rel="noopener noreferrer"&gt;Homepage&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feedback Welcome&lt;/strong&gt;: If you find it useful, a ⭐ Star on GitHub or an honest review on the Edge Store would help a solo dev a ton! If anything feels clunky or missing, &lt;strong&gt;drop a comment below with your feature request or bug report&lt;/strong&gt; and I'll fix/build it ASAP.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;A few weeks ago, my Google account hit the dreaded &lt;strong&gt;15GB storage limit&lt;/strong&gt;—to the point where Gmail started warning me that incoming emails would bounce.&lt;/p&gt;

&lt;p&gt;I opened Google Photos to clean up years of old screenshots, blurry bursts, and huge videos, and immediately remembered why everyone dreads this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Google Photos still has &lt;strong&gt;no native "Select All"&lt;/strong&gt; button for an entire library.&lt;/li&gt;
&lt;li&gt;Holding &lt;code&gt;Shift&lt;/code&gt; 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.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And you can't solve this cleanly with the official Google Photos Library API either—&lt;strong&gt;the API doesn't even allow deleting photos that weren't uploaded by your own app&lt;/strong&gt;, plus requesting Google OAuth scopes raises obvious privacy concerns.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;&lt;a href="https://qzm12348.github.io/photosweep/" rel="noopener noreferrer"&gt;PhotoSweep&lt;/a&gt;&lt;/strong&gt;, a lightweight, &lt;strong&gt;100% local Manifest V3 extension&lt;/strong&gt; in plain Vanilla JS + CSS with zero backend and zero Google OAuth. It just went live on the &lt;a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi" rel="noopener noreferrer"&gt;Microsoft Edge Add-ons Store&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here are the 4 trickiest DOM engineering pitfalls I ran into while automating &lt;code&gt;photos.google.com&lt;/code&gt;—hopefully useful if you ever build a browser extension on top of Google's Closure/Wiz web apps.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Finding the Real Virtual Scroll Container (Not &lt;code&gt;window&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Google Photos doesn't scroll &lt;code&gt;window&lt;/code&gt;. The photo grid lives inside a nested scrollable container under &lt;code&gt;c-wiz[role="main"]&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you blindly scroll the first &lt;code&gt;overflow-y: auto&lt;/code&gt; 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 (&lt;code&gt;width&lt;/code&gt; &amp;amp; &lt;code&gt;height&lt;/code&gt; thresholds) and driving virtual list hydration with a combination of &lt;code&gt;scrollBy&lt;/code&gt;, &lt;code&gt;scrollIntoView&lt;/code&gt;, and &lt;code&gt;WheelEvent&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Detecting &lt;strong&gt;true end-of-library&lt;/strong&gt; (versus "still lazy-loading") also required checking three signals together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scroll offset delta;&lt;/li&gt;
&lt;li&gt;The timeline scrubber &lt;code&gt;[role="slider"]&lt;/code&gt; (&lt;code&gt;aria-valuenow&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;Whether any new &lt;code&gt;a[href*="/photo/"]&lt;/code&gt; nodes appeared in the DOM.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Invisible &lt;code&gt;opacity: 0&lt;/code&gt; Checkboxes &amp;amp; Date-Header Collisions
&lt;/h2&gt;

&lt;p&gt;Two subtle checkbox traps bit me early on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Un-hovered checkboxes have &lt;code&gt;opacity: 0&lt;/code&gt;&lt;/strong&gt;: Every photo's &lt;code&gt;[role="checkbox"]&lt;/code&gt; is hidden until hover, so standard "is element visible?" checks skip them completely.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Date-header "Select entire day" checkboxes&lt;/strong&gt;: Each date group has its own checkbox next to the date heading (&lt;code&gt;h2&lt;/code&gt;/&lt;code&gt;h3&lt;/code&gt;). 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 &lt;code&gt;aria-label&lt;/code&gt; patterns and parent heading checks fixed it cleanly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Google's &lt;code&gt;jsaction&lt;/code&gt; Event Pipeline Ignores Plain &lt;code&gt;.click()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Google Photos relies heavily on Google's &lt;code&gt;jsaction&lt;/code&gt; event delegation. Calling &lt;code&gt;el.click()&lt;/code&gt; alone intermittently fails to trigger selection or toolbar actions.&lt;/p&gt;

&lt;p&gt;Dispatching the full pointer + mouse sequence solved the flakiness:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;pointerdown&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;mousedown&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;pointerup&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;mouseup&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;click&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pairing this with configurable click delays (&lt;code&gt;100ms–500ms&lt;/code&gt;) and batch sizes (&lt;code&gt;25 / 50 / 100&lt;/code&gt;) keeps the tab smooth even on libraries with tens of thousands of photos.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Multi-Language Trash Detection (3-Layer Fallback)
&lt;/h2&gt;

&lt;p&gt;A huge complaint about older cleaners is: &lt;em&gt;"Doesn't work because my Google Photos is in Spanish / Japanese / Chinese."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Instead of relying on English text alone, PhotoSweep uses a 3-layer fallback to trigger "Move to Trash":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Layer 1&lt;/strong&gt;: Built-in &lt;code&gt;aria-label&lt;/code&gt; / &lt;code&gt;data-tooltip&lt;/code&gt; dictionary covering &lt;strong&gt;11+ languages&lt;/strong&gt; (EN, ZH, ES, FR, DE, JA, KO, PT, RU, IT, etc.).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 2&lt;/strong&gt;: Matching the Material Trash icon's SVG &lt;code&gt;path&lt;/code&gt; signature in the top action bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 3&lt;/strong&gt;: Dispatching Google Photos' native keyboard shortcut (&lt;code&gt;#&lt;/code&gt; / &lt;code&gt;Delete&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the confirmation modal, the script polls for up to 3 seconds matching &lt;code&gt;data-mdc-dialog-action="ok"&lt;/code&gt; or localized confirmation labels. If no dialog appears, &lt;strong&gt;it automatically pauses&lt;/strong&gt; so nothing runs out of sync.&lt;/p&gt;




&lt;h2&gt;
  
  
  Safety First (Dry-Run by Default)
&lt;/h2&gt;

&lt;p&gt;Nobody trusts an automation tool near years of family photos—myself included. So PhotoSweep enforces a few guardrails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Starts in Dry-Run (Select Only) mode by default&lt;/strong&gt;: It highlights selected items with a blue border and &lt;strong&gt;never clicks delete&lt;/strong&gt; until you explicitly switch to &lt;em&gt;"Auto Move to Trash"&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trash only (30-day recovery)&lt;/strong&gt;: Items are only moved to Google Photos Trash, never permanently wiped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skip Starred / Cutoff Year&lt;/strong&gt;: Automatically skips favorited photos by default, and lets you set a cutoff year (e.g., &lt;em&gt;2024 &amp;amp; Older&lt;/em&gt;) so recent photos stay untouched.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;100% Local&lt;/strong&gt;: Only requests &lt;code&gt;storage&lt;/code&gt;, &lt;code&gt;activeTab&lt;/code&gt;, and &lt;code&gt;https://photos.google.com/*&lt;/code&gt;. No photos, credentials, or metadata ever leave your browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;(Quick reminder if you try it: if mobile backup &amp;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.)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It Out &amp;amp; Free Pro Giveaway (First 199 Readers!)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Edge Add-ons Store&lt;/strong&gt;: &lt;a href="https://microsoftedge.microsoft.com/addons/detail/photosweep-%E2%80%94-google-photo/ddmgkgjpaelgifebnbojjlfighnmljgi" rel="noopener noreferrer"&gt;PhotoSweep on Microsoft Edge Add-ons&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chrome / Brave / Arc (Open Source + 10s ZIP Guide)&lt;/strong&gt;: &lt;a href="https://github.com/qzm12348/photosweep" rel="noopener noreferrer"&gt;GitHub — qzm12348/photosweep&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Landing Page &amp;amp; Privacy Policy&lt;/strong&gt;: &lt;a href="https://qzm12348.github.io/photosweep/" rel="noopener noreferrer"&gt;https://qzm12348.github.io/photosweep/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It includes &lt;strong&gt;500 free items per day&lt;/strong&gt; (resets daily at midnight, with all filters, Dry-Run, and Skip Starred unlocked), plus an optional &lt;strong&gt;$4.99 one-time lifetime Pro&lt;/strong&gt; unlock if you want to wipe tens of thousands of old photos in one sitting.&lt;/p&gt;

&lt;p&gt;🎁 &lt;strong&gt;DEV Community Early-Bird Giveaway&lt;/strong&gt;: To celebrate the launch, I'm giving away &lt;strong&gt;free Lifetime Pro promo codes to the first 199 readers&lt;/strong&gt;—no strings attached! Just email me at &lt;strong&gt;&lt;a href="mailto:9090qzm@gmail.com"&gt;9090qzm@gmail.com&lt;/a&gt;&lt;/strong&gt; (subject: &lt;code&gt;PhotoSweep Pro&lt;/code&gt;) and I'll reply with your free activation code.&lt;/p&gt;

&lt;p&gt;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!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
