Files
ObsidianHome/小鱼/.cdp/expr-comm-probe.mjs
T

29 lines
1.4 KiB
JavaScript
Raw Normal View History

2026-11-05 15:16:24 +08:00
(() => {
const q = s => Array.from(document.querySelectorAll(s));
const txt = e => (e.innerText || '').replace(/\s+/g, ' ').trim();
return {
href: location.href,
title: document.title,
radioGroups: q('.ant-radio-group').map(g => {
const o = Array.from(g.querySelectorAll('.ant-radio-wrapper, .ant-radio-button-wrapper'));
const c = o.find(x => /checked/.test(x.className) || x.querySelector('.ant-radio-checked'));
return { opts: o.map(txt), checked: c ? txt(c) : null };
}),
pagination: {
total: (document.querySelector('.ant-pagination-total-text') || {}).innerText || null,
pages: q('.ant-pagination-item').map(e => e.innerText.trim()),
options: q('.ant-pagination-options').map(txt),
sizeChanger: q('.ant-select-selection-item').map(txt),
jump: !!document.querySelector('.ant-pagination-options-quick-jumper'),
},
sorterColumns: q('.ant-table-thead th').map((th, i) => ({
i, text: txt(th),
sortable: !!th.querySelector('.ant-table-column-sorter'),
})).filter(x => x.sortable),
headerRows: q('.ant-table-thead tr').map(tr => Array.from(tr.querySelectorAll('th')).map(txt)),
rowCount: q('.ant-table-tbody tr').length,
firstRows: q('.ant-table-tbody tr').slice(0, 3).map(tr => Array.from(tr.querySelectorAll('td')).map(txt)),
buttons: q('button').map(txt).filter(Boolean).slice(0, 30),
selects: q('.ant-select').map(txt).slice(0, 20),
};
})()