From 8956ca14a94f6f78b4f6e5bda8bf9de0175410cf Mon Sep 17 00:00:00 2001 From: Sean Takats Date: Mon, 26 Nov 2007 22:16:34 +0000 Subject: [PATCH] Another, better RIS hack until #821 is fixed. --- scrapers.sql | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/scrapers.sql b/scrapers.sql index 89d611c66..463a06ae7 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -22,7 +22,7 @@ -- Set the following timestamp to the most recent scraper update date -REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-11-25 14:00:00')); +REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-11-26 23:00:00')); REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b4.r1', '', '2007-06-21 20:00:00', '1', '100', '4', 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon', 'function detectWeb(doc, url) { @@ -14926,7 +14926,7 @@ function doImport() { } }'); -REPLACE INTO translators VALUES ('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7', '1.0.0b4.r1', '', '2007-11-20 09:35:00', '1', '100', '3', 'RIS', 'Simon Kornblith', 'ris', +REPLACE INTO translators VALUES ('32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7', '1.0.0b4.r1', '', '2007-11-26 23:00:00', '1', '100', '3', 'RIS', 'Simon Kornblith', 'ris', 'Zotero.configure("dataMode", "line"); Zotero.addOption("exportNotes", true); @@ -15138,23 +15138,26 @@ function processTag(item, tag, value) { } } else if(tag == "UR" || tag == "L1" || tag == "L2" || tag == "L4") { // URL - if(!item.url) { -// commenting out until #821 is fixed -// item.url = value; - } - - if(tag == "UR") { -// commenting out until #821 is fixed -// item.attachments.push({url:value}); - } else if(tag == "L1") { - item.attachments.push({url:value, mimeType:"application/pdf", - title:"Full Text (PDF)", downloadable:true}); - } else if(tag == "L2") { - item.attachments.push({url:value, mimeType:"text/html", - title:"Full Text (HTML)", downloadable:true}); - } else if(tag == "L4") { - item.attachments.push({url:value, - title:"Image", downloadable:true}); + //using regex to test URL until #821 is fixed + urlRe = /(https?:\/\/[^\s]*)/; + var m = urlRe.exec(value); + if (m){ + value = m[1]; + if(!item.url) { + item.url = value; + } + if(tag == "UR") { + item.attachments.push({url:value}); + } else if(tag == "L1") { + item.attachments.push({url:value, mimeType:"application/pdf", + title:"Full Text (PDF)", downloadable:true}); + } else if(tag == "L2") { + item.attachments.push({url:value, mimeType:"text/html", + title:"Full Text (HTML)", downloadable:true}); + } else if(tag == "L4") { + item.attachments.push({url:value, + title:"Image", downloadable:true}); + } } } }