Fix advancedSearch menu

This commit is contained in:
windingwind 2024-01-05 09:18:46 +08:00 committed by Dan Stillman
parent 90b3c2206b
commit 56cef1d504
3 changed files with 4 additions and 4 deletions

View file

@ -26,10 +26,10 @@
<script> <script>
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
</script> </script>
<script src="include.js"/> <script src="include.js"/>
<script src="customElements.js"/>
<script src="advancedSearch.js"/> <script src="advancedSearch.js"/>
<popupset> <popupset>

View file

@ -107,7 +107,7 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/librariesC
} }
// Following the implementation from https://searchfox.org/mozilla-esr102/source/toolkit/content/widgets/menupopup.js // Following the implementation from https://searchfox.org/mozilla-esr102/source/toolkit/content/widgets/menupopup.js
let haveCheckableChild = this.querySelector( let haveCheckableChild = this.querySelector(
":scope > menuitem:not([hidden]):is([type=checkbox],[type=radio])" ":scope > menuitem:not([hidden]):is([type=checkbox],[type=radio],[selected],[checked])"
); );
this.toggleAttribute("needsgutter", haveCheckableChild); this.toggleAttribute("needsgutter", haveCheckableChild);
// Update animate attribute when the popup is shown // Update animate attribute when the popup is shown

View file

@ -405,7 +405,7 @@
{ {
var val = operatorsList.firstChild.childNodes[i].getAttribute('value'); var val = operatorsList.firstChild.childNodes[i].getAttribute('value');
var hidden = !operators[val]; var hidden = !operators[val];
operatorsList.firstChild.childNodes[i].setAttribute('hidden', hidden); operatorsList.firstChild.childNodes[i].toggleAttribute('hidden', hidden);
if (!hidden && (selectThis == null || this.selectedOperator == val)) if (!hidden && (selectThis == null || this.selectedOperator == val))
{ {
selectThis = i; selectThis = i;
@ -836,7 +836,7 @@
case 'fulltextContent': case 'fulltextContent':
var menu = this.querySelector('#textbox-fulltext-menu'); var menu = this.querySelector('#textbox-fulltext-menu');
this.setAttribute('hasOptions', true); this.setAttribute('hasOptions', true);
button.setAttribute('hidden', false); button.removeAttribute('hidden');
var selectedIndex = 0; var selectedIndex = 0;
if (mode){ if (mode){