Preferences: Fix and improve search
This commit is contained in:
parent
6e651271e8
commit
1d662b9fef
3 changed files with 34 additions and 23 deletions
|
@ -218,6 +218,7 @@ var Zotero_Preferences = {
|
|||
this.navigation.append(listItem);
|
||||
|
||||
let container = document.createElement('div');
|
||||
container.classList.add('pane-container');
|
||||
container.hidden = true;
|
||||
this.helpContainer.before(container);
|
||||
|
||||
|
@ -276,8 +277,13 @@ var Zotero_Preferences = {
|
|||
|
||||
let heading = document.createElement('h1');
|
||||
heading.textContent = pane.rawLabel;
|
||||
pane.container.append(heading);
|
||||
pane.container.append(contentFragment);
|
||||
if (pane.container.querySelector('.main-section')) {
|
||||
pane.container.querySelector('.main-section').prepend(heading);
|
||||
}
|
||||
else {
|
||||
pane.container.prepend(heading);
|
||||
}
|
||||
|
||||
await document.l10n.ready;
|
||||
await document.l10n.translateFragment(pane.container);
|
||||
|
@ -585,12 +591,13 @@ ${str}
|
|||
let termForDisplay = Zotero.Utilities.trimInternal(term).toLowerCase();
|
||||
term = this._normalizeSearch(term);
|
||||
|
||||
for (let container of this.content.children) {
|
||||
let root = container.firstElementChild;
|
||||
if (!root) continue;
|
||||
|
||||
for (let child of root.children) {
|
||||
let matches = await this._findNodesMatching(child, term);
|
||||
for (let paneContainer of this.content.querySelectorAll(':scope > .pane-container')) {
|
||||
let roots = paneContainer.children;
|
||||
while (roots.length === 1 && roots[0].childElementCount) {
|
||||
roots = roots[0].children;
|
||||
}
|
||||
for (let root of roots) {
|
||||
let matches = await this._findNodesMatching(root, term);
|
||||
if (matches.length) {
|
||||
let touchedTabPanels = new Set();
|
||||
for (let node of matches) {
|
||||
|
@ -642,10 +649,14 @@ ${str}
|
|||
}
|
||||
}
|
||||
else {
|
||||
child.classList.add('hidden-by-search');
|
||||
child.ariaHidden = true;
|
||||
root.classList.add('hidden-by-search');
|
||||
root.ariaHidden = true;
|
||||
}
|
||||
}
|
||||
if (Array.from(roots).every(root => root.classList.contains('hidden-by-search'))) {
|
||||
paneContainer.classList.add('hidden-by-search');
|
||||
paneContainer.ariaHidden = true;
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
|
|
|
@ -203,18 +203,18 @@
|
|||
<label value="&zotero.preferences.trashAutoEmptyDaysPost;"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<groupbox>
|
||||
<label><html:h2>&zotero.preferences.groups;</html:h2></label>
|
||||
|
||||
<label value="&zotero.preferences.groups.whenCopyingInclude;"/>
|
||||
<vbox style="margin-left: 2em">
|
||||
<checkbox label="&zotero.preferences.groups.childNotes;" preference="extensions.zotero.groups.copyChildNotes" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.childFiles;" preference="extensions.zotero.groups.copyChildFileAttachments" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.annotations;" preference="extensions.zotero.groups.copyAnnotations" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.childLinks;" preference="extensions.zotero.groups.copyChildLinks" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.tags;" preference="extensions.zotero.groups.copyTags" native="true"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
|
||||
<groupbox>
|
||||
<label><html:h2>&zotero.preferences.groups;</html:h2></label>
|
||||
|
||||
<label value="&zotero.preferences.groups.whenCopyingInclude;"/>
|
||||
<vbox style="margin-left: 2em">
|
||||
<checkbox label="&zotero.preferences.groups.childNotes;" preference="extensions.zotero.groups.copyChildNotes" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.childFiles;" preference="extensions.zotero.groups.copyChildFileAttachments" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.annotations;" preference="extensions.zotero.groups.copyAnnotations" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.childLinks;" preference="extensions.zotero.groups.copyChildLinks" native="true"/>
|
||||
<checkbox label="&zotero.preferences.groups.tags;" preference="extensions.zotero.groups.copyTags" native="true"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
|
|
|
@ -222,7 +222,7 @@ groupbox:not(:first-of-type) label > h2 {
|
|||
}
|
||||
|
||||
.hidden-by-search {
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
prefwindow .chromeclass-toolbar
|
||||
|
|
Loading…
Reference in a new issue