www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0191601f9f860edb001a6381990427f15ad8842d
parent d5bfed1c9635cc7f2ed46895e5dd39b79b1de30e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 13 Mar 2013 00:00:27 -0400

Fix items tree styling (context rows, attachment pies) in Fx22+

Diffstat:
Mchrome/content/zotero/xpcom/itemTreeView.js | 49+++++++++++++++++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -2974,36 +2974,61 @@ Zotero.ItemTreeView.prototype.getCellProperties = function(row, col, prop) { var treeRow = this._getItemAtRow(row); var itemID = treeRow.ref.id; + var props = []; + // Mark items not matching search as context rows, displayed in gray if (this._searchMode && !this._searchItemIDs[itemID]) { - var aServ = Components.classes["@mozilla.org/atom-service;1"]. - getService(Components.interfaces.nsIAtomService); - prop.AppendElement(aServ.getAtom("contextRow")); + // <=Fx21 + if (prop) { + var aServ = Components.classes["@mozilla.org/atom-service;1"]. + getService(Components.interfaces.nsIAtomService); + prop.AppendElement(aServ.getAtom("contextRow")); + } + // Fx22+ + else { + props.push("contextRow"); + } } // Mark hasAttachment column, which needs special image handling if (col.id == 'zotero-items-column-hasAttachment') { - var aServ = Components.classes["@mozilla.org/atom-service;1"]. - getService(Components.interfaces.nsIAtomService); - prop.AppendElement(aServ.getAtom("hasAttachment")); + // <=Fx21 + if (prop) { + var aServ = Components.classes["@mozilla.org/atom-service;1"]. + getService(Components.interfaces.nsIAtomService); + prop.AppendElement(aServ.getAtom("hasAttachment")); + } + // Fx22+ + else { + props.push("hasAttachment"); + } // Don't show pie for open parent items, since we show it for the // child item if (this.isContainer(row) && this.isContainerOpen(row)) { - return; + return props.join(" "); } var num = Zotero.Sync.Storage.getItemDownloadImageNumber(treeRow.ref); //var num = Math.round(new Date().getTime() % 10000 / 10000 * 64); if (num !== false) { - if (!aServ) { - var aServ = Components.classes["@mozilla.org/atom-service;1"]. - getService(Components.interfaces.nsIAtomService); + // <=Fx21 + if (prop) { + if (!aServ) { + var aServ = Components.classes["@mozilla.org/atom-service;1"]. + getService(Components.interfaces.nsIAtomService); + } + prop.AppendElement(aServ.getAtom("pie")); + prop.AppendElement(aServ.getAtom("pie" + num)); + } + // Fx22+ + else { + props.push("pie", "pie" + num); } - prop.AppendElement(aServ.getAtom("pie")); - prop.AppendElement(aServ.getAtom("pie" + num)); } } + + return props.join(" "); } Zotero.ItemTreeView.TreeRow = function(ref, level, isOpen)