Closes #497, Clicking parent title at the top of child note window should jump to parent item

Also:

- More scope fallout from r1144 
- ZoteroPane.clearQuicksearch()
- JS strict warning when opening attachment
This commit is contained in:
Dan Stillman 2007-02-02 08:15:25 +00:00
parent 97af49efc4
commit 8364988810
4 changed files with 63 additions and 10 deletions

View File

@ -99,6 +99,47 @@
]]>
</body>
</method>
<method name="selectParent">
<body>
<![CDATA[
if (!this.item.getID()) {
return;
}
if (document.getElementById('zotero-pane')) {
var zp = ZoteroPane;
}
else {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var lastWin = wm.getMostRecentWindow("navigator:browser");
if (!lastWin) {
window.open();
var newWindow = wm.getMostRecentWindow("navigator:browser");
var b = newWindow.getBrowser();
return;
}
if (lastWin.document.getElementById('zotero-pane').getAttribute('hidden') == 'true') {
lastWin.ZoteroPane.toggleDisplay();
// DEBUG: The actions below seem to crash Firefox 2.0.0.1 on OS X if
// the Z pane isn't already open, so we don't try
return;
}
var zp = lastWin.ZoteroPane;
}
zp.clearQuicksearch();
zp.selectItem(this.item.getID());
]]>
</body>
</method>
<method name="id">
<parameter name="id"/>
<body>
@ -111,7 +152,7 @@
<content>
<xul:vbox xbl:inherits="flex">
<xul:label id="citeLabel"/>
<xul:label id="citeLabel" onclick="this.parentNode.parentNode.selectParent()"/>
<xul:textbox id="noteField" multiline="true" type="timed" timeout="1000" flex="1" oncommand="this.parentNode.parentNode.save();"/>
<xul:hbox>
<xul:linksbox id="links" flex="1"/>

View File

@ -47,6 +47,7 @@ var ZoteroPane = new function()
this.deleteSelectedItem = deleteSelectedItem;
this.deleteSelectedCollection = deleteSelectedCollection;
this.editSelectedCollection = editSelectedCollection;
this.clearQuicksearch = clearQuicksearch;
this.handleSearchKeypress = handleSearchKeypress;
this.handleSearchInput = handleSearchInput;
this.search = search;
@ -447,7 +448,7 @@ var ZoteroPane = new function()
this.itemsView.unregister();
}
document.getElementById('zotero-tb-search').value = "";
this.clearQuicksearch();
if (this.collectionsView.selection.count == 1 && this.collectionsView.selection.currentIndex != -1) {
var itemgroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex);
@ -735,6 +736,12 @@ var ZoteroPane = new function()
}
function clearQuicksearch() {
document.getElementById('zotero-tb-search').value = "";
document.getElementById('zotero-tb-search').doCommand('cmd_zotero_search');
}
function handleSearchKeypress(textbox, event) {
// Events that turn find-as-you-type on
if (event.keyCode == event.DOM_VK_ESCAPE) {
@ -1130,7 +1137,7 @@ var ZoteroPane = new function()
}
else if (tree.id == 'zotero-items-tree') {
if (this.itemsView && this.itemsView.selection.currentIndex > -1) {
var item = getSelectedItems()[0];
var item = this.getSelectedItems()[0];
if (item && item.isNote()) {
document.getElementById('zotero-view-note-button').doCommand();
}
@ -1162,8 +1169,8 @@ var ZoteroPane = new function()
var menuitem = document.getElementById("zotero-context-add-to-current-note");
var showing = false;
if (menuitem){
var items = getSelectedItems();
if (this.itemsView.selection.count==1 && items[0] && items[0].isNote()
var items = ZoteroPane.getSelectedItems();
if (ZoteroPane.itemsView.selection.count==1 && items[0] && items[0].isNote()
&& window.gContextMenu.isTextSelected)
{
menuitem.hidden = false;
@ -1261,7 +1268,7 @@ var ZoteroPane = new function()
return false;
}
var items = getSelectedItems();
var items = this.getSelectedItems();
if (this.itemsView.selection.count == 1 && items[0] && items[0].isNote()) {
var note = items[0].getNote()
items[0].updateNote(note == '' ? text : note + "\n\n" + text);
@ -1292,7 +1299,7 @@ var ZoteroPane = new function()
function toggleAbstractForSelectedItem() {
var items = getSelectedItems();
var items = this.getSelectedItems();
if (this.itemsView.selection.count == 1 && items[0] && items[0].isNote()
&& items[0].getSource()) {
@ -1373,7 +1380,7 @@ var ZoteroPane = new function()
function viewSelectedAttachment()
{
if (this.itemsView && this.itemsView.selection.count == 1) {
var attachment = getSelectedItems()[0];
var attachment = this.getSelectedItems()[0];
if(attachment.getAttachmentLinkMode() != Zotero.Attachments.LINK_MODE_LINKED_URL)
{
@ -1419,7 +1426,7 @@ var ZoteroPane = new function()
function showSelectedAttachmentInFilesystem()
{
if (this.itemsView && this.itemsView.selection.count == 1) {
var attachment = getSelectedItems()[0];
var attachment = this.getSelectedItems()[0];
if (attachment.getAttachmentLinkMode() != Zotero.Attachments.LINK_MODE_LINKED_URL)
{

View File

@ -228,7 +228,7 @@ Zotero.MIME = new function(){
.hiddenDOMWindow.navigator.mimeTypes;
for (var i in types){
if (types[i].type==mimeType){
if (types[i].type && types[i].type == mimeType){
Zotero.debug('MIME type ' + mimeType + ' can be handled by plugins');
return true;
}

View File

@ -2,3 +2,8 @@ noteeditor[abstract="true"] #links
{
display: none;
}
#citeLabel:hover
{
cursor: pointer !important;
}