- Show quicksearch drop-down in integration windows
- Remove dir="reverse" on quicksearch bar, which I don't think is still necessary
This commit is contained in:
parent
fdc6e1b6d3
commit
f60f3aa930
6 changed files with 96 additions and 93 deletions
|
@ -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"
|
||||
|
|
|
@ -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">
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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()"/>
|
||||
|
|
Loading…
Reference in a new issue