From 9de109db1df75cf315800382ac13a91d34a37769 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 26 Apr 2011 19:39:18 +0000 Subject: [PATCH] - Fix placeholder text switching in quicksearch box - Open popup on Alt-Up/Down, as in Firefox search bar - Don't re-run search when switching modes if search is empty --- chrome/content/zotero/xpcom/zotero.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index f72c445c00..3d98db0e85 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1569,6 +1569,7 @@ var Zotero = new function(){ 'oncommand', 'var mode = event.target.id.substr(22); ' + 'Zotero.Prefs.set("search.quicksearch-mode", mode);' + + 'if (document.getElementById("zotero-tb-search").value == "") { event.stopPropagation(); }' ); button.appendChild(menupopup); @@ -1580,6 +1581,16 @@ var Zotero = new function(){ else { searchBox.placeholder = modes[mode].label; } + + // If Alt-Up/Down, show popup + searchBox.setAttribute( + 'onkeypress', + searchBox.getAttribute('onkeypress') + "\n" + + "if (event.altKey && (event.keyCode == event.DOM_VK_UP || event.keyCode == event.DOM_VK_DOWN)) {" + + "document.getElementById('zotero-tb-search-menu-button').open = true;" + + "event.stopPropagation();" + + "}" + ); } @@ -1809,7 +1820,7 @@ Zotero.Prefs = new function(){ while (enumerator.hasMoreElements()) { var win = enumerator.getNext(); if (!win.ZoteroPane) continue; - win.ZoteroPane.updateQuickSearchBox(); + Zotero.updateQuickSearchBox(win.ZoteroPane.document); } break; }