Skip to content

Instantly share code, notes, and snippets.

@jarp0l
Last active January 14, 2026 12:47
Show Gist options
  • Select an option

  • Save jarp0l/41b4169f7b1c55272d9aea00879dc43e to your computer and use it in GitHub Desktop.

Select an option

Save jarp0l/41b4169f7b1c55272d9aea00879dc43e to your computer and use it in GitHub Desktop.
Hide listings from users who have more than a certain number of ads on Hamrobazaar. Users with high number of ads are usually sort of brokers. (Updated to support Hamrobazaar's new UI layout)
// ==UserScript==
// @name Hamrobazaar - Hide Users with Many Ads
// @namespace hamrobazaar
// @version 2026.01.14
// @description Hide listings from users who have more than a certain number of ads on Hamrobazaar
// @author jarp0l
// @match https://hamrobazaar.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=hamrobazaar.com
// @grant none
// @updateURL https://gist.github.com/jarp0l/41b4169f7b1c55272d9aea00879dc43e/raw
// @downloadURL https://gist.github.com/jarp0l/41b4169f7b1c55272d9aea00879dc43e/raw
// ==/UserScript==
(function () {
'use strict';
const MAX_ADS_ALLOWED = 15;
function processListings() {
document.querySelectorAll('span.span-small').forEach(span => {
const text = span.textContent?.trim();
if (!text) return;
const m = text.match(/^(\d+)\s+Ads?$/i);
if (!m) return;
const adCount = Number(m[1]);
if (adCount <= MAX_ADS_ALLOWED) return;
// closest listing card
const card = span.closest('div.group.bg-white');
if (!card) return;
// hide others
card.style.display = 'none';
// logging
const user = card.querySelector('a[href^="/user/"]')?.textContent?.trim() || 'Unknown';
const title = card.querySelector('img[alt]')?.alt || 'Unknown title';
console.log(`Hiding: "${title}" by ${user} (${adCount} ads)`);
});
}
window.addEventListener('load', () => {
processListings();
new MutationObserver(processListings)
.observe(document.body, { childList: true, subtree: true });
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment