更新
This commit is contained in:
@@ -754,11 +754,18 @@ function filterAndExtractWords(array $result)
|
||||
*/
|
||||
function highlightKeywords($title, $searchTitle)
|
||||
{
|
||||
$originalTitle = $title; // 保存原始标题
|
||||
|
||||
// 使用正则表达式来高亮所有关键词
|
||||
foreach ($searchTitle as $keyword) {
|
||||
$title = preg_replace('/(' . preg_quote($keyword, '/') . ')/i', '<span>$1</span>', $title);
|
||||
}
|
||||
|
||||
// 如果有关键词被高亮,添加<p>标签
|
||||
if ($title !== $originalTitle) {
|
||||
$title = '<p>' . $title . '</p>';
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
|
||||
@@ -477,8 +477,12 @@ a:hover {
|
||||
font-weight: bold;
|
||||
padding-right: 42px;
|
||||
padding-bottom: 4px;
|
||||
color: var(--theme-theme);
|
||||
}
|
||||
.listBox .left .list .item .title span{
|
||||
.listBox .left .list .item .title p{
|
||||
color: var(--theme-color);
|
||||
}
|
||||
.listBox .left .list .item .title p span{
|
||||
color: var(--theme-theme);
|
||||
}
|
||||
.listBox .left .list .item .btns{
|
||||
@@ -489,11 +493,11 @@ a:hover {
|
||||
.listBox .left .list .item .btns .btn{
|
||||
position: relative;
|
||||
margin-right: 35px;
|
||||
color: var(--theme-theme);
|
||||
opacity: .95;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-weight: 500;
|
||||
color: var(--theme-color);
|
||||
}
|
||||
.listBox .left .list .item .btns .btn .iconfont{
|
||||
font-size: 18px;
|
||||
|
||||
Reference in New Issue
Block a user