forked from wezm/wezm.net
Implement clearing of search field
This commit is contained in:
parent
fdf05d41c7
commit
e4a11f7a7a
3 changed files with 19 additions and 7 deletions
|
@ -48,7 +48,7 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="query">Search</label>
|
<label for="query">Search</label>
|
||||||
<input type="text" name="q" id="query" value="" />
|
<input type="text" name="q" id="query" value="" />
|
||||||
<span class="sbox_r"></span>
|
<span class="clear"></span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -274,17 +274,14 @@ ul.inline li:first-child {
|
||||||
font: 11px/13px "Lucida Grande", Helvetica, "Liberation Sans", "Bitstream Vera Sans", Tahoma, Geneva, Arial, sans-serif;
|
font: 11px/13px "Lucida Grande", Helvetica, "Liberation Sans", "Bitstream Vera Sans", Tahoma, Geneva, Arial, sans-serif;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
#search .sbox_r {
|
#search .clear {
|
||||||
background: #fff url(/images/srch_r.gif) 0 0 no-repeat;
|
background: #fff url(/images/srch_r.gif) 0 0 no-repeat;
|
||||||
float: left;
|
float: left;
|
||||||
width: 19px;
|
width: 19px;
|
||||||
height: 19px;
|
height: 19px;
|
||||||
}
|
}
|
||||||
#search .sbox_r_f2 {
|
#search .active {
|
||||||
background: #fff url(/images/srch_r.gif) 0 -19px no-repeat;
|
background-position: 0 -19px;
|
||||||
float: left;
|
|
||||||
width: 19px;
|
|
||||||
height: 19px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra parts on post page */
|
/* Extra parts on post page */
|
||||||
|
|
|
@ -12,6 +12,21 @@ var WezM = {
|
||||||
if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) {
|
if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0) {
|
||||||
$('#search input').css('paddingTop', 0);
|
$('#search input').css('paddingTop', 0);
|
||||||
}
|
}
|
||||||
|
$('#search input').keyup(function(e) {
|
||||||
|
var input = $(this);
|
||||||
|
var clear_search = $('#search .clear');
|
||||||
|
var value = input.attr('value');
|
||||||
|
if(value && (value != '')) {
|
||||||
|
clear_search.addClass('active');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clear_search.removeClass('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#search .clear.active').live('click', function() {
|
||||||
|
$('#search input').attr('value', '').keyup(); // Simulate keypress to clear results
|
||||||
|
|
||||||
|
});
|
||||||
},
|
},
|
||||||
_searchItemSelected: function() {},
|
_searchItemSelected: function() {},
|
||||||
_renderArticle: function(o) {
|
_renderArticle: function(o) {
|
||||||
|
|
Loading…
Reference in a new issue