mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 23:30:36 +01:00
made the acp search a bit more cooler
This commit is contained in:
@@ -213,6 +213,20 @@
|
||||
}
|
||||
|
||||
#acp-search {
|
||||
input {
|
||||
background: black;
|
||||
border: 0;
|
||||
color: white;
|
||||
box-shadow: none;
|
||||
width: 31px;
|
||||
.transition(.4s ease width);
|
||||
font-family: @font-family-monospace;
|
||||
|
||||
&:focus {
|
||||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.search-match {
|
||||
font-weight: 700;
|
||||
color: black;
|
||||
|
||||
@@ -102,18 +102,22 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) {
|
||||
function setupACPSearch() {
|
||||
var menu = $('#acp-search .dropdown-menu'),
|
||||
routes = [],
|
||||
input = $('#acp-search input'),
|
||||
firstResult = null;
|
||||
|
||||
$('#acp-search input').on('keyup', function() {
|
||||
input.on('keyup', function() {
|
||||
$('#acp-search .dropdown').addClass('open');
|
||||
});
|
||||
|
||||
$('#acp-search').parents('form').on('submit', function(ev) {
|
||||
var href = firstResult ? firstResult : RELATIVE_PATH + '/search/' + $(this).find('input').val();
|
||||
var input = $(this).find('input'),
|
||||
href = firstResult ? firstResult : RELATIVE_PATH + '/search/' + input.val();
|
||||
|
||||
ajaxify.go(href.replace(/^\//, ''));
|
||||
|
||||
setTimeout(function() {
|
||||
$('#acp-search .dropdown').removeClass('open');
|
||||
$(input).blur();
|
||||
}, 150);
|
||||
|
||||
ev.preventDefault();
|
||||
@@ -124,7 +128,11 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) {
|
||||
routes.push($(link).attr('href'));
|
||||
});
|
||||
|
||||
$('#acp-search input').on('keyup focus', function() {
|
||||
input.on('blur', function() {
|
||||
$(this).val('').attr('placeholder', '/');
|
||||
});
|
||||
|
||||
input.on('keyup focus', function() {
|
||||
var $input = $(this),
|
||||
value = $input.val().toLowerCase(),
|
||||
menuItems = $('#acp-search .dropdown-menu').html('');
|
||||
@@ -133,6 +141,8 @@ define('forum/admin/footer', ['forum/admin/settings'], function(Settings) {
|
||||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
||||
}
|
||||
|
||||
$input.attr('placeholder', '');
|
||||
|
||||
firstResult = null;
|
||||
|
||||
if (value.length >= 3) {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<form class="navbar-form navbar-left hidden-xs" role="search">
|
||||
<div class="form-group" id="acp-search" >
|
||||
<div class="dropdown" >
|
||||
<input type="text" data-toggle="dropdown" class="form-control" placeholder="Search ACP...">
|
||||
<input type="text" data-toggle="dropdown" class="form-control" placeholder="/">
|
||||
<ul class="dropdown-menu" role="menu"></ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user