Adds billi's second patch to Optical Society of America translator and corrects name

This commit is contained in:
Sean Takats 2009-01-06 20:53:11 +00:00
parent 815877a330
commit 1fb948d148

View file

@ -2,13 +2,13 @@
"translatorID":"a1a97ad4-493a-45f2-bd46-016069de4162",
"translatorType":4,
"label":"Optical Society of America",
"creator":"Michael Berkowitz and billi",
"creator":"Michael Berkowitz and Eli Osherovich",
"target":"https?://[^.]+\\.(opticsinfobase|osa)\\.org",
"minVersion":"1.0.0b4.r1",
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2009-01-06 17:00:00"
"lastUpdated":"2009-01-06 20:55:00"
}
function detectWeb(doc, url) {
@ -52,7 +52,7 @@ function doWeb(doc, url) {
var pdfpath = '//div[@id="abstract-header"]/p/a[contains(text(), "Full Text")]';
var pdflink = newDoc.evaluate(pdfpath, newDoc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
var abstractblock = newDoc.evaluate('//meta[@name="dc.description"]', newDoc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var doiblock = newDoc.evaluate('//meta[@name="dc.identifier"]', newDoc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var identifierblock = newDoc.evaluate('//meta[@name="dc.identifier"]', newDoc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
Zotero.Utilities.HTTP.doGet(osalink, function(text) {
var action = text.match(/select\s+name=\"([^"]+)\"/)[1];
var id = text.match(/input\s+type=\"hidden\"\s+name=\"articles\"\s+value=\"([^"]+)\"/)[1];
@ -69,8 +69,10 @@ function doWeb(doc, url) {
} else {
pubName = item.publicationTitle;
}
if (doiblock) {
item.DOI = doiblock.getAttribute('content').match(/doi:(.*)$/)[1];
if (identifierblock) {
if (/doi:(.*)$/.test(identifierblock.getAttribute('content'))) {
item.DOI = RegExp.$1;
}
}
item.attachments = [{url:osalink, title:pubName + " Snapshot", mimeType:"text/html"}];
if (pdflink) {