From 005375cc3358e63e75d918e171a25a7104f8f91f Mon Sep 17 00:00:00 2001 From: Asa Kusuma Date: Fri, 8 Aug 2008 19:39:06 +0000 Subject: [PATCH] Adds tag cloud feature. Use about:config to turn on. --- .../content/zotero/bindings/tagselector.xml | 79 ++++++++++++++++++- defaults/preferences/zotero.js | 3 + 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index 771e9bfc9..be6507f21 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -177,19 +177,25 @@ tagsToggleBox.removeChild(tagsToggleBox.firstChild); } - // Regenerate list + + + var i=0; for (var tagID in this._tags) { // If the last tag was the same, add this tagID and tagType to it if (tagsToggleBox.lastChild && tagsToggleBox.lastChild.getAttribute('value') == this._tags[tagID].name) { tagsToggleBox.lastChild.setAttribute('tagID', tagsToggleBox.lastChild.getAttribute('tagID') + '-' + tagID); tagsToggleBox.lastChild.setAttribute('tagType', tagsToggleBox.lastChild.getAttribute('tagType') + '-' + this._tags[tagID].type); + + continue; } var label = document.createElement('label'); label.setAttribute('onclick', "this.parentNode.parentNode.parentNode.handleTagClick(event, this)"); label.className = 'zotero-clicky'; + + label.setAttribute('value', this._tags[tagID].name); label.setAttribute('tagID', tagID); label.setAttribute('tagType', this._tags[tagID].type); @@ -199,7 +205,7 @@ label.setAttribute('ondragdrop', 'nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode.dragObserver)'); tagsToggleBox.appendChild(label); } - + i++; this._dirty = false; } @@ -282,7 +288,76 @@ } } + //start tag cloud code + var tagCloud = Zotero.Prefs.get('tagCloud'); + + if(tagCloud) { + var labels = tagsToggleBox.getElementsByTagName('label'); + + //loop through displayed labels and find number of linked items + var numlinked= []; + for (var i=0; i