mirror of
https://github.com/zotero/zotero.git
synced 2026-10-06 02:50:03 +00:00
Move tag selector view settings popup handler out of XHTML
This commit is contained in:
parent
66d5d51557
commit
9294c0515c
2 changed files with 16 additions and 20 deletions
|
|
@ -1712,6 +1712,21 @@ var ZoteroPane = new function () {
|
|||
return !tagSelector.hasAttribute('collapsed')
|
||||
|| tagSelector.getAttribute('collapsed') == 'false';
|
||||
};
|
||||
|
||||
|
||||
this.updateTagSelectorViewSettingsMenu = async function () {
|
||||
document.getElementById('show-automatic').setAttribute('checked', ZoteroPane.tagSelector.showAutomatic);
|
||||
document.getElementById('display-all-tags').setAttribute('checked', ZoteroPane.tagSelector.displayAllTags);
|
||||
document.getElementById('num-selected').label = ZoteroPane.tagSelector.label;
|
||||
var libraryID = ZoteroPane.tagSelector.libraryID;
|
||||
var library = Zotero.Libraries.get(libraryID);
|
||||
// 'Delete Automatic Tags in This Library' is per-library, so disable it when the
|
||||
// selection spans multiple libraries
|
||||
var enabled = !ZoteroPane.tagSelector.multiLibrary
|
||||
&& library.editable
|
||||
&& (await Zotero.Tags.getAutomaticInLibrary(libraryID)).length > 0;
|
||||
document.getElementById('delete-automatic-tags').disabled = !enabled;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1040,26 +1040,7 @@
|
|||
oncommand="ZoteroPane.tagSelector.openDeletePrompt(); event.stopPropagation();"/>
|
||||
</menupopup>
|
||||
<menupopup id="tag-selector-view-settings-menu"
|
||||
onpopupshowing="
|
||||
document.getElementById('show-automatic').setAttribute('checked', ZoteroPane.tagSelector.showAutomatic);
|
||||
document.getElementById('display-all-tags').setAttribute('checked', ZoteroPane.tagSelector.displayAllTags);
|
||||
document.getElementById('num-selected').label = ZoteroPane.tagSelector.label;
|
||||
(async function () {
|
||||
var libraryID = ZoteroPane.tagSelector.libraryID;
|
||||
var library = Zotero.Libraries.get(libraryID);
|
||||
var enabled = false;
|
||||
// 'Delete Automatic Tags in This Library' is per-library, so disable it
|
||||
// when the selection spans multiple libraries (nested ifs to avoid '&&'
|
||||
// in this XML attribute)
|
||||
if (!ZoteroPane.tagSelector.multiLibrary) {
|
||||
if (library.editable) {
|
||||
if ((await Zotero.Tags.getAutomaticInLibrary(libraryID)).length) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById('delete-automatic-tags').disabled = !enabled;
|
||||
})();">
|
||||
onpopupshowing="ZoteroPane.updateTagSelectorViewSettingsMenu();">
|
||||
<menuitem id="num-selected" disabled="true"/>
|
||||
<menuitem id="deselect-all" label="&zotero.tagSelector.clearAll;"
|
||||
oncommand="ZoteroPane.tagSelector.deselectAll();;"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue