From 012e127a7e8057510be7a534182c6e74464865c6 Mon Sep 17 00:00:00 2001 From: Avram Lyon Date: Sun, 7 Nov 2010 20:16:11 +0000 Subject: [PATCH] Trans: In EBSCO, fix all items showing up as journal articles, also DOI parsing http://forums.zotero.org/discussion/15024 --- translators/EBSCOhost.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/translators/EBSCOhost.js b/translators/EBSCOhost.js index 82d7e378e..7119bc231 100644 --- a/translators/EBSCOhost.js +++ b/translators/EBSCOhost.js @@ -16,9 +16,6 @@ function detectWeb(doc, url) { var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; - - - // The Scientific American Archive breaks this translator, disabling try { var databases = doc.evaluate("//span[@class = 'selected-databases']", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; @@ -50,10 +47,6 @@ function detectWeb(doc, url) { +' or starts-with(text(), "Bu kayda sürekli bağlantı")' +' or starts-with(text(), "Μόνιμος σύνδεσμος σε αυτό το αρχείο")]'; */ - - - - var xpath = '//input[@id="ctl00_ctl00_Column2_Column2_topDeliveryControl_deliveryButtonControl_lnkExport"]'; var persistentLink = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); if(persistentLink) { @@ -112,16 +105,16 @@ function downloadFunction(text) { translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7"); translator.setString(text); translator.setHandler("itemDone", function(obj, item) { - if (text.match("L3")) { - item.DOI = text.match(/L3\s+\-\s*(.*)/)[1]; + if (text.match(/^L3\s+-\s*(.*)/m)) { + item.DOI = text.match(/^L3\s+\-\s*(.*)/m)[1]; } - if (text.match("DO")) { - item.DOI = text.match(/DO\s+\-\s*(.*)/)[1]; + if (text.match(/^DO\s+-\s*(.*)/m)) { + item.DOI = text.match(/^DO\s+-\s*(.*)/m)[1]; } - if (text.match("T1")) { - item.title = text.match(/T1\s+-\s*(.*)/)[1]; + if (text.match(/^T1\s+-/m)) { + item.title = text.match(/^T1\s+-\s*(.*)/m)[1]; } - item.itemType = "journalArticle"; + //item.itemType = "journalArticle"; item.url = false; // RIS translator tries to download the link in "UR" this leads to unhappyness item.attachments = [];