commit f60f3aa930e4d8868fc21579df911716a075eea0
parent fdc6e1b6d3a766801a05d7ec3e0a9dbb4fe3a461
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 26 Apr 2011 17:43:00 +0000
- Show quicksearch drop-down in integration windows
- Remove dir="reverse" on quicksearch bar, which I don't think is still necessary
Diffstat:
6 files changed, 96 insertions(+), 93 deletions(-)
diff --git a/chrome/content/zotero/integration/addCitationDialog.xul b/chrome/content/zotero/integration/addCitationDialog.xul
@@ -27,6 +27,7 @@
<?xml-stylesheet href="chrome://global/skin/dialog.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?>
+<?xml-stylesheet href="chrome://zotero-platform/content/overlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
@@ -55,8 +56,8 @@
<hbox flex="1">
<vbox align="stretch" flex="1">
<hbox align="center" pack="end">
- <textbox id="zotero-tb-search" type="search" timeout="250" oncommand="onSearch()" dir="reverse" tabindex="1"
- onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { if (this.value == '') { cancelDialog(); return false; } this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;"/>
+ <textbox id="zotero-tb-search" type="search" timeout="250" oncommand="onSearch()" tabindex="1"
+ onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { if (this.value == '') { cancelDialog(); return false; } this.value = ''; onSearch(); return false; } return true;"/>
</hbox>
<hbox flex="1" style="margin-top: 5px">
<tree id="zotero-collections-tree"
diff --git a/chrome/content/zotero/integration/editBibliographyDialog.xul b/chrome/content/zotero/integration/editBibliographyDialog.xul
@@ -26,6 +26,7 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/overlay.css" type="text/css"?>
+<?xml-stylesheet href="chrome://zotero-platform/content/overlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
diff --git a/chrome/content/zotero/selectItemsDialog.js b/chrome/content/zotero/selectItemsDialog.js
@@ -48,6 +48,8 @@ function doLoad()
collectionsView.showCommons = false;
document.getElementById('zotero-collections-tree').view = collectionsView;
if(io.select) itemsView.selectItem(io.select);
+
+ Zotero.updateQuickSearchBox(document);
}
function doUnload()
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1495,6 +1495,94 @@ var Zotero = new function(){
}
+ this.updateQuickSearchBox = function (document) {
+ var mode = Zotero.Prefs.get("search.quicksearch-mode");
+ var prefix = 'zotero-tb-search-mode-';
+ var prefixLen = prefix.length;
+
+ var modes = {
+ titlesAndCreators: {
+ label: "Titles & Creators"
+ },
+
+ fields: {
+ label: "All Fields"
+ },
+
+ everything: {
+ label: "Everything"
+ }
+ };
+
+ if (!modes[mode]) {
+ mode = 'fields';
+ }
+
+ var searchBox = document.getElementById('zotero-tb-search')
+ var hbox = document.getAnonymousNodes(searchBox)[0];
+ var input = hbox.getElementsByAttribute('class', 'textbox-input')[0];
+
+ // Already initialized, so just update selection
+ var button = hbox.getElementsByAttribute('id', 'zotero-tb-search-menu-button');
+ if (button.length) {
+ button = button[0];
+ var menupopup = button.firstChild;
+ for each(var menuitem in menupopup.childNodes) {
+ if (menuitem.id.substr(prefixLen) == mode) {
+ menuitem.setAttribute('checked', true);
+ if (Zotero.isFx36) {
+ searchBox.emptytext = modes[mode].label;
+ }
+ else {
+ searchBox.placeholder = modes[mode].label;
+ }
+ return;
+ }
+ }
+ return;
+ }
+
+ // Otherwise, build menu
+ button = document.createElement('button');
+ button.id = 'zotero-tb-search-menu-button';
+ button.setAttribute('type', 'menu');
+
+ var menupopup = document.createElement('menupopup');
+
+ for (var i in modes) {
+ var menuitem = document.createElement('menuitem');
+ menuitem.setAttribute('id', prefix + i);
+ menuitem.setAttribute('label', modes[i].label);
+ menuitem.setAttribute('name', 'searchMode');
+ menuitem.setAttribute('type', 'radio');
+ //menuitem.setAttribute("tooltiptext", "");
+
+ menupopup.appendChild(menuitem);
+
+ if (mode == i) {
+ menuitem.setAttribute('checked', true);
+ menupopup.selectedItem = menuitem;
+ }
+ }
+
+ menupopup.setAttribute(
+ 'oncommand',
+ 'var mode = event.target.id.substr(22); '
+ + 'Zotero.Prefs.set("search.quicksearch-mode", mode);'
+ );
+
+ button.appendChild(menupopup);
+ hbox.insertBefore(button, input);
+
+ if (Zotero.isFx36) {
+ searchBox.emptytext = modes[mode].label;
+ }
+ else {
+ searchBox.placeholder = modes[mode].label;
+ }
+ }
+
+
/*
* Clear entries that no longer exist from various tables
*/
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -119,7 +119,7 @@ var ZoteroPane = new function()
window.addEventListener("resize", this.updateToolbarPosition, false);
window.setTimeout(this.updateToolbarPosition, 0);
- this.updateQuickSearchBox();
+ Zotero.updateQuickSearchBox(document);
if (Zotero.isMac) {
//document.getElementById('zotero-tb-actions-zeroconf-update').setAttribute('hidden', false);
@@ -3612,95 +3612,6 @@ var ZoteroPane = new function()
toolbar.style.width = computedStyle.getPropertyValue("width");
}
}
-
-
- this.updateQuickSearchBox = function () {
- var mode = Zotero.Prefs.get("search.quicksearch-mode");
- var prefix = 'zotero-tb-search-mode-';
- var prefixLen = prefix.length;
-
- var modes = {
- titlesAndCreators: {
- label: "Titles & Creators"
- },
-
- fields: {
- label: "All Fields"
- },
-
- everything: {
- label: "Everything"
- }
- };
-
- if (!modes[mode]) {
- mode = 'fields';
- }
-
- var searchBox = document.getElementById('zotero-tb-search');
-
- var hbox = document.getAnonymousNodes(searchBox)[0];
- var input = hbox.getElementsByAttribute('class', 'textbox-input')[0];
-
- // Already initialized, so just update selection
- var button = hbox.getElementsByAttribute('id', 'zotero-tb-search-menu-button');
- if (button.length) {
- button = button[0];
- var menupopup = button.firstChild;
- for each(var menuitem in menupopup.childNodes) {
- if (menuitem.id.substr(prefixLen) == mode) {
- menuitem.setAttribute('checked', true);
- if (Zotero.isFx36) {
- searchBox.emptytext = modes[mode].label;
- }
- else {
- searchBox.placeholder = modes[mode].label;
- }
- return;
- }
- }
- return;
- }
-
- // Otherwise, build menu
- button = document.createElement('button');
- button.id = 'zotero-tb-search-menu-button';
- button.setAttribute('type', 'menu');
-
- var menupopup = document.createElement('menupopup');
-
- for (var i in modes) {
- var menuitem = document.createElement('menuitem');
- menuitem.setAttribute('id', prefix + i);
- menuitem.setAttribute('label', modes[i].label);
- menuitem.setAttribute('name', 'searchMode');
- menuitem.setAttribute('type', 'radio');
- //menuitem.setAttribute("tooltiptext", "");
-
- menupopup.appendChild(menuitem);
-
- if (mode == i) {
- menuitem.setAttribute('checked', true);
- menupopup.selectedItem = menuitem;
- }
- }
-
- menupopup.setAttribute(
- 'oncommand',
- 'var mode = event.target.id.substr(22); '
- + 'Zotero.Prefs.set("search.quicksearch-mode", mode);'
- );
-
- button.appendChild(menupopup);
- hbox.insertBefore(button, input);
-
- if (Zotero.isFx36) {
- searchBox.emptytext = modes[mode].label;
- }
- else {
- searchBox.placeholder = modes[mode].label;
- }
- }
}
/**
diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul
@@ -144,7 +144,7 @@
<toolbarseparator/>
<toolbarbutton id="zotero-tb-advanced-search" class="zotero-tb-button" tooltiptext="&zotero.toolbar.advancedSearch;" oncommand="ZoteroPane_Local.openAdvancedSearchWindow()"/>
<spacer flex="1"/>
- <textbox id="zotero-tb-search" type="search" timeout="250" dir="reverse"
+ <textbox id="zotero-tb-search" type="search" timeout="250"
onkeypress="ZoteroPane_Local.handleSearchKeypress(this, event)"
oninput="ZoteroPane_Local.handleSearchInput(this, event)"
oncommand="ZoteroPane_Local.search()"/>