From 017713716e965d1ffebdaeb53c87a8119ff4d235 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 31 May 2009 07:15:55 +0000 Subject: [PATCH] Fixes #1317, Sort triangle icon points in wrong direction in Firefox 3.1 Also fixes initial items pane sort, which was previously descending until a column was clicked --- chrome/content/zotero/xpcom/itemTreeView.js | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 34a98c0cb1..88ca48d066 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -798,8 +798,14 @@ Zotero.ItemTreeView.prototype.cycleHeader = function(column) } else { - col.element.setAttribute('sortActive',true); - col.element.setAttribute('sortDirection',col.element.getAttribute('sortDirection') == 'descending' ? 'ascending' : 'descending'); + // If not yet selected, start with ascending + if (!col.element.getAttribute('sortActive')) { + col.element.setAttribute('sortDirection', Zotero.isFx30 ? 'descending' : 'ascending'); + } + else { + col.element.setAttribute('sortDirection', col.element.getAttribute('sortDirection') == 'descending' ? 'ascending' : 'descending'); + } + col.element.setAttribute('sortActive', true); } } @@ -848,7 +854,14 @@ Zotero.ItemTreeView.prototype.sort = function(itemID) } var columnField = this.getSortField(); - var order = this.getSortDirection() == 'ascending'; + + // Firefox 3 is upside-down + if (Zotero.isFx30) { + var order = this.getSortDirection() == 'ascending'; + } + else { + var order = this.getSortDirection() == 'descending'; + } var collation = Zotero.getLocaleCollation(); @@ -1526,15 +1539,11 @@ Zotero.ItemTreeView.prototype.getSortField = function() { /* * Returns 'ascending' or 'descending' - * - * A-Z == 'descending', because Mozilla is confused - * (an upwards-facing triangle is A-Z on OS X and Windows, - * but Firefox uses the opposite) */ Zotero.ItemTreeView.prototype.getSortDirection = function() { var column = this._treebox.columns.getSortedColumn(); if (!column) { - return 'descending'; + return Zotero.isFx30 ? 'descending' : 'ascending'; } return column.element.getAttribute('sortDirection'); }