aboutsummaryrefslogtreecommitdiffstats
path: root/html/search.js
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2021-05-08 11:30:44 +0900
committerchibash <chiba@javassist.org>2021-05-08 11:30:44 +0900
commitbf1b5e9fdf1cf264348975435181463715f9606e (patch)
treec21177a3b21afae0a4db46a2e51c6525d3b41a13 /html/search.js
parente2221a5d661445e90402c22faed1dfb9483ef022 (diff)
downloadjavassist-bf1b5e9fdf1cf264348975435181463715f9606e.tar.gz
javassist-bf1b5e9fdf1cf264348975435181463715f9606e.zip
release 3.28.0-GA
Diffstat (limited to 'html/search.js')
-rw-r--r--html/search.js38
1 files changed, 18 insertions, 20 deletions
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 = "<span class=\"resultHighlight\">$&</span>";
var camelCaseRegexp = "";
var secondaryMatcher = "";
-function escapeHtml(str) {
- return str.replace(/</g, "&lt;").replace(/>/g, "&gt;");
-}
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 = $("<li/>").appendTo(ul);
- var div = $("<div/>").appendTo(li);
+ $li = $("<li/>").appendTo(ul);
if (item.category === catSearchTags) {
if (item.d) {
- div.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
- + item.d + "</span><br>");
+ $("<a/>").attr("href", "#")
+ .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
+ + item.d + "</span><br>")
+ .appendTo($li);
} else {
- div.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>");
+ $("<a/>").attr("href", "#")
+ .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>")
+ .appendTo($li);
}
} else {
- div.html(label);
+ $("<a/>").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();
}
}
});