From 8364988810b6052cff5514e30b2a5b8afbf71e40 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 2 Feb 2007 08:15:25 +0000 Subject: [PATCH] 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 --- chrome/content/zotero/bindings/noteeditor.xml | 43 ++++++++++++++++++- chrome/content/zotero/overlay.js | 23 ++++++---- chrome/content/zotero/xpcom/mime.js | 2 +- .../default/zotero/bindings/noteeditor.css | 5 +++ 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml index 4a5342d07..b5627b4d4 100644 --- a/chrome/content/zotero/bindings/noteeditor.xml +++ b/chrome/content/zotero/bindings/noteeditor.xml @@ -99,6 +99,47 @@ ]]> + + + + + + + @@ -111,7 +152,7 @@ - + diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 575399ce5..2610d086c 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -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) { diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index d4452baf2..a537e9ae8 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -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; } diff --git a/chrome/skin/default/zotero/bindings/noteeditor.css b/chrome/skin/default/zotero/bindings/noteeditor.css index 1352c3021..e66351085 100644 --- a/chrome/skin/default/zotero/bindings/noteeditor.css +++ b/chrome/skin/default/zotero/bindings/noteeditor.css @@ -2,3 +2,8 @@ noteeditor[abstract="true"] #links { display: none; } + +#citeLabel:hover +{ + cursor: pointer !important; +}