Settings' search lists each provider's own settings (warm-ups, check-ins
and the like) as rows that open the provider's editor. It listed them
for every provider magpie knows, so a search for "warm up on reset"
offered ChatGPT and Claude to a user with neither, and Open did nothing
(the scattered settings audit after netube99 on X). A row now remembers
its providers and is left out while none is added, and a row whose
built-in plugin is off is left out as the others are.
Those rows are drawn by a lazy provlinks.js the first time a search
wants them, not on each Settings draw: app.js was 399 bytes over
TestCoreScriptBudget with the change, and is now 956 under its size at
the base, with the budget unchanged.
Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): settings-search, provider-prefs, old-webkit,
i18n-keys, builtin-places: 168 pass, 0 fail, Chromium and WebKit;
TestCoreScriptBudget ok. Broken by hand: without the set-miss line the
new case was red with ['ChatGPT','Claude'].
45 lines
2.1 KiB
JavaScript
45 lines
2.1 KiB
JavaScript
// Settings' search finds a provider's own settings (Codex's reset and
|
|
// warm-up, Claude's warm-up, a plugin's check-in) by these rows, each
|
|
// opening the provider's editor. They show only while searching, so
|
|
// app.js imports this when a search first wants them, and it weighs
|
|
// nothing on the core. A row goes with its list's plugin (warm-ups), and
|
|
// with no such provider to open (findSettings, by its agents).
|
|
window.provPrefLinksDraw = function () {
|
|
const box = $("#provPrefLinks");
|
|
box.replaceChildren();
|
|
const ids = [...new Set(Object.values(PROV_PREFS).flat())];
|
|
const by = (list) => list.classList.contains("ci-plugin") ? [list.dataset.provider] : Object.keys(PROV_PREFS).filter((k) => PROV_PREFS[k].includes(list.id));
|
|
for (const list of [...ids.map((id) => $("#" + id)), ...$("#pluginCheckinList").children]) {
|
|
if (!list || list.hidden) continue;
|
|
const agents = by(list);
|
|
for (const r of list.querySelectorAll(":scope > .row.pref:not(.ci-acct):not(.ci-now-row):not(.warm-now):not([hidden])")) {
|
|
const name = r.querySelector(".who > .name");
|
|
if (!name) continue;
|
|
const row = el("div", "row pref agent-pref-link");
|
|
const f = list.closest("[data-feature]")?.dataset.feature;
|
|
if (f) row.dataset.feature = f;
|
|
row.agents = agents;
|
|
const who = el("div", "who");
|
|
const n = el("div", "name", name.textContent);
|
|
n.dataset.en = name.dataset.en || name.textContent;
|
|
who.append(n, el("div", "sub", t("In {provider}'s editor, on the Providers page", { provider: subNames(agents.slice(0, 1)) })));
|
|
const sub = r.querySelector(".sub:not(.err)");
|
|
if (sub) {
|
|
const says = el("span", "", sub.textContent);
|
|
says.hidden = true;
|
|
says.dataset.en = sub.dataset.en || sub.textContent;
|
|
who.append(says);
|
|
}
|
|
const go = el("button", "text", t("Open"));
|
|
go.type = "button";
|
|
go.onclick = async () => {
|
|
if (!await show("providers")) return;
|
|
const p = providers?.providers.find((x) => agents.includes(x.account?.agent));
|
|
if (p) openProvider(p.id);
|
|
};
|
|
row.append(who, go);
|
|
box.append(row);
|
|
}
|
|
}
|
|
};
|