From 5d2a5a82cb31f49669b3669ed3b9ce75751e252c Mon Sep 17 00:00:00 2001 From: ruanyf Date: Thu, 18 Feb 2016 19:30:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/app.css | 22 ++++++++++++++++++++-- images/magnifier.jpg | Bin 0 -> 607 bytes js/ditto.js | 19 +++++++++++++++++-- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 images/magnifier.jpg 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 0000000000000000000000000000000000000000..d339b5b7920553e8b33a18206aece083b29fb6c6 GIT binary patch literal 607 zcmex=uI=H%w(=K}(Mey}1a#RK7?>VxzCA7BvVU=U&uVrCR%U=n0x7G(T?grNZFY-XS% z5rBh@os$s=5F$VpBLkBF0|P4)6FVy>Oo9>Q0XB99!9*cpV-quu4~m9H!A&WmrefmZ z7Bd8a=AxM)Xvp;c76T7Zm`RXXkinkeQg?7prr*NMH1lPj-2ayR+iBdsWv{8ys`l>2 zE~DkXtHaiuO7PC!tRWfd!t%_bzb-;*=8{>x?O`Y5R%AyrDtx@UVW)vm(Uq+x9}o2% zV{#L8d+<`NYfbWsu+>XmEaIGTh}F_PTtQ|-ul7bpH@*J7(?YMz(Oui#uv2XB=i~e< zUxh{aMnp;o?+!S%>Z-WI-CN#US^1LH0u}uNWMhsn7|P0Nz1|*sBl^4Fow!9Sr{yoy z?r?HAaPG2~MVQ$XhZxy#-%XJM;@+#0mMmI+X4w_Sn^PQ29ZU=IYrk*0KXqjs_al4L z>_fk1pXZgcGU$r>(J=qo{nxGKr|*URIlk-O^ycsDz5Obdd|u@K>AlLgZv`g*Zvp@` C0;o~| literal 0 HcmV?d00001 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; } } + */ }