Bug 703920: In about:config, filter prefs when pressing the enter key, and close the keyboard. Remove the Filter button. r=mfinkle
authorSteffen Wilberg <steffen.wilberg@web.de>
Mon, 28 Nov 2011 21:04:42 +0100
changeset 83609 fe5c5000bc2dd9e271cddf6586f0bd7db0182061
parent 83608 aa6ad7ab9b435bff6a0fd8ff89c8698461f41c0c
child 83610 82f3392976b4a487dd93bc41566c02f01aefe62a
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs703920
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 703920: In about:config, filter prefs when pressing the enter key, and close the keyboard. Remove the Filter button. r=mfinkle
mobile/android/chrome/content/config.xhtml
mobile/android/locales/en-US/chrome/config.dtd
--- a/mobile/android/chrome/content/config.xhtml
+++ b/mobile/android/chrome/content/config.xhtml
@@ -48,18 +48,21 @@
 <head>
   <meta name="viewport" content="width=480; initial-scale=.6667; user-scalable=0" />
   <link rel="stylesheet" href="chrome://browser/skin/config.css" type="text/css"/>
 </head>
 
 <body dir="&locale.dir;" onload="AboutConfig.init();" onunload="AboutConfig.uninit();">
 
   <div id="filter-container">
-    <input id="filter-input" type="text" placeholder="&filter.placeholder;"/>
-    <button onclick="AboutConfig.filter();">&filter.label;</button>
+    <input id="filter-input" type="search" placeholder="&filter.placeholder;"
+           onchange="AboutConfig.filter_onchange();"/>
+    <input id="clear-input" type="image" disabled="true"
+           onclick="AboutConfig.clearInput();" alt="&clear.altText;"
+           src="chrome://browser/skin/images/search-clear-30.png"/>
   </div>
 
   <div id="new-pref-container">
     <button id="new-pref-button" onclick="AboutConfig.addNewPref();">&newpref.label;</button>
   </div>
 
   <div id="prefs-container"/>
 
@@ -71,30 +74,44 @@
 
     function dump(a) {
       Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(a);
     }
 
     let AboutConfig = {
       _container: null,
       _filterInput: null,
+      _clearInput: null,
 
       init: function AC_init() {
         this._container = document.getElementById("prefs-container");
         this._filterInput = document.getElementById("filter-input");
+        this._clearInput = document.getElementById("clear-input");
 
         this.filter();
 
         Services.prefs.addObserver("", this, false);
       },
 
       uninit: function AC_uninit() {
         Services.prefs.removeObserver("", this);
       },
 
+      filter_onchange: function AC_filter_onchange() {
+        this.filter();
+        this._filterInput.blur(); // close the VKB
+        this._clearInput.disabled = this._filterInput.value == "";
+      },
+
+      clearInput: function AC_clearInput() {
+        this._filterInput.value = '';
+        this.filter();
+        this._clearInput.disabled = true;
+      },
+
       filter: function AC_filter(aValue) {
         if (!aValue)
           aValue = this._filterInput.value;
 
         // Replace pref container with a new empty one
         let empty = this._container.cloneNode(false);
         this._container.parentNode.replaceChild(empty, this._container);
         this._container = empty;
--- a/mobile/android/locales/en-US/chrome/config.dtd
+++ b/mobile/android/locales/en-US/chrome/config.dtd
@@ -1,3 +1,3 @@
 <!ENTITY filter.placeholder     "Filter Preferences">
-<!ENTITY filter.label           "Filter">
+<!ENTITY clear.altText          "Clear">
 <!ENTITY newpref.label          "Add a New Preference">