diff --git a/scrapers.sql b/scrapers.sql index 9a008339d..e4e017434 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -18171,7 +18171,7 @@ REPLACE INTO translators VALUES ('232903bc-7307-4058-bb1a-27cfe3e4e655', '1.0.0b Zotero.wait(); }'); -REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b4.r5', '', '2008-06-30 12:13:10', '1', '100', '4', 'Wiley InterScience', 'Sean Takats and Michael Berkowitz', 'https?:\/\/(?:www3\.|www\.)?interscience\.wiley\.com[^\/]*\/(?:search\/|(cgi-bin|journal)\/[0-9]+\/abstract|journal)', +REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b4.r5', '', '2008-07-01 14:49:26', '1', '100', '4', 'Wiley InterScience', 'Sean Takats and Michael Berkowitz', 'https?:\/\/(?:www3\.|www\.)?interscience\.wiley\.com[^\/]*\/(?:search\/|(cgi-bin|journal)\/[0-9]+\/abstract|journal)', 'function detectWeb(doc, url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { @@ -18182,10 +18182,10 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { return "multiple"; } - if (url.match(/journal\/\d+\/(issue|home)/)) { + if (url.match(/journal\/\d+\/(issue|home)$/)) { return "multiple"; } - var m = url.match(/https?:\/\/[^\/]*\/(cgi-bin|journal)(\/(abstract|summary))?\/[0-9]+(\/abstract)?/); + var m = url.match(/https?:\/\/[^\/]*\/(cgi-bin|journal)(\/(abstract|summary))?\/[0-9]+\/abstract/); if (m){ return "journalArticle"; } @@ -18195,7 +18195,8 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b var nsResolver = namespace ? function(prefix) { if (prefix == ''x'') return namespace; else return null; } : null; - + var host = ''http://'' + doc.location.host + "/"; + Zotero.debug(host); var m = url.match(/https?:\/\/[^\/]*\/(journal|cgi-bin\/summary)\/([0-9]+)\/(abstract)?/); var ids = new Array(); if(detectWeb(doc, url) == "multiple") { //search @@ -18232,41 +18233,38 @@ REPLACE INTO translators VALUES ('fe728bc9-595a-4f03-98fc-766f1d8d0936', '1.0.0b } else if (m){ //single article ids.push(m[2]); } - var hostRe = new RegExp("^http(?:s)?://[^/]+"); - var m = hostRe.exec(doc.location.href); - var host = m[0]; - var uri = host+"/tools/citex"; - var poststring = ""; - for each(var id in ids) { - poststring = poststring + "&id=" + id; - } - poststring = "clienttype=1&subtype=1&mode=1&version=1" + poststring; - Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) { - uri = host+"/tools/CitEx"; - poststring = "mode=2&format=3&type=2&file=3&exportCitation.x=16&exportCitation.y=10&exportCitation=submit"; + for each (id in ids) { + var uri = host + ''tools/citex''; + var poststring = "clienttype=1&subtype=1&mode=1&version=1&id=" + id; Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) { - var m = text.match(/%A\s(.*)/); //following lines fix Wiley''s incorrect %A tag (should be separate tags for each author) - if (m){ - var newauthors =""; - var authors = m[1].split(",") - for each (var author in authors){ - if (author != ""){ - newauthors = newauthors + "%A "+Zotero.Utilities.unescapeHTML(Zotero.Utilities.trimInternal(author))+"\n"; + uri = host+"tools/CitEx"; + poststring = "mode=2&format=3&type=2&file=3&exportCitation.x=16&exportCitation.y=10&exportCitation=submit"; + Zotero.Utilities.HTTP.doPost(uri, poststring, function(text) { + var m = text.match(/%A\s(.*)/); //following lines fix Wiley''s incorrect %A tag (should be separate tags for each author) + if (m){ + var newauthors =""; + var authors = m[1].split(",") + for each (var author in authors){ + if (author != ""){ + newauthors = newauthors + "%A "+Zotero.Utilities.unescapeHTML(Zotero.Utilities.trimInternal(author))+"\n"; + } } + text = text.replace(/%A\s.*\n/, newauthors); } - text = text.replace(/%A\s.*\n/, newauthors); - } - var translator = Zotero.loadTranslator("import"); - translator.setTranslator("881f60f2-0802-411a-9228-ce5f47b64c7d"); //EndNote/Refer/BibIX - translator.setString(text); - translator.setHandler("itemDone", function(obj, item) { - item.DOI = item.url.match(/\.org\/(.*)$/)[1]; - item.complete(); + var translator = Zotero.loadTranslator("import"); + translator.setTranslator("881f60f2-0802-411a-9228-ce5f47b64c7d"); //EndNote/Refer/BibIX + translator.setString(text); + translator.setHandler("itemDone", function(obj, item) { + var pdfurl = ''http://download.interscience.wiley.com/cgi-bin/fulltext?ID='' + id + ''&PLACEBO=IE.pdf&mode=pdf''; + item.attachments.push({url:pdfurl, title:"Wiley Interscience PDF", mimeType:"application/pdf"}); + item.DOI = item.url.match(/\.org\/(.*)$/)[1]; + item.complete(); + }); + translator.translate(); + Zotero.done(); }); - translator.translate(); - Zotero.done(); }); - }); + }; Zotero.wait(); }');