Files
ObsidianHome/小鱼/.cdp/expr-find-rules.mjs
T

11 lines
464 B
JavaScript

(() => {
const out = { href: location.href, title: document.title, links: [], text: '' };
const all = Array.from(document.querySelectorAll('a[href]'));
out.links = all
.map(a => ({ t: (a.innerText || '').replace(/\s+/g, ' ').trim(), h: a.getAttribute('href') }))
.filter(x => x.t && /规则|规范|帮助|协议|中心/.test(x.t))
.slice(0, 40);
out.text = (document.body.innerText || '').replace(/\s+/g, ' ').slice(0, 800);
return out;
})()