From bf44c0fe91b5c41cf3b022f4b2d14c40172e857e Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 16 Mar 2007 02:43:18 +0000 Subject: [PATCH] - fix scrape bug - fix problem with scientificcommons search results --- chrome/content/zotero/browser.js | 2 +- scrapers.sql | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index bbc4fb9bb..c42b14af7 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -149,7 +149,7 @@ var Zotero_Browser = new function() { // make sure annotation action is toggled var tab = _getTabObject(Zotero_Browser.tabbrowser.selectedBrowser); - if(tab.page.annotations.clearAction) tab.page.annotations.clearAction(); + if(tab.page && tab.page.annotations && tab.page.annotations.clearAction) tab.page.annotations.clearAction(); if(!toggleTool) return; diff --git a/scrapers.sql b/scrapers.sql index 69888fc48..eb8b1b71a 100644 --- a/scrapers.sql +++ b/scrapers.sql @@ -1,4 +1,4 @@ --- 177 +-- 178 -- ***** BEGIN LICENSE BLOCK ***** -- @@ -22,7 +22,7 @@ -- Set the following timestamp to the most recent scraper update date -REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-15 22:10:00')); +REPLACE INTO version VALUES ('repository', STRFTIME('%s', '2007-03-16 02:40:00')); REPLACE INTO translators VALUES ('96b9f483-c44d-5784-cdad-ce21b984fe01', '1.0.0b3.r1', '', '2006-12-15 03:40:00', 1, 100, 4, 'Amazon.com', 'Sean Takats', '^https?://(?:www\.)?amazon', 'function detectWeb(doc, url) { @@ -4550,7 +4550,7 @@ function doWeb(doc, url) { Zotero.wait(); }'); -REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b3.r1', '', '2007-03-15 22:10:00', '1', '100', '4', 'ScientificCommons', 'Sean Takats', '^http://(?:en|de|www)\.scientificcommons\.org', +REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b3.r1', '', '2007-03-16 02:40:00', '1', '100', '4', 'ScientificCommons', 'Sean Takats', '^http://(?:en|de|www)\.scientificcommons\.org', 'function detectWeb(doc, url) { var articleRe = /^http:\/\/(?:www|en|de)\.scientificcommons\.org\/([0-9]+)/; var m = articleRe.exec(url); @@ -4558,14 +4558,15 @@ REPLACE INTO translators VALUES ('19643c25-a4b2-480d-91b7-4e0b761fb6ad', '1.0.0b if(m) { return "journalArticle"; } else { + var frontRe = /^http:\/\/(?:www|en|de)\.scientificcommons\.org\/$/; + if(frontRe.test(url)) return "multiple"; + var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == ''x'') return namespace; else return null; } : null; - var listElt = doc.evaluate(''//div[@class="content_element"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - if (listElt) { - return "multiple"; - } + var listElt = doc.evaluate(''//div[@id="content_search_details"]'', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); + if (listElt) return "multiple"; } return false; }',