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:
Dan Stillman 2016-04-04 23:10:36 -04:00
parent 0a63c7665a
commit cf212e2b70
2 changed files with 19 additions and 19 deletions

View File

@ -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 * 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-editpane-tabs').setAttribute('hidden', item.isFeedItem);
document.getElementById('zotero-view-item').classList.add('no-tabs'); 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(); var editable = ZoteroPane_Local.canEdit();
_notesButton.hidden = !editable; _notesButton.hidden = !editable;

View File

@ -131,8 +131,6 @@ var ZoteroPane = new function()
}); });
this.addReloadListener(_loadPane); this.addReloadListener(_loadPane);
ZoteroItemPane.init();
// continue loading pane // continue loading pane
_loadPane(); _loadPane();
} }