diff --git a/css/app.css b/css/app.css index 6774237..cb9528a 100644 --- a/css/app.css +++ b/css/app.css @@ -105,10 +105,28 @@ body { font-size: 0.7rem; } -input[type=search] { - display: block; +form.searchBox { width: 180px; + border: 1px solid #4682BE; + height:20px; + position: relative; +} + +input[type=search] { + position: absolute; + top: 0; + left: 0; + width: 160px; + height: 18px; text-align: left; + border: none; +} + +input.searchButton { + position: absolute; + top: 0; + left: 160px; + height: 18px; } #content { diff --git a/images/magnifier.jpg b/images/magnifier.jpg new file mode 100644 index 0000000..d339b5b Binary files /dev/null and b/images/magnifier.jpg differ diff --git a/js/ditto.js b/js/ditto.js index 2123c69..8ff1dd5 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -75,12 +75,26 @@ function init_sidebar_section() { } function init_searchbar() { - var search = ''; + var search = '
'; $(ditto.sidebar_id).find('h2').first().before($(search)); - $('input[name=search]').keydown(searchbar_listener); + // $('input.searchButton').click(searchbar_listener); + // $('input[name=search]').keydown(searchbar_listener); } function searchbar_listener(event) { + // event.preventDefault(); + var q = $('input[name=search]').val(); + if (q !== '') { + var url = 'https://github.com/ruanyf/es6tutorial/search?utf8=✓&q=' + encodeURIComponent(q); + window.open(url, '_blank'); + win.focus(); + } + return false; + /* if (event.which === 13) { var q = $('input[name=search]').val(); if (q !== '') { @@ -88,6 +102,7 @@ function searchbar_listener(event) { location.href = url; } } + */ }