feat: hide pip in mobile, sort search results

This commit is contained in:
shinya
2025-07-09 10:17:13 +08:00
parent 6dd508640e
commit fba049ef9f
2 changed files with 23 additions and 0 deletions

View File

@@ -159,3 +159,10 @@ div[data-media-provider] video {
background-repeat: no-repeat !important; /* 防止重复 */
background-color: #000 !important; /* 其余区域填充为黑色 */
}
/* 隐藏移动端竖屏时的 pip 按钮 */
@media (max-width: 768px) and (orientation: portrait) {
.art-control-pip {
display: none !important;
}
}

View File

@@ -49,6 +49,14 @@ function SearchPageClient() {
map.set(key, arr);
});
return Array.from(map.entries()).sort((a, b) => {
// 优先排序:标题与搜索词完全一致的排在前面
const aExactMatch = a[1][0].title === searchQuery.trim();
const bExactMatch = b[1][0].title === searchQuery.trim();
if (aExactMatch && !bExactMatch) return -1;
if (!aExactMatch && bExactMatch) return 1;
// 如果都匹配或都不匹配,则按原来的逻辑排序
return a[1][0].year === b[1][0].year
? a[0].localeCompare(b[0])
: a[1][0].year > b[1][0].year
@@ -89,6 +97,14 @@ function SearchPageClient() {
const data = await response.json();
setSearchResults(
data.results.sort((a: SearchResult, b: SearchResult) => {
// 优先排序:标题与搜索词完全一致的排在前面
const aExactMatch = a.title === query.trim();
const bExactMatch = b.title === query.trim();
if (aExactMatch && !bExactMatch) return -1;
if (!aExactMatch && bExactMatch) return 1;
// 如果都匹配或都不匹配,则按原来的逻辑排序
return a.year === b.year
? a.title.localeCompare(b.title)
: a.year > b.year