diff --git a/public/home/search.js b/public/home/search.js index 66dcce6c3..4ba0a5ced 100644 --- a/public/home/search.js +++ b/public/home/search.js @@ -376,7 +376,7 @@ function getTaskDesc(isZh,key){ function getActiveItem(sort_type){ console.log("currentSearchSortBy=" + currentSearchSortBy + " sort_type=" + sortBy[sort_type]); - if(currentSearchSortBy == sortBy[sort_type]){ + if(currentSearchSortBy == sortBy[sort_type] && currentSearchAscending == sortAscending[sort_type]){ return "active "; }else{ return ""; diff --git a/routers/search.go b/routers/search.go index 6433026d3..3b9035f5b 100644 --- a/routers/search.go +++ b/routers/search.go @@ -554,23 +554,23 @@ func truncLongText(text string, isNeedToDealText bool) string { if end >= stringlen { end = stringlen } - return string(trimFontHtml(textRune[start:end])) + "..." + return trimFontHtml(textRune[start:end]) + "..." } else { - return string(trimFontHtml(textRune[0:200])) + "..." + return trimFontHtml(textRune[0:200]) + "..." } } else { if stringlen > 200 { - return string(trimFontHtml(textRune[0:200])) + "..." + return trimFontHtml(textRune[0:200]) + "..." } else { return text } } } -func trimFontHtml(text []rune) []rune { +func trimFontHtml(text []rune) string { startRune := rune('<') endRune := rune('>') - + count := 0 for i := 0; i < len(text); i++ { if text[i] == startRune { //start < re := false @@ -583,12 +583,18 @@ func trimFontHtml(text []rune) []rune { } if re { //found > i = j + count++ } else { - return text[0:i] + if count%2 == 1 { + return string(text[0:i]) + "" + } else { + return string(text[0:i]) + } + } } } - return text + return string(text) } func trimHrefHtml(result string) string { diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index f895613e9..18cf3ce0e 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -97,7 +97,7 @@