Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMiłosz Lewandowski <milosz.lewandowski@gmail.com>2012-05-16 23:31:59 +0400
committerMiłosz Lewandowski <milosz.lewandowski@gmail.com>2012-05-16 23:31:59 +0400
commit6130edd505e76cc515a1d2afe16bf7e7350e0ce0 (patch)
tree920a1c2f1fdace3c1cb05b2caa3f6a3087d854b1 /js
parentf447066be6db85b8be59917ca963d4587d83ae19 (diff)
Feature Requests item #3300418: Fast database search.
Diffstat (limited to 'js')
-rw-r--r--js/navigation.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/js/navigation.js b/js/navigation.js
index 843a998675..cd65e595d8 100644
--- a/js/navigation.js
+++ b/js/navigation.js
@@ -203,6 +203,37 @@ function clear_fast_filter()
}
/**
+ * hide all LI elements with second A tag which doesn`t contain requested value
+ *
+ * @param string value requested value
+ *
+ */
+function fast_db_filter(value)
+{
+ var lowercase_value = value.toLowerCase();
+
+ $('#databaseList li a').each(function(idx, elem) {
+ var $elem = $(elem);
+ if (value && $elem.html().toLowerCase().indexOf(lowercase_value) == -1) {
+ $elem.parent().hide();
+ } else {
+ $elem.parents('li').show();
+ }
+ });
+
+}
+
+/**
+ * Clears fast database filter.
+ */
+function clear_fast_db_filter()
+{
+ var $elm = $('#fast_db_filter');
+ $elm.val('');
+ fast_db_filter('');
+}
+
+/**
* Reloads the recent tables list.
*/
function PMA_reloadRecentTable()
@@ -251,6 +282,32 @@ $(function(){
}
});
+ /* Fast database filter */
+ var txtDb = $('#fast_db_filter').val();
+
+ $('#fast_db_filter.gray').live('focus', function() {
+ $(this).removeClass('gray');
+ clear_fast_db_filter();
+ });
+
+ $('#fast_db_filter:not(.gray)').live('focusout', function() {
+ var $input = $(this);
+ if ($input.val() == '') {
+ $input
+ .addClass('gray')
+ .val(txtDb);
+ }
+ });
+
+ $('#clear_fast_db_filter').click(function() {
+ clear_fast_db_filter();
+ $('#fast_db_filter').focus();
+ });
+
+ $('#fast_db_filter').keyup(function(evt) {
+ fast_db_filter($(this).val());
+ });
+
/* Jump to recent table */
$('#recentTable').change(function() {
if (this.value != '') {