diff --git a/public/less/admin/admin.less b/public/less/admin/admin.less index 581415c4a0..72ee4f209c 100644 --- a/public/less/admin/admin.less +++ b/public/less/admin/admin.less @@ -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; diff --git a/public/src/forum/admin/footer.js b/public/src/forum/admin/footer.js index a2dcbe6c70..062b7ed7e8 100644 --- a/public/src/forum/admin/footer.js +++ b/public/src/forum/admin/footer.js @@ -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) { diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl index b464908dac..ea0484edfe 100644 --- a/src/views/admin/header.tpl +++ b/src/views/admin/header.tpl @@ -65,7 +65,7 @@