mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-22 02:24:44 +08:00
feat: hide pip in mobile, sort search results
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user