← All examples

JavaScript Productivity ebay.com

eBay: open all photos at once

Adds a button that opens every gallery photo at full size in separate tabs.

Code to copy

// Add a button that opens every gallery photo at full size in tabs
function addOpenAllButton() {
  if (document.getElementById('jz-eby-openall')) { return; }
  const gallery = document.querySelector('.ux-image-grid, .ux-image-filmstrip-carousel');
  if (!gallery) { return; }
  const btn = document.createElement('button');
  btn.id = 'jz-eby-openall';
  btn.type = 'button';
  btn.textContent = 'Open all photos';
  btn.style.cssText = 'margin:8px 0;padding:6px 12px;font-weight:700;'
    + 'background:#2b3a8c;color:#fff;border:0;border-radius:6px;cursor:pointer';
  btn.addEventListener('click', function () {
    const seen = {};
    gallery.querySelectorAll('img[src]').forEach(function (img) {
      const full = img.src.replace(/s-l\d+/, 's-l1600');
      if (!seen[full]) { seen[full] = 1; window.open(full, '_blank', 'noopener'); }
    });
  });
  gallery.parentElement.insertBefore(btn, gallery);
}
addOpenAllButton();
const obs = new MutationObserver(addOpenAllButton);
obs.observe(document.documentElement, { childList: true, subtree: true });

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases