From 5d638df73afb2a93fe15fc1c01abfc6896ecaa66 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 18 Feb 2007 11:23:23 +0000 Subject: [PATCH] Addresses #85, Button(s) to expand/collapse all notes in a view Enable expand/collapse in advanced search window --- chrome/content/zotero/advancedSearch.js | 17 +++++++++++++++++ chrome/content/zotero/advancedSearch.xul | 1 + chrome/content/zotero/overlay.js | 1 - 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js index 58e6ccb69..1cb094ace 100644 --- a/chrome/content/zotero/advancedSearch.js +++ b/chrome/content/zotero/advancedSearch.js @@ -3,6 +3,7 @@ var ZoteroAdvancedSearch = new function() { this.search = search; this.clear = clear; this.save = save; + this.handleKeyPress = handleKeyPress; this.onDblClick = onDblClick; this.onUnload = onUnload; @@ -86,6 +87,22 @@ var ZoteroAdvancedSearch = new function() { } + function handleKeyPress(event) { + var key = String.fromCharCode(event.which); + + if (key == '+' && !(event.ctrlKey || event.altKey || event.metaKey)) { + this.itemsView.expandAllRows(); + return; + } + else if (key == '-' && !(event.shiftKey || event.ctrlKey || + event.altKey || event.metaKey)) { + this.itemsView.collapseAllRows(); + return; + } + } + + + // Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9 function onDblClick(event, tree) { diff --git a/chrome/content/zotero/advancedSearch.xul b/chrome/content/zotero/advancedSearch.xul index 8371a3c18..cb38b091d 100644 --- a/chrome/content/zotero/advancedSearch.xul +++ b/chrome/content/zotero/advancedSearch.xul @@ -37,6 +37,7 @@ diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index d80a18421..d438186a8 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -369,7 +369,6 @@ var ZoteroPane = new function() return; } } - }