Skip to content

Instantly share code, notes, and snippets.

@t04glovern
Last active July 26, 2025 06:11
Show Gist options
  • Save t04glovern/3df656b4decc4f7d80260abdc2f3de71 to your computer and use it in GitHub Desktop.
Save t04glovern/3df656b4decc4f7d80260abdc2f3de71 to your computer and use it in GitHub Desktop.
Useful JS console scripts to interact with Ebay

Open Leave Feedback for each item in an order in a new tab

(async function() {
  // Get all "More actions" buttons (using their common class)
  const moreButtons = Array.from(document.querySelectorAll('button.fake-menu-button__button'));
  console.log(`Found ${moreButtons.length} "More actions" buttons.`);
  
  for (const btn of moreButtons) {
    // Click the button to open its dropdown
    btn.click();
    // Wait for the dropdown to render (adjust delay if needed)
    await new Promise(resolve => setTimeout(resolve, 10));
    
    // Look for the feedback link within the newly revealed dropdown
    const feedbackLink = document.querySelector('a[href*="leave_single_feedback"]');
    if (feedbackLink) {
      console.log("Opening feedback link: " + feedbackLink.href);
      window.open(feedbackLink.href, '_blank');
    } else {
      console.log("No feedback link found for this card.");
    }
    
    // Optionally, click the button again to close the dropdown
    btn.click();
    await new Promise(resolve => setTimeout(resolve, 10));
  }
})();

Copy the contents of a dropdown list (excluding Out of Stock items) to clipboard

const allDropdowns = [...document.querySelectorAll('div[role="listbox"].listbox__options')];

// pick the one with the most .listbox__option children (assumes it's your target)
const target = allDropdowns.reduce((a, b) =>
  (a.querySelectorAll('.listbox__option').length > b.querySelectorAll('.listbox__option').length) ? a : b
);

copy(
  [...target.querySelectorAll('.listbox__option')]
    .map(el => el.querySelector('.listbox__value')?.textContent.trim())
    .filter(text => text && !text.includes('Select') && !text.includes('Out of stock'))
    .join('\n')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment