make column and position information persist between tab and overlay
This commit is contained in:
parent
c7e92b6e16
commit
47f57509e5
4 changed files with 73 additions and 21 deletions
|
@ -212,6 +212,8 @@ var ZoteroOverlay = new function()
|
|||
// Make sure tags splitter isn't missing for people upgrading from <2.0b7
|
||||
document.getElementById('zotero-tags-splitter').collapsed = false;
|
||||
} else {
|
||||
ZoteroPane.makeHidden();
|
||||
|
||||
// Collapse pane
|
||||
zoteroPane.setAttribute('collapsed', true);
|
||||
zoteroPane.height = 0;
|
||||
|
|
|
@ -317,6 +317,8 @@ var ZoteroPane = new function()
|
|||
this.collectionsView.unregister();
|
||||
if (this.itemsView)
|
||||
this.itemsView.unregister();
|
||||
|
||||
_serializePersist();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -344,6 +346,8 @@ var ZoteroPane = new function()
|
|||
return false;
|
||||
}
|
||||
|
||||
_unserializePersist();
|
||||
|
||||
this.updateTagSelectorSize();
|
||||
|
||||
// Focus the quicksearch on pane open
|
||||
|
@ -379,6 +383,12 @@ var ZoteroPane = new function()
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to be called before ZoteroPane is hidden. Does not actually hide the Zotero pane.
|
||||
*/
|
||||
this.makeHidden = function() {
|
||||
_serializePersist();
|
||||
}
|
||||
|
||||
function isShowing() {
|
||||
var zoteroPane = document.getElementById('zotero-pane-stack');
|
||||
|
@ -3425,4 +3435,41 @@ var ZoteroPane = new function()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserializes zotero-persist elements from preferences
|
||||
*/
|
||||
function _unserializePersist() {
|
||||
var serializedValues = Zotero.Prefs.get("pane.persist");
|
||||
if(!serializedValues) return;
|
||||
serializedValues = JSON.parse(serializedValues);
|
||||
for(var id in serializedValues) {
|
||||
var el = document.getElementById(id);
|
||||
if(!el) return;
|
||||
var elValues = serializedValues[id];
|
||||
for(var attr in elValues) {
|
||||
el.setAttribute(attr, elValues[attr]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.itemsView) this.itemsView.sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes zotero-persist elements to preferences
|
||||
*/
|
||||
function _serializePersist() {
|
||||
var serializedValues = {};
|
||||
for each(var el in document.getElementsByAttribute("zotero-persist", "*")) {
|
||||
if(!el.getAttribute) continue;
|
||||
var id = el.getAttribute("id");
|
||||
if(!id) continue;
|
||||
var elValues = {};
|
||||
for each(var attr in el.getAttribute("zotero-persist").split(/[\s,]+/)) {
|
||||
var attrValue = el.getAttribute(attr);
|
||||
elValues[attr] = attrValue;
|
||||
}
|
||||
serializedValues[id] = elValues;
|
||||
}
|
||||
Zotero.Prefs.set("pane.persist", JSON.stringify(serializedValues));
|
||||
}
|
||||
}
|
|
@ -126,7 +126,7 @@
|
|||
</menupopup>
|
||||
</popupset>
|
||||
|
||||
<vbox id="zotero-collections-pane" persist="width" flex="1">
|
||||
<vbox id="zotero-collections-pane" zotero-persist="width" flex="1">
|
||||
<!-- This extra vbox prevents the toolbar from getting compressed when resizing
|
||||
the tag selector to max height -->
|
||||
<vbox flex="1">
|
||||
|
@ -181,7 +181,7 @@
|
|||
<splitter id="zotero-tags-splitter" onmouseup="ZoteroPane.updateTagSelectorSize()" collapse="after">
|
||||
<grippy oncommand="ZoteroPane.toggleTagSelector()"/>
|
||||
</splitter>
|
||||
<zoterotagselector id="zotero-tag-selector" persist="height,collapsed,showAutomatic,filterToScope"
|
||||
<zoterotagselector id="zotero-tag-selector" zotero-persist="height,collapsed,showAutomatic,filterToScope"
|
||||
oncommand="ZoteroPane.updateTagFilter()"/>
|
||||
</vbox>
|
||||
|
||||
|
@ -190,7 +190,7 @@
|
|||
<grippy/>
|
||||
</splitter>
|
||||
|
||||
<vbox id="zotero-items-pane" persist="width" flex="1">
|
||||
<vbox id="zotero-items-pane" zotero-persist="width" flex="1">
|
||||
<hbox class="toolbar" id="zotero-items-toolbar" align="center">
|
||||
<toolbarbutton id="zotero-tb-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newItem.label;" type="menu">
|
||||
<!-- New Item drop-down built in overlay.js::onLoad() -->
|
||||
|
@ -246,82 +246,82 @@
|
|||
<treecol
|
||||
id="zotero-items-column-title" primary="true"
|
||||
label="&zotero.items.title_column;"
|
||||
flex="4" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="4" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-firstCreator"
|
||||
label="&zotero.items.creator_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-type" hidden="true"
|
||||
label="&zotero.items.type_column;"
|
||||
width="40" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
width="40" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-date" hidden="true"
|
||||
label="&zotero.items.date_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-year" hidden="true"
|
||||
label="&zotero.items.year_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-publisher" hidden="true"
|
||||
label="&zotero.items.publisher_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-publicationTitle" hidden="true"
|
||||
label="&zotero.items.publication_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-journalAbbreviation" hidden="true"
|
||||
label="&zotero.items.journalAbbr_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-language" hidden="true"
|
||||
label="&zotero.items.language_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-accessDate" hidden="true"
|
||||
label="&zotero.items.accessDate_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-libraryCatalog" hidden="true"
|
||||
label="&zotero.items.libraryCatalog_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-callNumber" hidden="true"
|
||||
label="&zotero.items.callNumber_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-rights" hidden="true"
|
||||
label="&zotero.items.rights_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-dateAdded" hidden="true"
|
||||
label="&zotero.items.dateAdded_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-dateModified" hidden="true"
|
||||
label="&zotero.items.dateModified_column;"
|
||||
flex="1" persist="width ordinal hidden sortActive sortDirection"/>
|
||||
flex="1" zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol
|
||||
id="zotero-items-column-numChildren"
|
||||
label="&zotero.items.numChildren_column;"
|
||||
persist="width ordinal hidden sortActive sortDirection"/>
|
||||
zotero-persist="width ordinal hidden sortActive sortDirection"/>
|
||||
</treecols>
|
||||
<treechildren/>
|
||||
</tree>
|
||||
|
@ -334,7 +334,7 @@
|
|||
|
||||
<splitter id="zotero-view-splitter" resizebefore="closest" resizeafter="closest"/>
|
||||
|
||||
<vbox id="zotero-item-pane" persist="width">
|
||||
<vbox id="zotero-item-pane" zotero-persist="width">
|
||||
<hbox class="toolbar" align="center">
|
||||
<hbox align="center" pack="start" flex="1">
|
||||
<toolbarbutton id="zotero-tb-locate" class="zotero-tb-button" tooltiptext="&zotero.toolbar.openURL.label;" type="menu">
|
||||
|
|
|
@ -147,3 +147,6 @@ pref("extensions.zotero.purge.creators", false);
|
|||
pref("extensions.zotero.purge.fulltext", false);
|
||||
pref("extensions.zotero.purge.items", false);
|
||||
pref("extensions.zotero.purge.tags", false);
|
||||
|
||||
// Zotero pane persistent data
|
||||
pref("extensions.zotero.pane.persist", '');
|
||||
|
|
Loading…
Reference in a new issue