Allow searchbox to grow and shrink more flexibly.

This is nearly perfect, modulo two things:

1. If you have a search active and you resize the window, the search
   box resize doesn't take effect until you exit the search.

2. In super-narrow windows (<380px), the searchbox overshoots
   the message area slightly.

I don't regard either as huge issues -- I'll probably fix #1
eventually.

(imported from commit 4900fb9783cc9f447315b0892bd3505f5c31ce15)
This commit is contained in:
Waseem Daher 2012-11-15 15:40:05 -05:00
parent 50995dc6b7
commit 5fa0b8d9d0
2 changed files with 9 additions and 7 deletions

View File

@ -112,7 +112,11 @@ function clear_search_cache() {
}
exports.focus_search = function () {
$("#search_query").width("504px");
// Shrink the searchbox to make room for the buttons.
var search_query = $('#search_query');
var new_width = search_query.width() -
$('.search_button').outerWidth(true)*3;
search_query.width(new_width);
$("#search_arrows").addClass("input-append");
$('.search_button').show();
disable_search_arrows_if(false, ["up", "down"]);
@ -124,9 +128,8 @@ exports.initiate_search = function () {
exports.clear_search = function () {
$('table tr').removeHighlight();
// Reset the width to that in the stylesheet. If you change it there, change
// it here.
$('#search_query').val('').width("610px");
// Clear & reset searchbox to its normal size
$('#search_query').val('').width('');
$("#search_arrows").removeClass("input-append");
$("#search_up, #search_down").removeAttr("disabled");
$('.search_button').blur().hide();

View File

@ -372,7 +372,7 @@ input.send_message {
visibility: visible;
max-height: 30px;
padding: 5px 10px;
width: 640px;
max-width: 640px;
}
.always_in_view {
@ -380,8 +380,7 @@ input.send_message {
}
#search_query {
/* If this changes, also change the width in search.js:clear_search */
width: 610px;
width: 95%;
}
.highlight {