Bug 661831 - In about:permissions, make Ctrl+f focus the filter box instead of invoking the find bar. r=jaws

This commit is contained in:
Steffen Wilberg 2015-08-24 22:18:54 +02:00
parent 1899fd0235
commit e448bd65fc
3 changed files with 17 additions and 2 deletions

View File

@ -355,6 +355,7 @@ let AboutPermissions = {
*/
_sites: {},
sitesFilter: null,
sitesList: null,
_selectedSite: null,
@ -391,6 +392,7 @@ let AboutPermissions = {
* Called on page load.
*/
init: function() {
this.sitesFilter = document.getElementById("sites-filter");
this.sitesList = document.getElementById("sites-list");
this.getSitesFromPlaces();
@ -620,7 +622,7 @@ let AboutPermissions = {
aSite.listitem = item;
// Make sure to only display relevant items when list is filtered
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
let filterValue = this.sitesFilter.value.toLowerCase();
item.collapsed = aSite.principal.origin.toLowerCase().indexOf(filterValue) == -1;
(this._listFragment || this.sitesList).appendChild(item);
@ -643,7 +645,7 @@ let AboutPermissions = {
*/
filterSitesList: function() {
let siteItems = this.sitesList.children;
let filterValue = document.getElementById("sites-filter").value.toLowerCase();
let filterValue = this.sitesFilter.value.toLowerCase();
if (filterValue == "") {
for (let i = 0; i < siteItems.length; i++) {
@ -880,6 +882,13 @@ let AboutPermissions = {
window.openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies", "", {filterString : selectedHost});
}
},
/**
* Focusses the filter box.
*/
focusFilterBox: function() {
this.sitesFilter.focus();
}
}

View File

@ -25,6 +25,10 @@
<script type="application/javascript"
src="chrome://browser/content/preferences/aboutPermissions.js"/>
<keyset>
<key key="&focusSearch.key;" modifiers="accel" oncommand="AboutPermissions.focusFilterBox();"/>
</keyset>
<hbox flex="1" id="permissions-content" class="main-content">
<vbox id="sites-box">

View File

@ -44,3 +44,5 @@
<!ENTITY push.label "Receive Push Notifications">
<!ENTITY camera.label "Use the Camera">
<!ENTITY microphone.label "Use the Microphone">
<!ENTITY focusSearch.key "f">