Remove sync buttons from PDF reader toolbar

Fixes #2045
This commit is contained in:
Martynas Bagdonas 2021-06-02 20:39:44 +03:00
parent a418d5ae8d
commit a5fe49b866
7 changed files with 18 additions and 38 deletions

View file

@ -44,12 +44,10 @@ var ZoteroContextPane = new function () {
var _itemPaneDeck;
var _notesPaneDeck;
var _itemToolbar;
var _splitButton;
var _itemPaneToggle;
var _notesPaneToggle;
var _toolbar;
var _tabToolbarContainer;
var _tabToolbar;
var _itemContexts = [];
var _notesContexts = [];
@ -73,19 +71,17 @@ var ZoteroContextPane = new function () {
_contextPaneSplitter = document.getElementById('zotero-context-splitter');
_contextPaneSplitterStacked = document.getElementById('zotero-context-splitter-stacked');
_itemToolbar = document.getElementById('zotero-item-toolbar');
_splitButton = document.getElementById('zotero-tb-split');
_itemPaneToggle = document.getElementById('zotero-tb-toggle-item-pane');
_notesPaneToggle = document.getElementById('zotero-tb-toggle-notes-pane');
_toolbar = document.getElementById('zotero-toolbar');
_tabToolbarContainer = document.getElementById('zotero-tab-toolbar-container');
_tabToolbar = document.getElementById('zotero-tab-toolbar');
if (Zotero.rtl) {
_tabToolbarContainer.style.left = 0;
_tabToolbar.style.left = 0;
_splitButton.style.transform = 'scaleX(-1)';
}
else {
_tabToolbarContainer.style.right = 0;
_tabToolbar.style.right = 0;
}
_init();
@ -96,13 +92,6 @@ var ZoteroContextPane = new function () {
_notesToggle.addEventListener('click', _toggleNotesButton);
Zotero.Reader.onChangeSidebarWidth = _updatePaneWidth;
Zotero.Reader.onChangeSidebarOpen = _updatePaneWidth;
this._mutationObserver = new MutationObserver(() => {
_updateToolbarWidth();
// Sometimes XUL is late to reflow
setTimeout(_updateToolbarWidth, 100);
});
this._mutationObserver.observe(_tabToolbarContainer, { attributes: true, childList: true, subtree: true });
};
this.onUnload = function () {
@ -110,7 +99,6 @@ var ZoteroContextPane = new function () {
_notesToggle.removeEventListener('click', _toggleNotesButton);
window.removeEventListener('resize', _update);
Zotero.Notifier.unregisterObserver(this._notifierID);
this._mutationObserver.disconnect();
Zotero.Reader.onChangeSidebarWidth = () => {};
Zotero.Reader.onChangeSidebarOpen = () => {};
_contextPaneInner.innerHTML = '';
@ -170,9 +158,7 @@ var ZoteroContextPane = new function () {
if (Zotero_Tabs.selectedIndex == 0) {
_contextPaneSplitter.setAttribute('hidden', true);
_contextPane.setAttribute('collapsed', true);
_toolbar.append(_itemToolbar);
_itemToolbar.classList.remove('tab-mode');
_splitButton.classList.add('hidden');
_tabToolbar.hidden = true;
_tabCover.hidden = true;
}
else {
@ -200,9 +186,7 @@ var ZoteroContextPane = new function () {
_contextPaneSplitter.setAttribute('hidden', false);
_contextPane.setAttribute('collapsed', !(_contextPaneSplitter.getAttribute('state') != 'collapsed'));
_tabToolbarContainer.append(_itemToolbar);
_itemToolbar.classList.add('tab-mode');
_splitButton.classList.remove('hidden');
_tabToolbar.hidden = false;
}
_selectItemContext(ids[0]);
@ -279,7 +263,7 @@ var ZoteroContextPane = new function () {
var reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
if (reader) {
if ((stacked || _contextPaneSplitter.getAttribute('state') == 'collapsed')) {
reader.setToolbarPlaceholderWidth(_tabToolbarContainer.boxObject.width);
reader.setToolbarPlaceholderWidth(_tabToolbar.boxObject.width);
}
else {
reader.setToolbarPlaceholderWidth(0);

View file

@ -1309,7 +1309,6 @@ Zotero.Sync.Runner_Module = function (options = {}) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
win.Zotero_Tabs.select('zotero-pane');
win.ZoteroPane.selectItem(object.id);
};
}

View file

@ -82,7 +82,12 @@
<box id="zotero-tab-cover" hidden="true">
<label pack="center">&zotero.general.loading;</label>
</box>
<box id="zotero-tab-toolbar-container"/>
<box id="zotero-tab-toolbar" class="toolbar" hidden="true">
<div id="zotero-tb-split" xmlns="http://www.w3.org/1999/xhtml" class="split-button">
<div id="zotero-tb-toggle-item-pane" class="toolbarButton item" title="&zotero.toolbar.context.item;"><span/></div>
<div id="zotero-tb-toggle-notes-pane" class="toolbarButton notes" title="&zotero.toolbar.context.notes;"><span/></div>
</div>
</box>
<deck id="tabs-deck" flex="1">
<vbox id="zotero-pane"
onkeydown="ZoteroPane_Local.handleKeyDown(event, this.id)"
@ -228,11 +233,6 @@
<div xmlns="http://www.w3.org/1999/xhtml" class="sync-button-tooltip-messages"/>
</tooltip>
</toolbarbutton>
<div id="zotero-tb-split" xmlns="http://www.w3.org/1999/xhtml" class="split-button hidden">
<div id="zotero-tb-toggle-item-pane" class="toolbarButton item" title="&zotero.toolbar.context.item;"><span></span></div>
<div id="zotero-tb-toggle-notes-pane" class="toolbarButton notes" title="&zotero.toolbar.context.notes;"><span></span></div>
</div>
</hbox>
</toolbar>

View file

@ -43,7 +43,7 @@
/* display: none;*/
/*}*/
#zotero-tab-toolbar-container {
#zotero-tab-toolbar {
position: fixed;
z-index: 1;
-moz-appearance: none;
@ -54,11 +54,6 @@
height: 32px;
}
#zotero-tab-toolbar-container #zotero-tb-locate,
#zotero-tab-toolbar-container #zotero-pq-buttons {
display: none;
}
#zotero-context-toolbar-extension {
height: 32px;
/* To cover the splitter that has a higher stacking order than our parent */

@ -1 +1 @@
Subproject commit cff42ffa8f616df41cdd4aec68621a44cee27837
Subproject commit f52448994834563569f7a22a44b15f70e2d7474d

@ -1 +1 @@
Subproject commit 7db07151abe5e67aa03b24b86151816c95bcd865
Subproject commit 1d8e8ed20b466963192ebf7aa713c1c97e9d89d7

View file

@ -232,6 +232,8 @@ $toolbar-btn-icon-active-offset: 0;
}
.split-button {
height: 100%;
align-items: center;
display: flex;
}