Move extra search result information for keywords and primitives from CSS to DOM

This commit is contained in:
Guillaume Gomez 2021-05-24 14:24:34 +02:00
parent a7890c7952
commit 706aa31a2d
2 changed files with 12 additions and 16 deletions

View File

@ -796,16 +796,6 @@ a {
display: inline-block;
}
.result-name span.primitive::after {
content: ' (primitive type)';
font-style: italic;
}
.result-name span.keyword::after {
content: ' (keyword)';
font-style: italic;
}
body.blur > :not(#help) {
filter: blur(8px);
-webkit-filter: blur(8px);

View File

@ -975,26 +975,32 @@ window.initSearch = function(rawSearchIndex) {
output = "<div class=\"search-results " + extraClass + "\">";
array.forEach(function(item) {
var name, type;
name = item.name;
type = itemTypes[item.ty];
if (item.is_alias !== true) {
if (duplicates[item.fullPath]) {
return;
}
duplicates[item.fullPath] = true;
}
var name = item.name;
var type = itemTypes[item.ty];
length += 1;
var extra = "";
if (type === "primitive") {
extra = " <i>(primitive type)</i>";
} else if (type === "keyword") {
extra = " <i>(keyword)</i>";
}
output += "<a class=\"result-" + type + "\" href=\"" + item.href + "\">" +
"<div><div class=\"result-name\">" +
(item.is_alias === true ?
("<span class=\"alias\"><b>" + item.alias + " </b></span><span " +
"class=\"grey\"><i>&nbsp;- see&nbsp;</i></span>") : "") +
item.displayPath + "<span class=\"" + type + "\">" +
name + "</span></div><div class=\"desc\">" +
name + extra + "</span></div><div class=\"desc\">" +
"<span>" + item.desc +
"&nbsp;</span></div></div></a>";
});