Permalink
Browse files

Improve the look and feel of the fast filter

  • Loading branch information...
1 parent b3143e6 commit 7e4fe589f399352c048df5acab7a09a400b686f2 @madhuracj madhuracj committed Jan 20, 2012
Showing with 33 additions and 10 deletions.
  1. +24 −9 js/navigation.js
  2. +1 −1 navigation.php
  3. +4 −0 themes/original/css/theme_left.css.php
  4. +4 −0 themes/pmahomme/css/theme_left.css.php
View
@@ -170,10 +170,9 @@ function fast_filter(value)
*/
function clear_fast_filter()
{
- var elm = $('#NavFilter input');
- elm.val('');
+ var $elm = $('#fast_filter');
+ $elm.val('');
fast_filter('');
- elm.focus();
}
/**
@@ -197,14 +196,30 @@ function PMA_reloadRecentTable()
$(document).ready(function(){
/* Display filter */
$('#NavFilter').css('display', 'inline');
- $('input[id="fast_filter"]').focus(function() {
- if($(this).attr("value") === "filter tables by name") {
- clear_fast_filter();
+ var txt = $('#fast_filter').val();
+
+ $('#fast_filter.gray').live('focus', function() {
+ $(this).removeClass('gray');
+ clear_fast_filter();
+ });
+
+ $('#fast_filter:not(.gray)').live('focusout', function() {
+ var $input = $(this);
+ if ($input.val() == '') {
+ $input
+ .addClass('gray')
+ .val(txt);
}
});
- $('#clear_fast_filter').click(clear_fast_filter);
- $('#fast_filter').focus(function (evt) {evt.target.select();});
- $('#fast_filter').keyup(function (evt) {fast_filter(evt.target.value);});
+
+ $('#clear_fast_filter').click(function() {
+ clear_fast_filter();
+ $('#fast_filter').focus();
+ });
+
+ $('#fast_filter').keyup(function(evt) {
+ fast_filter($(this).val());
+ });
/* Jump to recent table */
$('#recentTable').change(function() {
View
@@ -267,7 +267,7 @@ function PMA_exitNavigationFrame()
?>
<span id="NavFilter">
<span id="clear_fast_filter" title="<?php echo __('Clear'); ?>">X</span>
- <input type="text" name="fast_filter" id="fast_filter" title="<?php echo __('Filter tables by name'); ?>" value="<?php echo __('Filter tables by name'); ?>" />
+ <input type="text" class="gray" name="fast_filter" id="fast_filter" title="<?php echo __('Filter tables by name'); ?>" value="<?php echo __('Filter tables by name'); ?>" />
</span>
<?php
}
@@ -248,3 +248,7 @@
margin: 0;
border: 0;
}
+
+#fast_filter.gray {
+ color: gray;
+}
@@ -306,3 +306,7 @@
width: 85%;
padding: 0.1em;
}
+
+#fast_filter.gray {
+ color: gray;
+}

0 comments on commit 7e4fe58

Please sign in to comment.