Lesss gooo claude

This commit is contained in:
2026-09-06 11:44:59 +02:00
parent 477db87363
commit 9362c9ac80
22 changed files with 3871 additions and 1 deletions
+39
View File
@@ -0,0 +1,39 @@
import type { SiteAdapter } from './adapter-interface';
/** Matches "Buy", "Buy pixelcat", etc. — never a hardcoded token name. */
const NOOB_MODE_BUY_TEXT = /^Buy\s/i;
function findQuickBuyContainers(root: ParentNode): HTMLElement[] {
// The reliable anchor is `.buy-click-container` itself, not a fixed
// ancestor depth from the inner pill — DOM depth here isn't stable.
return Array.from(root.querySelectorAll<HTMLElement>('.buy-click-container'));
}
function findNoobModeBuyButtons(root: ParentNode): HTMLElement[] {
return Array.from(root.querySelectorAll<HTMLElement>('button.bg-increase')).filter((button) =>
NOOB_MODE_BUY_TEXT.test(button.textContent?.trim() ?? ''),
);
}
export const axiomAdapter: SiteAdapter = {
id: 'axiom.trade',
matches(url) {
try {
return new URL(url).hostname.endsWith('axiom.trade');
} catch {
return false;
}
},
findBuyElements(root) {
return [...findQuickBuyContainers(root), ...findNoobModeBuyButtons(root)];
},
getContainer(el) {
// Quick Buy pills are already `.buy-click-container` (closest() matches
// the element itself). Noob Mode buttons have no such ancestor, so the
// button itself is the stable container to style.
return el.closest<HTMLElement>('.buy-click-container') ?? el;
},
};