From cf212e2b70dccc48eb77f39b42eaa87a0727ce48 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 4 Apr 2016 23:10:36 -0400 Subject: [PATCH] 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. --- chrome/content/zotero/itemPane.js | 36 +++++++++++++++-------------- chrome/content/zotero/zoteroPane.js | 2 -- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index e03951bfe..cdaae2eff 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -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; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 91f1b4c3a..07d16cabe 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -131,8 +131,6 @@ var ZoteroPane = new function() }); this.addReloadListener(_loadPane); - ZoteroItemPane.init(); - // continue loading pane _loadPane(); }