better styling for ACP search

v1.18.x
psychobunny 10 years ago
parent 5a36c33fac
commit 27a2af89c8

@ -357,6 +357,13 @@
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
border-top-right-radius: 5px; border-top-right-radius: 5px;
} }
#acp-search {
.search-match {
font-weight: 700;
color: black;
}
}
} }

@ -28,9 +28,13 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) {
if (value.length > 3) { if (value.length > 3) {
for (var file in acpIndex) { for (var file in acpIndex) {
if (acpIndex.hasOwnProperty(file)) { if (acpIndex.hasOwnProperty(file)) {
if (acpIndex[file].indexOf(value) !== -1) { var position = acpIndex[file].indexOf(value);
if (position !== -1) {
var href = file.replace('.tpl', ''), var href = file.replace('.tpl', ''),
title = href.replace(/^\/admin\//, '').split('/'); title = href.replace(/^\/admin\//, '').split('/'),
description = acpIndex[file].substring(Math.max(0, position - 15), Math.min(acpIndex[file].length - 1, position + 15))
.replace(value, '<span class="search-match">' + value + '</span>');
for (var t in title) { for (var t in title) {
if (title.hasOwnProperty(t)) { if (title.hasOwnProperty(t)) {
@ -42,7 +46,7 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) {
title = title.join(' > '); title = title.join(' > ');
menuItems.append('<li role="presentation"><a role="menuitem" href="' + RELATIVE_PATH + href + '">' + title + '</a></li>'); menuItems.append('<li role="presentation"><a role="menuitem" href="' + RELATIVE_PATH + href + '">' + title + '<br /><small><code>...' + description + '...</code></small></a></li>');
} }
} }
} }

Loading…
Cancel
Save