From 5cfe4db098dfb0cbc1e4378a33e8a098d7595f14 Mon Sep 17 00:00:00 2001 From: Frank Bennett Date: Fri, 30 Jan 2015 22:21:23 +0900 Subject: [PATCH] Use nav-bar as target ID for Zotero nav bar icon The statusBarIcon pref is retained to maintain state across starts. --- chrome/content/zotero/overlay.js | 32 ++++----- .../zotero/preferences/preferences_general.js | 23 ------- .../preferences_general_firefox.xul | 13 +--- chrome/content/zotero/xpcom/zotero.js | 61 ------------------ chrome/locale/en-US/zotero/preferences.dtd | 2 - chrome/skin/default/zotero/preferences.css | 7 +- chrome/skin/default/zotero/zotero.css | 14 ---- .../skin/default/zotero/zotero_status_bar.png | Bin 1313 -> 0 bytes .../zotero/zotero_status_bar_compact.png | Bin 1123 -> 0 bytes .../zotero/zotero_status_bar_error.png | Bin 941 -> 0 bytes defaults/preferences/zotero.js | 2 +- 11 files changed, 16 insertions(+), 138 deletions(-) delete mode 100644 chrome/skin/default/zotero/zotero_status_bar.png delete mode 100644 chrome/skin/default/zotero/zotero_status_bar_compact.png delete mode 100644 chrome/skin/default/zotero/zotero_status_bar_error.png diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index f9aa287f9..3040f51bb 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -75,18 +75,18 @@ var ZoteroOverlay = new function() .getService(Components.interfaces.nsIPrefService) .getBranch('extensions.zotero.'); - var addonBar = document.getElementById('addon-bar'); + var navBar = document.getElementById('nav-bar'); var iconPref = prefBranch.getIntPref('statusBarIcon'); // If this is the first run, add icon to add-on bar if not // in the window already and not hidden by the Zotero prefs if (!document.getElementById("zotero-toolbar-button") && iconPref != 0) { - addonBar.insertItem("zotero-toolbar-button"); - addonBar.setAttribute("currentset", addonBar.currentSet); - document.persist(addonBar.id, "currentset"); - addonBar.setAttribute("collapsed", false); - document.persist(addonBar.id, "collapsed"); + navBar.insertItem("zotero-toolbar-button"); + navBar.setAttribute("currentset", navBar.currentSet); + document.persist(navBar.id, "currentset"); + navBar.setAttribute("collapsed", false); + document.persist(navBar.id, "collapsed"); } var icon = document.getElementById('zotero-toolbar-button'); @@ -108,13 +108,10 @@ var ZoteroOverlay = new function() } icon.setAttribute('tooltiptext', str); - if (iconPref == 1) { - icon.setAttribute('compact', true); - } // If hidden in prefs, remove from add-on bar - else if (iconPref == 0) { + if (iconPref == 0) { var toolbar = icon.parentNode; - if (toolbar.id == 'addon-bar') { + if (toolbar.id == 'nav-bar') { var palette = document.getElementById("navigator-toolbox").palette; palette.appendChild(icon); toolbar.setAttribute("currentset", toolbar.currentSet); @@ -197,19 +194,16 @@ var ZoteroOverlay = new function() function onToolbarChange(e) { // e.target seems to be navigator-toolbox in all cases, - // so check the addon-bar directly - var addonBar = document.getElementById("addon-bar"); + // so check the nav-bar directly + var navBar = document.getElementById("nav-bar"); var icon = document.getElementById("zotero-toolbar-button"); if (icon) { - // If dragged to add-on bar - if (addonBar.getElementsByAttribute("id", "zotero-toolbar-button").length) { + // If dragged to nav bar + if (navBar.getElementsByAttribute("id", "zotero-toolbar-button").length) { var statusBarPref = Zotero.Prefs.get("statusBarIcon"); // If pref set to hide, force to full if (statusBarPref == 0) { - Zotero.Prefs.set("statusBarIcon", 2) - } - else if (statusBarPref == 1) { - icon.setAttribute("compact", true); + Zotero.Prefs.set("statusBarIcon", 1) } return; } diff --git a/chrome/content/zotero/preferences/preferences_general.js b/chrome/content/zotero/preferences/preferences_general.js index ab1623fef..35caea94e 100644 --- a/chrome/content/zotero/preferences/preferences_general.js +++ b/chrome/content/zotero/preferences/preferences_general.js @@ -35,32 +35,9 @@ Zotero_Preferences.General = { ); } - // Only show icon options for Firefox <29 - if (Zotero.platformMajorVersion < 29) { - let statusBarRow = document.getElementById('zotero-prefpane-general-statusBarIcon-row'); - if (statusBarRow) { - statusBarRow.hidden = false; - } - } - document.getElementById('noteFontSize').value = Zotero.Prefs.get('note.fontSize'); }, - /** - * Sets "Status bar icon" to "None" if Zotero is set to load in separate tab - */ - handleShowInPreferenceChange: function () { - var showInSeparateTab = document.getElementById("zotero-prefpane-general-showIn-separateTab"); - var showInAppTab = document.getElementById("zotero-prefpane-general-showIn-appTab"); - if(showInAppTab.selected) { - document.getElementById('statusBarIcon').selectedItem = document.getElementById('statusBarIcon-none'); - Zotero.Prefs.set("statusBarIcon", 0); - } else { - document.getElementById('statusBarIcon').selectedItem = document.getElementById('statusBarIcon-full'); - Zotero.Prefs.set("statusBarIcon", 2); - } - }, - updateTranslators: function () { Zotero.Schema.updateFromRepository(true, function (xmlhttp, updated) { diff --git a/chrome/content/zotero/preferences/preferences_general_firefox.xul b/chrome/content/zotero/preferences/preferences_general_firefox.xul index d658e35f7..0bc040001 100644 --- a/chrome/content/zotero/preferences/preferences_general_firefox.xul +++ b/chrome/content/zotero/preferences/preferences_general_firefox.xul @@ -29,7 +29,6 @@ -