Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(web): 社媒标记回到药丸里,等待态那块浮层是一块

longmeidao17d4c3db4b4a
diff --git a/frontend/src/entity-skeleton.ts b/frontend/src/entity-skeleton.ts
index c9c3f74b1..ed90abd91 100644
--- a/frontend/src/entity-skeleton.ts
+++ b/frontend/src/entity-skeleton.ts
@@ -1,5 +1,11 @@
-/** 实体资料的等待态使用资料头、标签条和对应正文布局。 */
-export function entitySkeletonHtml(kind: string, body: string) {
+/** 实体资料的等待态使用资料头、标签条和对应正文布局。
+ *
+ * 筛选条和作品抬头在这一页是同一块浮层的上下两格,等待态也得是一块:这两条各自都
+ * 带着玻璃材质和 22px 圆角,不套进外框就被当成两块独立浮层画出来,中间一道缝、四个
+ * 角各一道弧,等内容回来又并成一块。`mountFilterFrame` 是运行时才建外框的,骨架进不了
+ * 那条路径,所以自己把外框和两个槽位的标记写全。
+ */
+export function entitySkeletonHtml(kind: string, head: string, body: string) {
const square = kind === 'studio' || kind === 'agency';
return `<section data-skeleton="entity/${kind}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
@@ -7,6 +13,8 @@ export function entitySkeletonHtml(kind: string, body: string) {
<div class="entityskeletontext"><div class="entitytitle"><h2 class="skeleton">&nbsp;</h2></div>
<div class="alias"><span class="skeleton"></span></div>
<div class="entitylinks"><span class="skeleton"></span></div></div></div>
- <section class="entitytagbar"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>
+ <div class="board-filter-frame" data-filter-frame>
+ <section class="entitytagbar" data-filter-row="top"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>
+ ${head}</div>
<div class="entitysection">${body}</div></div></section>`;
}
diff --git a/frontend/test/entity-skeleton.test.ts b/frontend/test/entity-skeleton.test.ts
index e1da51908..e51158481 100644
--- a/frontend/test/entity-skeleton.test.ts
+++ b/frontend/test/entity-skeleton.test.ts
@@ -1,9 +1,11 @@
import { describe, expect, it } from 'vitest';
import { entitySkeletonHtml } from '../src/entity-skeleton';
+const HEAD = '<div class="entitycollectionhead" data-filter-row="bottom"><h3 class="skeleton">&nbsp;</h3></div>';
+
describe('实体资料骨架', () => {
it('事务所使用方形标识、资料头、标签和成员正文', () => {
- const html = entitySkeletonHtml('agency', '<div class="igrid">成员</div>');
+ const html = entitySkeletonHtml('agency', HEAD, '<div class="igrid">成员</div>');
expect(html).toContain('data-skeleton="entity/agency"');
expect(html).toContain('entityportrait square skeleton');
expect(html).toContain('entityhero');
@@ -11,6 +13,14 @@ describe('实体资料骨架', () => {
expect(html).toContain('<div class="entitysection"><div class="igrid">');
});
it('人物资料使用圆形头像', () => {
- expect(entitySkeletonHtml('performer', '')).toContain('entityportrait skeleton');
+ expect(entitySkeletonHtml('performer', HEAD, '')).toContain('entityportrait skeleton');
+ });
+ it('筛选条和作品抬头装在同一块浮层外框里', () => {
+ const html = entitySkeletonHtml('performer', HEAD, '');
+ const frame = html.slice(html.indexOf('board-filter-frame'), html.indexOf('<div class="entitysection"'));
+ expect(frame).toContain('data-filter-row="top"');
+ expect(frame).toContain('data-filter-row="bottom"');
+ // 外框只有一个,两条筛选行都在它里面,等待态和内容回来之后是同一个形状。
+ expect(html.match(/board-filter-frame/g)).toHaveLength(1);
});
});
diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjs
index 7c8ad4880..ada73fab0 100644
--- a/scripts/vendor_web_dependencies.mjs
+++ b/scripts/vendor_web_dependencies.mjs
@@ -135,7 +135,9 @@ const lucideIcons = new Map([
const handDrawnIcons = new Set([
"shuffle", // 两条带 pathLength 的动画路径由 Peach 维护。
"alert", "pics", "jav", "theater-enter", "theater-exit", "brand-x",
- "brand-instagram", // 字形来自 Phosphor regular instagram-logo(MIT),套进与 brand-x 同一只墨色圆盘。
+ // 字形来自 Phosphor regular 的 instagram-logo 与 threads-logo(MIT),各套进与 brand-x
+ // 同一只墨色圆盘:三枚并排时圆一样大、字形一样占直径的一半。
+ "brand-instagram", "brand-threads",
// 「换一批」:Lucide shuffle 的线条拆成 strand-a/strand-b 两条 path 供忙态逐条画出,
// 上游一刷新就会把两条并回五条,所以由手工维护。
"shuffle",
diff --git a/tests/test_web_js.py b/tests/test_web_js.py
index 1c8a5a2bd..f69cfdd64 100644
--- a/tests/test_web_js.py
+++ b/tests/test_web_js.py
@@ -321,14 +321,17 @@ class WebJsBehaviourTests(unittest.TestCase):
self.assertNotIn("url=", url, "外链图标端点不得接受前端给的地址")
def test_brand_marks_cover_the_host_and_its_subdomains_only(self):
- # 416 条社媒链接里 372 条是 x.com/twitter.com,只给它一个内联标记就覆盖
- # 89%,还省一次跨站请求。其余继续走 favicon,不为个位数的链接各配图标。
+ # x.com 一家就占了账本里 793 条外链中的 378 条,只给它一个内联标记就覆盖将近一半,
+ # 还省一次跨站请求。其余继续走 favicon,不为个位数的链接各配图标。
self.assertJsResults([
("core.js", "brandIcon", ["https://x.com/remu"], "brand-x"),
("core.js", "brandIcon", ["https://www.twitter.com/remu"], "brand-x"),
("core.js", "brandIcon", ["https://mobile.x.com/remu"], "brand-x"),
# Instagram 的 favicon 同样取不到,给它自己的标记。
("core.js", "brandIcon", ["https://www.instagram.com/arina_hashimoto1215"], "brand-instagram"),
+ # Threads 给得出图,给的是 iOS 应用图标那种带高光的圆角方图,裁成圆露白边。
+ ("core.js", "brandIcon", ["https://www.threads.com/@remu"], "brand-threads"),
+ ("core.js", "brandIcon", ["https://www.threads.net/@remu"], "brand-threads"),
# 只认后缀边界:`notx.com` 不是 `x.com` 的子域。
("core.js", "brandIcon", ["https://notx.com/remu"], ""),
("core.js", "brandIcon", ["https://example.com/a"], ""),
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 028008c32..0a677047f 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2035,15 +2035,54 @@ class WebUiSourceTests(unittest.TestCase):
'mask="url(#brand-x-knockout)"/>')
self.assertPageContains(
'transform="translate(12 12) scale(.5) translate(-12 -12)"')
- # Instagram 同一只圆盘:Phosphor 的 256 视口字形按 24×.5/256 缩进去。
- self.assertPageContains('<symbol id="i-brand-instagram" viewBox="0 0 24 24">')
+ # Instagram 与 Threads 同一只圆盘:Phosphor 的 256 视口字形按 24×.5/256 缩进去。
+ for symbol in ("brand-instagram", "brand-threads"):
+ self.assertPageContains(f'<symbol id="i-{symbol}" viewBox="0 0 24 24">')
+ self.assertPageContains(f'mask="url(#{symbol}-knockout)"/>')
self.assertPageContains(
'transform="translate(12 12) scale(.046875) translate(-128 -128)"')
self.assertPageContains("[['instagram.com'],'brand-instagram']")
+ self.assertPageContains("[['threads.com','threads.net'],'brand-threads']")
self.assertPageLacks('fill="#000" stroke="none"', "品牌标记不写死板子的颜色")
self.assertPageContains(
'.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}')
+ def test_an_icon_link_keeps_its_pill_whether_the_mark_is_an_img_or_an_svg(self):
+ """一句话那种外链才是无边无底的蓝字;带图标的外链是一圈药丸。
+
+ 判据写成「这条链接里有没有那枚圆盘」,不是「有没有 `<img>`」:社媒标记是内联
+ `<svg>`,按后一个判据会被当成文字外链,药丸的边和底被抹平,同一排里只有它们
+ 几个没有圈。判据缺席时连带图标的那几枚也会被抹平,所以两条都要钉。
+ """
+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")
+ for rule in (
+ "body a:is(.externallink,[target=_blank])"
+ ":not(:has(img,.entitylinkicon)):not(.cardlink){",
+ "body a:is(.externallink,[target=_blank])"
+ ":not(:has(img,.entitylinkicon)):not(.cardlink):hover{",
+ ):
+ self.assertIn(rule, board)
+ for weaker in (":not(:has(img)):not(.cardlink){", ":not(:has(img)):hover{",
+ "body a:is(.externallink,[target=_blank]):not(.cardlink){"):
+ self.assertNotIn(weaker, board)
+
+ def test_the_waiting_filter_frame_is_one_slab_not_two(self):
+ """等待态的筛选条和作品抬头共用一块浮层,和内容回来之后是同一个形状。
+
+ 这两条各自带着玻璃材质和 22px 圆角,`mountFilterFrame` 在运行时把它们收进外框;
+ 骨架是一段字符串,进不了那条路径,外框和两个槽位的标记必须写在 HTML 里,
+ 否则等的那几秒钟里它们是上下两块独立浮层,中间一道缝。
+ """
+ source = (Path(__file__).resolve().parents[1]
+ / "frontend/src/entity-skeleton.ts").read_text(encoding="utf-8")
+ self.assertIn('<div class="board-filter-frame" data-filter-frame>', source)
+ self.assertIn('<section class="entitytagbar" data-filter-row="top">', source)
+ self.assertIn("entitySkeletonHtml(kind: string, head: string, body: string)", source)
+ self.assertPageContains(
+ "collectionHeaderHtml({readout:'&nbsp;',loading:true,filterRow:'bottom'})")
+ self.assertPageContains(
+ '${filterRow?` data-filter-row="${esc(filterRow)}"`:\'\'}')
+
def test_the_link_icon_disc_carries_no_plate_of_its_own(self):
"""内联品牌标记直接画在药丸上。垫一层 `--sunk` 会让它比周围暗一档,看着像
这条链接被禁用了——而图标要说的是「去哪」,不是「能不能点」。"""
@@ -9813,7 +9852,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("toggleAttribute('data-media-only',now!=='videos')")
self.assertPageContains(".entitytagbar[data-media-only] .entitytags .pill{display:none}")
self.assertPageContains(
- "const head=collectionHeaderHtml({readout:'&nbsp;',loading:true});")
+ "const head=collectionHeaderHtml({readout:'&nbsp;',loading:true,filterRow:'bottom'});")
def test_the_filter_panel_is_two_rows_on_a_phone(self):
"""手机上这块浮层是两行,两侧也留出跟内容一样的白。
diff --git a/web/app.js b/web/app.js
index 44af4ec12..9ee5000c1 100644
--- a/web/app.js
+++ b/web/app.js
@@ -7694,11 +7694,11 @@ function wireNamePicker(kind,current){
/* 等着的这一下浮层也得是整块的:下半要到列表回来才画的话,上半的下沿在等的那几秒里
留着两个直角,读起来是这块浮层缺了一半。这一页的作品多时那几秒不算短。 */
function showEntityLoading(kind){
- const head=collectionHeaderHtml({readout:'&nbsp;',loading:true});
- const body=head+(kind==='agency'
+ const head=collectionHeaderHtml({readout:'&nbsp;',loading:true,filterRow:'bottom'});
+ const body=kind==='agency'
?indexSkeletonHtml({kind:'performers',layout:peopleIndexLayout()})
- :pageSkeletonHtml('正在读取作品',{cards:true}));
- const placeholder=entitySkeletonHtml(kind,body);
+ :pageSkeletonHtml('正在读取作品',{cards:true});
+ const placeholder=entitySkeletonHtml(kind,head,body);
if($('#index').firstElementChild?.dataset.skeleton!==`entity/${kind}`){
$('#index').innerHTML=placeholder;fitSkeleton($('#index'));
}
diff --git a/web/board.css b/web/board.css
index 2e2ec0132..428fdfa39 100644
--- a/web/board.css
+++ b/web/board.css
@@ -973,8 +973,13 @@ body :is(.photozoom input,.vjs-peach-speed-range)::-moz-range-track{height:6px;b
body :is(.popmenu,.gselectmenu,.cardmenupanel){box-sizing:border-box;padding:10px;border:1px solid var(--color-border-button-default);border-radius:16px;background:var(--color-background-primary-default);color:var(--color-text-primary);box-shadow:0 12px 24px -4px #0000001a,0 4px 8px -2px #0000000d}
body :is(.popmenu,.gselectmenu,.cardmenupanel)>:is(button,[role=option],[role=menuitem]){min-height:36px;padding:8px;gap:8px;border:0;border-radius:10px;background:transparent;color:var(--color-text-secondary);font:var(--board-body);box-shadow:none}
body :is(.popmenu,.gselectmenu,.cardmenupanel)>:is(button,[role=option],[role=menuitem]):is(:hover,:focus-visible,[aria-selected=true]){background:var(--color-background-primary-hover);color:var(--color-text-primary)}
-body a:is(.externallink,[target=_blank]):not(.cardlink){display:inline-flex;align-items:center;gap:4px;min-height:20px;padding:0;border:0;border-radius:4px;background:transparent;box-shadow:none;color:var(--tungsten);font-weight:500;text-decoration:none;text-underline-offset:3px}
-body a:is(.externallink,[target=_blank]):not(.cardlink):hover{background:transparent;text-decoration:underline;box-shadow:none}.externallink .externalmark{width:18px;height:18px;flex:none}
+/* 这一条只管「一句话就是一个链接」的那种外链:一行蓝字,没有边、没有底、不占按钮的位置。
+ 带图标的外链不在此列——资料页那排社媒标是一圈药丸,边、底和 4px 内边距都是它自己的。
+ 排除条件判的是那枚圆盘本身,不是「有没有 `<img>`」:常见社媒的标记是内联 `<svg>`(它们
+ 的 favicon 被站点挡着取不到),一枚 `<img>` 都没有,按后一个判据会漏进这条规则里——
+ `padding:0` 和 `border:0` 把那圈药丸抹平,同一排社媒标里只有它们几个没有圈。 */
+body a:is(.externallink,[target=_blank]):not(:has(img,.entitylinkicon)):not(.cardlink){display:inline-flex;align-items:center;gap:4px;min-height:20px;padding:0;border:0;border-radius:4px;background:transparent;box-shadow:none;color:var(--tungsten);font-weight:500;text-decoration:none;text-underline-offset:3px}
+body a:is(.externallink,[target=_blank]):not(:has(img,.entitylinkicon)):not(.cardlink):hover{background:transparent;text-decoration:underline;box-shadow:none}.externallink .externalmark{width:18px;height:18px;flex:none}
.board-link-button{display:inline-flex;align-items:center;justify-content:center;justify-self:start;gap:4px;max-width:100%;padding:0;border:0;border-radius:4px;background:transparent;box-shadow:none;color:var(--tungsten);font:inherit;font-weight:500;text-decoration:none;text-underline-offset:3px;transition:color .15s ease}
.board-link-button:hover{background:transparent;text-decoration:underline;box-shadow:none}
.board-link-button:focus-visible{outline:2px solid var(--tungsten);outline-offset:3px}
diff --git a/web/dist/peach-ui.js b/web/dist/peach-ui.js
index 0705bc8a0..5010707f7 100644
--- a/web/dist/peach-ui.js
+++ b/web/dist/peach-ui.js
@@ -1,6 +1,6 @@
import { LOC as e, esc as t, faviconUrl as n, fmtDur as r, fmtSize as i, icon as a, requestErrorMessage as o } from "/js/core.js";
import { MEDIA_SOURCE_ICONS as s, checkboxHtml as c, collectionSummaryHtml as l, confirmModal as u, emptyStateHtml as d, fieldsetTitle as f, loadingDotsHtml as p, moveGlidePane as m, noteHtml as h, progressHtml as g, projectBannerHtml as _, selectFieldHtml as v, selectOptionIconHtml as y, setActionBusy as b, wireCollapse as x, wireSelectField as S } from "/js/ui-components.js";
-//#region node_modules/preact/dist/preact.module.js
+//#region ../../../peach-app/frontend/node_modules/preact/dist/preact.module.js
var C, w, T, E, D, O, k, A, j, M, N, P, ee, F, te, ne = {}, re = [], ie = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ae = Array.isArray;
function I(e, t) {
for (var n in t) e[n] = t[n];
@@ -399,7 +399,7 @@ function Be(e, t) {
return `<svg class="board-radar" viewBox="0 0 320 280" role="img" aria-label="${R(t)}"><title>${R(n.map((e) => `${e.name} ${e.score}`).join(","))}</title>${s}<polygon points="${o((e) => n[e].score / r * 100)}" class="board-radar-value"/>${c}</svg>`;
}
//#endregion
-//#region node_modules/preact/hooks/dist/hooks.module.js
+//#region ../../../peach-app/frontend/node_modules/preact/hooks/dist/hooks.module.js
var Ve, z, He, Ue, We = 0, Ge = [], B = w, Ke = B.__b, qe = B.__r, Je = B.diffed, Ye = B.__c, Xe = B.unmount, Ze = B.__;
function Qe(e, t) {
B.__h && B.__h(z, e, We || t), We = 0;
@@ -636,7 +636,7 @@ function ft(e) {
});
}
//#endregion
-//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
+//#region ../../../peach-app/frontend/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
var pt = 0;
Array.isArray;
function J(e, t, n, r, i, a) {
@@ -1175,7 +1175,7 @@ function Ft(e) {
});
}
//#endregion
-//#region node_modules/d3-array/src/max.js
+//#region ../../../peach-app/frontend/node_modules/d3-array/src/max.js
function It(e, t) {
let n;
if (t === void 0) for (let t of e) t != null && (n < t || n === void 0 && t >= t) && (n = t);
@@ -1186,7 +1186,7 @@ function It(e, t) {
return n;
}
//#endregion
-//#region node_modules/d3-array/src/min.js
+//#region ../../../peach-app/frontend/node_modules/d3-array/src/min.js
function Lt(e, t) {
let n;
if (t === void 0) for (let t of e) t != null && (n > t || n === void 0 && t >= t) && (n = t);
@@ -1197,7 +1197,7 @@ function Lt(e, t) {
return n;
}
//#endregion
-//#region node_modules/d3-array/src/sum.js
+//#region ../../../peach-app/frontend/node_modules/d3-array/src/sum.js
function Rt(e, t) {
let n = 0;
if (t === void 0) for (let t of e) (t = +t) && (n += t);
@@ -1208,19 +1208,19 @@ function Rt(e, t) {
return n;
}
//#endregion
-//#region node_modules/d3-sankey/src/align.js
+//#region ../../../peach-app/frontend/node_modules/d3-sankey/src/align.js
function zt(e, t) {
return e.sourceLinks.length ? e.depth : t - 1;
}
//#endregion
-//#region node_modules/d3-sankey/src/constant.js
+//#region ../../../peach-app/frontend/node_modules/d3-sankey/src/constant.js
function Bt(e) {
return function() {
return e;
};
}
//#endregion
-//#region node_modules/d3-sankey/src/sankey.js
+//#region ../../../peach-app/frontend/node_modules/d3-sankey/src/sankey.js
function Vt(e, t) {
return Ut(e.source, t.source) || e.index - t.index;
}
@@ -1440,7 +1440,7 @@ function Xt() {
return m;
}
//#endregion
-//#region node_modules/d3-path/src/path.js
+//#region ../../../peach-app/frontend/node_modules/d3-path/src/path.js
var Zt = Math.PI, Qt = 2 * Zt, $t = 1e-6, en = Qt - $t;
function tn() {
this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
@@ -1492,14 +1492,14 @@ tn.prototype = nn.prototype = {
}
};
//#endregion
-//#region node_modules/d3-shape/src/constant.js
+//#region ../../../peach-app/frontend/node_modules/d3-shape/src/constant.js
function rn(e) {
return function() {
return e;
};
}
//#endregion
-//#region node_modules/d3-shape/src/point.js
+//#region ../../../peach-app/frontend/node_modules/d3-shape/src/point.js
function an(e) {
return e[0];
}
@@ -1507,10 +1507,10 @@ function on(e) {
return e[1];
}
//#endregion
-//#region node_modules/d3-shape/src/array.js
+//#region ../../../peach-app/frontend/node_modules/d3-shape/src/array.js
var sn = Array.prototype.slice;
//#endregion
-//#region node_modules/d3-shape/src/link/index.js
+//#region ../../../peach-app/frontend/node_modules/d3-shape/src/link/index.js
function cn(e) {
return e.source;
}
@@ -1542,7 +1542,7 @@ function fn() {
return un(dn);
}
//#endregion
-//#region node_modules/d3-sankey/src/sankeyLinkHorizontal.js
+//#region ../../../peach-app/frontend/node_modules/d3-sankey/src/sankeyLinkHorizontal.js
function pn(e) {
return [e.source.x1, e.y0];
}
@@ -3161,7 +3161,7 @@ function ir({ receipt: e, data: t, error: n }) {
});
}
//#endregion
-//#region node_modules/@preact/signals-core/dist/signals-core.module.js
+//#region ../../../peach-app/frontend/node_modules/@preact/signals-core/dist/signals-core.module.js
var ar = Symbol.for("preact-signals");
function or() {
if (Z > 1) Z--;
@@ -3410,7 +3410,7 @@ function Dr(e, t) {
return r[Symbol.dispose] = r, r;
}
//#endregion
-//#region node_modules/@preact/signals/dist/signals.module.js
+//#region ../../../peach-app/frontend/node_modules/@preact/signals/dist/signals.module.js
var Or, kr, Ar = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, jr = [];
Dr(function() {
Or = this.N;
@@ -4386,15 +4386,17 @@ function wi(e, t, n, r, i = 1) {
}
//#endregion
//#region src/entity-skeleton.ts
-function Ti(e, t) {
+function Ti(e, t, n) {
return `<section data-skeleton="entity/${e}" role="status" aria-label="正在读取资料">
<span class="sr-only">正在读取资料</span><div aria-hidden="true">
<div class="entityhero"><div class="entityportrait ${e === "studio" || e === "agency" ? "square " : ""}skeleton"></div>
<div class="entityskeletontext"><div class="entitytitle"><h2 class="skeleton">&nbsp;</h2></div>
<div class="alias"><span class="skeleton"></span></div>
<div class="entitylinks"><span class="skeleton"></span></div></div></div>
- <section class="entitytagbar"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>
- <div class="entitysection">${t}</div></div></section>`;
+ <div class="board-filter-frame" data-filter-frame>
+ <section class="entitytagbar" data-filter-row="top"><div class="entitytags"><span class="skeleton entitymediaskeleton"></span><span class="skeleton entitymediaskeleton"></span></div></section>
+ ${t}</div>
+ <div class="entitysection">${n}</div></div></section>`;
}
//#endregion
//#region src/board-skeleton.ts
diff --git a/web/index.html b/web/index.html
index be364fd92..ea1deb846 100644
--- a/web/index.html
+++ b/web/index.html
@@ -168,6 +168,7 @@
借来命名一个内部遮罩会被当成一枚没人认领的图标。 -->
<symbol id="i-brand-x" viewBox="0 0 24 24"><mask id="brand-x-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.5) translate(-12 -12)" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-x-knockout)"/></symbol>
<symbol id="i-brand-instagram" viewBox="0 0 24 24"><mask id="brand-instagram-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.046875) translate(-128 -128)" d="M128,80a48,48,0,1,0,48,48A48.05,48.05,0,0,0,128,80Zm0,80a32,32,0,1,1,32-32A32,32,0,0,1,128,160ZM176,24H80A56.06,56.06,0,0,0,24,80v96a56.06,56.06,0,0,0,56,56h96a56.06,56.06,0,0,0,56-56V80A56.06,56.06,0,0,0,176,24Zm40,152a40,40,0,0,1-40,40H80a40,40,0,0,1-40-40V80A40,40,0,0,1,80,40h96a40,40,0,0,1,40,40ZM192,76a12,12,0,1,1-12-12A12,12,0,0,1,192,76Z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-instagram-knockout)"/></symbol>
+ <symbol id="i-brand-threads" viewBox="0 0 24 24"><mask id="brand-threads-knockout"><rect width="24" height="24" fill="#fff"/><path fill="#000" transform="translate(12 12) scale(.046875) translate(-128 -128)" d="M186.42,123.65a63.81,63.81,0,0,0-11.13-6.72c-4-29.89-24-39.31-33.1-42.07-19.78-6-42.51,1.19-52.85,16.7a8,8,0,0,0,13.32,8.88c6.37-9.56,22-14.16,34.89-10.27,9.95,3,16.82,10.3,20.15,21a81.05,81.05,0,0,0-15.29-1.43c-13.92,0-26.95,3.59-36.67,10.1C94.3,127.57,88,139,88,152c0,20.58,15.86,35.52,37.71,35.52a48,48,0,0,0,34.35-14.81c6.44-6.7,14-18.36,15.61-37.1.38.26.74.53,1.1.8C186.88,144.05,192,154.68,192,168c0,19.36-20.34,48-64,48-26.73,0-45.48-8.65-57.34-26.44C60.93,175,56,154.26,56,128s4.93-47,14.66-61.56C82.52,48.65,101.27,40,128,40c32.93,0,54,13.25,64.53,40.52a8,8,0,1,0,14.93-5.75C194.68,41.56,167.2,24,128,24,96,24,72.19,35.29,57.34,57.56,45.83,74.83,40,98.52,40,128s5.83,53.17,17.34,70.44C72.19,220.71,96,232,128,232c30.07,0,48.9-11.48,59.4-21.1C200.3,199.08,208,183,208,168,208,149.66,200.54,134.32,186.42,123.65Zm-37.89,38a31.94,31.94,0,0,1-22.82,9.9c-10.81,0-21.71-6-21.71-19.52,0-12.63,12-26.21,38.41-26.21A63.88,63.88,0,0,1,160,128.24C160,142.32,156,153.86,148.53,161.62Z"/></mask><circle cx="12" cy="12" r="12" fill="currentColor" stroke="none" mask="url(#brand-threads-knockout)"/></symbol>
<symbol id="i-bookmark-plus" viewBox="0 0 24 24"><path d="M12 7v6" /><path d="M15 10H9" /><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol>
<symbol id="i-bookmark" viewBox="0 0 24 24"><path d="M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z" /></symbol>
<symbol id="i-gallery-vertical-end" viewBox="0 0 24 24"><path d="M7 2h10" /><path d="M5 6h14" /><rect width="18" height="12" x="3" y="10" rx="2" /></symbol>
diff --git a/web/js/core.js b/web/js/core.js
index 6191de2b4..65fed2f2d 100644
--- a/web/js/core.js
+++ b/web/js/core.js
@@ -94,10 +94,14 @@ const linkMarkUrl=link=>`/link-mark?id=${encodeURIComponent(link.link_id ?? '')}
favicon 是别人服务器上的一张小位图:X 直接挡掉爬取(资料页那个空白白圆就是它),
取到的也多是 16×16,放进 32 px 的圆里必然糊。内联 SVG 没有这两个问题,还省一次
- 跨站请求。只覆盖真正占量的主机——416 条社媒链接里 372 条是 x.com/twitter.com;
- Instagram 的 favicon 同样被挡,资料页上只剩一只地球,所以也给它一枚;
- 其余继续走 favicon,不为个位数的链接各配一个图标。 */
-const BRAND_ICONS=[[['x.com','twitter.com'],'brand-x'],[['instagram.com'],'brand-instagram']];
+ 跨站请求。x.com 一家就占了账本里 793 条外链中的 378 条;Instagram 的 favicon 同样被挡,
+ 资料页上只剩一只地球,这两个是按量进来的。
+ Threads 是另一种理由:它给得出图,给的是 iOS 应用图标那种圆角方图,四边一圈高光是
+ 照着方角画的,裁成圆之后沿着圆周露出一道白。这种图 `/link-mark` 只能原样用——那圈
+ 高光是人家设计的一部分,抠不掉。
+ 其余继续走 favicon:字形图标合成出来的品牌色圆底本来就好看,不为个位数的链接各配一枚。 */
+const BRAND_ICONS=[[['x.com','twitter.com'],'brand-x'],[['instagram.com'],'brand-instagram'],
+ [['threads.com','threads.net'],'brand-threads']];
const brandIcon=url=>{try{
const host=new URL(url).hostname.replace(/^www\./,'').toLowerCase();
return BRAND_ICONS.find(([hosts])=>hosts.some(d=>host===d||host.endsWith('.'+d)))?.[1]||'';
diff --git a/web/js/ui-components.js b/web/js/ui-components.js
index 1f103529d..bbf15432d 100644
--- a/web/js/ui-components.js
+++ b/web/js/ui-components.js
@@ -13,8 +13,10 @@ export function filterChipHtml(label,{attr,value,selected=false,count,className=
export function sortControlsHtml({items=[],renderItem=String,extra='',shuffleId='',shuffleClass='entitybatch'}={}){
return `<span class="sorts"><button class="batchaction ${esc(shuffleClass)}"${shuffleId?` id="${esc(shuffleId)}"`:''} type="button" title="换一批" aria-label="换一批">${icon('shuffle')}</button>${extra}${items.map(renderItem).join('')}</span>`;
}
-export function collectionHeaderHtml({readout='',controls='',before='',className='',loading=false}={}){
- return `<div class="entitycollectionhead${className?' '+esc(className):''}">${before}<h3${loading?' class="skeleton"':''}>${readout}</h3>${controls}</div>`;
+/* `filterRow` 只给等待态用:那时浮层还是一段字符串,`mountFilterFrame` 没得跑,
+ 槽位标记得跟着 HTML 一起生成,否则这一条会自己画成第二块浮层。 */
+export function collectionHeaderHtml({readout='',controls='',before='',className='',loading=false,filterRow=''}={}){
+ return `<div class="entitycollectionhead${className?' '+esc(className):''}"${filterRow?` data-filter-row="${esc(filterRow)}"`:''}>${before}<h3${loading?' class="skeleton"':''}>${readout}</h3>${controls}</div>`;
}
const horizontalControls=new Map();
diff --git a/web/vendor/lucide-ORIGIN.md b/web/vendor/lucide-ORIGIN.md
index e9d1c167a..28d207d5c 100644
--- a/web/vendor/lucide-ORIGIN.md
+++ b/web/vendor/lucide-ORIGIN.md
@@ -5,5 +5,5 @@
- 许可证:ISC;原文见 `lucide-LICENSE.txt`
- 消费者:`web/index.html` 内联的 115 个 symbol
-雪碧图里另有 8 枚自绘 symbol(shuffle、alert、pics、jav、theater-enter、theater-exit、brand-x、brand-instagram)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。
+雪碧图里另有 9 枚自绘 symbol(shuffle、alert、pics、jav、theater-enter、theater-exit、brand-x、brand-instagram、brand-threads)与 16 枚 player-* 前缀的播放器图标,都没有上游可对。
RSS 与拖动点保留填充修正,避免小圆点在全局描边样式下消失。