* Add clear button to nextmatch search box for Firefox

This commit is contained in:
Nathan Gray 2014-10-29 14:33:19 +00:00
parent a137491ec0
commit 928c61d4cf
2 changed files with 33 additions and 0 deletions

View File

@ -1929,6 +1929,29 @@ var et2_nextmatch_header_bar = et2_DOMWidget.extend(et2_INextmatchHeader,
self.nextmatch.applyFilters({search: self.search.getValue()}); self.nextmatch.applyFilters({search: self.search.getValue()});
} }
}); });
// Firefox treats search differently. Add in the clear button.
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1)
{
this.search.input.on("keyup",
function(event) {
// Insert the button, if needed
if(self.search.input.next('span').length == 0)
{
self.search.input.after(
$j('<span class="ui-icon"></span>').click(
function() {self.search.input.val('');}
)
);
}
if(event.which == 27) // Escape
{
// Excape clears search
self.search.input.val('');
}
self.search.input.next('span').toggle(self.search.input.val() != '');
}
);
}
// Add category // Add category
if(!settings.no_cat) { if(!settings.no_cat) {

View File

@ -984,6 +984,16 @@ div.message.floating {
.et2_nextmatch .nextmatch_header_row > div { .et2_nextmatch .nextmatch_header_row > div {
display: inline-block; display: inline-block;
} }
/* Firefox only search clear button */
.et2_nextmatch .nextmatch_header_row input[type="search"] + span {
position: relative;
display: inline-block;
top: 4px;
margin-left: -16px;
/* Clear icon (x) ui-icon-clear */
background-position: -80px -128px;
}
/* Favorites */ /* Favorites */
.nextmatch_header div[id$=favorite_wrapper] { .nextmatch_header div[id$=favorite_wrapper] {
margin-top: 6px; margin-top: 6px;