From bf1b5e9fdf1cf264348975435181463715f9606e Mon Sep 17 00:00:00 2001 From: chibash Date: Sat, 8 May 2021 11:30:44 +0900 Subject: release 3.28.0-GA --- html/search.js | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'html/search.js') diff --git a/html/search.js b/html/search.js index 35d79210..7fc8bfc5 100644 --- a/html/search.js +++ b/html/search.js @@ -32,16 +32,11 @@ var catSearchTags = "SearchTags"; var highlight = "$&"; var camelCaseRegexp = ""; var secondaryMatcher = ""; -function escapeHtml(str) { - return str.replace(//g, ">"); -} function getHighlightedText(item) { - var ccMatcher = new RegExp(escapeHtml(camelCaseRegexp)); - var escapedItem = escapeHtml(item); - var label = escapedItem.replace(ccMatcher, highlight); - if (label === escapedItem) { - var secMatcher = new RegExp(escapeHtml(secondaryMatcher.source), "i"); - label = escapedItem.replace(secMatcher, highlight); + var ccMatcher = new RegExp(camelCaseRegexp); + var label = item.replace(ccMatcher, highlight); + if (label === item) { + label = item.replace(secondaryMatcher, highlight); } return label; } @@ -55,7 +50,7 @@ function getURLPrefix(ui) { return ui.item.m + slash; } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) { $.each(packageSearchIndex, function(index, item) { - if (item.m && ui.item.p == item.l) { + if (ui.item.p == item.l) { urlPrefix = item.m + slash; } }); @@ -97,7 +92,6 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { _renderMenu: function(ul, items) { var rMenu = this, currentCategory = ""; - rMenu.menu.bindings = $(); $.each(items, function(index, item) { var li; if (item.l !== noResult.l && item.category !== currentCategory) { @@ -133,25 +127,30 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { } else { label = item.l; } - var li = $("
  • ").appendTo(ul); - var div = $("
    ").appendTo(li); + $li = $("
  • ").appendTo(ul); if (item.category === catSearchTags) { if (item.d) { - div.html(label + " (" + item.h + ")
    " - + item.d + "
    "); + $("").attr("href", "#") + .html(label + " (" + item.h + ")
    " + + item.d + "
    ") + .appendTo($li); } else { - div.html(label + " (" + item.h + ")"); + $("
    ").attr("href", "#") + .html(label + " (" + item.h + ")") + .appendTo($li); } } else { - div.html(label); + $("").attr("href", "#") + .html(label) + .appendTo($li); } - return li; + return $li; } }); $(function() { $("#search").catcomplete({ minLength: 1, - delay: 300, + delay: 100, source: function(request, response) { var result = new Array(); var presult = new Array(); @@ -324,7 +323,6 @@ $(function() { } else { window.location.href = pathtoroot + url; } - $("#search").focus(); } } }); -- cgit v1.2.3