From 79b3c5c70388e75da3030bfc542820270da79ce8 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sat, 19 Feb 2011 01:48:24 +0000 Subject: [PATCH] revert r8278 --- chrome/content/zotero/locateMenu.js | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js index 85bbb948ff..2233e3ffad 100644 --- a/chrome/content/zotero/locateMenu.js +++ b/chrome/content/zotero/locateMenu.js @@ -34,7 +34,7 @@ var Zotero_LocateMenu = new function() { /** * Clear and build the locate menu */ - this.buildLocateMenu = function() { + this.buildLocateMenu = function(menu, useIcons, ) { var locateMenu = document.getElementById('zotero-tb-locate-menu'); // clear menu @@ -51,6 +51,7 @@ var Zotero_LocateMenu = new function() { for each(var item in selectedItems) { for(var viewOption in ViewOptions) { if(!optionsToShow[viewOption]) { + Zotero.debug("testing "+viewOption); optionsToShow[viewOption] = ViewOptions[viewOption].canHandleItem(item); } } @@ -63,6 +64,7 @@ var Zotero_LocateMenu = new function() { var menuitem = _createMenuItem(Zotero.getString("locate."+viewOption+".label"), null, Zotero.getString("locate."+viewOption+".tooltip")); menuitem.setAttribute("class", "menuitem-iconic"); + Zotero.debug("icon is "+ViewOptions[viewOption].icon); menuitem.setAttribute("image", ViewOptions[viewOption].icon); locateMenu.appendChild(menuitem); @@ -273,28 +275,26 @@ var Zotero_LocateMenu = new function() { function _getURL(item) { // try url field for item and for attachments - var urlField = item.getField('url'); - if(urlField) { - return urlField; - } - + var urlFields = [item.getField('url')]; if(item.isRegularItem()) { var attachments = item.getAttachments(); if(attachments) { - // look through url fields for non-file:/// attachments - for each(var attachment in Zotero.Items.get(attachments)) { - try { - Zotero.debug(urlField); - var uri = Zotero_LocateMenu.ios.newURI(urlField, null, null); - if(uri && uri.host && uri.scheme !== 'file') { - return urlField; - } - } catch(e) {}; - } - + 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; + } + } catch(e) {}; + } + // if no url field, try DOI field var doi = item.getField('DOI'); if(doi && typeof doi === "string") {