Initialize feed button only when necessary
And without extra init() call This fixes the button being initialized before Zotero.hiDPI is set, resulting in a low-res icon until the target is changed.
This commit is contained in:
parent
0a63c7665a
commit
cf212e2b70
|
@ -48,22 +48,6 @@ var ZoteroItemPane = new function() {
|
|||
}
|
||||
|
||||
|
||||
this.init = function() {
|
||||
Zotero.debug("Initializing ZoteroItemPane");
|
||||
let lastTranslationTarget = Zotero.Prefs.get('feeds.lastTranslationTarget');
|
||||
if (lastTranslationTarget) {
|
||||
if (lastTranslationTarget[0] == "C") {
|
||||
_translationTarget = Zotero.Collections.get(parseInt(lastTranslationTarget.substr(1)));
|
||||
} else if (lastTranslationTarget[0] == "L") {
|
||||
_translationTarget = Zotero.Libraries.get(parseInt(lastTranslationTarget.substr(1)));
|
||||
}
|
||||
}
|
||||
if (!_translationTarget) {
|
||||
_translationTarget = Zotero.Libraries.userLibrary;
|
||||
}
|
||||
this.setTranslateButton();
|
||||
}
|
||||
|
||||
/*
|
||||
* Load a top-level item
|
||||
*/
|
||||
|
@ -107,7 +91,25 @@ var ZoteroItemPane = new function() {
|
|||
document.getElementById('zotero-editpane-tabs').setAttribute('hidden', item.isFeedItem);
|
||||
document.getElementById('zotero-view-item').classList.add('no-tabs');
|
||||
|
||||
if (index == 1) {
|
||||
if (index == 0) {
|
||||
if (item.isFeedItem) {
|
||||
let lastTranslationTarget = Zotero.Prefs.get('feeds.lastTranslationTarget');
|
||||
if (lastTranslationTarget) {
|
||||
let id = parseInt(lastTranslationTarget.substr(1));
|
||||
if (lastTranslationTarget[0] == "L") {
|
||||
_translationTarget = Zotero.Libraries.get(id);
|
||||
}
|
||||
else if (lastTranslationTarget[0] == "C") {
|
||||
_translationTarget = Zotero.Collections.get(id);
|
||||
}
|
||||
}
|
||||
if (!_translationTarget) {
|
||||
_translationTarget = Zotero.Libraries.userLibrary;
|
||||
}
|
||||
this.setTranslateButton();
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
var editable = ZoteroPane_Local.canEdit();
|
||||
_notesButton.hidden = !editable;
|
||||
|
||||
|
|
|
@ -131,8 +131,6 @@ var ZoteroPane = new function()
|
|||
});
|
||||
this.addReloadListener(_loadPane);
|
||||
|
||||
ZoteroItemPane.init();
|
||||
|
||||
// continue loading pane
|
||||
_loadPane();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user