Preferences: Extract #prefs-search queries

This commit is contained in:
Abe Jellinek 2024-07-08 16:39:23 -04:00
parent c2b51c7dfe
commit 58c445b616

View file

@ -40,11 +40,11 @@ var Zotero_Preferences = {
this.navigation = document.getElementById('prefs-navigation'); this.navigation = document.getElementById('prefs-navigation');
this.content = document.getElementById('prefs-content'); this.content = document.getElementById('prefs-content');
this.helpContainer = document.getElementById('prefs-help-container'); this.helpContainer = document.getElementById('prefs-help-container');
this.searchField = document.getElementById('prefs-search');
this.navigation.addEventListener('mouseover', event => this._handleNavigationMouseOver(event)); this.navigation.addEventListener('mouseover', event => this._handleNavigationMouseOver(event));
this.navigation.addEventListener('select', () => this._handleNavigationSelect()); this.navigation.addEventListener('select', () => this._handleNavigationSelect());
document.getElementById('prefs-search').addEventListener('command', this.searchField.addEventListener('command', () => this._search(this.searchField.value));
event => this._search(event.target.value));
document.getElementById('prefs-subpane-back-button').addEventListener('command', () => { document.getElementById('prefs-subpane-back-button').addEventListener('command', () => {
let parent = this.panes.get(this.navigation.value).parent; let parent = this.panes.get(this.navigation.value).parent;
@ -53,7 +53,7 @@ var Zotero_Preferences = {
} }
}); });
document.getElementById('prefs-search').focus(); this.searchField.focus();
Zotero.PreferencePanes.builtInPanes.forEach(pane => this._addPane(pane)); Zotero.PreferencePanes.builtInPanes.forEach(pane => this._addPane(pane));
if (Zotero.PreferencePanes.pluginPanes.length) { if (Zotero.PreferencePanes.pluginPanes.length) {
@ -146,7 +146,7 @@ var Zotero_Preferences = {
let paneID = this.navigation.value; let paneID = this.navigation.value;
if (paneID) { if (paneID) {
let pane = this.panes.get(paneID); let pane = this.panes.get(paneID);
document.getElementById('prefs-search').value = ''; this.searchField.value = '';
await this._search(''); await this._search('');
await this._loadPane(paneID); await this._loadPane(paneID);