revert r8278

This commit is contained in:
Simon Kornblith 2011-02-19 01:48:24 +00:00
parent fcd3ef0c80
commit 79b3c5c703

View file

@ -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") {