www

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

commit faf478e386b3c010e2cfdb45450fb8c461f11e70
parent c6c33099de7c36dd1e2db5a7d42c2ca014c489ac
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 17 Apr 2011 11:12:59 +0000

- Color tags in right pane
- Update colors in tag selector and tags box in all windows on update


Diffstat:
Mchrome/content/zotero/bindings/tagsbox.xml | 7+++++++
Mchrome/content/zotero/bindings/tagselector.xml | 20+++++++++++++++++++-
Mchrome/content/zotero/xpcom/data/tags.js | 2+-
3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/bindings/tagsbox.xml b/chrome/content/zotero/bindings/tagsbox.xml @@ -32,6 +32,7 @@ <binding id="tags-box"> <implementation> <field name="clickHandler"/> + <field name="_tagColors"/> <!-- Modes are predefined settings groups for particular tasks --> <field name="_mode">"view"</field> @@ -120,6 +121,7 @@ rows.removeChild(rows.firstChild); var tags = this.item.getTags(); + this._tagColors = Zotero.Tags.getColors(); if(tags) { @@ -255,6 +257,11 @@ valueElement.appendChild(document.createTextNode(valueText)); } + // Tag color + if (color = this._tagColors[valueText]) { + valueElement.setAttribute('style', 'color:' + this._tagColors[valueText]); + } + return valueElement; ]]> </body> diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml @@ -712,7 +712,25 @@ tagIDs = tagIDs.split('-'); var name = Zotero.Tags.getName(tagIDs[0]); Zotero.Tags.setColor(name, color); - this.refresh(); + + // Iterate through all windows, updating tag selector and tags box + var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] + .getService(Components.interfaces.nsIWindowMediator); + var enumerator = wm.getEnumerator("navigator:browser"); + while (enumerator.hasMoreElements()) { + var win = enumerator.getNext(); + if (!win.ZoteroPane) continue; + + var tagSelector = win.ZoteroPane.document.getElementById('zotero-tag-selector'); + var itemPane = win.ZoteroPane.document.getElementById('zotero-view-item'); + + tagSelector.refresh(); + + if (itemPane.selectedPanel.firstChild.getAttribute('id') == 'zotero-editpane-tags') { + var tagsBox = win.ZoteroPane.document.getElementById('zotero-editpane-tags'); + tagsBox.reload(); + } + } ]]> </body> </method> diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js @@ -446,7 +446,7 @@ Zotero.Tags = new function() { tagColors = JSON.stringify(tagColors); Zotero.Prefs.set('tagColors', tagColors); - _reloadTagColors() + _reloadTagColors(); Zotero.Notifier.trigger('redraw', 'item', []); }