commit 73857fbba76a5e746a44272ac0543266b25625d2
parent ff93acd5f52132ef692c00aded0b100aa046be75
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 21 Feb 2011 22:27:39 +0000
allow "View Online" for file:/// URIs in attachments
Diffstat:
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js
@@ -273,24 +273,22 @@ var Zotero_LocateMenu = new function() {
function _getURL(item) {
// try url field for item and for attachments
- var urlFields = [item.getField('url')];
+ var urlField = item.getField('url');
+ if(urlField) {
+ var uri = Zotero_LocateMenu.ios.newURI(urlField, null, null);
+ if(uri && uri.host && uri.scheme !== 'file') return urlField;
+ }
+
if(item.isRegularItem()) {
var attachments = item.getAttachments();
if(attachments) {
- urlFields = urlFields.concat([attachment.getField('url')
- for each(attachment in Zotero.Items.get(attachments))]);
- }
- }
-
- // look through url fields for non-file:/// attachments
- for each(var urlField in urlFields) {
- try {
- Zotero.debug(urlField);
- var uri = Zotero_LocateMenu.ios.newURI(urlField, null, null);
- if(uri && uri.host && uri.scheme !== 'file') {
- return urlField;
+ // look through url fields for non-file:/// attachments
+ for each(var attachment in Zotero.Items.get(attachments)) {
+ var urlField = attachment.getField('url');
+ if(urlField) return urlField;
}
- } catch(e) {};
+
+ }
}
// if no url field, try DOI field